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

29822 lines
1.1 MiB

// Decompiled with JetBrains decompiler
// Type: Terraria.Projectile
// 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 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.Golf;
using Terraria.Graphics;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.Localization;
using Terraria.Physics;
using Terraria.WorldBuilding;
namespace Terraria
{
public class Projectile : Entity
{
public static uint[][] perIDStaticNPCImmunity = new uint[950][];
public const int SentryLifeTime = 7200;
public const int ArrowLifeTime = 1200;
public float ownerHitCheckDistance = 1000f;
public bool arrow;
public int numHits;
public bool bobber;
public bool netImportant;
public bool noDropItem;
public static int maxAI = 2;
public bool counterweight;
public float scale = 1f;
public float rotation;
public int type;
public int alpha;
public bool sentry;
public short glowMask;
public int owner = (int) byte.MaxValue;
public float[] ai = new float[Projectile.maxAI];
public float[] localAI = new float[Projectile.maxAI];
public float gfxOffY;
public float stepSpeed = 1f;
public int aiStyle;
public int timeLeft;
public int soundDelay;
public int damage;
public int originalDamage;
public int spriteDirection = 1;
public bool hostile;
public float knockBack;
public bool friendly;
public int penetrate = 1;
private int[] localNPCImmunity = new int[200];
private bool usesLocalNPCImmunity;
private bool usesIDStaticNPCImmunity;
public int maxPenetrate = 1;
public int identity;
public float light;
public bool netUpdate;
public bool netUpdate2;
public int netSpam;
public Vector2[] oldPos = new Vector2[10];
public float[] oldRot = new float[10];
public int[] oldSpriteDirection = new int[10];
public bool minion;
public float minionSlots;
public int minionPos;
public int restrikeDelay;
public bool tileCollide;
public int extraUpdates;
public int numUpdates;
public bool ignoreWater;
public bool hide;
public bool ownerHitCheck;
public int[] playerImmune = new int[(int) byte.MaxValue];
public string miscText = "";
public bool melee;
public bool ranged;
public bool magic;
public bool coldDamage;
public bool noEnchantments;
public bool noEnchantmentVisuals;
public bool trap;
public bool npcProj;
public bool originatedFromActivableTile;
public int frameCounter;
public int frame;
public bool manualDirectionChange;
public int projUUID = -1;
public bool decidesManualFallThrough;
public bool shouldFallThrough;
public int localNPCHitCooldown = -2;
public int idStaticNPCHitCooldown = -1;
private static Conditions.IsSolid _cachedConditions_solid = new Conditions.IsSolid();
private static Conditions.NotNull _cachedConditions_notNull = new Conditions.NotNull();
private List<Vector2> _whipPointsForCollision = new List<Vector2>();
private static Microsoft.Xna.Framework.Rectangle _lanceHitboxBounds = new Microsoft.Xna.Framework.Rectangle(0, 0, 300, 300);
private static List<Tuple<int, float>> _medusaHeadTargetList = new List<Tuple<int, float>>();
private static Projectile.NPCDistanceByIndexComparator _medusaTargetComparer = new Projectile.NPCDistanceByIndexComparator();
private static List<int> _ai164_blacklistedTargets = new List<int>();
private static List<int> _ai158_blacklistedTargets = new List<int>();
private static List<int> _ai156_blacklistedTargets = new List<int>();
private static float[] _CompanionCubeScreamCooldown = new float[(int) byte.MaxValue];
public string Name => Lang.GetProjectileName(this.type).Value;
public static void InitializeStaticThings()
{
Projectile.perIDStaticNPCImmunity = new uint[950][];
for (int index = 0; index < Projectile.perIDStaticNPCImmunity.Length; ++index)
Projectile.perIDStaticNPCImmunity[index] = new uint[200];
WorldGen.Hooks.OnWorldLoad += new Action(Projectile.ResetImmunity);
}
public static void ResetImmunity()
{
for (int index1 = 0; index1 < 950; ++index1)
{
for (int index2 = 0; index2 < 200; ++index2)
Projectile.perIDStaticNPCImmunity[index1][index2] = 0U;
}
}
public static bool IsNPCIndexImmuneToProjectileType(int projectileType, int npcIndex) => Projectile.perIDStaticNPCImmunity[projectileType][npcIndex] <= Main.GameUpdateCount;
public bool WipableTurret => this.owner == Main.myPlayer && this.sentry && !this.TurretShouldPersist();
public bool TurretShouldPersist()
{
switch (this.type)
{
case 663:
case 665:
case 667:
case 677:
case 678:
case 679:
case 688:
case 689:
case 690:
case 691:
case 692:
case 693:
return DD2Event.Ongoing;
default:
return false;
}
}
public float Opacity
{
get => (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
set => this.alpha = (int) MathHelper.Clamp((float) ((1.0 - (double) value) * (double) byte.MaxValue), 0.0f, (float) byte.MaxValue);
}
public int MaxUpdates
{
get => this.extraUpdates + 1;
set => this.extraUpdates = value - 1;
}
public NPC OwnerMinionAttackTargetNPC => Main.player[this.owner].MinionAttackTargetNPC < 0 ? (NPC) null : Main.npc[Main.player[this.owner].MinionAttackTargetNPC];
public void SetDefaults(int Type)
{
this.ownerHitCheckDistance = 1000f;
this.counterweight = false;
this.sentry = false;
this.arrow = false;
this.bobber = false;
this.numHits = 0;
this.netImportant = false;
this.manualDirectionChange = false;
this.decidesManualFallThrough = false;
this.shouldFallThrough = false;
this.localNPCHitCooldown = -2;
this.idStaticNPCHitCooldown = -1;
this.usesLocalNPCImmunity = false;
this.usesIDStaticNPCImmunity = false;
int newSize = 10;
if (Type >= 0)
newSize = ProjectileID.Sets.TrailCacheLength[Type];
if (newSize != this.oldPos.Length)
{
Array.Resize<Vector2>(ref this.oldPos, newSize);
Array.Resize<float>(ref this.oldRot, newSize);
Array.Resize<int>(ref this.oldSpriteDirection, newSize);
}
for (int index = 0; index < this.oldPos.Length; ++index)
{
this.oldPos[index].X = 0.0f;
this.oldPos[index].Y = 0.0f;
this.oldRot[index] = 0.0f;
this.oldSpriteDirection[index] = 0;
}
for (int index = 0; index < Projectile.maxAI; ++index)
{
this.ai[index] = 0.0f;
this.localAI[index] = 0.0f;
}
for (int index = 0; index < (int) byte.MaxValue; ++index)
this.playerImmune[index] = 0;
this.ResetLocalNPCHitImmunity();
this.noDropItem = false;
this.minion = false;
this.minionSlots = 0.0f;
this.soundDelay = 0;
this.spriteDirection = 1;
this.melee = false;
this.ranged = false;
this.magic = false;
this.ownerHitCheck = false;
this.hide = false;
this.lavaWet = false;
this.wetCount = (byte) 0;
this.wet = false;
this.ignoreWater = false;
this.hostile = false;
this.netUpdate = false;
this.netUpdate2 = false;
this.netSpam = 0;
this.numUpdates = 0;
this.extraUpdates = 0;
this.identity = 0;
this.restrikeDelay = 0;
this.light = 0.0f;
this.penetrate = 1;
this.tileCollide = true;
this.position = Vector2.Zero;
this.velocity = Vector2.Zero;
this.aiStyle = 0;
this.alpha = 0;
this.glowMask = (short) -1;
this.type = Type;
this.active = true;
this.rotation = 0.0f;
this.scale = 1f;
this.owner = (int) byte.MaxValue;
this.timeLeft = 3600;
this.friendly = false;
this.damage = 0;
this.originalDamage = 0;
this.knockBack = 0.0f;
this.miscText = "";
this.coldDamage = false;
this.noEnchantments = false;
this.noEnchantmentVisuals = false;
this.trap = false;
this.npcProj = false;
this.originatedFromActivableTile = false;
this.projUUID = -1;
this.frame = 0;
this.frameCounter = 0;
if (this.type == 1)
{
this.arrow = true;
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.friendly = true;
this.ranged = true;
this.timeLeft = 1200;
}
else if (this.type == 2)
{
this.arrow = true;
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.friendly = true;
this.light = 1f;
this.ranged = true;
this.timeLeft = 1200;
}
else if (this.type == 3)
{
this.width = 22;
this.height = 22;
this.aiStyle = 2;
this.friendly = true;
this.penetrate = 4;
this.ranged = true;
}
else if (this.type == 4)
{
this.arrow = true;
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.friendly = true;
this.light = 0.35f;
this.penetrate = 5;
this.ranged = true;
this.timeLeft = 1200;
}
else if (this.type == 5)
{
this.arrow = true;
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.friendly = true;
this.light = 0.4f;
this.penetrate = -1;
this.alpha = 100;
this.ignoreWater = true;
this.ranged = true;
this.extraUpdates = 1;
this.timeLeft = 120;
}
else if (this.type == 6)
{
this.width = 22;
this.height = 22;
this.aiStyle = 3;
this.friendly = true;
this.penetrate = -1;
this.melee = true;
this.light = 0.4f;
}
else if (this.type == 7 || this.type == 8)
{
this.width = 28;
this.height = 28;
this.aiStyle = 4;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.alpha = (int) byte.MaxValue;
this.ignoreWater = true;
this.magic = true;
}
else if (this.type == 9)
{
this.width = 24;
this.height = 24;
this.aiStyle = 5;
this.friendly = true;
this.penetrate = 2;
this.alpha = 50;
this.scale = 0.8f;
this.tileCollide = false;
this.melee = true;
}
else if (this.type == 10)
{
this.width = 64;
this.height = 64;
this.aiStyle = 6;
this.friendly = true;
this.tileCollide = false;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.ignoreWater = true;
}
else if (this.type == 11)
{
this.width = 48;
this.height = 48;
this.aiStyle = 6;
this.friendly = true;
this.tileCollide = false;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.ignoreWater = true;
}
else if (this.type == 12)
{
this.width = 18;
this.height = 18;
this.aiStyle = 5;
this.friendly = true;
this.penetrate = -1;
this.alpha = 50;
this.light = 1f;
}
else if (this.type == 13)
{
this.netImportant = true;
this.width = 18;
this.height = 18;
this.aiStyle = 7;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.timeLeft *= 10;
}
else if (this.type == 14)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.friendly = true;
this.penetrate = 1;
this.light = 0.5f;
this.alpha = (int) byte.MaxValue;
this.scale = 1.2f;
this.timeLeft = 600;
this.ranged = true;
this.extraUpdates = 1;
}
else if (this.type == 15)
{
this.width = 16;
this.height = 16;
this.aiStyle = 8;
this.friendly = true;
this.light = 0.8f;
this.alpha = 100;
this.magic = true;
}
else if (this.type == 16)
{
this.width = 32;
this.height = 32;
this.aiStyle = 9;
this.friendly = true;
this.light = 0.8f;
this.alpha = 100;
this.magic = true;
}
else if (this.type == 17)
{
this.width = 10;
this.height = 10;
this.aiStyle = 10;
this.friendly = true;
this.ignoreWater = true;
}
else if (this.type == 18)
{
this.netImportant = true;
this.width = 32;
this.height = 32;
this.aiStyle = 11;
this.friendly = true;
this.light = 0.9f;
this.alpha = 150;
this.tileCollide = false;
this.penetrate = -1;
this.timeLeft *= 5;
this.ignoreWater = true;
this.scale = 0.8f;
}
else if (this.type == 19)
{
this.width = 22;
this.height = 22;
this.aiStyle = 3;
this.friendly = true;
this.penetrate = -1;
this.light = 1f;
this.melee = true;
}
else if (this.type == 20)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.friendly = true;
this.penetrate = 3;
this.light = 0.75f;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 2;
this.scale = 1.4f;
this.timeLeft = 600;
this.magic = true;
}
else if (this.type == 21)
{
this.width = 16;
this.height = 16;
this.aiStyle = 2;
this.scale = 1.2f;
this.friendly = true;
this.ranged = true;
}
else if (this.type == 22)
{
this.width = 18;
this.height = 18;
this.aiStyle = 12;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.extraUpdates = 2;
this.ignoreWater = true;
this.magic = true;
}
else if (this.type == 23)
{
this.width = 4;
this.height = 4;
this.aiStyle = 13;
this.friendly = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.ranged = true;
}
else if (this.type == 24)
{
this.width = 14;
this.height = 14;
this.aiStyle = 14;
this.friendly = true;
this.penetrate = 6;
this.ranged = true;
}
else if (this.type == 25)
{
this.netImportant = true;
this.width = 22;
this.height = 22;
this.aiStyle = 15;
this.friendly = true;
this.penetrate = -1;
this.melee = true;
this.scale = 0.9f;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 10;
}
else if (this.type == 26)
{
this.netImportant = true;
this.width = 22;
this.height = 22;
this.aiStyle = 15;
this.friendly = true;
this.penetrate = -1;
this.melee = true;
this.scale = 0.8f;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 10;
}
else if (this.type == 27)
{
this.width = 16;
this.height = 16;
this.aiStyle = 8;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.timeLeft /= 2;
this.penetrate = 10;
this.magic = true;
}
else if (this.type == 28)
{
this.width = 22;
this.height = 22;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
}
else if (this.type == 29)
{
this.width = 10;
this.height = 10;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
}
else if (this.type == 30)
{
this.width = 14;
this.height = 14;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
this.ranged = true;
}
else if (this.type == 31)
{
this.knockBack = 6f;
this.width = 10;
this.height = 10;
this.aiStyle = 10;
this.friendly = true;
this.hostile = true;
this.penetrate = -1;
}
else if (this.type == 32)
{
this.netImportant = true;
this.width = 18;
this.height = 18;
this.aiStyle = 7;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.timeLeft *= 10;
}
else if (this.type == 33)
{
this.width = 38;
this.height = 38;
this.aiStyle = 3;
this.friendly = true;
this.scale = 0.9f;
this.penetrate = -1;
this.melee = true;
}
else if (this.type == 34)
{
this.width = 32;
this.height = 32;
this.aiStyle = 9;
this.friendly = true;
this.light = 0.8f;
this.penetrate = 2;
this.magic = true;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 12;
}
else if (this.type == 35)
{
this.netImportant = true;
this.width = 22;
this.height = 22;
this.aiStyle = 15;
this.friendly = true;
this.penetrate = -1;
this.melee = true;
this.scale = 0.8f;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 10;
}
else if (this.type == 36)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.friendly = true;
this.penetrate = 2;
this.light = 0.6f;
this.alpha = (int) byte.MaxValue;
this.scale = 1.4f;
this.timeLeft = 600;
this.ranged = true;
this.extraUpdates = 1;
}
else if (this.type == 37)
{
this.width = 22;
this.height = 22;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
}
else if (this.type == 38)
{
this.width = 14;
this.height = 14;
this.aiStyle = 0;
this.hostile = true;
this.penetrate = -1;
this.aiStyle = 1;
this.tileCollide = true;
}
else if (this.type == 39)
{
this.knockBack = 6f;
this.width = 10;
this.height = 10;
this.aiStyle = 10;
this.friendly = true;
this.hostile = true;
this.penetrate = -1;
}
else if (this.type == 40)
{
this.knockBack = 6f;
this.width = 10;
this.height = 10;
this.aiStyle = 10;
this.friendly = true;
this.hostile = true;
this.penetrate = -1;
}
else if (this.type == 41)
{
this.arrow = true;
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.friendly = true;
this.penetrate = -1;
this.ranged = true;
this.light = 0.3f;
}
else if (this.type == 42)
{
this.knockBack = 8f;
this.width = 10;
this.height = 10;
this.aiStyle = 10;
this.ranged = true;
this.friendly = true;
this.extraUpdates = 1;
}
else if (this.type == 43)
{
this.knockBack = 12f;
this.width = 24;
this.height = 24;
this.aiStyle = 17;
this.penetrate = -1;
}
else if (this.type == 44)
{
this.width = 48;
this.height = 48;
this.alpha = 100;
this.light = 0.2f;
this.aiStyle = 18;
this.hostile = true;
this.penetrate = -1;
this.tileCollide = true;
this.scale = 0.9f;
}
else if (this.type == 45)
{
this.width = 48;
this.height = 48;
this.alpha = 100;
this.light = 0.2f;
this.aiStyle = 18;
this.friendly = true;
this.penetrate = 5;
this.tileCollide = true;
this.scale = 0.9f;
this.magic = true;
}
else if (this.type == 46)
{
this.width = 20;
this.height = 20;
this.aiStyle = 19;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.scale = 1.1f;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
}
else if (this.type == 47)
{
this.width = 18;
this.height = 18;
this.aiStyle = 19;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.scale = 1.1f;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
}
else if (this.type == 48)
{
this.width = 12;
this.height = 12;
this.aiStyle = 2;
this.friendly = true;
this.penetrate = 2;
this.ranged = true;
}
else if (this.type == 49)
{
this.width = 18;
this.height = 18;
this.aiStyle = 19;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.scale = 1.2f;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
}
else if (this.type == 50)
{
this.netImportant = true;
this.width = 6;
this.height = 6;
this.aiStyle = 14;
this.penetrate = -1;
this.alpha = 75;
this.light = 1f;
this.timeLeft *= 5;
}
else if (this.type == 51)
{
this.width = 8;
this.height = 8;
this.aiStyle = 1;
this.ranged = true;
this.friendly = true;
}
else if (this.type == 52)
{
this.width = 22;
this.height = 22;
this.aiStyle = 3;
this.friendly = true;
this.penetrate = -1;
this.melee = true;
}
else if (this.type == 53)
{
this.netImportant = true;
this.width = 6;
this.height = 6;
this.aiStyle = 14;
this.penetrate = -1;
this.alpha = 75;
this.light = 1f;
this.timeLeft *= 5;
this.tileCollide = false;
}
else if (this.type == 54)
{
this.width = 12;
this.height = 12;
this.aiStyle = 2;
this.friendly = true;
this.penetrate = 2;
this.ranged = true;
}
else if (this.type == 55)
{
this.width = 10;
this.height = 10;
this.aiStyle = 0;
this.hostile = true;
this.penetrate = -1;
this.aiStyle = 1;
this.tileCollide = true;
}
else if (this.type == 56)
{
this.knockBack = 6f;
this.width = 10;
this.height = 10;
this.aiStyle = 10;
this.friendly = true;
this.hostile = true;
this.penetrate = -1;
}
else if (this.type == 57)
{
this.width = 18;
this.height = 18;
this.aiStyle = 20;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
}
else if (this.type == 58)
{
this.width = 18;
this.height = 18;
this.aiStyle = 20;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
this.scale = 1.08f;
}
else if (this.type == 59)
{
this.width = 22;
this.height = 22;
this.aiStyle = 20;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
this.scale = 0.9f;
}
else if (this.type == 60)
{
this.width = 22;
this.height = 22;
this.aiStyle = 20;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
this.scale = 0.9f;
}
else if (this.type == 61)
{
this.width = 18;
this.height = 18;
this.aiStyle = 20;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
this.scale = 1.16f;
}
else if (this.type == 62)
{
this.width = 22;
this.height = 22;
this.aiStyle = 20;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
this.scale = 0.9f;
}
else if (this.type == 63)
{
this.netImportant = true;
this.width = 22;
this.height = 22;
this.aiStyle = 15;
this.friendly = true;
this.penetrate = -1;
this.melee = true;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 10;
}
else if (this.type == 64)
{
this.width = 18;
this.height = 18;
this.aiStyle = 19;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.scale = 1.25f;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
}
else if (this.type == 65)
{
this.knockBack = 6f;
this.width = 10;
this.height = 10;
this.aiStyle = 10;
this.friendly = true;
this.ranged = true;
this.penetrate = -1;
this.extraUpdates = 1;
}
else if (this.type == 66)
{
this.width = 18;
this.height = 18;
this.aiStyle = 19;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.scale = 1.27f;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
}
else if (this.type == 67)
{
this.knockBack = 6f;
this.width = 10;
this.height = 10;
this.aiStyle = 10;
this.friendly = true;
this.hostile = true;
this.penetrate = -1;
}
else if (this.type == 68)
{
this.knockBack = 6f;
this.width = 10;
this.height = 10;
this.aiStyle = 10;
this.friendly = true;
this.ranged = true;
this.penetrate = -1;
this.extraUpdates = 1;
}
else if (this.type == 69)
{
this.width = 14;
this.height = 14;
this.aiStyle = 2;
this.friendly = true;
this.penetrate = 1;
}
else if (this.type == 70)
{
this.width = 14;
this.height = 14;
this.aiStyle = 2;
this.friendly = true;
this.penetrate = 1;
}
else if (this.type == 621)
{
this.width = 14;
this.height = 14;
this.aiStyle = 2;
this.friendly = true;
this.penetrate = 1;
}
else if (this.type == 71)
{
this.knockBack = 6f;
this.width = 10;
this.height = 10;
this.aiStyle = 10;
this.friendly = true;
this.hostile = true;
this.penetrate = -1;
}
else if (this.type == 72)
{
this.netImportant = true;
this.width = 18;
this.height = 18;
this.aiStyle = 11;
this.friendly = true;
this.light = 0.9f;
this.tileCollide = false;
this.penetrate = -1;
this.timeLeft *= 5;
this.ignoreWater = true;
this.scale = 0.8f;
}
else if (this.type == 73 || this.type == 74)
{
this.netImportant = true;
this.width = 18;
this.height = 18;
this.aiStyle = 7;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.timeLeft *= 10;
this.light = 0.4f;
}
else if (this.type == 75)
{
this.width = 22;
this.height = 22;
this.aiStyle = 16;
this.hostile = true;
this.penetrate = -1;
}
else if (this.type == 76 || this.type == 77 || this.type == 78)
{
if (this.type == 76)
{
this.width = 10;
this.height = 22;
}
else if (this.type == 77)
{
this.width = 18;
this.height = 24;
}
else
{
this.width = 22;
this.height = 24;
}
this.aiStyle = 21;
this.friendly = true;
this.alpha = 100;
this.light = 0.3f;
this.penetrate = -1;
this.timeLeft = 180;
this.magic = true;
}
else if (this.type == 79)
{
this.width = 32;
this.height = 32;
this.aiStyle = 9;
this.friendly = true;
this.light = 0.8f;
this.magic = true;
this.penetrate = 3;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 12;
}
else if (this.type == 80)
{
this.width = 16;
this.height = 16;
this.aiStyle = 22;
this.friendly = true;
this.magic = true;
this.tileCollide = false;
this.light = 0.5f;
this.coldDamage = true;
}
else if (this.type == 81)
{
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.hostile = true;
}
else if (this.type == 82)
{
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.hostile = true;
}
else if (this.type == 83)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.hostile = true;
this.penetrate = 3;
this.light = 0.75f;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 2;
this.scale = 1.7f;
this.timeLeft = 600;
this.magic = true;
}
else if (this.type == 84)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.hostile = true;
this.penetrate = 3;
this.light = 0.75f;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 2;
this.scale = 1.2f;
this.timeLeft = 600;
this.magic = true;
}
else if (this.type == 85)
{
this.width = 6;
this.height = 6;
this.aiStyle = 23;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.penetrate = 3;
this.extraUpdates = 2;
this.ranged = true;
}
else if (this.type == 86)
{
this.netImportant = true;
this.width = 18;
this.height = 18;
this.aiStyle = 11;
this.friendly = true;
this.light = 0.9f;
this.tileCollide = false;
this.penetrate = -1;
this.timeLeft *= 5;
this.ignoreWater = true;
this.scale = 0.8f;
}
else if (this.type == 87)
{
this.netImportant = true;
this.width = 18;
this.height = 18;
this.aiStyle = 11;
this.friendly = true;
this.light = 0.9f;
this.tileCollide = false;
this.penetrate = -1;
this.timeLeft *= 5;
this.ignoreWater = true;
this.scale = 0.8f;
}
else if (this.type == 88)
{
this.width = 6;
this.height = 6;
this.aiStyle = 1;
this.friendly = true;
this.penetrate = 3;
this.light = 0.75f;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 4;
this.scale = 1.4f;
this.timeLeft = 600;
this.magic = true;
}
else if (this.type == 89)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.friendly = true;
this.penetrate = 1;
this.light = 0.5f;
this.alpha = (int) byte.MaxValue;
this.scale = 1.2f;
this.timeLeft = 600;
this.ranged = true;
this.extraUpdates = 1;
}
else if (this.type == 90)
{
this.width = 6;
this.height = 6;
this.aiStyle = 24;
this.friendly = true;
this.penetrate = 1;
this.light = 0.5f;
this.alpha = 50;
this.scale = 1.2f;
this.timeLeft = 600;
this.ranged = true;
this.tileCollide = false;
}
else if (this.type == 91)
{
this.arrow = true;
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.friendly = true;
this.ranged = true;
this.timeLeft = 1200;
}
else if (this.type == 92)
{
this.width = 24;
this.height = 24;
this.aiStyle = 5;
this.friendly = true;
this.penetrate = 1;
this.alpha = 50;
this.scale = 0.8f;
this.tileCollide = false;
this.ranged = true;
}
else if (this.type == 93)
{
this.light = 0.15f;
this.width = 12;
this.height = 12;
this.aiStyle = 2;
this.friendly = true;
this.penetrate = 2;
this.magic = true;
}
else if (this.type == 94)
{
this.ignoreWater = true;
this.width = 8;
this.height = 8;
this.aiStyle = 24;
this.friendly = true;
this.light = 0.5f;
this.alpha = 50;
this.scale = 1.2f;
this.timeLeft = 600;
this.magic = true;
this.tileCollide = true;
this.penetrate = 1;
}
else if (this.type == 95)
{
this.width = 16;
this.height = 16;
this.aiStyle = 8;
this.friendly = true;
this.light = 0.8f;
this.alpha = 100;
this.magic = true;
this.penetrate = 2;
}
else if (this.type == 96)
{
this.width = 16;
this.height = 16;
this.aiStyle = 8;
this.hostile = true;
this.light = 0.8f;
this.alpha = 100;
this.magic = true;
this.penetrate = -1;
this.scale = 0.9f;
this.scale = 1.3f;
}
else if (this.type == 97)
{
this.width = 18;
this.height = 18;
this.aiStyle = 19;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.scale = 1.1f;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
}
else if (this.type == 98)
{
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.friendly = true;
this.hostile = true;
this.penetrate = -1;
this.trap = true;
}
else if (this.type == 99 || this.type == 727)
{
this.width = 31;
this.height = 31;
this.aiStyle = 25;
this.friendly = true;
this.hostile = true;
this.ranged = true;
this.penetrate = -1;
this.trap = true;
}
else if (this.type == 100)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.hostile = true;
this.penetrate = 3;
this.light = 0.75f;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 2;
this.scale = 1.8f;
this.timeLeft = 2700;
this.magic = true;
}
else if (this.type == 101)
{
this.width = 6;
this.height = 6;
this.aiStyle = 23;
this.hostile = true;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.extraUpdates = 3;
this.magic = true;
}
else if (this.type == 102)
{
this.width = 22;
this.height = 22;
this.aiStyle = 16;
this.hostile = true;
this.penetrate = -1;
this.ranged = true;
}
else if (this.type == 103)
{
this.arrow = true;
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.friendly = true;
this.light = 1f;
this.ranged = true;
this.timeLeft = 1200;
}
else if (this.type == 104)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.friendly = true;
this.penetrate = 1;
this.light = 0.5f;
this.alpha = (int) byte.MaxValue;
this.scale = 1.2f;
this.timeLeft = 600;
this.ranged = true;
this.extraUpdates = 1;
}
else if (this.type == 105)
{
this.width = 18;
this.height = 18;
this.aiStyle = 19;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.scale = 1.3f;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
}
else if (this.type == 106)
{
this.width = 32;
this.height = 32;
this.aiStyle = 3;
this.friendly = true;
this.penetrate = -1;
this.melee = true;
this.light = 0.4f;
}
else if (this.type == 107)
{
this.width = 22;
this.height = 22;
this.aiStyle = 20;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
this.scale = 1.1f;
}
else if (this.type == 108)
{
this.width = 260;
this.height = 260;
this.aiStyle = 16;
this.friendly = true;
this.hostile = true;
this.penetrate = -1;
this.tileCollide = false;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 2;
this.trap = true;
}
else if (this.type == 109)
{
this.knockBack = 6f;
this.width = 10;
this.height = 10;
this.aiStyle = 10;
this.hostile = true;
this.scale = 0.9f;
this.penetrate = -1;
this.coldDamage = true;
this.ranged = true;
}
else if (this.type == 110)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.hostile = true;
this.penetrate = -1;
this.light = 0.5f;
this.alpha = (int) byte.MaxValue;
this.scale = 1.2f;
this.timeLeft = 600;
this.ranged = true;
this.extraUpdates = 1;
}
else if (this.type == 111)
{
this.netImportant = true;
this.width = 18;
this.height = 18;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 112)
{
this.netImportant = true;
this.width = 18;
this.height = 18;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 113)
{
this.width = 22;
this.height = 22;
this.aiStyle = 3;
this.friendly = true;
this.penetrate = -1;
this.melee = true;
this.light = 0.4f;
this.coldDamage = true;
}
else if (this.type == 114)
{
this.width = 16;
this.height = 16;
this.aiStyle = 27;
this.magic = true;
this.penetrate = 3;
this.light = 0.5f;
this.alpha = (int) byte.MaxValue;
this.friendly = true;
}
else if (this.type == 115)
{
this.width = 16;
this.height = 16;
this.aiStyle = 27;
this.hostile = true;
this.magic = true;
this.penetrate = -1;
this.light = 0.5f;
this.alpha = (int) byte.MaxValue;
}
else if (this.type == 116)
{
this.width = 16;
this.height = 16;
this.aiStyle = 27;
this.melee = true;
this.penetrate = 1;
this.light = 0.5f;
this.alpha = (int) byte.MaxValue;
this.friendly = true;
}
else if (this.type == 117)
{
this.arrow = true;
this.extraUpdates = 2;
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.friendly = true;
this.ranged = true;
this.timeLeft = 1200;
}
else if (this.type == 118)
{
this.width = 10;
this.height = 10;
this.aiStyle = 28;
this.alpha = (int) byte.MaxValue;
this.melee = true;
this.penetrate = 1;
this.friendly = true;
this.coldDamage = true;
}
else if (this.type == 119)
{
this.width = 14;
this.height = 14;
this.aiStyle = 28;
this.alpha = (int) byte.MaxValue;
this.melee = true;
this.penetrate = 2;
this.friendly = true;
this.coldDamage = true;
}
else if (this.type == 120)
{
this.arrow = true;
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.friendly = true;
this.ranged = true;
this.coldDamage = true;
this.extraUpdates = 1;
this.timeLeft = 1200;
}
else if (this.type == 121)
{
this.width = 10;
this.height = 10;
this.aiStyle = 29;
this.alpha = (int) byte.MaxValue;
this.magic = true;
this.penetrate = 1;
this.friendly = true;
}
else if (this.type == 122)
{
this.width = 10;
this.height = 10;
this.aiStyle = 29;
this.alpha = (int) byte.MaxValue;
this.magic = true;
this.penetrate = 1;
this.friendly = true;
}
else if (this.type == 123)
{
this.width = 10;
this.height = 10;
this.aiStyle = 29;
this.alpha = (int) byte.MaxValue;
this.magic = true;
this.penetrate = 1;
this.friendly = true;
}
else if (this.type == 124)
{
this.width = 10;
this.height = 10;
this.aiStyle = 29;
this.alpha = (int) byte.MaxValue;
this.magic = true;
this.penetrate = 2;
this.friendly = true;
}
else if (this.type == 125)
{
this.width = 10;
this.height = 10;
this.aiStyle = 29;
this.alpha = (int) byte.MaxValue;
this.magic = true;
this.penetrate = 2;
this.friendly = true;
}
else if (this.type == 126)
{
this.width = 10;
this.height = 10;
this.aiStyle = 29;
this.alpha = (int) byte.MaxValue;
this.magic = true;
this.penetrate = 2;
this.friendly = true;
}
else if (this.type == (int) sbyte.MaxValue)
{
this.netImportant = true;
this.width = 22;
this.height = 22;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 128)
{
this.width = 14;
this.height = 14;
this.aiStyle = 28;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.friendly = false;
this.hostile = true;
this.coldDamage = true;
}
else if (this.type == 129)
{
this.width = 14;
this.height = 14;
this.aiStyle = 28;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.friendly = false;
this.hostile = true;
this.tileCollide = false;
}
else if (this.type == 130)
{
this.width = 22;
this.height = 22;
this.aiStyle = 19;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.scale = 1.2f;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
}
else if (this.type == 131)
{
this.width = 22;
this.height = 22;
this.aiStyle = 30;
this.friendly = true;
this.penetrate = 1;
this.tileCollide = false;
this.melee = true;
this.light = 0.5f;
}
else if (this.type == 132)
{
this.width = 16;
this.height = 16;
this.aiStyle = 27;
this.melee = true;
this.penetrate = 3;
this.light = 0.5f;
this.alpha = (int) byte.MaxValue;
this.friendly = true;
}
else if (this.type == 133)
{
this.width = 14;
this.height = 14;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
this.ranged = true;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = -1;
}
else if (this.type == 134)
{
this.width = 14;
this.height = 14;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
this.ranged = true;
}
else if (this.type == 135)
{
this.width = 14;
this.height = 14;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
this.ranged = true;
}
else if (this.type == 136)
{
this.width = 14;
this.height = 14;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
this.ranged = true;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = -1;
}
else if (this.type == 137)
{
this.width = 14;
this.height = 14;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
this.ranged = true;
}
else if (this.type == 138)
{
this.width = 14;
this.height = 14;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
this.ranged = true;
}
else if (this.type == 139)
{
this.width = 14;
this.height = 14;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
this.ranged = true;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = -1;
}
else if (this.type == 140)
{
this.width = 14;
this.height = 14;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
this.ranged = true;
}
else if (this.type == 141)
{
this.width = 14;
this.height = 14;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
this.ranged = true;
}
else if (this.type == 142)
{
this.width = 14;
this.height = 14;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
this.ranged = true;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = -1;
}
else if (this.type == 143)
{
this.width = 14;
this.height = 14;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
this.ranged = true;
}
else if (this.type == 144)
{
this.width = 14;
this.height = 14;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
this.ranged = true;
}
else if (this.type == 145)
{
this.width = 6;
this.height = 6;
this.aiStyle = 31;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.extraUpdates = 2;
this.tileCollide = false;
this.ignoreWater = true;
}
else if (this.type == 146)
{
this.width = 6;
this.height = 6;
this.aiStyle = 31;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.extraUpdates = 2;
this.tileCollide = false;
this.ignoreWater = true;
}
else if (this.type == 147)
{
this.width = 6;
this.height = 6;
this.aiStyle = 31;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.extraUpdates = 2;
this.tileCollide = false;
this.ignoreWater = true;
}
else if (this.type == 148)
{
this.width = 6;
this.height = 6;
this.aiStyle = 31;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.extraUpdates = 2;
this.tileCollide = false;
this.ignoreWater = true;
}
else if (this.type == 149)
{
this.width = 6;
this.height = 6;
this.aiStyle = 31;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.extraUpdates = 2;
this.tileCollide = false;
this.ignoreWater = true;
}
else if (this.type == 150 || this.type == 151 || this.type == 152)
{
this.width = 28;
this.height = 28;
this.aiStyle = 4;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.alpha = (int) byte.MaxValue;
this.ignoreWater = true;
this.magic = true;
}
else if (this.type == 153)
{
this.width = 18;
this.height = 18;
this.aiStyle = 19;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.scale = 1.1f;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
}
else if (this.type == 154)
{
this.netImportant = true;
this.width = 22;
this.height = 22;
this.aiStyle = 15;
this.friendly = true;
this.penetrate = -1;
this.melee = true;
this.scale = 0.8f;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 10;
}
else if (this.type == 155)
{
this.netImportant = true;
this.width = 44;
this.height = 44;
this.aiStyle = 32;
this.friendly = true;
}
else if (this.type == 156)
{
this.width = 16;
this.height = 16;
this.aiStyle = 27;
this.melee = true;
this.light = 0.5f;
this.alpha = (int) byte.MaxValue;
this.friendly = true;
}
else if (this.type == 157)
{
this.width = 32;
this.height = 32;
this.aiStyle = 27;
this.melee = true;
this.light = 0.5f;
this.alpha = (int) byte.MaxValue;
this.friendly = true;
this.scale = 1.2f;
}
else if (this.type == 158)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.friendly = true;
this.penetrate = 1;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 600;
this.ranged = true;
this.extraUpdates = 1;
}
else if (this.type == 159)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.friendly = true;
this.penetrate = 1;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 600;
this.ranged = true;
this.extraUpdates = 1;
}
else if (this.type == 160)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.friendly = true;
this.penetrate = 1;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 600;
this.ranged = true;
this.extraUpdates = 1;
}
else if (this.type == 161)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.friendly = true;
this.penetrate = 1;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 600;
this.ranged = true;
this.extraUpdates = 1;
}
else if (this.type == 162)
{
this.width = 16;
this.height = 16;
this.aiStyle = 2;
this.friendly = true;
this.penetrate = 4;
this.alpha = (int) byte.MaxValue;
}
else if (this.type == 163)
{
this.netImportant = true;
this.width = 6;
this.height = 6;
this.aiStyle = 33;
this.friendly = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 36000;
}
else if (this.type == 164)
{
this.width = 128;
this.height = 128;
this.aiStyle = 16;
this.friendly = true;
this.hostile = true;
this.penetrate = -1;
this.tileCollide = false;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 2;
}
else if (this.type == 165)
{
this.netImportant = true;
this.width = 12;
this.height = 12;
this.aiStyle = 7;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.timeLeft *= 10;
}
else if (this.type == 166)
{
this.width = 14;
this.height = 14;
this.aiStyle = 2;
this.friendly = true;
this.ranged = true;
this.coldDamage = true;
}
else if (this.type == 167 || this.type == 168 || this.type == 169 || this.type == 170)
{
this.width = 14;
this.height = 14;
this.aiStyle = 34;
this.friendly = true;
this.ranged = true;
this.timeLeft = 45;
this.usesIDStaticNPCImmunity = true;
this.idStaticNPCHitCooldown = 3;
}
else if (this.type == 171 || this.type == 505 || this.type == 506)
{
this.width = 14;
this.height = 14;
this.aiStyle = 35;
this.penetrate = -1;
this.tileCollide = false;
this.timeLeft = 400;
}
else if (this.type == 172)
{
this.arrow = true;
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.friendly = true;
this.light = 1f;
this.ranged = true;
this.coldDamage = true;
this.timeLeft = 1200;
}
else if (this.type == 173)
{
this.width = 16;
this.height = 16;
this.aiStyle = 27;
this.melee = true;
this.penetrate = 1;
this.light = 0.2f;
this.alpha = (int) byte.MaxValue;
this.friendly = true;
}
else if (this.type == 174)
{
this.alpha = (int) byte.MaxValue;
this.width = 6;
this.height = 6;
this.aiStyle = 1;
this.hostile = true;
this.penetrate = -1;
this.coldDamage = true;
}
else if (this.type == 175)
{
this.width = 34;
this.height = 34;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 176)
{
this.alpha = (int) byte.MaxValue;
this.width = 6;
this.height = 6;
this.aiStyle = 1;
this.hostile = true;
this.penetrate = -1;
}
else if (this.type == 177)
{
this.width = 10;
this.height = 10;
this.aiStyle = 28;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.friendly = false;
this.hostile = true;
this.coldDamage = true;
}
else if (this.type == 178)
{
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.timeLeft = 2;
}
else if (this.type == 179)
{
this.knockBack = 6f;
this.width = 10;
this.height = 10;
this.aiStyle = 10;
this.friendly = true;
this.hostile = true;
this.penetrate = -1;
}
else if (this.type == 180)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.hostile = true;
this.penetrate = -1;
this.light = 0.5f;
this.alpha = (int) byte.MaxValue;
this.scale = 1.2f;
this.timeLeft = 600;
this.extraUpdates = 1;
}
else if (this.type == 181)
{
this.width = 8;
this.height = 8;
this.aiStyle = 36;
this.friendly = true;
this.penetrate = 3;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 600;
this.extraUpdates = 3;
}
else if (this.type == 182)
{
this.light = 0.15f;
this.width = 30;
this.height = 30;
this.aiStyle = 3;
this.friendly = true;
this.penetrate = 10;
this.melee = true;
this.extraUpdates = 1;
}
else if (this.type == 183)
{
this.width = 14;
this.height = 22;
this.aiStyle = 14;
this.penetrate = 1;
this.timeLeft = 180;
this.ranged = true;
this.friendly = true;
}
else if (this.type == 184)
{
this.width = 6;
this.height = 6;
this.aiStyle = 1;
this.friendly = true;
this.hostile = true;
this.penetrate = -1;
this.trap = true;
}
else if (this.type == 185)
{
this.width = 14;
this.height = 14;
this.aiStyle = 14;
this.friendly = true;
this.hostile = true;
this.penetrate = -1;
this.timeLeft = 900;
this.trap = true;
}
else if (this.type == 186)
{
this.width = 10;
this.height = 14;
this.aiStyle = 37;
this.friendly = true;
this.tileCollide = false;
this.ignoreWater = true;
this.hostile = true;
this.penetrate = -1;
this.timeLeft = 300;
this.trap = true;
}
else if (this.type == 187)
{
this.width = 6;
this.height = 6;
this.aiStyle = 38;
this.alpha = (int) byte.MaxValue;
this.tileCollide = false;
this.ignoreWater = true;
this.timeLeft = 60;
this.trap = true;
}
else if (this.type == 188)
{
this.width = 6;
this.height = 6;
this.aiStyle = 23;
this.friendly = true;
this.hostile = true;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.extraUpdates = 2;
this.trap = true;
}
else if (this.type == 189)
{
this.width = 8;
this.height = 8;
this.aiStyle = 36;
this.friendly = true;
this.penetrate = 3;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 600;
this.magic = true;
this.extraUpdates = 3;
}
else if (this.type == 190)
{
this.width = 22;
this.height = 22;
this.aiStyle = 39;
this.friendly = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.ranged = true;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 14;
}
else if (this.type >= 191 && this.type <= 194)
{
this.netImportant = true;
this.width = 18;
this.height = 18;
this.aiStyle = 26;
this.penetrate = -1;
this.timeLeft *= 5;
this.minion = true;
this.minionSlots = 1f;
if (this.type == 192)
this.scale = 1.025f;
if (this.type == 193)
this.scale = 1.05f;
if (this.type == 194)
this.scale = 1.075f;
}
else if (this.type == 195)
{
this.tileCollide = false;
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.friendly = true;
}
else if (this.type == 196)
{
this.width = 16;
this.height = 16;
this.aiStyle = 14;
this.penetrate = -1;
this.scale = 0.8f;
}
else if (this.type == 197)
{
this.netImportant = true;
this.width = 42;
this.height = 42;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 198)
{
this.netImportant = true;
this.width = 26;
this.height = 26;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 199)
{
this.netImportant = true;
this.width = 28;
this.height = 28;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
this.ignoreWater = true;
}
else if (this.type == 200)
{
this.netImportant = true;
this.width = 28;
this.height = 28;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 201)
{
this.knockBack = 12f;
this.width = 24;
this.height = 24;
this.aiStyle = 17;
this.penetrate = -1;
}
else if (this.type == 202)
{
this.knockBack = 12f;
this.width = 24;
this.height = 24;
this.aiStyle = 17;
this.penetrate = -1;
}
else if (this.type == 203)
{
this.knockBack = 12f;
this.width = 24;
this.height = 24;
this.aiStyle = 17;
this.penetrate = -1;
}
else if (this.type == 204)
{
this.knockBack = 12f;
this.width = 24;
this.height = 24;
this.aiStyle = 17;
this.penetrate = -1;
}
else if (this.type == 205)
{
this.knockBack = 12f;
this.width = 24;
this.height = 24;
this.aiStyle = 17;
this.penetrate = -1;
}
else if (this.type == 206)
{
this.width = 14;
this.height = 14;
this.aiStyle = 40;
this.friendly = true;
this.penetrate = 1;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 600;
this.magic = true;
}
else if (this.type == 207)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.friendly = true;
this.penetrate = 1;
this.light = 0.5f;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 2;
this.scale = 1.2f;
this.timeLeft = 600;
this.ranged = true;
}
else if (this.type == 208)
{
this.netImportant = true;
this.width = 18;
this.height = 36;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 209)
{
this.width = 12;
this.height = 32;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
this.light = 0.5f;
}
else if (this.type == 210)
{
this.netImportant = true;
this.width = 14;
this.height = 30;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 211)
{
this.netImportant = true;
this.width = 24;
this.height = 24;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
this.light = 1f;
this.ignoreWater = true;
}
else if (this.type == 212)
{
this.width = 18;
this.height = 18;
this.aiStyle = 19;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.scale = 1.12f;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
}
else if (this.type == 213)
{
this.width = 22;
this.height = 22;
this.aiStyle = 20;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
this.scale = 0.92f;
}
else if (this.type == 214)
{
this.width = 18;
this.height = 18;
this.aiStyle = 20;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
}
else if (this.type == 215)
{
this.width = 18;
this.height = 18;
this.aiStyle = 19;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.scale = 1.27f;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
}
else if (this.type == 216)
{
this.width = 22;
this.height = 22;
this.aiStyle = 20;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
this.scale = 0.93f;
}
else if (this.type == 217)
{
this.width = 18;
this.height = 18;
this.aiStyle = 20;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
this.scale = 1.12f;
}
else if (this.type == 218)
{
this.width = 18;
this.height = 18;
this.aiStyle = 19;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.scale = 1.28f;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
}
else if (this.type == 219)
{
this.width = 22;
this.height = 22;
this.aiStyle = 20;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
this.scale = 0.95f;
}
else if (this.type == 220)
{
this.width = 18;
this.height = 18;
this.aiStyle = 20;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
this.scale = 1.2f;
}
else if (this.type == 221)
{
this.width = 20;
this.height = 20;
this.aiStyle = 41;
this.friendly = true;
this.tileCollide = false;
this.ignoreWater = true;
this.timeLeft = 120;
this.penetrate = -1;
this.scale = (float) (1.0 + (double) Main.rand.Next(30) * 0.00999999977648258);
this.extraUpdates = 2;
}
else if (this.type == 222)
{
this.width = 18;
this.height = 18;
this.aiStyle = 19;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.scale = 1.3f;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
}
else if (this.type == 223)
{
this.width = 22;
this.height = 22;
this.aiStyle = 20;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
this.scale = 1f;
}
else if (this.type == 224)
{
this.width = 18;
this.height = 18;
this.aiStyle = 20;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
this.scale = 1.1f;
}
else if (this.type == 225)
{
this.arrow = true;
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.friendly = true;
this.ranged = true;
this.extraUpdates = 1;
this.timeLeft = 1200;
}
else if (this.type == 226)
{
this.netImportant = true;
this.width = 22;
this.height = 42;
this.aiStyle = 42;
this.friendly = true;
this.tileCollide = false;
this.penetrate = -1;
this.timeLeft *= 5;
this.light = 0.4f;
this.ignoreWater = true;
}
else if (this.type == 227)
{
this.netImportant = true;
this.tileCollide = false;
this.light = 0.1f;
this.width = 14;
this.height = 14;
this.aiStyle = 43;
this.friendly = true;
this.penetrate = 1;
this.timeLeft = 180;
}
else if (this.type == 228)
{
this.tileCollide = false;
this.width = 30;
this.height = 30;
this.aiStyle = 44;
this.friendly = true;
this.melee = true;
this.scale = 1.1f;
this.penetrate = -1;
this.noEnchantmentVisuals = true;
}
else if (this.type == 229)
{
this.width = 30;
this.height = 30;
this.aiStyle = 44;
this.friendly = true;
this.melee = true;
this.penetrate = -1;
this.light = 0.2f;
this.noEnchantmentVisuals = true;
}
else if (this.type >= 230 && this.type <= 235)
{
this.netImportant = true;
this.width = 18;
this.height = 18;
this.aiStyle = 7;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.timeLeft *= 10;
}
else if (this.type == 236)
{
this.netImportant = true;
this.width = 34;
this.height = 34;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 237)
{
this.netImportant = true;
this.width = 28;
this.height = 28;
this.aiStyle = 45;
this.penetrate = -1;
}
else if (this.type == 238)
{
this.tileCollide = false;
this.ignoreWater = true;
this.width = 54;
this.height = 28;
this.aiStyle = 45;
this.penetrate = -1;
}
else if (this.type == 239)
{
this.ignoreWater = true;
this.width = 4;
this.height = 40;
this.aiStyle = 45;
this.friendly = true;
this.penetrate = -1;
this.timeLeft = 300;
this.scale = 1.1f;
this.magic = true;
this.extraUpdates = 1;
}
else if (this.type == 240)
{
this.width = 16;
this.height = 16;
this.aiStyle = 2;
this.hostile = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
}
else if (this.type == 241)
{
this.knockBack = 6f;
this.width = 10;
this.height = 10;
this.aiStyle = 10;
this.friendly = true;
this.hostile = true;
this.penetrate = -1;
}
else if (this.type == 242)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.friendly = true;
this.penetrate = 1;
this.light = 0.5f;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 7;
this.scale = 1.18f;
this.timeLeft = 600;
this.ranged = true;
this.ignoreWater = true;
}
else if (this.type == 243)
{
this.width = 28;
this.height = 28;
this.aiStyle = 45;
this.penetrate = -1;
}
else if (this.type == 244)
{
this.tileCollide = false;
this.ignoreWater = true;
this.width = 54;
this.height = 28;
this.aiStyle = 45;
this.penetrate = -1;
}
else if (this.type == 245)
{
this.ignoreWater = true;
this.width = 4;
this.height = 40;
this.aiStyle = 45;
this.friendly = true;
this.penetrate = 2;
this.timeLeft = 300;
this.scale = 1.1f;
this.magic = true;
this.extraUpdates = 1;
}
else if (this.type == 246)
{
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.friendly = true;
this.ranged = true;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 1;
}
else if (this.type == 247)
{
this.netImportant = true;
this.width = 34;
this.height = 34;
this.aiStyle = 15;
this.friendly = true;
this.penetrate = -1;
this.melee = true;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 10;
}
else if (this.type == 248)
{
this.width = 18;
this.height = 18;
this.aiStyle = 1;
this.friendly = true;
this.melee = true;
}
else if (this.type == 249)
{
this.width = 12;
this.height = 12;
this.aiStyle = 2;
this.friendly = true;
this.ranged = true;
}
else if (this.type == 250)
{
this.width = 12;
this.height = 12;
this.aiStyle = 46;
this.penetrate = -1;
this.magic = true;
this.alpha = (int) byte.MaxValue;
this.ignoreWater = true;
this.scale = 1.25f;
}
else if (this.type == 251)
{
this.width = 14;
this.height = 14;
this.aiStyle = 46;
this.friendly = true;
this.penetrate = -1;
this.magic = true;
this.alpha = (int) byte.MaxValue;
this.light = 0.3f;
this.tileCollide = false;
this.ignoreWater = true;
this.scale = 1.25f;
}
else if (this.type == 252)
{
this.width = 18;
this.height = 18;
this.aiStyle = 20;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
this.scale = 1.1f;
}
else if (this.type == 253)
{
this.width = 16;
this.height = 16;
this.aiStyle = 8;
this.friendly = true;
this.light = 0.8f;
this.alpha = 100;
this.magic = true;
this.coldDamage = true;
}
else if (this.type == 254)
{
this.width = 38;
this.height = 38;
this.aiStyle = 47;
this.magic = true;
this.timeLeft = 660;
this.light = 0.5f;
}
else if (this.type == (int) byte.MaxValue)
{
this.width = 8;
this.height = 8;
this.aiStyle = 48;
this.friendly = true;
this.magic = true;
this.extraUpdates = 100;
this.timeLeft = 100;
}
else if (this.type == 256)
{
this.netImportant = true;
this.tileCollide = false;
this.width = 6;
this.height = 6;
this.aiStyle = 7;
this.friendly = true;
this.penetrate = -1;
this.scale = 1f;
this.timeLeft *= 10;
}
else if (this.type == 257)
{
this.ignoreWater = true;
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.hostile = true;
this.penetrate = -1;
this.light = 0.75f;
this.alpha = (int) byte.MaxValue;
this.scale = 1.2f;
this.timeLeft = 600;
this.magic = true;
this.coldDamage = true;
this.extraUpdates = 1;
}
else if (this.type == 258)
{
this.width = 16;
this.height = 16;
this.aiStyle = 8;
this.hostile = true;
this.penetrate = -1;
this.alpha = 100;
this.timeLeft = 300;
}
else if (this.type == 259)
{
this.ignoreWater = true;
this.tileCollide = false;
this.width = 8;
this.height = 8;
this.aiStyle = 1;
this.hostile = true;
this.penetrate = -1;
this.light = 0.3f;
this.scale = 1.1f;
this.magic = true;
this.extraUpdates = 1;
}
else if (this.type == 260)
{
this.width = 8;
this.height = 8;
this.aiStyle = 48;
this.friendly = true;
this.magic = true;
this.extraUpdates = 100;
this.timeLeft = 200;
this.penetrate = 1;
}
else if (this.type == 261)
{
this.width = 32;
this.height = 34;
this.aiStyle = 14;
this.friendly = true;
this.penetrate = 6;
this.magic = true;
this.ignoreWater = true;
this.extraUpdates = 1;
}
else if (this.type == 262)
{
this.width = 30;
this.height = 30;
this.aiStyle = 13;
this.friendly = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.melee = true;
this.extraUpdates = 1;
}
else if (this.type == 263)
{
this.width = 34;
this.height = 34;
this.alpha = 100;
this.light = 0.5f;
this.aiStyle = 18;
this.friendly = true;
this.penetrate = 5;
this.tileCollide = true;
this.scale = 1f;
this.melee = true;
this.timeLeft = 180;
this.coldDamage = true;
}
else if (this.type == 264)
{
this.ignoreWater = true;
this.width = 4;
this.height = 40;
this.aiStyle = 45;
this.hostile = true;
this.penetrate = -1;
this.timeLeft = 120;
this.scale = 1.1f;
this.extraUpdates = 1;
}
else if (this.type == 265)
{
this.width = 12;
this.height = 12;
this.aiStyle = 1;
this.alpha = (int) byte.MaxValue;
this.friendly = true;
this.magic = true;
this.penetrate = 3;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 6;
this.timeLeft = 30;
}
else if (this.type == 266)
{
this.netImportant = true;
this.alpha = 75;
this.width = 24;
this.height = 16;
this.aiStyle = 26;
this.penetrate = -1;
this.timeLeft *= 5;
this.minion = true;
this.minionSlots = 1f;
this.usesIDStaticNPCImmunity = true;
this.idStaticNPCHitCooldown = 12;
}
else if (this.type == 267)
{
this.alpha = (int) byte.MaxValue;
this.width = 14;
this.height = 14;
this.aiStyle = 1;
this.friendly = true;
this.ranged = true;
}
else if (this.type == 268)
{
this.netImportant = true;
this.width = 18;
this.height = 32;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 269)
{
this.netImportant = true;
this.width = 20;
this.height = 26;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 270)
{
this.width = 26;
this.height = 26;
this.aiStyle = 1;
this.alpha = (int) byte.MaxValue;
this.hostile = true;
this.penetrate = 3;
}
else if (this.type == 271)
{
this.width = 20;
this.height = 20;
this.aiStyle = 13;
this.friendly = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.melee = true;
this.scale = 1.2f;
}
else if (this.type == 272)
{
this.width = 32;
this.height = 32;
this.aiStyle = 3;
this.friendly = true;
this.scale = 0.9f;
this.penetrate = -1;
this.melee = true;
}
else if (this.type == 273)
{
this.width = 26;
this.height = 26;
this.aiStyle = 13;
this.friendly = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.melee = true;
}
else if (this.type == 274)
{
this.width = 42;
this.height = 42;
this.alpha = 100;
this.light = 0.5f;
this.aiStyle = 18;
this.friendly = true;
this.penetrate = 5;
this.tileCollide = false;
this.scale = 1.1f;
this.melee = true;
this.timeLeft = 180;
}
else if (this.type == 275)
{
this.alpha = (int) byte.MaxValue;
this.width = 14;
this.height = 14;
this.aiStyle = 1;
this.hostile = true;
}
else if (this.type == 276)
{
this.alpha = (int) byte.MaxValue;
this.width = 14;
this.height = 14;
this.aiStyle = 1;
this.hostile = true;
}
else if (this.type == 277)
{
this.alpha = (int) byte.MaxValue;
this.width = 38;
this.height = 38;
this.aiStyle = 14;
this.hostile = true;
}
else if (this.type == 278)
{
this.arrow = true;
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.friendly = true;
this.light = 1f;
this.ranged = true;
this.extraUpdates = 1;
this.timeLeft = 1200;
}
else if (this.type == 279)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.friendly = true;
this.penetrate = 1;
this.light = 0.5f;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 2;
this.scale = 1.25f;
this.timeLeft = 600;
this.ranged = true;
}
else if (this.type == 280)
{
this.width = 32;
this.height = 32;
this.aiStyle = 12;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.penetrate = 5;
this.extraUpdates = 2;
this.ignoreWater = true;
this.magic = true;
}
else if (this.type == 281)
{
this.width = 28;
this.height = 28;
this.aiStyle = 49;
this.friendly = true;
this.penetrate = 1;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 600;
}
else if (this.type == 282)
{
this.arrow = true;
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.friendly = true;
this.ranged = true;
this.extraUpdates = 1;
this.timeLeft = 1200;
}
else if (this.type == 283)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.friendly = true;
this.penetrate = 1;
this.light = 0.5f;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 2;
this.scale = 1.25f;
this.timeLeft = 600;
this.ranged = true;
}
else if (this.type == 284)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.friendly = true;
this.penetrate = 1;
this.light = 0.5f;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 2;
this.scale = 1.3f;
this.timeLeft = 600;
this.ranged = true;
}
else if (this.type == 285)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.friendly = true;
this.penetrate = 1;
this.light = 0.5f;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 2;
this.scale = 1.3f;
this.timeLeft = 600;
this.ranged = true;
}
else if (this.type == 286)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.friendly = true;
this.penetrate = 1;
this.light = 0.5f;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 2;
this.scale = 1.3f;
this.timeLeft = 600;
this.ranged = true;
}
else if (this.type == 287)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.friendly = true;
this.penetrate = 1;
this.light = 0.5f;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 2;
this.scale = 1.3f;
this.timeLeft = 600;
this.ranged = true;
}
else if (this.type == 288)
{
this.width = 32;
this.height = 32;
this.aiStyle = 12;
this.hostile = true;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.extraUpdates = 2;
this.ignoreWater = true;
this.magic = true;
}
else if (this.type == 289)
{
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.timeLeft = 2;
}
else if (this.type == 290)
{
this.width = 4;
this.height = 4;
this.aiStyle = 48;
this.hostile = true;
this.magic = true;
this.extraUpdates = 100;
this.timeLeft = 100;
this.penetrate = -1;
}
else if (this.type == 291)
{
this.width = 12;
this.height = 12;
this.aiStyle = 50;
this.hostile = true;
this.alpha = (int) byte.MaxValue;
this.magic = true;
this.tileCollide = false;
this.penetrate = -1;
}
else if (this.type == 292)
{
this.width = 130;
this.height = 130;
this.aiStyle = 50;
this.hostile = true;
this.alpha = (int) byte.MaxValue;
this.magic = true;
this.tileCollide = false;
this.penetrate = -1;
}
else if (this.type == 293)
{
this.width = 12;
this.height = 12;
this.aiStyle = 51;
this.hostile = true;
this.alpha = (int) byte.MaxValue;
this.magic = true;
this.tileCollide = false;
this.penetrate = -1;
this.extraUpdates = 1;
}
else if (this.type == 294)
{
this.width = 4;
this.height = 4;
this.aiStyle = 48;
this.friendly = true;
this.magic = true;
this.extraUpdates = 100;
this.timeLeft = 300;
this.penetrate = -1;
}
else if (this.type == 295)
{
this.width = 12;
this.height = 12;
this.aiStyle = 50;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.magic = true;
this.tileCollide = true;
}
else if (this.type == 296)
{
this.width = 150;
this.height = 150;
this.aiStyle = 50;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.magic = true;
this.tileCollide = false;
this.penetrate = -1;
}
else if (this.type == 297)
{
this.width = 12;
this.height = 12;
this.aiStyle = 51;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.magic = true;
this.extraUpdates = 1;
this.penetrate = 3;
}
else if (this.type == 298)
{
this.width = 6;
this.height = 6;
this.aiStyle = 52;
this.alpha = (int) byte.MaxValue;
this.magic = true;
this.tileCollide = false;
this.extraUpdates = 3;
}
else if (this.type == 299)
{
this.width = 6;
this.height = 6;
this.aiStyle = 1;
this.hostile = true;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.extraUpdates = 2;
this.magic = true;
this.ignoreWater = true;
this.tileCollide = false;
}
else if (this.type == 300)
{
this.width = 38;
this.height = 38;
this.aiStyle = 2;
this.hostile = true;
this.penetrate = -1;
this.ignoreWater = true;
this.tileCollide = false;
}
else if (this.type == 301)
{
this.width = 38;
this.height = 38;
this.aiStyle = 3;
this.friendly = true;
this.penetrate = -1;
this.melee = true;
this.extraUpdates = 2;
}
else if (this.type == 302)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.hostile = true;
this.penetrate = -1;
this.light = 0.3f;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 7;
this.scale = 1.18f;
this.timeLeft = 300;
this.ranged = true;
this.ignoreWater = true;
}
else if (this.type == 303)
{
this.width = 14;
this.height = 14;
this.aiStyle = 16;
this.hostile = true;
this.penetrate = -1;
this.ranged = true;
}
else if (this.type == 304)
{
this.alpha = (int) byte.MaxValue;
this.width = 30;
this.height = 30;
this.aiStyle = 2;
this.friendly = true;
this.penetrate = 1;
this.melee = true;
this.light = 0.2f;
this.ignoreWater = true;
this.extraUpdates = 0;
}
else if (this.type == 305)
{
this.width = 6;
this.height = 6;
this.aiStyle = 52;
this.alpha = (int) byte.MaxValue;
this.tileCollide = false;
this.extraUpdates = 10;
}
else if (this.type == 306)
{
this.alpha = (int) byte.MaxValue;
this.width = 14;
this.height = 14;
this.aiStyle = 2;
this.friendly = true;
this.penetrate = 1;
this.melee = true;
this.ignoreWater = true;
this.extraUpdates = 1;
}
else if (this.type == 307)
{
this.width = 16;
this.height = 16;
this.aiStyle = 36;
this.penetrate = 1;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 600;
this.melee = true;
this.extraUpdates = 3;
}
else if (this.type == 308)
{
this.width = 80;
this.height = 74;
this.aiStyle = 53;
this.timeLeft = 7200;
this.light = 0.25f;
this.ignoreWater = true;
this.coldDamage = true;
this.sentry = true;
}
else if (this.type == 309)
{
this.width = 14;
this.height = 14;
this.aiStyle = 28;
this.alpha = (int) byte.MaxValue;
this.penetrate = 1;
this.friendly = true;
this.extraUpdates = 3;
this.coldDamage = true;
}
else if (this.type == 310)
{
this.netImportant = true;
this.width = 6;
this.height = 6;
this.aiStyle = 33;
this.friendly = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 36000;
}
else if (this.type == 311)
{
this.width = 10;
this.height = 12;
this.aiStyle = 1;
this.friendly = true;
this.penetrate = 3;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 600;
this.ranged = true;
}
else if (this.type == 312)
{
this.alpha = (int) byte.MaxValue;
this.width = 32;
this.height = 32;
this.aiStyle = 1;
this.friendly = true;
this.ranged = true;
this.timeLeft = 300;
this.glowMask = (short) 257;
}
else if (this.type == 313)
{
this.netImportant = true;
this.width = 30;
this.height = 30;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 314)
{
this.netImportant = true;
this.width = 24;
this.height = 40;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 315)
{
this.netImportant = true;
this.width = 14;
this.height = 14;
this.aiStyle = 7;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.timeLeft *= 10;
}
else if (this.type == 316)
{
this.alpha = (int) byte.MaxValue;
this.width = 16;
this.height = 16;
this.aiStyle = 36;
this.friendly = true;
this.penetrate = 1;
this.timeLeft = 600;
this.magic = true;
}
else if (this.type == 317)
{
this.netImportant = true;
this.width = 28;
this.height = 28;
this.aiStyle = 54;
this.penetrate = 1;
this.timeLeft *= 5;
this.minion = true;
this.minionSlots = 1f;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 10;
}
else if (this.type == 318)
{
this.width = 12;
this.height = 14;
this.aiStyle = 2;
this.friendly = true;
this.ranged = true;
}
else if (this.type == 319)
{
this.netImportant = true;
this.width = 36;
this.height = 30;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 320)
{
this.width = 34;
this.height = 34;
this.aiStyle = 3;
this.friendly = true;
this.penetrate = -1;
this.melee = true;
}
else if (this.type == 321)
{
this.width = 30;
this.height = 30;
this.aiStyle = 55;
this.friendly = true;
this.melee = true;
this.tileCollide = false;
this.ignoreWater = true;
}
else if (this.type == 322)
{
this.netImportant = true;
this.width = 14;
this.height = 14;
this.aiStyle = 7;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.timeLeft *= 10;
}
else if (this.type == 323)
{
this.penetrate = 10;
this.extraUpdates = 3;
this.width = 14;
this.height = 14;
this.aiStyle = 1;
this.alpha = (int) byte.MaxValue;
this.friendly = true;
this.ranged = true;
this.scale = 0.8f;
}
else if (this.type == 324)
{
this.netImportant = true;
this.width = 26;
this.height = 38;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 325)
{
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.width = 14;
this.height = 14;
this.aiStyle = 1;
this.hostile = true;
this.tileCollide = false;
this.timeLeft = 420;
}
else if (this.type >= 326 && this.type <= 328)
{
if (this.type == 326)
{
this.width = 14;
this.height = 16;
}
else if (this.type == 327)
{
this.width = 12;
this.height = 14;
}
else
{
this.width = 6;
this.height = 12;
}
this.aiStyle = 14;
this.hostile = true;
this.penetrate = -1;
this.timeLeft = 360;
}
else if (this.type == 329)
{
this.width = 80;
this.height = 80;
this.light = 0.25f;
this.aiStyle = 56;
this.hostile = true;
this.penetrate = -1;
this.tileCollide = false;
this.timeLeft = 420;
}
else if (this.type == 330)
{
this.width = 22;
this.height = 22;
this.aiStyle = 2;
this.friendly = true;
this.penetrate = 6;
this.ranged = true;
}
else if (this.type == 331)
{
this.netImportant = true;
this.width = 18;
this.height = 18;
this.aiStyle = 7;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.timeLeft *= 10;
}
else if (this.type == 332)
{
this.netImportant = true;
this.width = 18;
this.height = 18;
this.aiStyle = 7;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.timeLeft *= 10;
this.light = 0.5f;
}
else if (this.type == 333)
{
this.width = 38;
this.height = 38;
this.aiStyle = 3;
this.friendly = true;
this.scale = 0.9f;
this.penetrate = -1;
this.melee = true;
}
else if (this.type == 334)
{
this.netImportant = true;
this.width = 28;
this.height = 28;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 335)
{
this.width = 22;
this.height = 22;
this.aiStyle = 30;
this.friendly = true;
this.penetrate = 1;
this.melee = true;
}
else if (this.type == 336)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.friendly = true;
this.magic = true;
this.scale = 0.8f;
this.extraUpdates = 1;
}
else if (this.type == 337)
{
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.friendly = true;
this.magic = true;
this.tileCollide = false;
this.coldDamage = true;
this.extraUpdates = 1;
}
else if (this.type == 338 || this.type == 339 || this.type == 340 || this.type == 341)
{
this.width = 14;
this.height = 14;
this.aiStyle = 16;
this.penetrate = -1;
this.friendly = true;
this.ranged = true;
this.scale = 0.9f;
}
else if (this.type == 342)
{
this.width = 22;
this.height = 2;
this.aiStyle = 19;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.scale = 1.1f;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
this.coldDamage = true;
}
else if (this.type == 343)
{
this.alpha = (int) byte.MaxValue;
this.width = 10;
this.height = 10;
this.aiStyle = 57;
this.friendly = true;
this.melee = true;
this.scale = 1.1f;
this.penetrate = 3;
this.coldDamage = true;
}
else if (this.type == 344)
{
this.width = 26;
this.height = 26;
this.aiStyle = 1;
this.friendly = true;
this.scale = 0.9f;
this.alpha = (int) byte.MaxValue;
this.melee = true;
this.coldDamage = true;
this.tileCollide = false;
this.noEnchantmentVisuals = true;
}
else if (this.type == 345)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.hostile = true;
this.scale = 0.8f;
}
else if (this.type == 346)
{
this.width = 18;
this.height = 18;
this.aiStyle = 14;
this.hostile = true;
this.penetrate = -1;
this.timeLeft = 300;
}
else if (this.type == 347)
{
this.width = 6;
this.height = 6;
this.aiStyle = 2;
this.hostile = true;
this.penetrate = -1;
}
else if (this.type == 348)
{
this.aiStyle = 1;
this.width = 48;
this.height = 48;
this.hostile = true;
this.penetrate = -1;
this.tileCollide = false;
this.coldDamage = true;
this.extraUpdates = 1;
this.timeLeft = 900;
}
else if (this.type == 349)
{
this.aiStyle = 1;
this.width = 12;
this.height = 12;
this.hostile = true;
this.penetrate = -1;
this.coldDamage = true;
this.timeLeft = 900;
}
else if (this.type == 350)
{
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.width = 14;
this.height = 14;
this.aiStyle = 1;
this.hostile = true;
this.tileCollide = false;
this.timeLeft /= 2;
}
else if (this.type == 351)
{
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.width = 24;
this.height = 24;
this.aiStyle = 58;
this.hostile = true;
this.tileCollide = false;
}
else if (this.type == 352)
{
this.width = 30;
this.height = 30;
this.aiStyle = 14;
this.hostile = true;
this.penetrate = -1;
this.timeLeft /= 3;
}
else if (this.type == 353)
{
this.netImportant = true;
this.width = 18;
this.height = 28;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 354)
{
this.knockBack = 6f;
this.width = 10;
this.height = 10;
this.aiStyle = 10;
this.friendly = true;
this.ranged = true;
this.penetrate = -1;
this.extraUpdates = 1;
}
else if (this.type == 355)
{
this.width = 12;
this.height = 12;
this.aiStyle = 1;
this.alpha = (int) byte.MaxValue;
this.friendly = true;
this.magic = true;
this.penetrate = 5;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 6;
this.timeLeft = 45;
}
else if (this.type == 356)
{
this.width = 6;
this.height = 6;
this.aiStyle = 59;
this.alpha = (int) byte.MaxValue;
this.magic = true;
this.tileCollide = false;
this.extraUpdates = 3;
}
else if (this.type == 357)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.friendly = true;
this.penetrate = 6;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 2;
this.scale = 1.2f;
this.timeLeft = 600;
this.ranged = true;
}
else if (this.type == 358)
{
this.width = 18;
this.height = 18;
this.aiStyle = 60;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.extraUpdates = 2;
this.ignoreWater = true;
}
else if (this.type == 359)
{
this.width = 14;
this.height = 14;
this.aiStyle = 28;
this.alpha = (int) byte.MaxValue;
this.magic = true;
this.penetrate = 2;
this.friendly = true;
this.coldDamage = true;
}
else if (this.type >= 360 && this.type <= 366 || this.type == 381 || this.type == 382 || this.type == 760 || this.type == 775)
{
this.width = 14;
this.height = 14;
this.aiStyle = 61;
this.penetrate = -1;
this.netImportant = true;
this.bobber = true;
}
else if (this.type == 367)
{
this.width = 18;
this.height = 18;
this.aiStyle = 19;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.scale = 1.1f;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
}
else if (this.type == 368)
{
this.width = 18;
this.height = 18;
this.aiStyle = 19;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
}
else if (this.type == 369)
{
this.width = 22;
this.height = 22;
this.aiStyle = 20;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
}
else if (this.type == 370)
{
this.width = 14;
this.height = 14;
this.aiStyle = 2;
this.friendly = true;
this.penetrate = 1;
}
else if (this.type == 371)
{
this.width = 14;
this.height = 14;
this.aiStyle = 2;
this.friendly = true;
this.penetrate = 1;
}
else if (this.type == 372)
{
this.netImportant = true;
this.width = 18;
this.height = 18;
this.aiStyle = 7;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.timeLeft *= 10;
}
else if (this.type == 373)
{
this.netImportant = true;
this.width = 24;
this.height = 26;
this.aiStyle = 62;
this.penetrate = -1;
this.timeLeft *= 5;
this.minion = true;
this.minionSlots = 1f;
this.tileCollide = false;
this.ignoreWater = true;
}
else if (this.type == 374)
{
this.width = 10;
this.height = 10;
this.aiStyle = 0;
this.friendly = true;
this.penetrate = 1;
this.aiStyle = 1;
this.tileCollide = true;
this.scale *= 0.9f;
}
else if (this.type == 375)
{
this.netImportant = true;
this.width = 34;
this.height = 26;
this.aiStyle = 62;
this.penetrate = -1;
this.timeLeft *= 5;
this.minion = true;
this.minionSlots = 1f;
this.tileCollide = false;
this.ignoreWater = true;
}
else if (this.type == 376)
{
this.width = 12;
this.height = 12;
this.aiStyle = 0;
this.friendly = true;
this.penetrate = -1;
this.aiStyle = 1;
this.tileCollide = true;
this.timeLeft = 100;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 1;
}
else if (this.type == 377)
{
this.width = 66;
this.height = 50;
this.aiStyle = 53;
this.timeLeft = 7200;
this.ignoreWater = true;
this.sentry = true;
}
else if (this.type == 378)
{
this.width = 16;
this.height = 16;
this.aiStyle = 14;
this.friendly = true;
this.penetrate = -1;
this.timeLeft = 60;
this.scale = 0.9f;
}
else if (this.type == 379)
{
this.width = 14;
this.height = 10;
this.aiStyle = 63;
this.friendly = true;
this.timeLeft = 300;
this.penetrate = 1;
}
else if (this.type == 380)
{
this.netImportant = true;
this.width = 26;
this.height = 26;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 383)
{
this.width = 34;
this.height = 34;
this.aiStyle = 3;
this.friendly = true;
this.penetrate = -1;
this.melee = true;
}
else if (this.type == 384)
{
this.width = 150;
this.height = 42;
this.hostile = true;
this.penetrate = -1;
this.aiStyle = 64;
this.tileCollide = false;
this.ignoreWater = true;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 540;
}
else if (this.type == 385)
{
this.width = 30;
this.height = 30;
this.hostile = true;
this.penetrate = -1;
this.aiStyle = 65;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 300;
}
else if (this.type == 386)
{
this.width = 150;
this.height = 42;
this.hostile = true;
this.penetrate = -1;
this.aiStyle = 64;
this.tileCollide = false;
this.ignoreWater = true;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 840;
}
else if (this.type == 387)
{
this.netImportant = true;
this.width = 40;
this.height = 20;
this.aiStyle = 66;
this.penetrate = -1;
this.timeLeft *= 5;
this.minion = true;
this.minionSlots = 0.5f;
this.tileCollide = false;
this.ignoreWater = true;
this.friendly = true;
this.usesIDStaticNPCImmunity = true;
this.idStaticNPCHitCooldown = 18;
}
else if (this.type == 388)
{
this.netImportant = true;
this.width = 40;
this.height = 20;
this.aiStyle = 66;
this.penetrate = -1;
this.timeLeft *= 5;
this.minion = true;
this.minionSlots = 0.5f;
this.tileCollide = false;
this.ignoreWater = true;
this.friendly = true;
this.usesIDStaticNPCImmunity = true;
this.idStaticNPCHitCooldown = 18;
}
else if (this.type == 389)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.friendly = true;
this.penetrate = 3;
this.light = 0.75f;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 2;
this.scale = 1.2f;
this.timeLeft = 600;
}
else if (this.type == 390 || this.type == 391 || this.type == 392)
{
this.width = 18;
this.height = 18;
this.aiStyle = 26;
this.penetrate = -1;
this.netImportant = true;
this.timeLeft *= 5;
this.minion = true;
this.minionSlots = 1f;
this.usesIDStaticNPCImmunity = true;
this.idStaticNPCHitCooldown = 15;
}
else if (this.type == 393 || this.type == 394 || this.type == 395)
{
this.width = 20;
this.height = 30;
this.aiStyle = 67;
this.penetrate = -1;
this.netImportant = true;
this.timeLeft *= 5;
this.minion = true;
this.minionSlots = 1f;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 18;
this.decidesManualFallThrough = true;
}
else if (this.type == 396)
{
this.netImportant = true;
this.width = 18;
this.height = 18;
this.aiStyle = 7;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.timeLeft *= 10;
this.alpha = 100;
}
else if (this.type == 397)
{
this.width = 14;
this.height = 14;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
this.ranged = true;
this.tileCollide = false;
}
else if (this.type == 398)
{
this.netImportant = true;
this.width = 18;
this.height = 38;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 399)
{
this.width = 14;
this.height = 14;
this.aiStyle = 68;
this.friendly = true;
this.penetrate = 1;
this.alpha = (int) byte.MaxValue;
this.ranged = true;
this.noEnchantments = true;
}
else if (this.type >= 400 && this.type <= 402)
{
if (this.type == 400)
{
this.width = 14;
this.height = 16;
}
else if (this.type == 401)
{
this.width = 12;
this.height = 14;
}
else
{
this.width = 6;
this.height = 12;
}
this.penetrate = 3;
this.aiStyle = 14;
this.friendly = true;
this.timeLeft = 360;
this.ranged = true;
this.noEnchantments = true;
}
else if (this.type == 403)
{
this.netImportant = true;
this.width = 18;
this.height = 18;
this.aiStyle = 7;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.timeLeft *= 10;
}
else if (this.type == 404)
{
this.width = 26;
this.height = 26;
this.aiStyle = 69;
this.friendly = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.melee = true;
}
else if (this.type == 405)
{
this.width = 14;
this.height = 14;
this.aiStyle = 70;
this.friendly = true;
this.penetrate = 1;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 90;
this.melee = true;
this.noEnchantments = true;
}
else if (this.type == 406)
{
this.width = 14;
this.height = 14;
this.aiStyle = 60;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.extraUpdates = 2;
this.ignoreWater = true;
}
else if (this.type == 407)
{
this.netImportant = true;
this.width = 28;
this.height = 40;
this.aiStyle = 62;
this.penetrate = -1;
this.timeLeft *= 5;
this.minion = true;
this.friendly = true;
this.minionSlots = 1f;
this.tileCollide = false;
this.ignoreWater = true;
}
else if (this.type == 408)
{
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.ignoreWater = true;
}
else if (this.type == 409)
{
this.width = 30;
this.height = 30;
this.penetrate = -1;
this.aiStyle = 71;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 360;
this.friendly = true;
this.tileCollide = true;
this.extraUpdates = 2;
this.magic = true;
this.ignoreWater = true;
}
else if (this.type == 410)
{
this.width = 14;
this.height = 14;
this.aiStyle = 72;
this.friendly = true;
this.penetrate = 1;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 50;
this.magic = true;
this.ignoreWater = true;
}
else if (this.type >= 411 && this.type <= 414)
{
switch (this.type)
{
default:
this.width = 10;
this.height = 10;
this.aiStyle = 10;
break;
}
}
else if (this.type == 415 || this.type == 416 || this.type == 417 || this.type == 418)
{
this.width = 14;
this.height = 14;
this.aiStyle = 34;
this.friendly = true;
this.ranged = true;
this.timeLeft = 45;
}
else if (this.type >= 419 && this.type <= 422)
{
this.width = 4;
this.height = 4;
this.aiStyle = 73;
this.friendly = true;
this.usesIDStaticNPCImmunity = true;
this.idStaticNPCHitCooldown = 3;
}
else if (this.type == 423)
{
this.netImportant = true;
this.width = 28;
this.height = 28;
this.aiStyle = 62;
this.penetrate = -1;
this.timeLeft *= 5;
this.minion = true;
this.friendly = true;
this.minionSlots = 1f;
this.ignoreWater = true;
}
else if (this.type >= 424 && this.type <= 426)
{
this.width = 24;
this.height = 24;
this.aiStyle = 1;
this.friendly = true;
this.magic = true;
this.tileCollide = false;
this.extraUpdates = 2;
}
else if (this.type == 427)
{
this.width = 22;
this.height = 56;
this.aiStyle = 20;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
this.glowMask = (short) 2;
}
else if (this.type == 428)
{
this.width = 26;
this.height = 54;
this.aiStyle = 20;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
this.glowMask = (short) 3;
}
else if (this.type == 429)
{
this.width = 18;
this.height = 56;
this.aiStyle = 20;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
this.glowMask = (short) 7;
}
else if (this.type == 430)
{
this.width = 30;
this.height = 54;
this.aiStyle = 20;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
this.glowMask = (short) 8;
}
else if (this.type == 431)
{
this.width = 28;
this.height = 64;
this.aiStyle = 20;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
}
else if (this.type == 432)
{
this.width = 30;
this.height = 54;
this.aiStyle = 20;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
}
else if (this.type == 610)
{
this.width = 28;
this.height = 64;
this.aiStyle = 20;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
this.glowMask = (short) 179;
}
else if (this.type == 609)
{
this.width = 30;
this.height = 54;
this.aiStyle = 20;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
this.glowMask = (short) 180;
}
else if (this.type == 433)
{
this.width = 8;
this.height = 8;
this.aiStyle = 48;
this.friendly = true;
this.extraUpdates = 100;
this.timeLeft = 100;
this.ignoreWater = true;
}
else if (this.type == 434)
{
this.width = 1;
this.height = 1;
this.aiStyle = 74;
this.friendly = true;
this.extraUpdates = 100;
this.penetrate = -1;
}
else if (this.type == 435)
{
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.hostile = true;
this.ignoreWater = true;
}
else if (this.type == 436)
{
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.hostile = true;
this.ignoreWater = true;
}
else if (this.type == 437)
{
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.hostile = true;
this.extraUpdates = 2;
this.ignoreWater = true;
}
else if (this.type == 438)
{
this.width = 8;
this.height = 8;
this.aiStyle = 1;
this.hostile = true;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 3;
this.ignoreWater = true;
}
else if (this.type == 439)
{
this.width = 22;
this.height = 22;
this.aiStyle = 75;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.magic = true;
this.ignoreWater = true;
}
else if (this.type == 440)
{
this.width = 5;
this.height = 5;
this.aiStyle = 1;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 2;
this.scale = 1f;
this.timeLeft = 600;
this.magic = true;
this.ignoreWater = true;
}
else if (this.type == 441)
{
this.width = 1;
this.height = 1;
this.aiStyle = 76;
this.ignoreWater = true;
this.tileCollide = false;
}
else if (this.type == 442)
{
this.width = 14;
this.height = 14;
this.aiStyle = 1;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.scale = 1f;
this.timeLeft = 600;
this.ranged = true;
}
else if (this.type == 443)
{
this.width = 80;
this.height = 80;
this.aiStyle = 77;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.scale = 1f;
this.ranged = true;
this.ignoreWater = true;
this.tileCollide = false;
this.penetrate = -1;
}
else if (this.type == 444)
{
this.width = 10;
this.height = 10;
this.aiStyle = 78;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.scale = 1f;
this.ranged = true;
this.ignoreWater = true;
this.extraUpdates = 1;
}
else if (this.type == 445)
{
this.width = 10;
this.height = 10;
this.aiStyle = 75;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.melee = true;
this.ignoreWater = true;
this.ownerHitCheck = true;
}
else if (this.type == 446)
{
this.netImportant = true;
this.width = 14;
this.height = 14;
this.aiStyle = 7;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.timeLeft *= 10;
this.light = 0.7f;
}
else if (this.type == 447)
{
this.width = 30;
this.height = 30;
this.aiStyle = 79;
this.hostile = true;
this.penetrate = -1;
this.tileCollide = false;
this.ignoreWater = true;
this.timeLeft = 240;
}
else if (this.type == 448)
{
this.width = 14;
this.height = 14;
this.aiStyle = 80;
this.hostile = true;
this.penetrate = -1;
this.tileCollide = false;
}
else if (this.type == 449)
{
this.width = 5;
this.height = 5;
this.aiStyle = 1;
this.hostile = true;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 1;
this.scale = 1f;
this.timeLeft = 600;
this.ignoreWater = true;
}
else if (this.type == 450)
{
this.width = 14;
this.height = 14;
this.aiStyle = 14;
this.hostile = true;
this.penetrate = -1;
this.timeLeft = 360;
}
else if (this.type == 451)
{
this.width = 16;
this.height = 16;
this.aiStyle = 81;
this.melee = true;
this.penetrate = 3;
this.light = 0.2f;
this.alpha = (int) byte.MaxValue;
this.friendly = true;
}
else if (this.type == 452)
{
this.width = 14;
this.height = 14;
this.aiStyle = 82;
this.hostile = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 600;
}
else if (this.type == 453)
{
this.width = 1;
this.height = 1;
this.aiStyle = 76;
this.ignoreWater = true;
this.tileCollide = false;
}
else if (this.type == 454)
{
this.width = 46;
this.height = 46;
this.aiStyle = 83;
this.hostile = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 600;
this.tileCollide = false;
}
else if (this.type == 455)
{
this.width = 36;
this.height = 36;
this.aiStyle = 84;
this.hostile = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 600;
this.tileCollide = false;
}
else if (this.type == 456)
{
this.width = 16;
this.height = 16;
this.aiStyle = 85;
this.hostile = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 600;
this.tileCollide = false;
}
else if (this.type == 459)
{
this.width = 22;
this.height = 22;
this.aiStyle = 1;
this.friendly = true;
this.magic = true;
this.alpha = (int) byte.MaxValue;
this.scale = 1f;
this.ignoreWater = true;
this.extraUpdates = 1;
}
else if (this.type == 460)
{
this.width = 14;
this.height = 18;
this.aiStyle = 75;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.magic = true;
this.ignoreWater = true;
}
else if (this.type == 461)
{
this.width = 18;
this.height = 18;
this.aiStyle = 84;
this.friendly = true;
this.magic = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.tileCollide = false;
this.hide = true;
}
else if (this.type == 462)
{
this.width = 8;
this.height = 8;
this.aiStyle = 1;
this.hostile = true;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 3;
this.ignoreWater = true;
this.tileCollide = false;
}
else if (this.type == 463)
{
this.width = 48;
this.height = 48;
this.aiStyle = 6;
this.friendly = true;
this.tileCollide = false;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.ignoreWater = true;
}
else if (this.type == 464)
{
this.width = 60;
this.height = 60;
this.aiStyle = 86;
this.hostile = true;
this.tileCollide = false;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.ignoreWater = true;
}
else if (this.type == 467)
{
this.width = 40;
this.height = 40;
this.aiStyle = 1;
this.hostile = true;
this.alpha = (int) byte.MaxValue;
this.ignoreWater = true;
this.extraUpdates = 1;
}
else if (this.type == 468)
{
this.width = 40;
this.height = 40;
this.aiStyle = 1;
this.hostile = true;
this.alpha = (int) byte.MaxValue;
this.ignoreWater = true;
this.extraUpdates = 1;
}
else if (this.type == 465)
{
this.width = 80;
this.height = 80;
this.aiStyle = 88;
this.hostile = true;
this.alpha = (int) byte.MaxValue;
this.ignoreWater = true;
this.tileCollide = false;
}
else if (this.type == 466)
{
this.width = 14;
this.height = 14;
this.aiStyle = 88;
this.hostile = true;
this.alpha = (int) byte.MaxValue;
this.ignoreWater = true;
this.tileCollide = true;
this.extraUpdates = 4;
this.timeLeft = 120 * (this.extraUpdates + 1);
}
else if (this.type == 491)
{
this.width = 26;
this.height = 26;
this.aiStyle = 9;
this.friendly = true;
this.melee = true;
this.penetrate = -1;
}
else if (this.type == 500)
{
this.width = 20;
this.height = 20;
this.aiStyle = 67;
this.penetrate = -1;
this.netImportant = true;
this.timeLeft *= 5;
this.friendly = true;
this.ignoreWater = true;
this.scale = 0.8f;
}
else if (this.type == 499)
{
this.netImportant = true;
this.width = 34;
this.height = 34;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 469)
{
this.alpha = (int) byte.MaxValue;
this.arrow = true;
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.friendly = true;
this.ranged = true;
this.timeLeft = 1200;
}
else if (this.type == 470)
{
this.width = 10;
this.height = 10;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
}
else if (this.type == 471)
{
this.width = 16;
this.height = 16;
this.aiStyle = 2;
this.scale = 1.2f;
this.hostile = true;
this.ranged = true;
}
else if (this.type == 472)
{
this.width = 8;
this.height = 8;
this.aiStyle = 0;
this.hostile = true;
this.penetrate = -1;
this.aiStyle = 1;
this.tileCollide = true;
this.timeLeft = 50;
}
else if (this.type == 474)
{
this.arrow = true;
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.friendly = true;
this.ranged = true;
this.timeLeft = 1200;
this.penetrate = 2;
}
else if (this.type == 473)
{
this.netImportant = true;
this.width = 8;
this.height = 8;
this.aiStyle = 14;
this.penetrate = -1;
this.alpha = 75;
this.light = 1f;
this.timeLeft *= 2;
}
else if (this.type == 475)
{
this.width = 14;
this.height = 14;
this.aiStyle = 35;
this.penetrate = -1;
this.tileCollide = false;
this.timeLeft = 400;
}
else if (this.type == 476)
{
this.width = 200;
this.height = 200;
this.aiStyle = -1;
this.friendly = true;
this.tileCollide = false;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.ignoreWater = true;
this.timeLeft = 3;
this.magic = true;
}
else if (this.type == 477)
{
this.alpha = (int) byte.MaxValue;
this.width = 14;
this.height = 14;
this.aiStyle = 1;
this.friendly = true;
this.penetrate = 7;
this.extraUpdates = 1;
this.ranged = true;
}
else if (this.type == 478)
{
this.alpha = (int) byte.MaxValue;
this.width = 14;
this.height = 14;
this.aiStyle = 1;
this.friendly = true;
this.timeLeft = 300;
this.ranged = true;
}
else if (this.type == 479)
{
this.alpha = (int) byte.MaxValue;
this.width = 14;
this.height = 14;
this.aiStyle = 1;
this.friendly = true;
this.ranged = true;
}
else if (this.type == 480)
{
this.alpha = (int) byte.MaxValue;
this.width = 12;
this.height = 12;
this.penetrate = 3;
this.aiStyle = 14;
this.friendly = true;
this.timeLeft = 120;
this.ranged = true;
this.noEnchantments = true;
}
else if (this.type == 481)
{
this.width = 22;
this.height = 22;
this.aiStyle = 13;
this.friendly = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.melee = true;
this.extraUpdates = 0;
}
else if (this.type == 482)
{
this.width = 16;
this.height = 200;
this.aiStyle = 87;
this.friendly = true;
this.tileCollide = false;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.ignoreWater = true;
this.timeLeft = 2700;
this.magic = true;
}
else if (this.type == 483)
{
this.width = 14;
this.height = 14;
this.aiStyle = 14;
this.friendly = true;
this.melee = true;
}
else if (this.type == 484)
{
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.friendly = true;
this.melee = true;
this.extraUpdates = 1;
}
else if (this.type == 485)
{
this.arrow = true;
this.width = 24;
this.height = 24;
this.aiStyle = 1;
this.friendly = true;
this.ranged = true;
this.penetrate = -1;
this.timeLeft = 1200;
}
else if (this.type >= 486 && this.type <= 489)
{
if (this.type == 486)
{
this.width = 12;
this.height = 12;
}
else if (this.type == 487)
{
this.width = 22;
this.height = 22;
}
else if (this.type == 488)
{
this.width = 12;
this.height = 12;
this.light = 0.3f;
}
else if (this.type == 489)
{
this.width = 20;
this.height = 16;
}
this.netImportant = true;
this.aiStyle = 7;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.timeLeft *= 10;
}
else if (this.type == 492)
{
this.netImportant = true;
this.width = 18;
this.height = 32;
this.aiStyle = 90;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 490)
{
this.width = 14;
this.height = 14;
this.aiStyle = 89;
this.hostile = true;
this.alpha = (int) byte.MaxValue;
this.ignoreWater = true;
this.tileCollide = false;
this.timeLeft = 600;
this.netImportant = true;
}
else if (this.type == 493 || this.type == 494)
{
this.width = 32;
this.height = 32;
this.aiStyle = 4;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.alpha = (int) byte.MaxValue;
this.ignoreWater = true;
this.magic = true;
this.light = 0.2f;
}
else if (this.type == 495)
{
this.arrow = true;
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.friendly = true;
this.ranged = true;
this.penetrate = 3;
this.timeLeft = 1200;
}
else if (this.type == 496)
{
this.alpha = (int) byte.MaxValue;
this.width = 40;
this.height = 40;
this.aiStyle = 91;
this.friendly = true;
this.magic = true;
this.MaxUpdates = 3;
this.penetrate = 3;
}
else if (this.type == 497)
{
this.width = 30;
this.height = 30;
this.aiStyle = 2;
this.friendly = true;
this.penetrate = 3;
this.melee = true;
}
else if (this.type == 498)
{
this.width = 6;
this.height = 6;
this.aiStyle = 1;
this.hostile = true;
this.penetrate = -1;
this.timeLeft = 180;
}
else if (this.type == 501)
{
this.width = 14;
this.height = 14;
this.aiStyle = 2;
this.scale = 1.1f;
this.hostile = true;
this.ranged = true;
}
else if (this.type == 502)
{
this.width = 16;
this.height = 16;
this.aiStyle = 8;
this.friendly = true;
this.melee = true;
this.penetrate = 5;
}
else if (this.type == 503)
{
this.width = 24;
this.height = 24;
this.aiStyle = 5;
this.friendly = true;
this.penetrate = 2;
this.alpha = (int) byte.MaxValue;
this.tileCollide = false;
this.melee = true;
this.extraUpdates = 1;
}
else if (this.type == 504)
{
this.width = 10;
this.height = 10;
this.aiStyle = 2;
this.friendly = true;
this.melee = true;
this.alpha = (int) byte.MaxValue;
this.penetrate = 2;
this.noEnchantmentVisuals = true;
}
else if (this.type == 507)
{
this.width = 16;
this.height = 16;
this.aiStyle = 1;
this.friendly = true;
this.ranged = true;
this.penetrate = 3;
}
else if (this.type == 508)
{
this.width = 16;
this.height = 16;
this.aiStyle = 1;
this.hostile = true;
this.penetrate = -1;
}
else if (this.type == 509)
{
this.width = 22;
this.height = 22;
this.aiStyle = 20;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
this.scale = 1.2f;
}
else if (this.type == 510)
{
this.width = 18;
this.height = 18;
this.aiStyle = 2;
this.friendly = true;
this.penetrate = 1;
this.magic = true;
}
else if (this.type == 511)
{
this.width = 32;
this.height = 32;
this.aiStyle = 92;
this.friendly = true;
this.penetrate = -1;
this.scale = 1.1f;
this.magic = true;
}
else if (this.type == 512)
{
this.width = 40;
this.height = 38;
this.aiStyle = 92;
this.friendly = true;
this.penetrate = -1;
this.scale = 1.1f;
this.magic = true;
}
else if (this.type == 513)
{
this.width = 30;
this.height = 28;
this.aiStyle = 92;
this.friendly = true;
this.penetrate = -1;
this.scale = 1.1f;
this.magic = true;
}
else if (this.type == 514)
{
this.width = 10;
this.height = 10;
this.aiStyle = 93;
this.friendly = true;
this.penetrate = 3;
this.alpha = (int) byte.MaxValue;
this.ranged = true;
}
else if (this.type == 515)
{
this.netImportant = true;
this.width = 6;
this.height = 6;
this.aiStyle = 14;
this.penetrate = -1;
this.alpha = 75;
this.light = 1f;
this.timeLeft *= 5;
}
else if (this.type == 516)
{
this.width = 22;
this.height = 22;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
}
else if (this.type == 517)
{
this.width = 14;
this.height = 14;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
this.ranged = true;
}
else if (this.type == 518)
{
this.width = 32;
this.height = 32;
this.aiStyle = 94;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.tileCollide = false;
this.ignoreWater = true;
}
else if (this.type == 519)
{
this.width = 24;
this.height = 24;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
}
else if (this.type == 520)
{
this.width = 22;
this.height = 22;
this.aiStyle = 2;
this.friendly = true;
this.penetrate = 3;
this.ranged = true;
this.coldDamage = true;
}
else if (this.type == 521)
{
this.width = 14;
this.height = 14;
this.aiStyle = 29;
this.alpha = (int) byte.MaxValue;
this.magic = true;
this.penetrate = 1;
this.friendly = true;
}
else if (this.type == 522)
{
this.width = 8;
this.height = 8;
this.aiStyle = 29;
this.alpha = (int) byte.MaxValue;
this.magic = true;
this.penetrate = 1;
this.friendly = true;
}
else if (this.type == 523)
{
this.width = 32;
this.height = 32;
this.aiStyle = 95;
this.alpha = (int) byte.MaxValue;
this.ranged = true;
this.penetrate = 1;
this.friendly = true;
}
else if (this.type == 524)
{
this.width = 10;
this.height = 10;
this.aiStyle = 96;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.ignoreWater = true;
this.melee = true;
this.extraUpdates = 5;
}
else if (this.type == 525)
{
this.width = 30;
this.height = 24;
this.aiStyle = 97;
this.tileCollide = false;
this.timeLeft = 10800;
this.hide = true;
}
else if (this.type == 526)
{
this.width = 8;
this.height = 8;
this.aiStyle = 98;
this.tileCollide = false;
this.timeLeft = 120;
this.alpha = (int) byte.MaxValue;
}
else if (this.type >= 527 && this.type <= 531)
{
this.knockBack = 12f;
this.width = 24;
this.height = 24;
this.aiStyle = 17;
this.penetrate = -1;
}
else if (this.type == 532)
{
this.width = 16;
this.height = 16;
this.aiStyle = 1;
this.scale = 1f;
this.friendly = true;
this.ranged = true;
this.penetrate = 3;
this.extraUpdates = 1;
}
else if (this.type == 533)
{
this.netImportant = true;
this.width = 20;
this.height = 20;
this.aiStyle = 66;
this.penetrate = -1;
this.timeLeft *= 5;
this.minion = true;
this.minionSlots = 1f;
this.tileCollide = false;
this.ignoreWater = true;
this.friendly = true;
this.usesIDStaticNPCImmunity = true;
this.idStaticNPCHitCooldown = 10;
}
else if (this.type == 534)
{
this.extraUpdates = 0;
this.width = 16;
this.height = 16;
this.aiStyle = 99;
this.friendly = true;
this.penetrate = -1;
this.melee = true;
this.scale = 1f;
}
else if (this.type >= 541 && this.type <= 555)
{
this.extraUpdates = 0;
this.width = 16;
this.height = 16;
this.aiStyle = 99;
this.friendly = true;
this.penetrate = -1;
this.melee = true;
this.scale = 1f;
if (this.type == 547)
this.scale = 1.1f;
if (this.type == 554)
this.scale = 1.2f;
if (this.type == 555)
this.scale = 1.15f;
if (this.type == 551 || this.type == 550)
this.scale = 1.1f;
}
else if (this.type >= 562 && this.type <= 564)
{
this.extraUpdates = 0;
this.width = 16;
this.height = 16;
this.aiStyle = 99;
this.friendly = true;
this.penetrate = -1;
this.melee = true;
this.scale = 1f;
if (this.type == 563)
this.scale = 1.05f;
if (this.type == 564)
this.scale = 1.075f;
}
else if (this.type == 603)
{
this.extraUpdates = 0;
this.width = 16;
this.height = 16;
this.aiStyle = 99;
this.friendly = true;
this.penetrate = -1;
this.melee = true;
this.scale = 1.15f;
}
else if (this.type == 604)
{
this.extraUpdates = 0;
this.width = 14;
this.height = 14;
this.aiStyle = 115;
this.friendly = true;
this.penetrate = -1;
this.melee = true;
this.scale = 1.2f;
}
else if (this.type >= 556 && this.type <= 561)
{
this.extraUpdates = 0;
this.width = 10;
this.height = 10;
this.aiStyle = 99;
this.friendly = true;
this.penetrate = -1;
this.melee = true;
this.scale = 1f;
this.counterweight = true;
}
else if (this.type == 535)
{
this.width = 18;
this.height = 18;
this.aiStyle = 100;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.magic = true;
this.ignoreWater = true;
}
else if (this.type == 536)
{
this.width = 10;
this.height = 10;
this.aiStyle = 101;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.magic = true;
this.ignoreWater = true;
}
else if (this.type == 537)
{
this.width = 22;
this.height = 22;
this.aiStyle = 84;
this.hostile = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 240;
this.tileCollide = false;
}
else if (this.type == 538)
{
this.width = 12;
this.height = 12;
this.aiStyle = 14;
this.hostile = true;
this.penetrate = -1;
this.timeLeft = 120;
this.extraUpdates = 1;
this.alpha = (int) byte.MaxValue;
}
else if (this.type == 539)
{
this.width = 18;
this.height = 30;
this.aiStyle = 102;
this.hostile = true;
this.penetrate = -1;
this.timeLeft = 600;
}
else if (this.type == 540)
{
this.width = 20;
this.height = 20;
this.aiStyle = 103;
this.hostile = true;
this.penetrate = -1;
this.timeLeft = 300;
this.alpha = (int) byte.MaxValue;
}
else if (this.type == 565)
{
this.width = 28;
this.height = 28;
this.aiStyle = 104;
this.penetrate = -1;
this.tileCollide = false;
this.ignoreWater = true;
this.alpha = (int) byte.MaxValue;
this.scale = 0.8f;
}
else if (this.type == 566)
{
this.width = 16;
this.height = 16;
this.aiStyle = 36;
this.friendly = true;
this.penetrate = 4;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 660;
this.extraUpdates = 3;
}
else if (this.type == 567 || this.type == 568)
{
if (this.type == 567)
{
this.width = 14;
this.height = 14;
}
else
{
this.width = 16;
this.height = 16;
}
this.aiStyle = 105;
this.friendly = true;
this.penetrate = 1;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 3600;
this.tileCollide = false;
this.ignoreWater = true;
}
else if (this.type >= 569 && this.type <= 571)
{
this.width = 32;
this.height = 32;
this.aiStyle = 106;
this.friendly = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 3600;
this.tileCollide = false;
this.ignoreWater = true;
}
else if (this.type == 575)
{
this.width = 24;
this.height = 24;
this.aiStyle = 107;
this.hostile = true;
this.penetrate = -1;
this.tileCollide = false;
this.timeLeft = 420;
this.alpha = (int) byte.MaxValue;
}
else if (this.type == 573)
{
this.width = 18;
this.height = 30;
this.aiStyle = 102;
this.hostile = true;
this.penetrate = -1;
this.timeLeft = 600;
}
else if (this.type == 574)
{
this.width = 18;
this.height = 18;
this.aiStyle = 102;
this.hostile = true;
this.timeLeft = 600;
this.tileCollide = false;
}
else if (this.type == 572)
{
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.friendly = false;
this.hostile = true;
}
else if (this.type == 576)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.hostile = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 2;
this.scale = 1.2f;
this.timeLeft = 600;
}
else if (this.type == 577)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.hostile = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 2;
this.scale = 1.2f;
this.timeLeft = 600;
}
else if (this.type == 578 || this.type == 579 || this.type == 813)
{
this.width = 32;
this.height = 32;
this.aiStyle = 108;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.tileCollide = false;
this.ignoreWater = true;
this.hostile = true;
this.hide = true;
}
else if (this.type == 580)
{
this.width = 14;
this.height = 14;
this.aiStyle = 88;
this.hostile = true;
this.alpha = (int) byte.MaxValue;
this.ignoreWater = true;
this.tileCollide = true;
this.extraUpdates = 4;
this.timeLeft = 600;
}
else if (this.type == 581)
{
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.friendly = false;
this.hostile = true;
}
else if (this.type == 582)
{
this.width = 20;
this.height = 20;
this.aiStyle = 109;
this.friendly = true;
this.penetrate = -1;
this.MaxUpdates = 2;
}
else if (this.type == 583)
{
this.width = 10;
this.height = 10;
this.aiStyle = 2;
this.friendly = true;
this.scale = 0.8f;
}
else if (this.type == 589)
{
this.width = 10;
this.height = 10;
this.aiStyle = 2;
this.friendly = true;
}
else if (this.type == 584)
{
this.width = 10;
this.height = 10;
this.aiStyle = 110;
this.friendly = true;
this.scale = 0.8f;
this.penetrate = 3;
}
else if (this.type == 585)
{
this.width = 26;
this.height = 26;
this.aiStyle = 1;
this.alpha = (int) byte.MaxValue;
this.friendly = true;
this.penetrate = 3;
}
else if (this.type == 586)
{
this.width = 26;
this.height = 26;
this.aiStyle = 111;
this.alpha = (int) byte.MaxValue;
this.friendly = true;
this.penetrate = -1;
}
else if (this.type == 587)
{
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.alpha = (int) byte.MaxValue;
this.friendly = true;
this.ranged = true;
}
else if (this.type == 588)
{
this.width = 14;
this.height = 14;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
this.ranged = true;
}
else if (this.type == 590)
{
this.width = 14;
this.height = 14;
this.aiStyle = 112;
this.friendly = true;
this.penetrate = 1;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 900;
this.tileCollide = false;
this.ignoreWater = true;
}
else if (this.type == 591)
{
this.width = 8;
this.height = 8;
this.aiStyle = 101;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ignoreWater = true;
}
else if (this.type == 592)
{
this.width = 8;
this.height = 8;
this.aiStyle = 1;
this.hostile = true;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 3;
this.ignoreWater = true;
}
else if (this.type == 593)
{
this.width = 16;
this.height = 16;
this.aiStyle = 1;
this.hostile = true;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 1;
this.ignoreWater = true;
}
else if (this.type == 594)
{
this.width = 40;
this.height = 40;
this.aiStyle = 1;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 2;
}
else if (this.type == 595)
{
this.width = 68;
this.height = 64;
this.aiStyle = 75;
this.friendly = true;
this.tileCollide = false;
this.melee = true;
this.penetrate = -1;
this.ownerHitCheck = true;
}
else if (this.type == 596)
{
this.width = 8;
this.height = 8;
this.aiStyle = 107;
this.hostile = true;
this.alpha = (int) byte.MaxValue;
this.ignoreWater = true;
this.timeLeft = 180;
this.tileCollide = false;
}
else if (this.type == 597)
{
this.width = 10;
this.height = 10;
this.aiStyle = 29;
this.alpha = (int) byte.MaxValue;
this.magic = true;
this.penetrate = 2;
this.friendly = true;
}
else if (this.type == 598)
{
this.width = 16;
this.height = 16;
this.aiStyle = 113;
this.friendly = true;
this.ranged = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.hide = true;
}
else if (this.type == 599)
{
this.width = 22;
this.height = 22;
this.aiStyle = 2;
this.friendly = true;
this.penetrate = 6;
this.ranged = true;
}
else if (this.type == 600)
{
this.width = 14;
this.height = 14;
this.aiStyle = 75;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ignoreWater = true;
}
else if (this.type == 601)
{
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.alpha = (int) byte.MaxValue;
this.friendly = true;
this.extraUpdates = 30;
}
else if (this.type == 602)
{
this.width = 10;
this.height = 10;
this.aiStyle = 114;
this.alpha = (int) byte.MaxValue;
this.friendly = true;
this.tileCollide = false;
this.netImportant = true;
}
else if (this.type == 605)
{
this.alpha = (int) byte.MaxValue;
this.width = 6;
this.height = 6;
this.aiStyle = 1;
this.hostile = true;
this.penetrate = -1;
}
else if (this.type == 606)
{
this.width = 5;
this.height = 5;
this.aiStyle = 1;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 2;
this.scale = 1f;
this.timeLeft = 600;
this.ignoreWater = true;
}
else if (this.type == 607)
{
this.width = 10;
this.height = 10;
this.aiStyle = 116;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 600;
this.ignoreWater = true;
this.tileCollide = false;
this.penetrate = -1;
}
else if (this.type == 608)
{
this.width = 160;
this.height = 160;
this.aiStyle = 117;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 3;
this.ignoreWater = true;
this.tileCollide = false;
this.penetrate = -1;
this.hide = true;
}
else if (this.type == 611)
{
this.width = 16;
this.height = 16;
this.aiStyle = 75;
this.friendly = true;
this.melee = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.hide = true;
this.tileCollide = false;
this.ignoreWater = true;
this.usesLocalNPCImmunity = true;
this.noEnchantmentVisuals = true;
}
else if (this.type == 612)
{
this.width = 8;
this.height = 8;
this.aiStyle = 117;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.ignoreWater = true;
this.timeLeft = 60;
this.tileCollide = false;
this.penetrate = -1;
this.usesLocalNPCImmunity = true;
}
else if (this.type == 613)
{
this.netImportant = true;
this.width = 24;
this.height = 24;
this.aiStyle = 62;
this.penetrate = -1;
this.timeLeft *= 5;
this.minion = true;
this.friendly = true;
this.minionSlots = 1f;
this.ignoreWater = true;
}
else if (this.type == 614)
{
this.width = 16;
this.height = 16;
this.aiStyle = 113;
this.friendly = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
}
else if (this.type == 615)
{
this.width = 22;
this.height = 22;
this.aiStyle = 75;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ranged = true;
this.ignoreWater = true;
}
else if (this.type == 616)
{
this.width = 14;
this.height = 14;
this.aiStyle = 1;
this.friendly = true;
this.penetrate = 1;
this.alpha = (int) byte.MaxValue;
this.ranged = true;
this.extraUpdates = 2;
this.timeLeft = 90 * this.MaxUpdates;
}
else if (this.type == 617)
{
this.width = 32;
this.height = 32;
this.aiStyle = 118;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.ignoreWater = true;
this.hide = true;
this.magic = true;
this.penetrate = 3;
this.usesLocalNPCImmunity = true;
}
else if (this.type == 618)
{
this.tileCollide = false;
this.width = 18;
this.height = 30;
this.aiStyle = 119;
this.penetrate = -1;
this.timeLeft = 420;
this.magic = true;
this.friendly = true;
this.usesLocalNPCImmunity = true;
}
else if (this.type == 619)
{
this.width = 14;
this.height = 14;
this.aiStyle = 29;
this.alpha = (int) byte.MaxValue;
this.magic = true;
this.penetrate = 1;
this.friendly = true;
}
else if (this.type == 620)
{
this.width = 8;
this.height = 8;
this.aiStyle = 29;
this.alpha = (int) byte.MaxValue;
this.magic = true;
this.penetrate = 1;
this.friendly = true;
}
else if (this.type == 622)
{
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 2;
}
else if (this.type == 623)
{
this.netImportant = true;
this.width = 50;
this.height = 80;
this.aiStyle = 120;
this.penetrate = -1;
this.timeLeft *= 5;
this.minion = true;
this.friendly = true;
this.minionSlots = 0.0f;
this.ignoreWater = true;
this.tileCollide = false;
this.netImportant = true;
this.manualDirectionChange = true;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 5;
}
else if (this.type == 624)
{
this.width = 8;
this.height = 8;
this.aiStyle = 117;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.ignoreWater = true;
this.timeLeft = 60;
this.tileCollide = false;
this.penetrate = -1;
}
else if (this.type >= 625 && this.type <= 628)
{
if (this.type == 625 || this.type == 628)
this.netImportant = true;
if (this.type == 626 || this.type == 627)
this.minionSlots = 0.5f;
this.width = 24;
this.height = 24;
this.aiStyle = 121;
this.penetrate = -1;
this.timeLeft *= 5;
this.minion = true;
this.friendly = true;
this.ignoreWater = true;
this.tileCollide = false;
this.alpha = (int) byte.MaxValue;
this.hide = true;
this.netImportant = true;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 7;
}
else if (this.type == 629)
{
this.width = 8;
this.height = 8;
this.aiStyle = 122;
this.hostile = true;
this.alpha = (int) byte.MaxValue;
this.ignoreWater = true;
this.timeLeft = 3600;
this.tileCollide = false;
this.penetrate = -1;
this.extraUpdates = 2;
}
else if (this.type == 630 || this.type == 705)
{
this.width = 22;
this.height = 22;
this.aiStyle = 75;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ranged = true;
this.ignoreWater = true;
}
else if (this.type == 631)
{
this.arrow = true;
this.width = 10;
this.height = 10;
this.aiStyle = 122;
this.friendly = true;
this.ranged = true;
this.tileCollide = false;
this.alpha = (int) byte.MaxValue;
this.ignoreWater = true;
this.extraUpdates = 1;
this.timeLeft = 1200;
}
else if (this.type == 633)
{
this.width = 14;
this.height = 18;
this.aiStyle = 75;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.magic = true;
this.ignoreWater = true;
}
else if (this.type == 632)
{
this.width = 18;
this.height = 18;
this.aiStyle = 84;
this.friendly = true;
this.magic = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.tileCollide = false;
}
else if (this.type == 634)
{
this.width = 40;
this.height = 40;
this.aiStyle = 1;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.ignoreWater = true;
this.extraUpdates = 2;
this.magic = true;
}
else if (this.type == 635)
{
this.width = 40;
this.height = 40;
this.aiStyle = 1;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.friendly = true;
this.extraUpdates = 3;
this.magic = true;
}
else if (this.type == 636)
{
this.width = 16;
this.height = 16;
this.aiStyle = 113;
this.friendly = true;
this.melee = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.hide = true;
this.MaxUpdates = 2;
}
else if (this.type == 637)
{
this.width = 10;
this.height = 10;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
}
else if (this.type == 638)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 5;
this.timeLeft = 600;
this.ranged = true;
this.ignoreWater = true;
this.usesLocalNPCImmunity = true;
this.penetrate = -1;
}
else if (this.type == 639)
{
this.arrow = true;
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.friendly = true;
this.ranged = true;
this.MaxUpdates = 2;
this.timeLeft = this.MaxUpdates * 45;
this.ignoreWater = true;
this.usesLocalNPCImmunity = true;
this.alpha = (int) byte.MaxValue;
this.penetrate = 4;
}
else if (this.type == 640)
{
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.friendly = true;
this.ranged = true;
this.MaxUpdates = 3;
this.timeLeft = 90;
this.ignoreWater = true;
this.usesLocalNPCImmunity = true;
this.alpha = (int) byte.MaxValue;
this.penetrate = 4;
}
else if (this.type == 642)
{
this.width = 18;
this.height = 18;
this.aiStyle = 84;
this.friendly = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.tileCollide = false;
this.usesLocalNPCImmunity = true;
}
else if (this.type == 641)
{
this.width = 32;
this.height = 32;
this.aiStyle = 123;
this.timeLeft = 7200;
this.ignoreWater = true;
this.tileCollide = false;
this.alpha = (int) byte.MaxValue;
this.hide = true;
this.sentry = true;
}
else if (this.type == 643)
{
this.width = 32;
this.height = 32;
this.aiStyle = 123;
this.timeLeft = 7200;
this.ignoreWater = true;
this.tileCollide = false;
this.alpha = (int) byte.MaxValue;
this.sentry = true;
}
else if (this.type == 644)
{
this.width = 14;
this.height = 14;
this.aiStyle = 112;
this.penetrate = 1;
this.timeLeft = 900;
this.tileCollide = false;
this.ignoreWater = true;
this.alpha = (int) byte.MaxValue;
}
else if (this.type == 645)
{
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.friendly = true;
this.magic = true;
this.tileCollide = false;
this.extraUpdates = 5;
this.penetrate = -1;
this.usesLocalNPCImmunity = true;
}
else if (this.type >= 646 && this.type <= 649)
{
this.netImportant = true;
this.width = 18;
this.height = 18;
this.aiStyle = 7;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.timeLeft *= 10;
}
else if (this.type == 650)
{
this.width = 20;
this.height = 20;
this.aiStyle = 124;
this.penetrate = -1;
this.netImportant = true;
this.timeLeft *= 5;
this.friendly = true;
this.ignoreWater = true;
this.tileCollide = false;
this.manualDirectionChange = true;
}
else if (this.type == 651)
{
this.width = 10;
this.height = 10;
this.aiStyle = 125;
this.friendly = true;
this.ignoreWater = true;
this.tileCollide = false;
this.penetrate = -1;
}
else if (this.type == 652)
{
this.netImportant = true;
this.width = 18;
this.height = 18;
this.aiStyle = 7;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.timeLeft *= 10;
}
else if (this.type == 653)
{
this.width = 30;
this.height = 30;
this.aiStyle = 67;
this.penetrate = -1;
this.netImportant = true;
this.timeLeft *= 5;
this.friendly = true;
this.ignoreWater = true;
this.scale = 0.8f;
}
else if (this.type == 654)
{
this.width = 30;
this.height = 30;
this.aiStyle = 126;
this.alpha = (int) byte.MaxValue;
this.tileCollide = false;
this.ignoreWater = true;
this.timeLeft = 120;
this.friendly = true;
this.hostile = true;
this.penetrate = -1;
this.trap = true;
}
else if (this.type == 655)
{
this.width = 31;
this.height = 31;
this.aiStyle = 25;
this.friendly = true;
this.hostile = true;
this.penetrate = -1;
this.trap = true;
}
else if (this.type == 656)
{
this.width = 10;
this.height = 10;
this.aiStyle = (int) sbyte.MaxValue;
this.friendly = true;
this.magic = true;
this.tileCollide = false;
this.penetrate = -1;
this.usesLocalNPCImmunity = true;
this.timeLeft = 1200;
}
else if (this.type == 657)
{
this.width = 10;
this.height = 10;
this.aiStyle = (int) sbyte.MaxValue;
this.hostile = true;
this.tileCollide = false;
this.penetrate = -1;
this.timeLeft = 1200;
}
else if (this.type == 658)
{
this.width = 14;
this.height = 14;
this.aiStyle = 128;
this.penetrate = 1;
this.timeLeft = 900;
this.tileCollide = false;
this.ignoreWater = true;
this.alpha = (int) byte.MaxValue;
this.hostile = true;
}
else if (this.type == 659)
{
this.width = 8;
this.height = 8;
this.aiStyle = 129;
this.friendly = true;
this.magic = true;
this.alpha = (int) byte.MaxValue;
this.ignoreWater = true;
this.timeLeft = 180;
this.tileCollide = false;
this.penetrate = -1;
}
else if (this.type == 660)
{
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 600;
this.magic = true;
this.ignoreWater = true;
}
else if (this.type == 661)
{
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 40;
this.extraUpdates = 1;
this.ranged = true;
this.ignoreWater = true;
this.usesLocalNPCImmunity = true;
}
else if (this.type == 662 || this.type == 685)
{
this.width = 16;
this.height = 16;
this.aiStyle = 1;
this.hostile = true;
this.penetrate = -1;
}
else if (this.type == 663 || this.type == 665 || this.type == 667)
{
this.width = 30;
this.height = 54;
this.aiStyle = 130;
this.timeLeft = 7200;
this.ignoreWater = true;
this.tileCollide = false;
this.manualDirectionChange = true;
switch (this.type)
{
case 665:
this.height = 58;
this.width = 28;
break;
case 667:
this.height = 60;
this.width = 28;
break;
}
this.sentry = true;
this.netImportant = true;
}
else if (this.type == 664 || this.type == 666 || this.type == 668)
{
this.width = 16;
this.height = 16;
this.aiStyle = 131;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = -1;
}
else if (this.type == 669)
{
this.width = 14;
this.height = 14;
this.aiStyle = 68;
this.friendly = true;
this.penetrate = 1;
this.alpha = (int) byte.MaxValue;
this.ranged = true;
this.noEnchantments = true;
}
else if (this.type == 670)
{
this.width = 30;
this.height = 30;
this.aiStyle = 126;
this.alpha = (int) byte.MaxValue;
this.tileCollide = false;
this.ignoreWater = true;
this.timeLeft = 120;
this.hostile = true;
this.penetrate = -1;
}
else if (this.type == 671)
{
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.friendly = false;
this.hostile = true;
}
else if (this.type == 672)
{
this.width = 10;
this.height = 10;
this.aiStyle = 132;
this.alpha = (int) byte.MaxValue;
this.tileCollide = false;
this.ignoreWater = true;
this.timeLeft = 900;
this.hostile = true;
this.penetrate = -1;
}
else if (this.type == 674 || this.type == 673)
{
this.width = 10;
this.height = 10;
this.aiStyle = 133;
this.alpha = (int) byte.MaxValue;
this.tileCollide = false;
this.ignoreWater = true;
this.timeLeft = 900;
this.hostile = true;
this.penetrate = -1;
this.hide = true;
}
else if (this.type == 675)
{
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.friendly = false;
this.hostile = true;
}
else if (this.type == 676)
{
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.friendly = false;
this.hostile = true;
}
else if (this.type == 677 || this.type == 678 || this.type == 679)
{
this.width = 26;
this.height = 54;
this.aiStyle = 134;
this.timeLeft = 7200;
this.ignoreWater = true;
this.tileCollide = false;
this.manualDirectionChange = true;
this.sentry = true;
this.netImportant = true;
}
else if (this.type == 680)
{
this.width = 16;
this.height = 16;
this.aiStyle = 1;
this.friendly = true;
this.penetrate = 4;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = -1;
}
else if (this.type == 681)
{
this.width = 14;
this.height = 14;
this.aiStyle = 16;
this.hostile = true;
this.penetrate = -1;
this.ranged = true;
}
else if (this.type == 682)
{
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.hostile = true;
this.ignoreWater = true;
this.timeLeft = 30;
this.scale = 1.2f;
}
else if (this.type == 683)
{
this.width = 30;
this.height = 30;
this.aiStyle = 135;
this.alpha = (int) byte.MaxValue;
this.tileCollide = false;
this.ignoreWater = true;
this.timeLeft = 120;
this.hostile = true;
this.penetrate = -1;
}
else if (this.type == 684)
{
this.width = 16;
this.height = 16;
this.aiStyle = 1;
this.melee = true;
this.penetrate = 5;
this.alpha = (int) byte.MaxValue;
this.friendly = true;
this.tileCollide = false;
}
else if (this.type == 686)
{
this.width = 30;
this.height = 30;
this.aiStyle = 1;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.friendly = false;
this.hostile = true;
}
else if (this.type == 687)
{
this.width = 30;
this.height = 30;
this.aiStyle = 136;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.friendly = false;
this.hostile = true;
}
else if (this.type == 688 || this.type == 689 || this.type == 690)
{
this.width = 16;
this.height = 16;
this.aiStyle = 137;
this.friendly = true;
this.ignoreWater = true;
this.usesLocalNPCImmunity = true;
this.timeLeft = 7200;
this.localNPCHitCooldown = 3;
this.tileCollide = false;
this.penetrate = -1;
this.sentry = true;
this.netImportant = true;
}
else if (this.type == 691 || this.type == 692 || this.type == 693)
{
this.width = 16;
this.height = 16;
this.aiStyle = 138;
this.ignoreWater = true;
this.friendly = true;
this.timeLeft = 7200;
this.tileCollide = false;
this.penetrate = -1;
this.hide = true;
this.sentry = true;
this.netImportant = true;
}
else if (this.type == 694 || this.type == 695 || this.type == 696)
{
this.aiStyle = 139;
this.friendly = true;
this.tileCollide = false;
this.penetrate = -1;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 30;
this.alpha = (int) byte.MaxValue;
this.width = 96;
this.height = 96;
}
else if (this.type == 697)
{
this.width = 16;
this.height = 16;
this.aiStyle = 140;
this.friendly = true;
this.melee = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.hide = true;
this.tileCollide = false;
this.ignoreWater = true;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 12;
this.ownerHitCheck = true;
}
else if (this.type == 698)
{
this.width = 50;
this.height = 200;
this.aiStyle = 141;
this.alpha = (int) byte.MaxValue;
this.tileCollide = false;
this.ignoreWater = true;
this.timeLeft = 120;
this.friendly = true;
this.penetrate = -1;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = -1;
this.melee = true;
}
else if (this.type == 699)
{
this.width = 24;
this.height = 24;
this.aiStyle = 142;
this.friendly = true;
this.melee = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.hide = true;
this.tileCollide = false;
this.ignoreWater = true;
this.usesIDStaticNPCImmunity = true;
this.idStaticNPCHitCooldown = 36;
this.ownerHitCheck = true;
}
else if (this.type == 700)
{
this.width = 40;
this.height = 40;
this.aiStyle = 143;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.friendly = true;
this.melee = true;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = -1;
this.ignoreWater = true;
this.tileCollide = false;
}
else if (this.type == 703 || this.type == 701 || this.type == 702)
{
this.width = 20;
this.height = 20;
this.aiStyle = 144;
this.penetrate = -1;
this.netImportant = true;
this.timeLeft *= 5;
this.scale = 1f;
this.friendly = true;
this.ignoreWater = true;
this.tileCollide = false;
this.manualDirectionChange = true;
}
else if (this.type == 704)
{
this.width = 60;
this.height = 210;
this.aiStyle = 145;
this.friendly = true;
this.magic = true;
this.tileCollide = false;
this.penetrate = -1;
this.usesLocalNPCImmunity = true;
this.timeLeft = 600;
this.localNPCHitCooldown = -1;
this.ignoreWater = true;
}
else if (this.type == 706)
{
this.width = 66;
this.height = 66;
this.aiStyle = 1;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 300;
this.ranged = true;
this.usesLocalNPCImmunity = true;
this.penetrate = -1;
this.localNPCHitCooldown = 10;
}
else if (this.type == 707)
{
this.width = 16;
this.height = 16;
this.aiStyle = 140;
this.friendly = true;
this.melee = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.hide = true;
this.tileCollide = false;
this.ignoreWater = true;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 6;
this.ownerHitCheck = true;
}
else if (this.type == 708)
{
this.width = 24;
this.height = 24;
this.aiStyle = 142;
this.friendly = true;
this.melee = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
this.hide = true;
this.tileCollide = false;
this.ignoreWater = true;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 6;
this.ownerHitCheck = true;
}
else if (this.type == 709)
{
this.width = 12;
this.height = 12;
this.aiStyle = 1;
this.friendly = true;
this.melee = true;
this.alpha = (int) byte.MaxValue;
this.ignoreWater = true;
this.extraUpdates = 1;
this.noEnchantments = true;
this.scale = 0.6f;
}
else if (this.type == 710)
{
this.arrow = true;
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.friendly = true;
this.ranged = true;
this.ignoreWater = true;
this.extraUpdates = 1;
this.timeLeft = this.extraUpdates * 60 * 5;
this.usesLocalNPCImmunity = true;
this.alpha = (int) byte.MaxValue;
this.localNPCHitCooldown = -1;
}
else if (this.type == 711)
{
this.width = 30;
this.height = 30;
this.aiStyle = 1;
this.alpha = (int) byte.MaxValue;
this.friendly = true;
this.magic = true;
this.extraUpdates = 1;
this.scale = 0.7f;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = -1;
}
else if (this.type == 712)
{
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 600;
this.magic = true;
this.extraUpdates = 1;
}
else if (this.type == 713)
{
this.width = 10;
this.height = 10;
this.aiStyle = 146;
this.alpha = (int) byte.MaxValue;
this.tileCollide = false;
this.ignoreWater = true;
this.timeLeft = 900;
this.hostile = true;
this.penetrate = -1;
}
else if (this.type == 714)
{
this.width = 22;
this.height = 22;
this.aiStyle = 75;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.hide = true;
this.ranged = true;
this.ignoreWater = true;
}
else if (this.type == 715 || this.type == 717)
{
this.width = 14;
this.height = 14;
this.aiStyle = 147;
this.friendly = true;
this.penetrate = 1;
this.alpha = (int) byte.MaxValue;
this.ranged = true;
this.extraUpdates = 2;
this.timeLeft = 360 * this.MaxUpdates;
}
else if (this.type == 716 || this.type == 718)
{
this.width = 14;
this.height = 14;
this.aiStyle = 147;
this.friendly = true;
this.penetrate = 1;
this.alpha = (int) byte.MaxValue;
this.ranged = true;
this.extraUpdates = 2;
this.timeLeft = 360 * this.MaxUpdates;
}
else if (this.type == 719)
{
this.width = 10;
this.height = 10;
this.hostile = true;
this.penetrate = -1;
this.aiStyle = 1;
this.tileCollide = true;
}
else if (this.type == 720)
{
this.width = 16;
this.height = 16;
this.aiStyle = 148;
this.tileCollide = false;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
}
else if (this.type == 721 || this.type == 739 || this.type == 740 || this.type == 741 || this.type == 742 || this.type == 743 || this.type == 744 || this.type == 745 || this.type == 746 || this.type == 747 || this.type == 748 || this.type == 749 || this.type == 750 || this.type == 751 || this.type == 752)
{
this.netImportant = true;
this.width = 7;
this.height = 7;
this.friendly = true;
this.penetrate = -1;
this.aiStyle = 149;
this.tileCollide = false;
}
else if (this.type == 722)
{
this.width = 2;
this.height = 2;
this.aiStyle = 150;
this.tileCollide = false;
this.ignoreWater = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
}
else if (this.type == 723 || this.type == 724 || this.type == 725 || this.type == 726)
{
this.width = 24;
this.height = 24;
this.aiStyle = 5;
this.friendly = true;
this.penetrate = 2;
this.alpha = 50;
this.tileCollide = false;
}
else if (this.type == 728)
{
this.width = 24;
this.height = 24;
this.aiStyle = 151;
this.alpha = (int) byte.MaxValue;
this.tileCollide = true;
this.ranged = true;
this.friendly = true;
this.penetrate = -1;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = -1;
}
else if (this.type == 729)
{
this.width = 20;
this.height = 20;
this.aiStyle = 152;
this.friendly = true;
this.tileCollide = false;
this.ignoreWater = true;
this.ranged = true;
this.penetrate = -1;
this.scale = (float) (1.0 + (double) Main.rand.Next(30) * 0.00999999977648258);
this.extraUpdates = 2;
this.timeLeft = 10 * this.MaxUpdates;
}
else if (this.type == 730)
{
this.width = 18;
this.height = 18;
this.aiStyle = 19;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.scale = 1f;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
}
else if (this.type == 731)
{
this.width = 10;
this.height = 10;
this.aiStyle = 29;
this.alpha = (int) byte.MaxValue;
this.magic = true;
this.friendly = true;
this.extraUpdates = 1;
this.timeLeft = 90;
}
else if (this.type == 732)
{
this.tileCollide = true;
this.width = 15;
this.height = 15;
this.aiStyle = 44;
this.friendly = true;
this.penetrate = 1;
this.melee = true;
this.noEnchantmentVisuals = true;
}
else if (this.type == 733)
{
this.width = 2;
this.height = 2;
this.aiStyle = 153;
this.tileCollide = false;
this.ignoreWater = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
}
else if (this.type == 734)
{
this.width = 30;
this.height = 24;
this.aiStyle = 154;
this.tileCollide = false;
this.timeLeft = 10800;
this.alpha = (int) byte.MaxValue;
this.hide = true;
}
else if (this.type == 735)
{
this.width = 68;
this.height = 64;
this.aiStyle = 75;
this.friendly = true;
this.tileCollide = false;
this.melee = true;
this.penetrate = -1;
this.ownerHitCheck = true;
}
else if (this.type == 736 || this.type == 737 || this.type == 738)
{
this.knockBack = 6f;
this.width = 10;
this.height = 10;
this.aiStyle = 10;
this.penetrate = -1;
}
else if (this.type == 753)
{
this.netImportant = true;
this.width = 18;
this.height = 18;
this.aiStyle = 7;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.timeLeft *= 10;
}
else if (this.type == 754)
{
this.width = 16;
this.height = 16;
this.aiStyle = 155;
this.tileCollide = false;
this.ignoreWater = true;
this.penetrate = -1;
this.alpha = (int) byte.MaxValue;
}
else if (this.type == 755)
{
this.netImportant = true;
this.width = 10;
this.height = 10;
this.penetrate = -1;
this.ignoreWater = true;
this.tileCollide = false;
this.friendly = true;
this.minion = true;
this.minionSlots = 1f;
this.timeLeft *= 5;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 15;
this.aiStyle = 156;
}
else if (this.type == 756)
{
this.width = 32;
this.height = 32;
this.aiStyle = 157;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.magic = true;
this.tileCollide = false;
this.ignoreWater = true;
this.penetrate = 2;
}
else if (this.type == 757)
{
this.netImportant = true;
this.width = 34;
this.height = 34;
this.aiStyle = 15;
this.friendly = true;
this.penetrate = -1;
this.melee = true;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 10;
}
else if (this.type == 758)
{
this.width = 20;
this.height = 30;
this.aiStyle = 67;
this.penetrate = -1;
this.netImportant = true;
this.timeLeft *= 5;
this.minion = true;
this.minionSlots = 1f;
this.decidesManualFallThrough = true;
}
else if (this.type == 759)
{
this.netImportant = true;
this.width = 10;
this.height = 10;
this.penetrate = -1;
this.ignoreWater = true;
this.tileCollide = true;
this.friendly = true;
this.minion = true;
this.minionSlots = 1f;
this.timeLeft *= 5;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 15;
this.aiStyle = 158;
this.hide = true;
}
else if (this.type == 761 || this.type == 762)
{
this.width = 10;
this.height = 10;
this.aiStyle = 159;
this.friendly = true;
this.manualDirectionChange = true;
}
else if (this.type == 763)
{
this.width = 10;
this.height = 10;
this.hostile = true;
this.friendly = true;
this.penetrate = -1;
this.aiStyle = 1;
this.tileCollide = true;
this.extraUpdates = 1;
}
else if (this.type == 764)
{
this.width = 20;
this.height = 20;
this.aiStyle = 144;
this.penetrate = -1;
this.netImportant = true;
this.timeLeft *= 5;
this.friendly = true;
this.ignoreWater = true;
this.tileCollide = false;
this.manualDirectionChange = true;
}
else if (this.type == 765)
{
this.netImportant = true;
this.width = 18;
this.height = 18;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type >= 766 && this.type <= 770 || this.type == 771)
{
this.width = 4;
this.height = 4;
this.aiStyle = 160;
this.penetrate = -1;
this.extraUpdates = 60;
}
else if (this.type == 772)
{
this.width = 22;
this.height = 22;
this.friendly = true;
this.aiStyle = 1;
this.tileCollide = true;
this.extraUpdates = 1;
}
else if (this.type == 773)
{
this.width = 22;
this.height = 22;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
}
else if (this.type == 774)
{
this.netImportant = true;
this.width = 26;
this.height = 26;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 802)
{
this.width = 18;
this.height = 18;
this.aiStyle = 161;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.scale = 1f;
this.ownerHitCheck = true;
this.melee = true;
this.extraUpdates = 1;
this.hide = true;
}
else if (this.type == 811 || this.type == 814)
{
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.friendly = false;
this.hostile = true;
}
else if (this.type >= 776 && this.type <= 801 || this.type >= 803 && this.type <= 810)
{
this.width = 14;
this.height = 14;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
this.ranged = true;
if (this.type == 777 || this.type == 781 || this.type == 794 || this.type == 797 || this.type == 800 || this.type == 785 || this.type == 788 || this.type == 800)
{
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = -1;
}
}
else if (this.type == 812)
{
this.knockBack = 6f;
this.width = 10;
this.height = 10;
this.aiStyle = 10;
this.friendly = true;
this.hostile = true;
this.penetrate = -1;
}
else if (this.type == 815)
{
this.netImportant = true;
this.width = 26;
this.height = 26;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 816)
{
this.netImportant = true;
this.width = 26;
this.height = 32;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 817)
{
this.netImportant = true;
this.width = 26;
this.height = 26;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 819)
{
this.arrow = true;
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 1;
this.hide = true;
this.friendly = true;
}
else if (this.type == 818)
{
this.width = 32;
this.height = 32;
this.aiStyle = 162;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.magic = true;
this.tileCollide = false;
this.ignoreWater = true;
this.penetrate = -1;
this.extraUpdates = 3;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 10;
}
else if (this.type == 820)
{
this.width = 12;
this.height = 12;
this.friendly = true;
this.aiStyle = 163;
this.tileCollide = true;
this.netImportant = true;
this.penetrate = -1;
this.timeLeft = 86400;
}
else if (this.type == 821)
{
this.netImportant = true;
this.width = 20;
this.height = 36;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type >= 822 && this.type <= 824)
{
this.netImportant = true;
this.width = 4;
this.height = 4;
this.aiStyle = 160;
this.penetrate = -1;
this.extraUpdates = 60;
}
else if (this.type == 825)
{
this.netImportant = true;
this.width = 26;
this.height = 32;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type >= 826 && this.type <= 830)
{
this.netImportant = true;
this.width = 4;
this.height = 4;
this.aiStyle = 160;
this.penetrate = -1;
this.extraUpdates = 60;
}
else if (this.type == 836)
{
this.width = 4;
this.height = 4;
this.aiStyle = 112;
this.hostile = true;
}
else if (this.type == 831)
{
this.netImportant = true;
this.width = 10;
this.height = 10;
this.penetrate = -1;
this.ignoreWater = true;
this.tileCollide = false;
this.friendly = true;
this.minion = true;
this.minionSlots = 1f;
this.timeLeft = 60;
this.aiStyle = 164;
this.hide = true;
}
else if (this.type == 833)
{
this.width = 26;
this.height = 20;
this.aiStyle = 67;
this.penetrate = -1;
this.netImportant = true;
this.timeLeft *= 5;
this.minion = true;
this.minionSlots = 0.0f;
this.decidesManualFallThrough = true;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 10;
}
else if (this.type == 834)
{
this.width = 20;
this.height = 30;
this.aiStyle = 67;
this.penetrate = -1;
this.netImportant = true;
this.timeLeft *= 5;
this.minion = true;
this.minionSlots = 0.0f;
this.decidesManualFallThrough = true;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 10;
}
else if (this.type == 835)
{
this.width = 20;
this.height = 30;
this.aiStyle = 67;
this.penetrate = -1;
this.netImportant = true;
this.timeLeft *= 5;
this.minion = true;
this.minionSlots = 0.0f;
this.decidesManualFallThrough = true;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 10;
}
else if (this.type == 837)
{
this.width = 26;
this.height = 26;
this.aiStyle = 1;
this.alpha = (int) byte.MaxValue;
this.friendly = true;
this.magic = true;
this.penetrate = 3;
}
else if (this.type >= 838 && this.type <= 840)
{
this.netImportant = true;
this.width = 4;
this.height = 4;
this.aiStyle = 160;
this.penetrate = -1;
this.extraUpdates = 60;
}
else if (this.type == 841)
this.DefaultToWhip();
else if (this.type == 842)
{
this.width = 18;
this.height = 18;
this.aiStyle = 161;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.scale = 1f;
this.ownerHitCheck = true;
this.melee = true;
this.extraUpdates = 1;
this.hide = true;
}
else if (this.type >= 843 && this.type <= 846)
{
this.netImportant = true;
this.width = 4;
this.height = 4;
this.aiStyle = 160;
this.penetrate = -1;
this.extraUpdates = 60;
}
else if (this.type == 847)
{
this.DefaultToWhip();
this.extraUpdates = 2;
}
else if (this.type == 848)
this.DefaultToWhip();
else if (this.type == 849)
{
this.DefaultToWhip();
this.extraUpdates = 2;
}
else if (this.type == 850)
{
this.netImportant = true;
this.width = 4;
this.height = 4;
this.aiStyle = 160;
this.penetrate = -1;
this.extraUpdates = 60;
}
else if (this.type == 851)
{
this.netImportant = true;
this.width = 4;
this.height = 4;
this.aiStyle = 166;
this.penetrate = -1;
this.timeLeft = 300;
}
else if (this.type >= 852 && this.type <= 853)
{
this.netImportant = true;
this.width = 4;
this.height = 4;
this.aiStyle = 160;
this.penetrate = -1;
this.extraUpdates = 60;
}
else if (this.type == 854)
{
this.netImportant = true;
this.width = 26;
this.height = 32;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 855)
{
this.netImportant = true;
this.width = 12;
this.height = 12;
this.aiStyle = 166;
this.penetrate = -1;
this.timeLeft = 1000;
}
else if (this.type == 856)
{
this.width = 32;
this.height = 32;
this.aiStyle = 167;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.magic = true;
this.tileCollide = false;
this.ignoreWater = true;
this.extraUpdates = 2;
this.usesLocalNPCImmunity = true;
}
else if (this.type == 857)
{
this.width = 32;
this.height = 32;
this.aiStyle = 168;
this.friendly = true;
this.alpha = (int) byte.MaxValue;
this.melee = true;
this.tileCollide = false;
this.ignoreWater = true;
this.extraUpdates = 1;
this.usesLocalNPCImmunity = true;
this.manualDirectionChange = true;
this.penetrate = -1;
this.hide = true;
}
else if (this.type == 858)
{
this.netImportant = true;
this.width = 26;
this.height = 20;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 859)
{
this.netImportant = true;
this.width = 20;
this.height = 32;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 860)
{
this.netImportant = true;
this.width = 20;
this.height = 20;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 861)
{
this.netImportant = true;
this.width = 10;
this.height = 10;
this.aiStyle = 2;
this.friendly = true;
}
else if (this.type == 862 || this.type == 863)
{
this.width = 14;
this.height = 14;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
this.ranged = true;
}
else if (this.type == 864)
{
this.netImportant = true;
this.width = 10;
this.height = 10;
this.penetrate = -1;
this.usesLocalNPCImmunity = true;
this.ignoreWater = true;
this.tileCollide = false;
this.friendly = true;
this.minion = true;
this.minionSlots = 1f;
this.timeLeft = 60;
this.aiStyle = 169;
this.localNPCHitCooldown = 40;
}
else if (this.type == 865)
{
this.netImportant = true;
this.width = 18;
this.height = 18;
this.aiStyle = 7;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.timeLeft *= 10;
}
else if (this.type == 866)
{
this.light = 0.15f;
this.width = 30;
this.height = 30;
this.aiStyle = 3;
this.friendly = true;
this.penetrate = 5;
this.melee = true;
this.extraUpdates = 1;
this.usesLocalNPCImmunity = true;
}
else if (this.type == 867)
{
this.width = 22;
this.height = 22;
this.aiStyle = 3;
this.friendly = true;
this.penetrate = -1;
this.melee = true;
this.light = 0.6f;
}
else if (this.type == 868 || this.type == 869)
{
this.width = 18;
this.height = 18;
this.aiStyle = 2;
this.friendly = true;
this.penetrate = 1;
}
else if (this.type == 870)
{
this.netImportant = true;
this.width = 6;
this.height = 6;
this.aiStyle = 14;
this.penetrate = -1;
this.alpha = 75;
this.light = 1f;
this.timeLeft *= 5;
}
else if (this.type == 873)
{
this.width = 30;
this.height = 30;
this.aiStyle = 171;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.friendly = false;
this.hostile = true;
this.timeLeft = 200;
this.tileCollide = false;
this.ignoreWater = true;
}
else if (this.type == 874)
{
this.width = 30;
this.height = 30;
this.aiStyle = 0;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.friendly = false;
this.hostile = true;
this.timeLeft = 210;
this.tileCollide = false;
this.ignoreWater = true;
}
else if (this.type == 871)
{
this.width = 30;
this.height = 30;
this.aiStyle = 172;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.friendly = false;
this.hostile = true;
this.timeLeft = 240;
this.tileCollide = false;
this.ignoreWater = true;
}
else if (this.type == 875)
{
this.netImportant = true;
this.width = 20;
this.height = 20;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 872)
{
this.width = 30;
this.height = 30;
this.aiStyle = 173;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.friendly = false;
this.hostile = true;
this.timeLeft = 660;
this.tileCollide = false;
this.ignoreWater = true;
}
else if (this.type == 876)
{
this.width = 4;
this.height = 4;
this.aiStyle = 1;
this.friendly = true;
this.penetrate = 8;
this.light = 0.75f;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 3;
this.scale = 1.4f;
this.timeLeft = 3600;
this.magic = true;
}
else if (this.type >= 877 && this.type <= 879)
{
this.netImportant = true;
this.width = 25;
this.height = 25;
this.aiStyle = 19;
this.alpha = (int) byte.MaxValue;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.scale = 1f;
this.hide = true;
this.ownerHitCheck = true;
this.melee = true;
}
else if (this.type == 880)
{
this.width = 32;
this.height = 32;
this.aiStyle = 183;
this.penetrate = -1;
this.timeLeft = 18;
this.ignoreWater = true;
this.tileCollide = false;
this.friendly = true;
this.hostile = false;
this.manualDirectionChange = true;
}
else if (this.type == 881)
{
this.netImportant = true;
this.width = 20;
this.height = 20;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 882)
{
this.width = 20;
this.height = 20;
this.aiStyle = 124;
this.penetrate = -1;
this.netImportant = true;
this.timeLeft *= 5;
this.friendly = true;
this.ignoreWater = true;
this.tileCollide = false;
this.manualDirectionChange = true;
}
else if (this.type == 883)
{
this.width = 20;
this.height = 20;
this.aiStyle = 174;
this.penetrate = -1;
this.timeLeft *= 5;
this.friendly = true;
this.ignoreWater = true;
this.tileCollide = false;
this.netImportant = true;
}
else if (this.type >= 884 && this.type <= 886)
{
this.netImportant = true;
this.width = 20;
this.height = 20;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 887)
{
this.width = 20;
this.height = 20;
this.aiStyle = 174;
this.penetrate = -1;
this.timeLeft *= 5;
this.friendly = true;
this.ignoreWater = true;
this.tileCollide = false;
this.netImportant = true;
}
else if (this.type == 888)
{
this.width = 20;
this.height = 20;
this.aiStyle = 124;
this.penetrate = -1;
this.netImportant = true;
this.timeLeft *= 5;
this.friendly = true;
this.ignoreWater = true;
this.tileCollide = false;
this.manualDirectionChange = true;
}
else if (this.type >= 889 && this.type <= 892)
{
this.netImportant = true;
this.width = 20;
this.height = 20;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 893)
{
this.width = 20;
this.height = 20;
this.aiStyle = 174;
this.penetrate = -1;
this.timeLeft *= 5;
this.friendly = true;
this.ignoreWater = true;
this.tileCollide = false;
this.netImportant = true;
}
else if (this.type == 894)
{
this.netImportant = true;
this.width = 20;
this.height = 20;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type >= 895 && this.type <= 896)
{
this.width = 20;
this.height = 20;
this.aiStyle = 124;
this.penetrate = -1;
this.netImportant = true;
this.timeLeft *= 5;
this.friendly = true;
this.ignoreWater = true;
this.tileCollide = false;
this.manualDirectionChange = true;
}
else if (this.type == 897)
{
this.netImportant = true;
this.width = 20;
this.height = 20;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 898)
{
this.width = 20;
this.height = 20;
this.aiStyle = 124;
this.penetrate = -1;
this.netImportant = true;
this.timeLeft *= 5;
this.friendly = true;
this.ignoreWater = true;
this.tileCollide = false;
this.manualDirectionChange = true;
}
else if (this.type >= 899 && this.type <= 901)
{
this.netImportant = true;
this.width = 20;
this.height = 20;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 902)
{
this.width = 20;
this.height = 20;
this.aiStyle = 3;
this.friendly = true;
this.penetrate = -1;
this.melee = true;
this.MaxUpdates = 2;
}
else if (this.type >= 903 && this.type <= 906)
{
this.width = 22;
this.height = 22;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
}
else if (this.type == 907)
{
this.width = 22;
this.height = 22;
this.aiStyle = 30;
this.friendly = true;
this.penetrate = 2;
this.melee = true;
}
else if (this.type == 908)
{
this.tileCollide = false;
this.ignoreWater = true;
this.width = 14;
this.height = 14;
this.aiStyle = 175;
this.friendly = true;
this.penetrate = 1;
this.timeLeft = 3600;
this.hide = true;
}
else if (this.type == 909)
{
this.width = 12;
this.height = 12;
this.aiStyle = 2;
this.friendly = false;
this.hostile = true;
this.penetrate = 1;
}
else if (this.type == 910)
{
this.width = 22;
this.height = 22;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
}
else if (this.type == 911)
{
this.width = 22;
this.height = 22;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
}
else if (this.type >= 912 && this.type <= 915)
{
this.DefaultToWhip();
if (this.type == 915)
this.extraUpdates = 2;
}
else if (this.type == 916)
{
this.width = 18;
this.height = 18;
this.aiStyle = 176;
this.friendly = true;
this.tileCollide = false;
this.penetrate = 2;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = -1;
this.extraUpdates = 2;
}
else if (this.type == 918)
{
this.aiStyle = 178;
this.friendly = true;
this.tileCollide = false;
this.penetrate = -1;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = -1;
this.alpha = (int) byte.MaxValue;
this.width = 96;
this.height = 96;
}
else if (this.type == 917)
{
this.width = 30;
this.height = 30;
this.aiStyle = 177;
this.friendly = true;
this.tileCollide = false;
this.penetrate = -1;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 20;
}
else if (this.type == 919)
{
this.width = 8;
this.height = 8;
this.aiStyle = 179;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.friendly = false;
this.hostile = true;
this.timeLeft = 240;
this.tileCollide = false;
this.ignoreWater = true;
}
else if (this.type == 920)
{
this.alpha = (int) byte.MaxValue;
this.width = 6;
this.height = 6;
this.aiStyle = 1;
this.hostile = true;
this.penetrate = 1;
}
else if (this.type == 921)
{
this.alpha = (int) byte.MaxValue;
this.width = 6;
this.height = 6;
this.aiStyle = 1;
this.hostile = true;
this.penetrate = 3;
}
else if (this.type == 922)
{
this.width = 30;
this.height = 30;
this.aiStyle = 135;
this.alpha = (int) byte.MaxValue;
this.tileCollide = false;
this.ignoreWater = true;
this.timeLeft = 120;
this.hostile = true;
this.penetrate = -1;
}
else if (this.type == 923)
{
this.width = 30;
this.height = 30;
this.aiStyle = 180;
this.alpha = (int) byte.MaxValue;
this.penetrate = -1;
this.friendly = false;
this.hostile = true;
this.timeLeft = 180;
this.tileCollide = false;
this.ignoreWater = true;
this.hide = true;
}
else if (this.type == 926)
{
this.alpha = (int) byte.MaxValue;
this.width = 12;
this.height = 12;
this.scale = 1f;
this.aiStyle = 1;
this.hostile = true;
this.penetrate = 2;
}
else if (this.type == 927)
{
this.width = 40;
this.height = 40;
this.aiStyle = 75;
this.friendly = true;
this.tileCollide = false;
this.melee = true;
this.penetrate = -1;
this.ownerHitCheck = true;
}
else if (this.type == 928)
{
this.netImportant = true;
this.width = 34;
this.height = 34;
this.aiStyle = 14;
this.friendly = true;
this.penetrate = 2;
this.melee = true;
this.timeLeft = 250;
}
else if (this.type == 929)
{
this.width = 32;
this.height = 32;
this.aiStyle = 183;
this.penetrate = -1;
this.timeLeft = 18;
this.ignoreWater = true;
this.tileCollide = false;
this.friendly = true;
this.hostile = false;
this.manualDirectionChange = true;
}
else if (this.type == 930)
{
this.width = 14;
this.height = 14;
this.aiStyle = 16;
this.friendly = true;
this.penetrate = -1;
this.ranged = true;
}
else if (this.type == 931)
{
this.width = 30;
this.height = 30;
this.aiStyle = 171;
this.alpha = (int) byte.MaxValue;
this.penetrate = 3;
this.friendly = true;
this.timeLeft = 240;
this.magic = true;
this.tileCollide = true;
this.ignoreWater = true;
this.extraUpdates = 1;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 60;
}
else if (this.type == 932)
{
this.ranged = true;
this.arrow = true;
this.width = 10;
this.height = 10;
this.aiStyle = 181;
this.penetrate = 5;
this.friendly = true;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = -1;
this.timeLeft = 120;
this.alpha = 0;
this.ignoreWater = true;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 60;
}
else if (this.type == 933)
{
this.width = 32;
this.height = 32;
this.aiStyle = 182;
this.friendly = true;
this.melee = true;
this.tileCollide = false;
this.ignoreWater = true;
this.alpha = (int) byte.MaxValue;
this.extraUpdates = 1;
this.usesLocalNPCImmunity = true;
this.manualDirectionChange = true;
this.localNPCHitCooldown = 15;
this.penetrate = -1;
this.noEnchantmentVisuals = true;
}
else if (this.type == 934)
{
this.netImportant = true;
this.width = 20;
this.height = 20;
this.aiStyle = 26;
this.friendly = true;
this.penetrate = -1;
this.timeLeft *= 5;
}
else if (this.type == 935)
{
this.netImportant = true;
this.width = 18;
this.height = 18;
this.aiStyle = 7;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.timeLeft *= 10;
this.extraUpdates = 3;
}
else if (this.type == 936)
{
this.width = 14;
this.height = 14;
this.aiStyle = 2;
this.friendly = true;
this.penetrate = 1;
this.Opacity = 0.6f;
}
else if (this.type == 937)
{
this.alpha = (int) byte.MaxValue;
this.width = 10;
this.height = 10;
this.aiStyle = 1;
this.hostile = false;
this.friendly = true;
this.penetrate = 3;
this.usesIDStaticNPCImmunity = true;
this.idStaticNPCHitCooldown = 10;
}
else if (this.type >= 938 && this.type <= 945)
{
this.width = 18;
this.height = 18;
this.aiStyle = 161;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.scale = 1f;
this.ownerHitCheck = true;
this.melee = true;
this.extraUpdates = 1;
this.timeLeft = 360;
this.hide = true;
}
else if (this.type == 946)
{
this.netImportant = true;
this.width = 10;
this.height = 10;
this.penetrate = -1;
this.ignoreWater = true;
this.tileCollide = false;
this.friendly = true;
this.minion = true;
this.minionSlots = 1f;
this.timeLeft *= 5;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 15;
this.aiStyle = 156;
this.scale = 0.75f;
this.manualDirectionChange = true;
this.hide = true;
}
else if (this.type == 947 || this.type == 948)
{
this.netImportant = true;
this.width = 20;
this.height = 20;
this.aiStyle = 15;
this.friendly = true;
this.penetrate = -1;
this.melee = true;
this.scale = 1f;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = 10;
}
else if (this.type == 949)
{
this.width = 4;
this.height = 4;
this.aiStyle = 184;
this.penetrate = -1;
this.hostile = true;
this.tileCollide = false;
}
else
this.active = false;
this.width = (int) ((double) this.width * (double) this.scale);
this.height = (int) ((double) this.height * (double) this.scale);
this.maxPenetrate = this.penetrate;
}
private void DefaultToWhip()
{
this.width = 18;
this.height = 18;
this.aiStyle = 165;
this.friendly = true;
this.penetrate = -1;
this.tileCollide = false;
this.scale = 1f;
this.ownerHitCheck = true;
this.extraUpdates = 1;
this.usesLocalNPCImmunity = true;
this.localNPCHitCooldown = -1;
}
public static int GetNextSlot()
{
int num = 1000;
for (int index = 0; index < 1000; ++index)
{
if (!Main.projectile[index].active)
{
num = index;
break;
}
}
return num;
}
public static int NewProjectile(
Vector2 position,
Vector2 velocity,
int Type,
int Damage,
float KnockBack,
int Owner = 255,
float ai0 = 0.0f,
float ai1 = 0.0f)
{
return Projectile.NewProjectile(position.X, position.Y, velocity.X, velocity.Y, Type, Damage, KnockBack, Owner, ai0, ai1);
}
public static int FindOldestProjectile()
{
int num1 = 1000;
int num2 = 9999999;
for (int index = 0; index < 1000; ++index)
{
if (!Main.projectile[index].netImportant && Main.projectile[index].timeLeft < num2)
{
num1 = index;
num2 = Main.projectile[index].timeLeft;
}
}
return num1;
}
public static int NewProjectile(
float X,
float Y,
float SpeedX,
float SpeedY,
int Type,
int Damage,
float KnockBack,
int Owner = 255,
float ai0 = 0.0f,
float ai1 = 0.0f)
{
int number = 1000;
for (int index = 0; index < 1000; ++index)
{
if (!Main.projectile[index].active)
{
number = index;
break;
}
}
if (number == 1000)
number = Projectile.FindOldestProjectile();
Projectile projectile = Main.projectile[number];
projectile.SetDefaults(Type);
projectile.position.X = X - (float) projectile.width * 0.5f;
projectile.position.Y = Y - (float) projectile.height * 0.5f;
projectile.owner = Owner;
projectile.velocity.X = SpeedX;
projectile.velocity.Y = SpeedY;
projectile.damage = Damage;
projectile.knockBack = KnockBack;
projectile.identity = number;
projectile.gfxOffY = 0.0f;
projectile.stepSpeed = 1f;
projectile.wet = Collision.WetCollision(projectile.position, projectile.width, projectile.height);
if (projectile.ignoreWater)
projectile.wet = false;
projectile.honeyWet = Collision.honey;
Main.projectileIdentity[Owner, number] = number;
if (projectile.aiStyle == 1)
{
for (; (double) projectile.velocity.X >= 16.0 || (double) projectile.velocity.X <= -16.0 || (double) projectile.velocity.Y >= 16.0 || (double) projectile.velocity.Y < -16.0; projectile.velocity.Y *= 0.97f)
projectile.velocity.X *= 0.97f;
}
if (Owner == Main.myPlayer)
{
switch (Type)
{
case 206:
projectile.ai[0] = (float) Main.rand.Next(-100, 101) * 0.0005f;
projectile.ai[1] = (float) Main.rand.Next(-100, 101) * 0.0005f;
break;
case 335:
projectile.ai[1] = (float) Main.rand.Next(4);
break;
case 358:
projectile.ai[1] = (float) Main.rand.Next(10, 31) * 0.1f;
break;
case 406:
projectile.ai[1] = (float) Main.rand.Next(10, 21) * 0.1f;
break;
default:
projectile.ai[0] = ai0;
projectile.ai[1] = ai1;
break;
}
}
if (Type == 434)
{
projectile.ai[0] = projectile.position.X;
projectile.ai[1] = projectile.position.Y;
}
if (Type > 0 && Type < 950)
{
if (ProjectileID.Sets.NeedsUUID[Type])
projectile.projUUID = projectile.identity;
if (ProjectileID.Sets.StardustDragon[Type])
{
int projUuid = Main.projectile[(int) projectile.ai[0]].projUUID;
if (projUuid >= 0)
projectile.ai[0] = (float) projUuid;
}
}
if (Main.netMode != 0 && Owner == Main.myPlayer)
NetMessage.SendData(27, number: number);
if (Owner == Main.myPlayer)
{
if (ProjectileID.Sets.IsAGolfBall[Type] && Damage <= 0)
{
int num1 = 0;
int index1 = 0;
int num2 = 99999999;
for (int index2 = 0; index2 < 1000; ++index2)
{
if (Main.projectile[index2].active && ProjectileID.Sets.IsAGolfBall[Main.projectile[index2].type] && Main.projectile[index2].owner == Owner && Main.projectile[index2].damage <= 0)
{
++num1;
if (num2 > Main.projectile[index2].timeLeft)
{
index1 = index2;
num2 = Main.projectile[index2].timeLeft;
}
}
}
if (num1 > 10)
Main.projectile[index1].Kill();
}
if (Type == 28)
projectile.timeLeft = 180;
if (Type == 516)
projectile.timeLeft = 180;
if (Type == 519)
projectile.timeLeft = 180;
if (Type == 29)
projectile.timeLeft = 300;
if (Type == 470)
projectile.timeLeft = 300;
if (Type == 637)
projectile.timeLeft = 300;
if (Type == 30)
projectile.timeLeft = 180;
if (Type == 517)
projectile.timeLeft = 180;
if (Type == 37)
projectile.timeLeft = 180;
if (Type == 773)
projectile.timeLeft = 180;
if (Type == 75)
projectile.timeLeft = 180;
if (Type == 133)
projectile.timeLeft = 180;
if (Type == 136)
projectile.timeLeft = 180;
if (Type == 139)
projectile.timeLeft = 180;
if (Type == 142)
projectile.timeLeft = 180;
if (Type == 397)
projectile.timeLeft = 180;
if (Type == 419)
projectile.timeLeft = 600;
if (Type == 420)
projectile.timeLeft = 600;
if (Type == 421)
projectile.timeLeft = 600;
if (Type == 422)
projectile.timeLeft = 600;
if (Type == 588)
projectile.timeLeft = 180;
if (Type == 779)
projectile.timeLeft = 60;
if (Type == 783)
projectile.timeLeft = 60;
if (Type == 862 || Type == 863)
projectile.timeLeft = 60;
if (Type == 443)
projectile.timeLeft = 300;
if (Type == 681)
projectile.timeLeft = 600;
if (Type == 684)
projectile.timeLeft = 60;
if (Type == 706)
projectile.timeLeft = 120;
if (Type == 680 && Main.player[projectile.owner].setSquireT2)
projectile.penetrate = 7;
if (Type == 777 || Type == 781 || Type == 794 || Type == 797 || Type == 800 || Type == 785 || Type == 788 || Type == 791 || Type == 903 || Type == 904 || Type == 905 || Type == 906 || Type == 910 || Type == 911)
projectile.timeLeft = 180;
}
if (Type == 249)
projectile.frame = Main.rand.Next(5);
return number;
}
public static Color GetGolfTrailColor(Projectile proj)
{
switch (proj.type)
{
case 739:
return new Color(50, 50, 50, 80);
case 740:
return new Color(30, 50, (int) byte.MaxValue, 40);
case 741:
return new Color(150, 90, 60, 90);
case 742:
return new Color(30, (int) byte.MaxValue, 170, 30);
case 743:
return new Color(30, (int) byte.MaxValue, 30, 40);
case 744:
return new Color(190, (int) byte.MaxValue, 30, 50);
case 745:
return new Color((int) byte.MaxValue, 130, 30, 50);
case 746:
return new Color((int) byte.MaxValue, 50, 110, 50);
case 747:
return new Color(130, 10, 200, 40);
case 748:
return new Color((int) byte.MaxValue, 30, 50, 50);
case 749:
return new Color(100, 180, (int) byte.MaxValue, 30);
case 750:
return new Color(50, 240, 160, 30);
case 751:
return new Color(220, 80, 220, 70);
case 752:
return new Color((int) byte.MaxValue, 180, 50, 30);
default:
return new Color(160, 160, (int) byte.MaxValue, 50);
}
}
public void StatusNPC(int i)
{
NPC npc = Main.npc[i];
if (this.melee && Main.player[this.owner].meleeEnchant > (byte) 0 && !this.noEnchantments)
{
int meleeEnchant = (int) Main.player[this.owner].meleeEnchant;
if (meleeEnchant == 1)
npc.AddBuff(70, 60 * Main.rand.Next(5, 10));
if (meleeEnchant == 2)
npc.AddBuff(39, 60 * Main.rand.Next(3, 7));
if (meleeEnchant == 3)
npc.AddBuff(24, 60 * Main.rand.Next(3, 7));
if (meleeEnchant == 5)
npc.AddBuff(69, 60 * Main.rand.Next(10, 20));
if (meleeEnchant == 6)
npc.AddBuff(31, 60 * Main.rand.Next(1, 4));
if (meleeEnchant == 8)
npc.AddBuff(20, 60 * Main.rand.Next(5, 10));
if (meleeEnchant == 4)
npc.AddBuff(72, 120);
}
if (this.type == 195)
{
if (Main.rand.Next(3) == 0)
npc.AddBuff(70, 60 * Main.rand.Next(5, 11));
else
npc.AddBuff(20, 60 * Main.rand.Next(10, 21));
}
switch (this.type)
{
case 841:
npc.AddBuff(307, 240);
break;
case 847:
npc.AddBuff(309, 240);
break;
case 848:
npc.AddBuff(319, 240);
break;
case 849:
npc.AddBuff(310, 240);
break;
case 913:
if ((double) this.localAI[0] == 0.0)
npc.AddBuff(313, 240);
npc.AddBuff(24, 240);
break;
case 914:
npc.AddBuff(20, 240);
npc.AddBuff(315, 240);
break;
case 915:
npc.AddBuff(316, 240);
break;
}
if (this.type == 664 && Main.rand.Next(3) == 0)
npc.AddBuff(24, 60 * Main.rand.Next(3, 6));
if (this.type == 666 && Main.rand.Next(2) == 0)
npc.AddBuff(24, 60 * Main.rand.Next(3, 9));
if (this.type == 668 && Main.rand.Next(3) != 0)
npc.AddBuff(24, 60 * Main.rand.Next(6, 9));
if (this.type == 567 || this.type == 568)
npc.AddBuff(20, 60 * Main.rand.Next(5, 11));
if (this.type == 598 && (double) this.ai[1] == (double) i)
npc.AddBuff(169, 900);
if (this.type == 636 && (double) this.ai[1] == (double) i)
npc.AddBuff(189, 300);
if (this.type == 611)
npc.AddBuff(189, 300);
if (this.type == 612)
npc.AddBuff(189, 300);
if (this.type == 711)
npc.AddBuff(203, 600);
if (this.type == 706)
npc.AddBuff(24, 480);
if (this.type == 614 && (double) this.ai[1] == (double) i)
npc.AddBuff(183, 900);
if (this.type == 585)
npc.AddBuff(153, 60 * Main.rand.Next(5, 11));
if (this.type == 583)
npc.AddBuff(20, 60 * Main.rand.Next(3, 6));
if (this.type == 524)
npc.AddBuff(69, 60 * Main.rand.Next(3, 8));
if (this.type == 504 && Main.rand.Next(2) == 0)
{
if (Main.rand.Next(3) == 0)
npc.AddBuff(24, Main.rand.Next(60, 180));
else
npc.AddBuff(24, Main.rand.Next(30, 120));
}
if ((this.type == 694 || this.type == 695 || this.type == 696) && Main.player[this.owner].setHuntressT2 && Main.rand.Next(2) == 0)
npc.AddBuff(204, Main.rand.Next(8, 18) * 30);
if (this.type == 545 && Main.rand.Next(3) == 0)
npc.AddBuff(24, Main.rand.Next(60, 240));
if (this.type == 553)
npc.AddBuff(24, Main.rand.Next(180, 480));
if (this.type == 552 && Main.rand.Next(3) != 0)
npc.AddBuff(44, Main.rand.Next(120, 320));
if (this.type == 495)
npc.AddBuff(153, Main.rand.Next(120, 300));
if (this.type == 497)
npc.AddBuff(153, Main.rand.Next(60, 180));
if (this.type == 496)
npc.AddBuff(153, Main.rand.Next(240, 480));
if (this.type == 476)
npc.AddBuff(151, 30);
if (this.type == 523)
npc.AddBuff(20, 60 * Main.rand.Next(10, 30));
if (this.type == 478 || this.type == 480)
npc.AddBuff(39, 60 * Main.rand.Next(3, 7));
if (this.type == 479)
npc.AddBuff(69, 60 * Main.rand.Next(7, 15));
if (this.type == 379)
npc.AddBuff(70, 60 * Main.rand.Next(2, 5));
if (this.type >= 390 && this.type <= 392)
npc.AddBuff(70, 60 * Main.rand.Next(2, 5));
if (this.type == 374)
npc.AddBuff(20, 60 * Main.rand.Next(4, 7));
if (this.type == 376)
npc.AddBuff(24, 60 * Main.rand.Next(3, 7));
if (this.type >= 399 && this.type <= 402)
npc.AddBuff(24, 60 * Main.rand.Next(3, 7));
if (this.type == 295 || this.type == 296)
npc.AddBuff(24, 60 * Main.rand.Next(8, 16));
if ((this.melee || this.ranged) && !this.npcProj && Main.player[this.owner].frostBurn && !this.noEnchantments)
npc.AddBuff(44, 60 * Main.rand.Next(5, 15));
if (this.melee && Main.player[this.owner].magmaStone && !this.noEnchantments)
{
if (Main.rand.Next(7) == 0)
npc.AddBuff(24, 360);
else if (Main.rand.Next(3) == 0)
npc.AddBuff(24, 120);
else
npc.AddBuff(24, 60);
}
if (this.type == 287)
npc.AddBuff(72, 120);
if (this.type == 285)
{
if (Main.rand.Next(3) == 0)
npc.AddBuff(31, 180);
else
npc.AddBuff(31, 60);
}
if (this.type == 2 && Main.rand.Next(3) == 0)
npc.AddBuff(24, 180);
if (this.type == 172)
{
if (Main.rand.Next(3) == 0)
npc.AddBuff(44, 180);
}
else if (this.type == 15)
{
if (Main.rand.Next(2) == 0)
npc.AddBuff(24, 300);
}
else if (this.type == 253)
npc.AddBuff(44, 480);
else if (this.type == 19)
{
if (Main.rand.Next(5) == 0)
npc.AddBuff(24, 180);
}
else if (this.type == 33)
{
if (Main.rand.Next(5) == 0)
npc.AddBuff(20, 420);
}
else if (this.type == 34)
{
if (Main.rand.Next(2) == 0)
npc.AddBuff(24, Main.rand.Next(240, 480));
}
else if (this.type == 948)
{
if (Main.rand.Next(6) == 0)
npc.AddBuff(24, 60 * Main.rand.Next(2, 4));
}
else if (this.type == 35)
{
if (Main.rand.Next(2) == 0)
npc.AddBuff(24, 300);
}
else if (this.type == 54)
{
if (Main.rand.Next(2) == 0)
npc.AddBuff(20, 600);
}
else if (this.type == 267)
{
if (Main.rand.Next(3) == 0)
npc.AddBuff(20, 3600);
else
npc.AddBuff(20, 1800);
}
else if (this.type == 63)
{
if (Main.rand.Next(5) != 0)
npc.AddBuff(31, 60 * Main.rand.Next(2, 5));
}
else if (this.type == 85 || this.type == 188)
npc.AddBuff(24, 1200);
else if (this.type == 95 || this.type == 103 || this.type == 104 || this.type == 482)
npc.AddBuff(39, 420);
else if (this.type == 278 || this.type == 279 || this.type == 280)
npc.AddBuff(69, 600);
else if (this.type == 282 || this.type == 283)
npc.AddBuff(70, 600);
if (this.type == 163 || this.type == 310)
{
if (Main.rand.Next(3) == 0)
npc.AddBuff(24, 600);
else
npc.AddBuff(24, 300);
}
else if (this.type == 98)
npc.AddBuff(20, 600);
else if (this.type == 184)
npc.AddBuff(20, 900);
else if (this.type == 265)
{
npc.AddBuff(20, 1800);
}
else
{
if (this.type != 355)
return;
npc.AddBuff(70, 1800);
}
}
public void StatusPvP(int i)
{
if (this.melee && Main.player[this.owner].meleeEnchant > (byte) 0 && !this.noEnchantments)
{
int meleeEnchant = (int) Main.player[this.owner].meleeEnchant;
if (meleeEnchant == 1)
Main.player[i].AddBuff(70, 60 * Main.rand.Next(5, 10), false);
if (meleeEnchant == 2)
Main.player[i].AddBuff(39, 60 * Main.rand.Next(3, 7), false);
if (meleeEnchant == 3)
Main.player[i].AddBuff(24, 60 * Main.rand.Next(3, 7), false);
if (meleeEnchant == 5)
Main.player[i].AddBuff(69, 60 * Main.rand.Next(10, 20), false);
if (meleeEnchant == 6)
Main.player[i].AddBuff(31, 60 * Main.rand.Next(1, 4), false);
if (meleeEnchant == 8)
Main.player[i].AddBuff(20, 60 * Main.rand.Next(5, 10), false);
}
if (this.type == 295 || this.type == 296)
Main.player[i].AddBuff(24, 60 * Main.rand.Next(8, 16), false);
if (this.type >= 399 && this.type <= 402)
Main.player[i].AddBuff(24, 60 * Main.rand.Next(3, 7), false);
if (this.type == 478 || this.type == 480)
Main.player[i].AddBuff(39, 60 * Main.rand.Next(3, 7), false);
if ((this.melee || this.ranged) && Main.player[this.owner].frostBurn && !this.noEnchantments)
Main.player[i].AddBuff(44, 60 * Main.rand.Next(1, 8), false);
if (this.melee && Main.player[this.owner].magmaStone && !this.noEnchantments)
{
if (Main.rand.Next(4) == 0)
Main.player[i].AddBuff(24, 360, false);
else if (Main.rand.Next(2) == 0)
Main.player[i].AddBuff(24, 240, false);
else
Main.player[i].AddBuff(24, 120, false);
}
if (this.type == 2 && Main.rand.Next(3) == 0)
Main.player[i].AddBuff(24, 180, false);
if (this.type == 172)
{
if (Main.rand.Next(3) == 0)
Main.player[i].AddBuff(44, 240, false);
}
else if (this.type == 15)
{
if (Main.rand.Next(2) == 0)
Main.player[i].AddBuff(24, 300, false);
}
else if (this.type == 253)
{
if (Main.rand.Next(2) == 0)
Main.player[i].AddBuff(44, 480, false);
}
else if (this.type == 19)
{
if (Main.rand.Next(5) == 0)
Main.player[i].AddBuff(24, 180, false);
}
else if (this.type == 33)
{
if (Main.rand.Next(5) == 0)
Main.player[i].AddBuff(20, 420, false);
}
else if (this.type == 34)
{
if (Main.rand.Next(2) == 0)
Main.player[i].AddBuff(24, 240, false);
}
else if (this.type == 35)
{
if (Main.rand.Next(4) == 0)
Main.player[i].AddBuff(24, 180, false);
}
else if (this.type == 54)
{
if (Main.rand.Next(2) == 0)
Main.player[i].AddBuff(20, 600, false);
}
else if (this.type == 267)
{
if (Main.rand.Next(3) == 0)
Main.player[i].AddBuff(20, 3600, false);
else
Main.player[i].AddBuff(20, 1800, false);
}
else if (this.type == 63)
{
if (Main.rand.Next(3) != 0)
Main.player[i].AddBuff(31, 120, false);
}
else if (this.type == 85 || this.type == 188)
Main.player[i].AddBuff(24, 1200, false);
else if (this.type == 95 || this.type == 103 || this.type == 104 || this.type == 482)
Main.player[i].AddBuff(39, 420, false);
else if (this.type == 278 || this.type == 279 || this.type == 280)
Main.player[i].AddBuff(69, 900, false);
else if (this.type == 282 || this.type == 283)
Main.player[i].AddBuff(70, 600, false);
if (this.type == 163 || this.type == 310)
{
if (Main.rand.Next(3) == 0)
Main.player[i].AddBuff(24, 600, false);
else
Main.player[i].AddBuff(24, 300, false);
}
else if (this.type == 265)
{
Main.player[i].AddBuff(20, 1200, false);
}
else
{
if (this.type != 355)
return;
Main.player[i].AddBuff(70, 1800, false);
}
}
public void ghostHurt(int dmg, Vector2 Position)
{
if (!this.magic || this.damage <= 0)
return;
int damage = this.damage;
if (dmg <= 1)
return;
int num1 = 1000;
if ((double) Main.player[Main.myPlayer].ghostDmg > (double) num1)
return;
Main.player[Main.myPlayer].ghostDmg += (float) damage;
int[] numArray1 = new int[200];
int maxValue1 = 0;
int[] numArray2 = new int[200];
int maxValue2 = 0;
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].CanBeChasedBy((object) this))
{
float num2 = Math.Abs(Main.npc[index].position.X + (float) (Main.npc[index].width / 2) - this.position.X + (float) (this.width / 2)) + Math.Abs(Main.npc[index].position.Y + (float) (Main.npc[index].height / 2) - this.position.Y + (float) (this.height / 2));
if ((double) num2 < 800.0)
{
if (Collision.CanHit(this.position, 1, 1, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height) && (double) num2 > 50.0)
{
numArray1[maxValue2] = index;
++maxValue2;
}
else if (maxValue2 == 0)
{
numArray1[maxValue1] = index;
++maxValue1;
}
}
}
}
if (maxValue1 == 0 && maxValue2 == 0)
return;
int num3 = maxValue2 <= 0 ? numArray1[Main.rand.Next(maxValue1)] : numArray1[Main.rand.Next(maxValue2)];
float num4 = (float) Main.rand.Next(-100, 101);
float num5 = (float) Main.rand.Next(-100, 101);
float num6 = (float) (4.0 / Math.Sqrt((double) num4 * (double) num4 + (double) num5 * (double) num5));
float SpeedX = num4 * num6;
float SpeedY = num5 * num6;
Projectile.NewProjectile(Position.X, Position.Y, SpeedX, SpeedY, 356, damage, 0.0f, this.owner, (float) num3);
}
public void ghostHeal(int dmg, Vector2 Position)
{
float num1 = 0.2f - (float) this.numHits * 0.05f;
if ((double) num1 <= 0.0)
return;
float ai1 = (float) dmg * num1;
if ((int) ai1 <= 0 || (double) Main.player[Main.myPlayer].lifeSteal <= 0.0)
return;
Main.player[Main.myPlayer].lifeSteal -= ai1;
if (!this.magic)
return;
float num2 = 0.0f;
int num3 = this.owner;
for (int index = 0; index < (int) byte.MaxValue; ++index)
{
if (Main.player[index].active && !Main.player[index].dead && (!Main.player[this.owner].hostile && !Main.player[index].hostile || Main.player[this.owner].team == Main.player[index].team) && (double) Math.Abs(Main.player[index].position.X + (float) (Main.player[index].width / 2) - this.position.X + (float) (this.width / 2)) + (double) Math.Abs(Main.player[index].position.Y + (float) (Main.player[index].height / 2) - this.position.Y + (float) (this.height / 2)) < 1200.0 && (double) (Main.player[index].statLifeMax2 - Main.player[index].statLife) > (double) num2)
{
num2 = (float) (Main.player[index].statLifeMax2 - Main.player[index].statLife);
num3 = index;
}
}
Projectile.NewProjectile(Position.X, Position.Y, 0.0f, 0.0f, 298, 0, 0.0f, this.owner, (float) num3, ai1);
}
public void vampireHeal(int dmg, Vector2 Position)
{
float ai1 = (float) dmg * 0.075f;
if ((int) ai1 == 0 || (double) Main.player[Main.myPlayer].lifeSteal <= 0.0)
return;
Main.player[Main.myPlayer].lifeSteal -= ai1;
int owner = this.owner;
Projectile.NewProjectile(Position.X, Position.Y, 0.0f, 0.0f, 305, 0, 0.0f, this.owner, (float) owner, ai1);
}
public void StatusPlayer(int i)
{
if (Main.player[i].creativeGodMode)
return;
if (this.type == 472)
Main.player[i].AddBuff(149, Main.rand.Next(30, 150));
if (this.type == 467)
Main.player[i].AddBuff(24, Main.rand.Next(30, 150));
if (this.type == 581)
{
if (Main.expertMode)
Main.player[i].AddBuff(164, Main.rand.Next(300, 540));
else if (Main.rand.Next(2) == 0)
Main.player[i].AddBuff(164, Main.rand.Next(360, 720));
}
if (this.type == 687)
Main.player[i].AddBuff(24, 60 * Main.rand.Next(7, 11));
if (this.type == 258 && Main.rand.Next(2) == 0)
Main.player[i].AddBuff(24, 60 * Main.rand.Next(5, 8));
if (this.type == 572 && Main.rand.Next(3) != 0)
Main.player[i].AddBuff(20, Main.rand.Next(120, 240));
if (this.type == 276)
{
if (Main.expertMode)
Main.player[i].AddBuff(20, Main.rand.Next(120, 540));
else if (Main.rand.Next(2) == 0)
Main.player[i].AddBuff(20, Main.rand.Next(180, 420));
}
if (this.type == 436 && Main.rand.Next(5) >= 2)
Main.player[i].AddBuff(31, 300);
if (this.type == 435 && Main.rand.Next(3) != 0)
Main.player[i].AddBuff(144, 300);
if (this.type == 682)
Main.player[i].AddBuff(196, 300);
if (this.type == 437)
Main.player[i].AddBuff(144, 60 * Main.rand.Next(4, 9));
if (this.type == 348)
{
if (Main.rand.Next(2) == 0)
Main.player[i].AddBuff(46, 600);
else
Main.player[i].AddBuff(46, 300);
if (Main.rand.Next(3) != 0)
{
if (Main.rand.Next(16) == 0)
Main.player[i].AddBuff(47, 60);
else if (Main.rand.Next(12) == 0)
Main.player[i].AddBuff(47, 40);
else if (Main.rand.Next(8) == 0)
Main.player[i].AddBuff(47, 20);
}
}
if (this.type == 349)
{
if (Main.rand.Next(3) == 0)
Main.player[i].AddBuff(46, 600);
else if (Main.rand.Next(2) == 0)
Main.player[i].AddBuff(46, 300);
}
if (this.type >= 399 && this.type <= 402 && !this.hostile)
Main.player[i].AddBuff(24, 60 * Main.rand.Next(3, 7));
if (this.type == 55 || this.type == 719)
{
if (Main.rand.Next(3) == 0)
Main.player[i].AddBuff(20, 600);
else if (Main.expertMode)
Main.player[i].AddBuff(20, Main.rand.Next(60, 300));
}
if (this.type == 44 && Main.rand.Next(3) == 0)
Main.player[i].AddBuff(22, 900);
if (this.type == 293)
Main.player[i].AddBuff(80, 60 * Main.rand.Next(2, 7));
if (this.type == 299)
Main.player[i].AddBuff(23, 240);
if (this.type == 82 && Main.rand.Next(3) == 0)
Main.player[i].AddBuff(24, 420);
if (this.type == 285 && !this.hostile)
{
if (Main.rand.Next(3) == 0)
Main.player[i].AddBuff(31, 180);
else
Main.player[i].AddBuff(31, 60);
}
if (this.type == 96 || this.type == 101)
{
if (Main.rand.Next(6) == 0)
Main.player[i].AddBuff(39, 180);
else if (Main.rand.Next(4) == 0)
Main.player[i].AddBuff(39, 180);
else if (Main.rand.Next(2) == 0)
Main.player[i].AddBuff(39, 120);
}
else if (this.type == 288)
Main.player[i].AddBuff(69, 900);
else if (this.type == 253 && !this.hostile)
Main.player[i].AddBuff(44, 600);
if (this.type == 291 || this.type == 292)
Main.player[i].AddBuff(24, 60 * Main.rand.Next(8, 16));
if (this.type == 98)
Main.player[i].AddBuff(20, 600);
if (this.type == 184)
Main.player[i].AddBuff(20, 900);
if (this.type == 290)
Main.player[i].AddBuff(32, 60 * Main.rand.Next(5, 16));
if (this.type == 174)
{
Main.player[i].AddBuff(46, 1200);
if (!Main.player[i].frozen && Main.rand.Next(20) == 0)
Main.player[i].AddBuff(47, 90);
else if (!Main.player[i].frozen && Main.expertMode && Main.rand.Next(20) == 0)
Main.player[i].AddBuff(47, 60);
}
if (this.type == 257)
{
Main.player[i].AddBuff(46, 2700);
if (!Main.player[i].frozen && Main.rand.Next(5) == 0)
Main.player[i].AddBuff(47, 60);
}
if (this.type == 177)
{
Main.player[i].AddBuff(46, 1500);
if (!Main.player[i].frozen && Main.rand.Next(10) == 0)
Main.player[i].AddBuff(47, Main.rand.Next(30, 120));
}
if (this.type != 176)
return;
if (Main.rand.Next(4) == 0)
{
Main.player[i].AddBuff(20, 1200);
}
else
{
if (Main.rand.Next(2) != 0)
return;
Main.player[i].AddBuff(20, 300);
}
}
public bool CanHitWithMeleeWeapon(Entity ent)
{
if ((double) this.Distance(ent.Center) > (double) this.ownerHitCheckDistance)
return false;
return Collision.CanHit(Main.player[this.owner].position, Main.player[this.owner].width, Main.player[this.owner].height, ent.position, ent.width, ent.height) || Collision.CanHitLine(Main.player[this.owner].Center + new Vector2((float) (Main.player[this.owner].direction * Main.player[this.owner].width / 2), (float) ((double) Main.player[this.owner].gravDir * (double) -Main.player[this.owner].height / 3.0)), 0, 0, ent.Center + new Vector2(0.0f, (float) (-ent.height / 3)), 0, 0) || Collision.CanHitLine(Main.player[this.owner].Center + new Vector2((float) (Main.player[this.owner].direction * Main.player[this.owner].width / 2), (float) ((double) Main.player[this.owner].gravDir * (double) -Main.player[this.owner].height / 3.0)), 0, 0, ent.Center, 0, 0) || Collision.CanHitLine(Main.player[this.owner].Center + new Vector2((float) (Main.player[this.owner].direction * Main.player[this.owner].width / 2), 0.0f), 0, 0, ent.Center + new Vector2(0.0f, (float) (ent.height / 3)), 0, 0);
}
public bool CanHitWithOwnBody(Entity ent)
{
if ((double) this.Distance(ent.Center) > (double) this.ownerHitCheckDistance)
return false;
bool flag = Collision.CanHit(this.position, this.width, this.height, ent.position, ent.width, ent.height) || Collision.CanHitLine(this.Center + new Vector2((float) (this.direction * this.width / 2), (float) (-this.height / 3)), 0, 0, ent.Center + new Vector2(0.0f, (float) (-ent.height / 3)), 0, 0) || Collision.CanHitLine(this.Center + new Vector2((float) (this.direction * this.width / 2), (float) (-this.height / 3)), 0, 0, ent.Center, 0, 0) || Collision.CanHitLine(this.Center + new Vector2((float) (this.direction * this.width / 2), 0.0f), 0, 0, ent.Center + new Vector2(0.0f, (float) (ent.height / 3)), 0, 0);
float num = ProjectileID.Sets.ExtendedCanHitCheckRange[this.type];
if ((double) num != 0.0 && !flag)
{
GenSearch search = ProjectileID.Sets.ExtendedCanHitCheckSearch[this.type];
Vector2 Position1 = this.Top + new Vector2(0.0f, -num);
Vector2 Position2 = ent.Top + new Vector2(0.0f, -num);
if (search != null)
{
Point result;
if (WorldUtils.Find(this.Top.ToTileCoordinates(), Searches.Chain(search, (GenCondition) Projectile._cachedConditions_notNull, (GenCondition) Projectile._cachedConditions_solid), out result))
Position1 = result.ToWorldCoordinates();
if (WorldUtils.Find(ent.Top.ToTileCoordinates(), Searches.Chain(search, (GenCondition) Projectile._cachedConditions_notNull, (GenCondition) Projectile._cachedConditions_solid), out result))
Position2 = result.ToWorldCoordinates();
}
flag |= Collision.CanHitLine(Position1, 0, 0, Position2, 0, 0);
}
return flag;
}
public void Damage()
{
if (this.type == 18 || this.type == 72 || this.type == 86 || this.type == 87 || this.aiStyle == 31 || this.aiStyle == 32 || this.type == 226 || this.type == 378 || this.type == 613 || this.type == 650 || this.type == 882 || this.type == 888 || this.type == 895 || this.type == 896 || this.type == 434 && (double) this.localAI[0] != 0.0 || this.type == 439 || this.type == 444 || this.type == 451 && ((int) ((double) this.ai[0] - 1.0) / this.penetrate == 0 || (double) this.ai[1] < 5.0) && (double) this.ai[0] != 0.0 || this.type == 500 || this.type == 653 || this.type == 460 || this.type == 633 || this.type == 600 || this.type == 601 || this.type == 602 || this.type == 535 || this.type == 631 && (double) this.localAI[1] == 0.0 || this.type == 651 || this.type == 188 && (double) this.localAI[0] < 5.0 || this.aiStyle == 137 && (double) this.ai[0] != 0.0 || this.aiStyle == 138 || this.type == 261 && (double) this.velocity.Length() < 1.5 || this.type == 818 && (double) this.ai[0] < 1.0 || this.type == 831 || this.type == 833 && (double) this.ai[0] == 4.0 || this.type == 834 && (double) this.ai[0] == 4.0 || this.type == 835 && (double) this.ai[0] == 4.0 || this.type == 281 && (double) this.ai[0] == -3.0 || this.type == 923 && (double) this.localAI[0] <= 60.0 || this.type == 919 && (double) this.localAI[0] <= 60.0 || this.aiStyle == 15 && (double) this.ai[0] == 0.0 && (double) this.localAI[1] <= 12.0 || this.type == 861 || this.aiStyle == 93 && (double) this.ai[0] != 0.0 && (double) this.ai[0] != 2.0 || this.aiStyle == 10 && (double) this.localAI[1] == -1.0 || Main.projPet[this.type] && this.type != 266 && this.type != 407 && this.type != 317 && (this.type != 388 || (double) this.ai[0] != 2.0) && (this.type < 390 || this.type > 392) && (this.type < 393 || this.type > 395) && (this.type != 533 || (double) this.ai[0] < 6.0 || (double) this.ai[0] > 8.0) && (this.type < 625 || this.type > 628) && (this.type != 755 || (double) this.ai[0] == 0.0) && (this.type != 946 || (double) this.ai[0] == 0.0) && this.type != 758 && (this.type != 759 || this.frame == Main.projFrames[this.type] - 1) && this.type != 833 && this.type != 834 && this.type != 835 && this.type != 864 && (this.type != 623 || (double) this.ai[0] != 2.0))
return;
Microsoft.Xna.Framework.Rectangle myRect = new Microsoft.Xna.Framework.Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height);
if (this.type == 85 || this.type == 101)
{
int num = 30;
myRect.X -= num;
myRect.Y -= num;
myRect.Width += num * 2;
myRect.Height += num * 2;
}
if (this.type == 188)
{
int num = 20;
myRect.X -= num;
myRect.Y -= num;
myRect.Width += num * 2;
myRect.Height += num * 2;
}
if (this.aiStyle == 29)
{
int num = 4;
myRect.X -= num;
myRect.Y -= num;
myRect.Width += num * 2;
myRect.Height += num * 2;
}
if (this.friendly && this.owner == Main.myPlayer && !this.npcProj)
{
if (this.aiStyle == 16 && !ProjectileID.Sets.RocketsSkipDamageForPlayers[this.type] && (this.timeLeft <= 1 || this.type == 108 || this.type == 164) || this.type == 286 && (double) this.localAI[1] == -1.0)
{
int player = Main.myPlayer;
if (Main.player[player].active && !Main.player[player].dead && !Main.player[player].immune && (!this.ownerHitCheck || this.CanHitWithMeleeWeapon((Entity) Main.player[player])))
{
Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) Main.player[player].position.X, (int) Main.player[player].position.Y, Main.player[player].width, Main.player[player].height);
if (myRect.Intersects(rectangle))
{
if ((double) Main.player[player].position.X + (double) (Main.player[player].width / 2) < (double) this.position.X + (double) (this.width / 2))
this.direction = -1;
else
this.direction = 1;
int Damage = Main.DamageVar((float) this.damage, -Main.player[player].luck);
this.StatusPlayer(player);
int playerIndex = this.owner;
bool pvp = true;
if (this.type == 108)
{
playerIndex = -1;
pvp = false;
}
Main.player[player].Hurt(PlayerDeathReason.ByProjectile(playerIndex, this.whoAmI), Damage, this.direction, pvp);
if (this.trap)
{
Main.player[player].trapDebuffSource = true;
if (Main.player[player].dead)
AchievementsHelper.HandleSpecialEvent(Main.player[player], 4);
}
}
}
}
if (!this.minion)
this.CutTiles();
}
if (this.owner == Main.myPlayer)
{
float num1 = 1f;
if (ProjectileID.Sets.IsARocketThatDealsDoubleDamageToPrimaryEnemy[this.type] && this.timeLeft > 3)
num1 *= 2f;
if (ProjectileID.Sets.IsAMineThatDealsTripleDamageWhenStationary[this.type] && (double) this.velocity.Length() < 0.5)
num1 *= 3f;
if (this.type == 34 && this.penetrate == 1)
num1 *= 1f;
if (this.aiStyle == 15 && (double) this.ai[0] == 0.0)
num1 *= 1.2f;
if (this.aiStyle == 15 && ((double) this.ai[0] == 1.0 || (double) this.ai[0] == 2.0))
num1 *= 2f;
if (this.type == 877 || this.type == 879 || this.type == 878)
num1 = (float) (0.100000001490116 + (double) Main.player[this.owner].velocity.Length() / 7.0 * 0.899999976158142);
if (this.damage > 0)
{
int[] localNpcImmunity = this.localNPCImmunity;
if (this.type == 626 || this.type == 627 || this.type == 628)
{
Projectile dragonHeadOfOwner = this.FindStardustDragonHeadOfOwner();
if (dragonHeadOfOwner != null)
localNpcImmunity = dragonHeadOfOwner.localNPCImmunity;
}
for (int index1 = 0; index1 < 200; ++index1)
{
bool flag1 = !this.usesLocalNPCImmunity && !this.usesIDStaticNPCImmunity || this.usesLocalNPCImmunity && localNpcImmunity[index1] == 0 || this.usesIDStaticNPCImmunity && Projectile.IsNPCIndexImmuneToProjectileType(this.type, index1);
if (((!Main.npc[index1].active ? 0 : (!Main.npc[index1].dontTakeDamage ? 1 : 0)) & (flag1 ? 1 : 0)) != 0 && (Main.npc[index1].aiStyle != 112 || (double) Main.npc[index1].ai[2] <= 1.0))
{
NPC npc1 = Main.npc[index1];
npc1.position = npc1.position + Main.npc[index1].netOffset;
bool flag2 = ((((!Main.npc[index1].friendly | this.type == 318 ? 1 : 0) | (Main.npc[index1].type != 22 || this.owner >= (int) byte.MaxValue ? 0 : (Main.player[this.owner].killGuide ? 1 : 0))) != 0 ? 1 : 0) | (Main.npc[index1].type != 54 || this.owner >= (int) byte.MaxValue ? 0 : (Main.player[this.owner].killClothier ? 1 : 0))) != 0;
if (this.owner < (int) byte.MaxValue && !Main.player[this.owner].CanNPCBeHitByPlayerOrPlayerProjectile(Main.npc[index1]))
flag2 = false;
bool flag3 = Main.npc[index1].friendly && !Main.npc[index1].dontTakeDamageFromHostiles;
if ((this.friendly & flag2 || this.hostile & flag3) && (this.owner < 0 || Main.npc[index1].immune[this.owner] == 0 || this.maxPenetrate == 1))
{
bool flag4 = false;
if (this.type == 11 && (Main.npc[index1].type == 47 || Main.npc[index1].type == 57))
flag4 = true;
else if (this.type == 31 && Main.npc[index1].type == 69)
flag4 = true;
else if (Main.npc[index1].trapImmune && this.trap)
flag4 = true;
else if (Main.npc[index1].immortal && this.npcProj)
flag4 = true;
if (!flag4 && (Main.npc[index1].noTileCollide || !this.ownerHitCheck || this.CanHitWithMeleeWeapon((Entity) Main.npc[index1])))
{
bool flag5;
if (Main.npc[index1].type == 414)
{
Microsoft.Xna.Framework.Rectangle rect = Main.npc[index1].getRect();
int num2 = 8;
rect.X -= num2;
rect.Y -= num2;
rect.Width += num2 * 2;
rect.Height += num2 * 2;
flag5 = this.Colliding(myRect, rect);
}
else
flag5 = this.Colliding(myRect, Main.npc[index1].getRect());
if (flag5)
{
if (this.type == 876)
{
Vector2 position1 = this.position;
if (Main.rand.Next(20) == 0)
{
this.tileCollide = false;
this.position.X += (float) Main.rand.Next(-256, 257);
}
if (Main.rand.Next(20) == 0)
{
this.tileCollide = false;
this.position.Y += (float) Main.rand.Next(-256, 257);
}
if (Main.rand.Next(2) == 0)
this.tileCollide = false;
if (Main.rand.Next(3) != 0)
{
Vector2 position2 = this.position;
this.position = this.position - this.velocity * (float) Main.rand.Next(0, 40);
if (this.tileCollide && Collision.SolidTiles(this.position, this.width, this.height))
{
this.position = position2;
this.position = this.position - this.velocity * (float) Main.rand.Next(0, 40);
if (this.tileCollide && Collision.SolidTiles(this.position, this.width, this.height))
this.position = position2;
}
}
this.velocity = this.velocity * 0.6f;
if (Main.rand.Next(7) == 0)
this.velocity.X += (float) Main.rand.Next(30, 31) * 0.01f;
if (Main.rand.Next(7) == 0)
this.velocity.Y += (float) Main.rand.Next(30, 31) * 0.01f;
this.damage = (int) ((double) this.damage * 0.9);
this.knockBack *= 0.9f;
if (Main.rand.Next(20) == 0)
this.knockBack *= 10f;
if (Main.rand.Next(50) == 0)
this.damage *= 10;
if (Main.rand.Next(7) == 0)
{
Vector2 position3 = this.position;
this.position.X += (float) Main.rand.Next(-64, 65);
if (this.tileCollide && Collision.SolidTiles(this.position, this.width, this.height))
this.position = position3;
}
if (Main.rand.Next(7) == 0)
{
Vector2 position4 = this.position;
this.position.Y += (float) Main.rand.Next(-64, 65);
if (this.tileCollide && Collision.SolidTiles(this.position, this.width, this.height))
this.position = position4;
}
if (Main.rand.Next(14) == 0)
this.velocity.X *= -1f;
if (Main.rand.Next(14) == 0)
this.velocity.Y *= -1f;
if (Main.rand.Next(10) == 0)
this.velocity = this.velocity * ((float) Main.rand.Next(1, 201) * 0.0005f);
this.ai[1] = !this.tileCollide ? 1f : 0.0f;
this.netUpdate = true;
}
NPC targetNPC = Main.npc[index1];
if (targetNPC.reflectsProjectiles && this.CanBeReflected() && targetNPC.CanReflectProjectile(this))
{
targetNPC.ReflectProjectile(this);
NPC npc2 = Main.npc[index1];
npc2.position = npc2.position - Main.npc[index1].netOffset;
return;
}
if (this.type == 604)
Main.player[this.owner].Counterweight(targetNPC.Center, this.damage, this.knockBack);
float knockBack = this.knockBack;
bool crit = false;
int armorPenetration = Main.player[this.owner].armorPenetration;
bool flag6 = !this.npcProj && !this.trap;
switch (this.type)
{
case 864:
armorPenetration += 25;
break;
case 877:
case 878:
case 879:
knockBack *= Main.player[this.owner].velocity.Length() / 7f;
break;
case 916:
armorPenetration += 50;
break;
case 917:
armorPenetration += 30;
break;
}
int num3 = (int) ((double) this.damage * (double) num1);
if (this.type > 0 && this.type < 950 && ProjectileID.Sets.StardustDragon[this.type])
{
float num4 = Utils.Clamp<float>((float) (((double) this.scale - 1.0) * 100.0), 0.0f, 50f);
num3 = (int) ((double) num3 * (1.0 + (double) num4 * 0.230000004172325));
}
if (this.type > 0 && this.type < 950 && ProjectileID.Sets.StormTiger[this.type])
{
int num5 = Math.Max(0, Main.player[this.owner].ownedProjectileCounts[831] - 1);
num3 = (int) ((double) num3 * (1.0 + (double) num5 * 0.333333343267441));
}
if (this.type == 818)
{
int num6 = Math.Max(0, Main.player[this.owner].ownedProjectileCounts[831] - 1);
num3 = (int) ((double) num3 * (1.5 + (double) num6 * 0.333333343267441));
}
if (flag6)
{
if (this.melee && Main.rand.Next(1, 101) <= Main.player[this.owner].meleeCrit)
crit = true;
if (this.ranged && Main.rand.Next(1, 101) <= Main.player[this.owner].rangedCrit)
crit = true;
if (this.magic && Main.rand.Next(1, 101) <= Main.player[this.owner].magicCrit)
crit = true;
switch (this.type)
{
case 688:
case 689:
case 690:
if (Main.player[this.owner].setMonkT3)
{
if (Main.rand.Next(4) == 0)
{
crit = true;
break;
}
break;
}
if (Main.player[this.owner].setMonkT2 && Main.rand.Next(6) == 0)
{
crit = true;
break;
}
break;
}
}
if (flag6 && (this.minion || ProjectileID.Sets.MinionShot[this.type]))
{
bool flag7 = false;
bool flag8 = false;
bool flag9 = false;
bool flag10 = false;
bool flag11 = false;
bool flag12 = false;
bool flag13 = false;
for (int index2 = 0; index2 < 5; ++index2)
{
if (targetNPC.buffTime[index2] >= 1)
{
switch (targetNPC.buffType[index2])
{
case 307:
flag7 = true;
continue;
case 309:
flag8 = true;
continue;
case 310:
flag10 = true;
continue;
case 313:
flag9 = true;
continue;
case 315:
flag11 = true;
continue;
case 316:
flag13 = true;
continue;
case 319:
flag12 = true;
continue;
default:
continue;
}
}
}
if (flag7)
num3 += 4;
if (flag11)
num3 += 6;
if (flag8)
num3 += 9;
if (flag12)
{
num3 += 5;
if (Main.rand.Next(20) == 0)
crit = true;
}
if (flag10)
{
int Damage = 10;
int index3 = Projectile.NewProjectile(targetNPC.Center, Vector2.Zero, 916, Damage, 0.0f, this.owner);
Main.projectile[index3].localNPCImmunity[index1] = -1;
Projectile.EmitBlackLightningParticles(targetNPC);
}
if (flag13)
{
int num7 = 20;
num3 += num7;
if (Main.rand.Next(10) == 0)
crit = true;
ParticleOrchestrator.RequestParticleSpawn(false, ParticleOrchestraType.RainbowRodHit, new ParticleOrchestraSettings()
{
PositionInWorld = this.Center
});
}
if (flag9)
{
targetNPC.RequestBuffRemoval(313);
int Damage = (int) ((double) num3 * 2.0);
int index4 = Projectile.NewProjectile(targetNPC.Center, Vector2.Zero, 918, Damage, 0.0f, this.owner);
Main.projectile[index4].localNPCImmunity[index1] = -1;
num3 += Damage;
}
}
int Damage1 = !flag6 ? Main.DamageVar((float) num3) : Main.DamageVar((float) num3, Main.player[this.owner].luck);
if (this.trap && NPCID.Sets.BelongsToInvasionOldOnesArmy[targetNPC.type])
Damage1 /= 2;
if (this.type == 482 && (targetNPC.aiStyle == 6 || targetNPC.aiStyle == 37))
Damage1 /= 2;
if (this.type == 604)
{
this.friendly = false;
this.ai[1] = 1000f;
}
if ((this.type == 400 || this.type == 401 || this.type == 402) && targetNPC.type >= 13 && targetNPC.type <= 15)
{
Damage1 = (int) ((double) Damage1 * 0.65);
if (this.penetrate > 1)
--this.penetrate;
}
if (this.type == 710)
{
if (!WorldUtils.Find(this.Center.ToTileCoordinates(), Searches.Chain((GenSearch) new Searches.Down(12), (GenCondition) Projectile._cachedConditions_notNull, (GenCondition) Projectile._cachedConditions_solid), out Point _))
Damage1 = (int) ((double) Damage1 * 1.5);
}
if (this.type == 504)
this.ai[0] += (float) ((60.0 - (double) this.ai[0]) / 2.0);
if (this.aiStyle == 3 && this.type != 301 && this.type != 866 && this.type != 902)
{
if ((double) this.ai[0] == 0.0)
{
this.velocity.X = -this.velocity.X;
this.velocity.Y = -this.velocity.Y;
this.netUpdate = true;
}
this.ai[0] = 1f;
}
else if (this.type == 582 || this.type == 902)
{
if ((double) this.ai[0] != 0.0)
this.direction *= -1;
}
else if (this.type == 612)
this.direction = Main.player[this.owner].direction;
else if (this.type == 624)
{
float num8 = 1f;
if ((double) targetNPC.knockBackResist > 0.0)
num8 = 1f / targetNPC.knockBackResist;
this.knockBack = 4f * num8;
knockBack = this.knockBack;
if ((double) targetNPC.Center.X < (double) this.Center.X)
this.direction = 1;
else
this.direction = -1;
}
else if (this.aiStyle == 16)
{
if (this.timeLeft > 3)
this.timeLeft = 3;
if ((double) targetNPC.position.X + (double) (targetNPC.width / 2) < (double) this.position.X + (double) (this.width / 2))
this.direction = -1;
else
this.direction = 1;
}
else if (this.aiStyle == 68)
{
if (this.timeLeft > 3)
this.timeLeft = 3;
if ((double) targetNPC.position.X + (double) (targetNPC.width / 2) < (double) this.position.X + (double) (this.width / 2))
this.direction = -1;
else
this.direction = 1;
}
else if (this.aiStyle == 50)
{
if ((double) targetNPC.position.X + (double) (targetNPC.width / 2) < (double) this.position.X + (double) (this.width / 2))
this.direction = -1;
else
this.direction = 1;
}
else if (this.type == 908)
{
if ((double) targetNPC.position.X + (double) (targetNPC.width / 2) < (double) this.position.X + (double) (this.width / 2))
this.direction = -1;
else
this.direction = 1;
}
if (this.type == 509)
{
int num9 = Main.rand.Next(2, 6);
for (int index5 = 0; index5 < num9; ++index5)
{
Vector2 vector2 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101));
vector2 += this.velocity * 3f;
vector2.Normalize();
vector2 *= (float) Main.rand.Next(35, 81) * 0.1f;
int Damage2 = (int) ((double) this.damage * 0.5);
Projectile.NewProjectile(this.Center.X, this.Center.Y, vector2.X, vector2.Y, 504, Damage2, this.knockBack * 0.2f, this.owner);
}
}
if (this.type == 598 || this.type == 636 || this.type == 614)
{
this.ai[0] = 1f;
this.ai[1] = (float) index1;
this.velocity = (targetNPC.Center - this.Center) * 0.75f;
this.netUpdate = true;
}
if (this.type >= 511 && this.type <= 513)
this.timeLeft = 0;
if (this.type == 659)
this.timeLeft = 0;
if (this.type == 524)
{
this.netUpdate = true;
this.ai[0] += 50f;
}
if ((this.type == 688 || this.type == 689 || this.type == 690) && targetNPC.type != 68 && targetNPC.defense < 999)
Damage1 += targetNPC.defense / 2;
if (this.aiStyle == 39)
{
if ((double) this.ai[1] == 0.0)
{
this.ai[1] = (float) (index1 + 1);
this.netUpdate = true;
}
if ((double) Main.player[this.owner].position.X + (double) (Main.player[this.owner].width / 2) < (double) this.position.X + (double) (this.width / 2))
this.direction = 1;
else
this.direction = -1;
}
if (this.type == 41 && this.timeLeft > 1)
this.timeLeft = 1;
if (this.aiStyle == 99)
{
Main.player[this.owner].Counterweight(targetNPC.Center, this.damage, this.knockBack);
if ((double) targetNPC.Center.X < (double) Main.player[this.owner].Center.X)
this.direction = -1;
else
this.direction = 1;
if ((double) this.ai[0] >= 0.0)
{
Vector2 vector2 = this.Center - targetNPC.Center;
vector2.Normalize();
float num10 = 16f;
this.velocity = this.velocity * -0.5f;
this.velocity = this.velocity + vector2 * num10;
this.netUpdate = true;
this.localAI[0] += 20f;
if (!Collision.CanHit(this.position, this.width, this.height, Main.player[this.owner].position, Main.player[this.owner].width, Main.player[this.owner].height))
{
this.localAI[0] += 40f;
Damage1 = (int) ((double) Damage1 * 0.75);
}
}
}
if (this.type == 856 && !Collision.CanHit(this.position, this.width, this.height, Main.player[this.owner].position, Main.player[this.owner].width, Main.player[this.owner].height))
Damage1 = (int) ((double) Damage1 * 0.75);
if (this.aiStyle == 93)
{
if ((double) this.ai[0] == 0.0)
{
this.ai[1] = 0.0f;
this.ai[0] = (float) (-index1 - 1);
this.velocity = targetNPC.Center - this.Center;
}
Damage1 = (double) this.ai[0] != 2.0 ? (int) ((double) Damage1 * 0.15) : (int) ((double) Damage1 * 1.35);
}
if (flag6)
{
int num11 = Item.NPCtoBanner(targetNPC.BannerID());
if (num11 >= 0)
Main.player[Main.myPlayer].lastCreatureHit = num11;
}
if (Main.netMode != 2 & flag6)
{
int num12 = Item.NPCtoBanner(targetNPC.BannerID());
if (num12 > 0 && Main.player[this.owner].HasNPCBannerBuff(num12))
Damage1 = !Main.expertMode ? (int) ((double) Damage1 * (double) ItemID.Sets.BannerStrength[Item.BannerToItem(num12)].NormalDamageDealt) : (int) ((double) Damage1 * (double) ItemID.Sets.BannerStrength[Item.BannerToItem(num12)].ExpertDamageDealt);
}
if (Main.expertMode)
{
if ((this.type == 30 || this.type == 397 || this.type == 517 || this.type == 28 || this.type == 37 || this.type == 516 || this.type == 29 || this.type == 470 || this.type == 637 || this.type == 108 || this.type == 281 || this.type == 588 || this.type == 519 || this.type == 773 || this.type == 183 || this.type == 181 || this.type == 566) && targetNPC.type >= 13 && targetNPC.type <= 15)
Damage1 /= 5;
if (this.type == 280 && (targetNPC.type >= 134 && targetNPC.type <= 136 || targetNPC.type == 139))
Damage1 = (int) ((double) Damage1 * 0.75);
}
if (Main.netMode != 2 && targetNPC.type == 439 && this.type >= 0 && this.type <= 950 && ProjectileID.Sets.CountsAsHoming[this.type])
Damage1 = (int) ((double) Damage1 * 0.75);
if (this.type == 497 && this.penetrate != 1)
{
this.ai[0] = 25f;
float num13 = this.velocity.Length();
Vector2 vector2 = targetNPC.Center - this.Center;
vector2.Normalize();
vector2 *= num13;
this.velocity = -vector2 * 0.9f;
this.netUpdate = true;
}
if (this.type == 323 && (targetNPC.type == 158 || targetNPC.type == 159))
Damage1 *= 10;
if (this.type == 294)
this.damage = (int) ((double) this.damage * 0.8);
if (this.type == 265)
this.damage = (int) ((double) this.damage * 0.75);
if (this.type == 355)
this.damage = (int) ((double) this.damage * 0.75);
if (this.type == 85)
this.damage = (int) ((double) this.damage * 0.85);
if (this.type == 866)
this.damage = (int) ((double) this.damage * 0.7);
if (this.type == 841)
this.damage = (int) ((double) this.damage * 0.5);
if (this.type == 914)
this.damage = (int) ((double) this.damage * 0.6);
if (this.type == 913)
this.damage = (int) ((double) this.damage * 0.66);
if (this.type == 912)
this.damage = (int) ((double) this.damage * 0.66);
if (this.type == 847)
this.damage = (int) ((double) this.damage * 0.7);
if (this.type == 848)
this.damage = (int) ((double) this.damage * 0.75);
if (this.type == 849)
this.damage = (int) ((double) this.damage * 0.7);
if (this.type == 915)
this.damage = (int) ((double) this.damage * 0.85);
if (this.type == 931)
this.damage = (int) ((double) this.damage * 0.8);
if (this.type == 477 && this.penetrate > 1)
{
int[] numArray = new int[10];
int maxValue = 0;
int num14 = 700;
int num15 = 20;
for (int index6 = 0; index6 < 200; ++index6)
{
if (index6 != index1 && Main.npc[index6].CanBeChasedBy((object) this))
{
float num16 = (this.Center - Main.npc[index6].Center).Length();
if ((double) num16 > (double) num15 && (double) num16 < (double) num14 && Collision.CanHitLine(this.Center, 1, 1, Main.npc[index6].Center, 1, 1))
{
numArray[maxValue] = index6;
++maxValue;
if (maxValue >= 9)
break;
}
}
}
if (maxValue > 0)
{
int index7 = Main.rand.Next(maxValue);
Vector2 vector2 = Main.npc[numArray[index7]].Center - this.Center;
float num17 = this.velocity.Length();
vector2.Normalize();
this.velocity = vector2 * num17;
this.netUpdate = true;
}
}
if (this.type == 261 && (double) this.velocity.Length() < 3.5)
{
Damage1 /= 2;
knockBack /= 2f;
}
if (flag6 && this.melee && Main.player[this.owner].parryDamageBuff && !ProjectileID.Sets.DontApplyParryDamageBuff[this.type])
{
Damage1 *= 5;
Main.player[this.owner].parryDamageBuff = false;
Main.player[this.owner].ClearBuff(198);
}
this.StatusNPC(index1);
if (flag6 && targetNPC.life > 5)
this.TryDoingOnHitEffects((Entity) targetNPC);
if (ProjectileID.Sets.ImmediatelyUpdatesNPCBuffFlags[this.type])
targetNPC.UpdateNPC_BuffSetFlags(false);
if (this.type == 317)
{
this.ai[1] = -1f;
this.netUpdate = true;
}
int hitDirection = this.direction;
if (this.type == 697 || this.type == 699 || this.type == 707 || this.type == 708)
hitDirection = (double) Main.player[this.owner].Center.X < (double) targetNPC.Center.X ? 1 : -1;
if (this.aiStyle == 15)
{
hitDirection = (double) Main.player[this.owner].Center.X < (double) targetNPC.Center.X ? 1 : -1;
if ((double) this.ai[0] == 0.0)
knockBack *= 0.25f;
if ((double) this.ai[0] == 6.0)
knockBack *= 0.5f;
}
if (flag6 && !this.hostile && armorPenetration > 0)
Damage1 += targetNPC.checkArmorPenetration(armorPenetration);
int dmg = !flag6 ? (int) targetNPC.StrikeNPCNoInteraction(Damage1, knockBack, hitDirection, crit) : (int) targetNPC.StrikeNPC(Damage1, knockBack, hitDirection, crit);
if (flag6 && Main.player[this.owner].accDreamCatcher)
Main.player[this.owner].addDPS(dmg);
if (flag6 && !targetNPC.immortal)
{
if (this.type == 756)
{
if (this.penetrate == 1)
{
this.damage = 0;
this.penetrate = -1;
}
else
this.damage = (int) ((double) this.damage * 0.7);
}
if (this.type == 304 && dmg > 0 && targetNPC.lifeMax > 5 && !Main.player[this.owner].moonLeech)
this.vampireHeal(dmg, new Vector2(targetNPC.Center.X, targetNPC.Center.Y));
if ((double) targetNPC.value > 0.0 && Main.player[this.owner].coins && Main.rand.Next(5) == 0)
{
int Type = 71;
if (Main.rand.Next(10) == 0)
Type = 72;
if (Main.rand.Next(100) == 0)
Type = 73;
int number = Item.NewItem((int) targetNPC.position.X, (int) targetNPC.position.Y, targetNPC.width, targetNPC.height, Type);
Main.item[number].stack = Main.rand.Next(1, 11);
Main.item[number].velocity.Y = (float) Main.rand.Next(-20, 1) * 0.2f;
Main.item[number].velocity.X = (float) Main.rand.Next(10, 31) * 0.2f * (float) hitDirection;
if (Main.netMode == 1)
NetMessage.SendData(21, number: number);
}
if (dmg > 0 && targetNPC.lifeMax > 5 && this.friendly && !this.hostile && this.aiStyle != 59)
{
if (targetNPC.canGhostHeal)
{
if (Main.player[this.owner].ghostHeal && !Main.player[this.owner].moonLeech)
this.ghostHeal(dmg, new Vector2(targetNPC.Center.X, targetNPC.Center.Y));
if (Main.player[this.owner].ghostHurt)
this.ghostHurt(dmg, new Vector2(targetNPC.Center.X, targetNPC.Center.Y));
if (this.magic && Main.player[this.owner].setNebula && Main.player[this.owner].nebulaCD == 0 && Main.rand.Next(3) == 0)
{
Main.player[this.owner].nebulaCD = 30;
int Type = Utils.SelectRandom<int>(Main.rand, 3453, 3454, 3455);
int number = Item.NewItem((int) targetNPC.position.X, (int) targetNPC.position.Y, targetNPC.width, targetNPC.height, Type);
Main.item[number].velocity.Y = (float) Main.rand.Next(-20, 1) * 0.2f;
Main.item[number].velocity.X = (float) Main.rand.Next(10, 31) * 0.2f * (float) hitDirection;
if (Main.netMode == 1)
NetMessage.SendData(21, number: number);
}
}
if (this.melee && Main.player[this.owner].beetleOffense && !targetNPC.immortal)
{
if (Main.player[this.owner].beetleOrbs == 0)
Main.player[this.owner].beetleCounter += (float) (dmg * 3);
else if (Main.player[this.owner].beetleOrbs == 1)
Main.player[this.owner].beetleCounter += (float) (dmg * 2);
else
Main.player[this.owner].beetleCounter += (float) dmg;
Main.player[this.owner].beetleCountdown = 0;
}
if (this.arrow && this.type != 631 && Main.player[this.owner].phantasmTime > 0)
{
Vector2 Source = Main.player[this.owner].position + Main.player[this.owner].Size * Utils.RandomVector2(Main.rand, 0.0f, 1f);
Vector2 vector2 = targetNPC.DirectionFrom(Source) * 6f;
int Damage3 = (int) ((double) this.damage * 0.300000011920929);
Projectile.NewProjectile(Source.X, Source.Y, vector2.X, vector2.Y, 631, Damage3, 0.0f, this.owner, (float) index1);
Projectile.NewProjectile(Source.X, Source.Y, vector2.X, vector2.Y, 631, Damage3, 0.0f, this.owner, (float) index1, 15f);
Projectile.NewProjectile(Source.X, Source.Y, vector2.X, vector2.Y, 631, Damage3, 0.0f, this.owner, (float) index1, 30f);
}
Player player = Main.player[this.owner];
switch (this.type)
{
case 847:
player.AddBuff(308, 180);
break;
case 849:
player.AddBuff(311, 180);
break;
case 912:
int Damage4 = 10;
if (!player.coolWhipBuff)
{
Projectile.NewProjectile(targetNPC.Center, Vector2.Zero, 917, Damage4, 0.0f, this.owner);
player.coolWhipBuff = true;
}
player.AddBuff(312, 180);
break;
case 914:
player.AddBuff(314, 180);
break;
}
}
}
if (flag6 && this.melee && Main.player[this.owner].meleeEnchant == (byte) 7)
Projectile.NewProjectile(targetNPC.Center.X, targetNPC.Center.Y, targetNPC.velocity.X, targetNPC.velocity.Y, 289, 0, 0.0f, this.owner);
if (flag6 && this.type == 913)
this.localAI[0] = 1f;
if (Main.netMode != 0)
{
if (crit)
NetMessage.SendData(28, number: index1, number2: ((float) Damage1), number3: this.knockBack, number4: ((float) hitDirection), number5: 1);
else
NetMessage.SendData(28, number: index1, number2: ((float) Damage1), number3: this.knockBack, number4: ((float) hitDirection));
}
if (this.type == 916)
Projectile.EmitBlackLightningParticles(targetNPC);
if (this.type >= 390 && this.type <= 392)
this.localAI[1] = 20f;
if (this.usesIDStaticNPCImmunity)
{
targetNPC.immune[this.owner] = 0;
Projectile.perIDStaticNPCImmunity[this.type][index1] = Main.GameUpdateCount + (uint) this.idStaticNPCHitCooldown;
}
else if (this.type == 434)
this.numUpdates = 0;
else if (this.type == 598 || this.type == 636 || this.type == 614)
{
this.damage = 0;
int length = 6;
if (this.type == 614)
length = 10;
if (this.type == 636)
length = 8;
Point[] pointArray = new Point[length];
int num18 = 0;
for (int x = 0; x < 1000; ++x)
{
if (x != this.whoAmI && Main.projectile[x].active && Main.projectile[x].owner == Main.myPlayer && Main.projectile[x].type == this.type && (double) Main.projectile[x].ai[0] == 1.0 && (double) Main.projectile[x].ai[1] == (double) index1)
{
pointArray[num18++] = new Point(x, Main.projectile[x].timeLeft);
if (num18 >= pointArray.Length)
break;
}
}
if (num18 >= pointArray.Length)
{
int index8 = 0;
for (int index9 = 1; index9 < pointArray.Length; ++index9)
{
if (pointArray[index9].Y < pointArray[index8].Y)
index8 = index9;
}
Main.projectile[pointArray[index8].X].Kill();
}
}
else if (this.type == 632)
targetNPC.immune[this.owner] = 5;
else if (this.type == 514)
targetNPC.immune[this.owner] = 1;
else if (this.type == 611)
{
if ((double) this.localAI[1] <= 0.0)
Projectile.NewProjectile(targetNPC.Center.X, targetNPC.Center.Y, 0.0f, 0.0f, 612, this.damage, 10f, this.owner, ai1: ((float) (0.850000023841858 + (double) Main.rand.NextFloat() * 1.14999997615814)));
this.localAI[1] = 4f;
}
else if (this.type == 595 || this.type == 735)
targetNPC.immune[this.owner] = 5;
else if (this.type == 927)
targetNPC.immune[this.owner] = 4;
else if (this.type == 286)
targetNPC.immune[this.owner] = 5;
else if (this.type == 443)
targetNPC.immune[this.owner] = 8;
else if (this.type >= 424 && this.type <= 426)
targetNPC.immune[this.owner] = 5;
else if (this.type == 634 || this.type == 635)
targetNPC.immune[this.owner] = 5;
else if (this.type == 659)
targetNPC.immune[this.owner] = 5;
else if (this.type == 246)
targetNPC.immune[this.owner] = 7;
else if (this.type == 249)
targetNPC.immune[this.owner] = 7;
else if (this.type == 16)
targetNPC.immune[this.owner] = 8;
else if (this.type == 409)
targetNPC.immune[this.owner] = 6;
else if (this.type == 407)
targetNPC.immune[this.owner] = 20;
else if (this.type == 311)
targetNPC.immune[this.owner] = 7;
else if (this.type == 582 || this.type == 902)
{
targetNPC.immune[this.owner] = 7;
if ((double) this.ai[0] != 1.0)
{
this.ai[0] = 1f;
this.netUpdate = true;
}
}
else
{
if (this.type == 451)
{
if ((double) this.ai[0] == 0.0)
this.ai[0] += (float) this.penetrate;
else
this.ai[0] -= (float) (this.penetrate + 1);
this.ai[1] = 0.0f;
this.netUpdate = true;
NPC npc3 = Main.npc[index1];
npc3.position = npc3.position - Main.npc[index1].netOffset;
break;
}
if (this.type == 864)
{
localNpcImmunity[index1] = 10;
targetNPC.immune[this.owner] = 0;
if ((double) this.ai[0] > 0.0)
{
this.ai[0] = -1f;
this.ai[1] = 0.0f;
this.netUpdate = true;
}
}
else if (this.type == 661 || this.type == 856)
{
localNpcImmunity[index1] = 8;
targetNPC.immune[this.owner] = 0;
}
else if (this.type == 866)
{
localNpcImmunity[index1] = -1;
targetNPC.immune[this.owner] = 0;
--this.penetrate;
if (this.penetrate == 0)
{
this.penetrate = 1;
this.damage = 0;
this.ai[1] = -1f;
this.netUpdate = true;
NPC npc4 = Main.npc[index1];
npc4.position = npc4.position - Main.npc[index1].netOffset;
break;
}
if (this.owner == Main.myPlayer)
{
int targetWithLineOfSight = this.FindTargetWithLineOfSight();
float num19 = this.ai[1];
this.ai[1] = (float) targetWithLineOfSight;
if ((double) this.ai[1] != (double) num19)
this.netUpdate = true;
if (targetWithLineOfSight != -1)
this.velocity = this.velocity.Length() * this.DirectionTo(Main.npc[targetWithLineOfSight].Center);
}
}
else if (this.usesLocalNPCImmunity && this.localNPCHitCooldown != -2)
{
targetNPC.immune[this.owner] = 0;
localNpcImmunity[index1] = this.localNPCHitCooldown;
}
else if (this.penetrate != 1)
targetNPC.immune[this.owner] = 10;
}
if (this.type == 710)
this.BetsySharpnel(index1);
if (this.penetrate > 0 && this.type != 317 && this.type != 866)
{
if (this.type == 357)
this.damage = (int) ((double) this.damage * 0.8);
--this.penetrate;
if (this.penetrate == 0)
{
NPC npc5 = Main.npc[index1];
npc5.position = npc5.position - Main.npc[index1].netOffset;
break;
}
}
if (this.aiStyle == 7)
{
this.ai[0] = 1f;
this.damage = 0;
this.netUpdate = true;
}
else if (this.aiStyle == 13)
{
this.ai[0] = 1f;
this.netUpdate = true;
}
else if (this.aiStyle == 69)
{
this.ai[0] = 1f;
this.netUpdate = true;
}
else if (this.type == 607)
{
this.ai[0] = 1f;
this.netUpdate = true;
this.friendly = false;
}
else if (this.type == 638 || this.type == 639 || this.type == 640)
{
localNpcImmunity[index1] = -1;
targetNPC.immune[this.owner] = 0;
this.damage = (int) ((double) this.damage * 0.96);
}
else if (this.type == 617)
{
localNpcImmunity[index1] = 8;
targetNPC.immune[this.owner] = 0;
}
else if (this.type == 656)
{
localNpcImmunity[index1] = 8;
targetNPC.immune[this.owner] = 0;
++this.localAI[0];
}
else if (this.type == 618)
{
localNpcImmunity[index1] = 20;
targetNPC.immune[this.owner] = 0;
}
else if (this.type == 642)
{
localNpcImmunity[index1] = 10;
targetNPC.immune[this.owner] = 0;
}
else if (this.type == 857)
{
localNpcImmunity[index1] = 10;
targetNPC.immune[this.owner] = 0;
}
else if (this.type == 611 || this.type == 612)
{
localNpcImmunity[index1] = 6;
targetNPC.immune[this.owner] = 4;
}
else if (this.type == 645)
{
localNpcImmunity[index1] = -1;
targetNPC.immune[this.owner] = 0;
if ((double) this.ai[1] != -1.0)
{
this.ai[0] = 0.0f;
this.ai[1] = -1f;
this.netUpdate = true;
}
}
++this.numHits;
if (this.type == 697)
{
if ((double) this.ai[0] >= 42.0)
this.localAI[1] = 1f;
}
else if (this.type == 699)
this.SummonMonkGhast();
else if (this.type == 706)
this.damage = (int) ((double) this.damage * 0.949999988079071);
else if (this.type == 728)
this.SummonSuperStarSlash(targetNPC.Center);
else if (this.type == 34)
{
if ((double) this.ai[0] == -1.0)
{
this.ai[1] = -1f;
this.netUpdate = true;
}
}
else if (this.type == 79)
{
if ((double) this.ai[0] == -1.0)
{
this.ai[1] = -1f;
this.netUpdate = true;
}
ParticleOrchestrator.RequestParticleSpawn(false, ParticleOrchestraType.RainbowRodHit, new ParticleOrchestraSettings()
{
PositionInWorld = targetNPC.Center,
MovementVector = this.velocity
});
}
else if (this.type == 931)
{
int targetWithLineOfSight = this.FindTargetWithLineOfSight();
if (targetWithLineOfSight != -1)
{
this.ai[0] = (float) targetWithLineOfSight;
this.netUpdate = true;
}
}
else if (this.aiStyle == 165)
{
if (targetNPC.active)
Main.player[this.owner].MinionAttackTargetNPC = index1;
}
else if (this.type == 623)
ParticleOrchestrator.RequestParticleSpawn(false, ParticleOrchestraType.StardustPunch, new ParticleOrchestraSettings()
{
PositionInWorld = Vector2.Lerp(this.Center, targetNPC.Hitbox.ClosestPointInRect(this.Center), 0.5f) + new Vector2(0.0f, Main.rand.NextFloatDirection() * 10f),
MovementVector = new Vector2((float) this.direction, Main.rand.NextFloatDirection() * 0.5f) * (float) (3.0 + 3.0 * (double) Main.rand.NextFloat())
});
}
}
}
NPC npc6 = Main.npc[index1];
npc6.position = npc6.position - Main.npc[index1].netOffset;
}
}
}
if (this.damage > 0 && Main.player[Main.myPlayer].hostile)
{
for (int index = 0; index < (int) byte.MaxValue; ++index)
{
if (index != this.owner)
{
Player player = Main.player[index];
if (player.active && !player.dead && !player.immune && player.hostile && this.playerImmune[index] <= 0 && (Main.player[Main.myPlayer].team == 0 ? 1 : (Main.player[Main.myPlayer].team != player.team ? 1 : 0)) != 0)
{
bool flag14 = !this.ownerHitCheck;
if (this.ownerHitCheck)
flag14 |= this.CanHitWithMeleeWeapon((Entity) player);
if (flag14 && this.Colliding(myRect, player.getRect()))
{
if (this.aiStyle == 3)
{
if ((double) this.ai[0] == 0.0)
{
this.velocity.X = -this.velocity.X;
this.velocity.Y = -this.velocity.Y;
this.netUpdate = true;
}
this.ai[0] = 1f;
}
else if (this.aiStyle == 16)
{
if (this.timeLeft > 3)
this.timeLeft = 3;
if ((double) player.position.X + (double) (player.width / 2) < (double) this.position.X + (double) (this.width / 2))
this.direction = -1;
else
this.direction = 1;
}
else if (this.aiStyle == 68)
{
if (this.timeLeft > 3)
this.timeLeft = 3;
if ((double) player.position.X + (double) (player.width / 2) < (double) this.position.X + (double) (this.width / 2))
this.direction = -1;
else
this.direction = 1;
}
PlayerDeathReason playerDeathReason = PlayerDeathReason.ByProjectile(this.owner, this.whoAmI);
if (this.type == 41 && this.timeLeft > 1)
this.timeLeft = 1;
bool flag15 = false;
if (this.melee && Main.rand.Next(1, 101) <= Main.player[this.owner].meleeCrit)
flag15 = true;
int num20 = Main.DamageVar((float) (int) ((double) this.damage * (double) num1), Main.player[this.owner].luck);
if (!player.immune)
this.StatusPvP(index);
this.TryDoingOnHitEffects((Entity) player);
int dmg = (int) player.Hurt(playerDeathReason, num20, this.direction, true, Crit: flag15);
if (dmg > 0 && Main.player[this.owner].ghostHeal && this.friendly && !this.hostile)
this.ghostHeal(dmg, new Vector2(player.Center.X, player.Center.Y));
if (this.type == 304 && dmg > 0)
this.vampireHeal(dmg, new Vector2(player.Center.X, player.Center.Y));
if (this.melee && Main.player[this.owner].meleeEnchant == (byte) 7)
Projectile.NewProjectile(player.Center.X, player.Center.Y, player.velocity.X, player.velocity.Y, 289, 0, 0.0f, this.owner);
if (Main.netMode != 0)
NetMessage.SendPlayerHurt(index, playerDeathReason, num20, this.direction, flag15, true, -1);
this.playerImmune[index] = 40;
if (this.penetrate > 0)
{
--this.penetrate;
if (this.penetrate == 0)
break;
}
if (this.aiStyle == 7)
{
this.ai[0] = 1f;
this.damage = 0;
this.netUpdate = true;
}
else if (this.aiStyle == 13)
{
this.ai[0] = 1f;
this.netUpdate = true;
}
else if (this.aiStyle == 69)
{
this.ai[0] = 1f;
this.netUpdate = true;
}
}
}
}
}
}
}
if (this.type == 10 && Main.netMode != 1)
{
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].type == 534)
{
Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) Main.npc[index].position.X, (int) Main.npc[index].position.Y, Main.npc[index].width, Main.npc[index].height);
if (myRect.Intersects(rectangle))
Main.npc[index].Transform(441);
}
}
}
if (this.type == 11 && Main.netMode != 1)
{
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active)
{
if (Main.npc[index].type == 46 || Main.npc[index].type == 303)
{
Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) Main.npc[index].position.X, (int) Main.npc[index].position.Y, Main.npc[index].width, Main.npc[index].height);
if (myRect.Intersects(rectangle))
Main.npc[index].Transform(47);
}
else if (Main.npc[index].type == 55)
{
Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) Main.npc[index].position.X, (int) Main.npc[index].position.Y, Main.npc[index].width, Main.npc[index].height);
if (myRect.Intersects(rectangle))
Main.npc[index].Transform(57);
}
else if (Main.npc[index].type == 148 || Main.npc[index].type == 149)
{
Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) Main.npc[index].position.X, (int) Main.npc[index].position.Y, Main.npc[index].width, Main.npc[index].height);
if (myRect.Intersects(rectangle))
Main.npc[index].Transform(168);
}
}
}
}
if (this.type == 463 && Main.netMode != 1)
{
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active)
{
if (Main.npc[index].type == 46 || Main.npc[index].type == 303)
{
Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) Main.npc[index].position.X, (int) Main.npc[index].position.Y, Main.npc[index].width, Main.npc[index].height);
if (myRect.Intersects(rectangle))
Main.npc[index].Transform(464);
}
else if (Main.npc[index].type == 55)
{
Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) Main.npc[index].position.X, (int) Main.npc[index].position.Y, Main.npc[index].width, Main.npc[index].height);
if (myRect.Intersects(rectangle))
Main.npc[index].Transform(465);
}
else if (Main.npc[index].type == 148 || Main.npc[index].type == 149)
{
Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) Main.npc[index].position.X, (int) Main.npc[index].position.Y, Main.npc[index].width, Main.npc[index].height);
if (myRect.Intersects(rectangle))
Main.npc[index].Transform(470);
}
}
}
}
if (Main.netMode == 2 || !this.hostile || Main.myPlayer >= (int) byte.MaxValue || this.damage <= 0)
return;
int cooldownCounter = -1;
switch (this.type)
{
case 452:
case 454:
case 455:
case 462:
cooldownCounter = 1;
break;
case 871:
case 872:
case 873:
case 874:
case 919:
case 923:
case 924:
cooldownCounter = 1;
break;
}
int player1 = Main.myPlayer;
bool flag = Main.player[player1].active && !Main.player[player1].dead && (!Main.player[player1].immune || cooldownCounter != -1);
if (flag && this.type == 281)
flag = (double) this.ai[1] - 1.0 == (double) player1;
if (Main.getGoodWorld && this.type == 281)
flag = true;
if (!flag || !this.Colliding(myRect, Main.player[player1].getRect()))
return;
int direction = this.direction;
int hitDirection1 = (double) Main.player[player1].position.X + (double) (Main.player[player1].width / 2) >= (double) this.position.X + (double) (this.width / 2) ? 1 : -1;
if (!Main.player[player1].CanParryAgainst(Main.player[player1].Hitbox, this.Hitbox, this.velocity))
{
int num21 = Main.DamageVar((float) this.damage, -Main.player[this.owner].luck);
if (!Main.player[player1].immune)
this.StatusPlayer(player1);
if (Main.player[player1].resistCold && this.coldDamage)
num21 = (int) ((double) num21 * 0.699999988079071);
float num22 = Main.GameModeInfo.EnemyDamageMultiplier;
if (Main.GameModeInfo.IsJourneyMode)
{
CreativePowers.DifficultySliderPower power = CreativePowerManager.Instance.GetPower<CreativePowers.DifficultySliderPower>();
if (power.GetIsUnlocked())
num22 = power.StrengthMultiplierToGiveNPCs;
}
int Damage = (int) ((double) num21 * (double) num22) * 2;
Main.player[player1].Hurt(PlayerDeathReason.ByProjectile(-1, this.whoAmI), Damage, hitDirection1, cooldownCounter: cooldownCounter);
if (this.trap)
{
Main.player[player1].trapDebuffSource = true;
if (Main.player[player1].dead)
AchievementsHelper.HandleSpecialEvent(Main.player[player1], 4);
}
}
if (false)
return;
if (this.type == 435 || this.type == 682)
--this.penetrate;
if (this.type == 436)
--this.penetrate;
if (this.type == 681)
this.timeLeft = 0;
if (this.type != 437)
return;
--this.penetrate;
}
private static void EmitBlackLightningParticles(NPC targetNPC) => ParticleOrchestrator.RequestParticleSpawn(false, ParticleOrchestraType.BlackLightningHit, new ParticleOrchestraSettings()
{
PositionInWorld = targetNPC.Center
});
private void TryDoingOnHitEffects(Entity entity)
{
switch (this.type)
{
case 221:
break;
case 227:
break;
case 614:
break;
case 729:
break;
case 908:
break;
default:
Main.player[this.owner].OnHit(entity.Center.X, entity.Center.Y, entity);
break;
}
}
private void SummonSuperStarSlash(Vector2 target)
{
Vector2 v = Main.rand.NextVector2CircularEdge(200f, 200f);
if ((double) v.Y < 0.0)
v.Y *= -1f;
v.Y += 100f;
Vector2 velocity = v.SafeNormalize(Vector2.UnitY) * 6f;
Projectile.NewProjectile(target - velocity * 20f, velocity, 729, this.damage / 2, 0.0f, this.owner, ai1: target.Y);
}
private void SummonMonkGhast()
{
if ((double) this.localAI[0] > 0.0)
return;
this.localAI[0] = 1000f;
List<NPC> npcList = new List<NPC>();
for (int index = 0; index < 200; ++index)
{
NPC npc = Main.npc[index];
if (npc.CanBeChasedBy((object) this) && (double) this.Distance(npc.Center) < 800.0)
npcList.Add(npc);
}
Vector2 center = this.Center;
Vector2 vector2_1 = Vector2.Zero;
if (npcList.Count > 0)
{
NPC npc = npcList[Main.rand.Next(npcList.Count)];
center = npc.Center;
vector2_1 = npc.velocity;
}
int num = Main.rand.Next(2) * 2 - 1;
Vector2 vector2_2 = new Vector2((float) num * (4f + (float) Main.rand.Next(3)), 0.0f);
Vector2 position = center + new Vector2((float) (-num * 120), 0.0f);
Vector2 velocity = vector2_2 + (center + vector2_1 * 15f - position).SafeNormalize(Vector2.Zero) * 2f;
Projectile.NewProjectile(position, velocity, 700, this.damage, 0.0f, this.owner);
}
private void CutTiles()
{
if (!this.CanCutTiles())
return;
AchievementsHelper.CurrentlyMining = true;
bool flag = true;
if (this.type == 461 || this.type == 632 || this.type == 642)
{
DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile;
Utils.PlotTileLine(this.Center, this.Center + this.velocity * this.localAI[1], (float) this.width * this.scale, new Utils.TileActionAttempt(DelegateMethods.CutTiles));
}
else if (ProjectileID.Sets.IsAWhip[this.type])
{
flag = false;
this._whipPointsForCollision.Clear();
Projectile.FillWhipControlPoints(this, this._whipPointsForCollision);
Vector2 vector2 = new Vector2((float) ((double) this.width * (double) this.scale / 2.0), 0.0f);
for (int index = 0; index < this._whipPointsForCollision.Count; ++index)
{
DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile;
Utils.PlotTileLine(this._whipPointsForCollision[index] - vector2, this._whipPointsForCollision[index] + vector2, (float) this.height * this.scale, new Utils.TileActionAttempt(DelegateMethods.CutTiles));
}
}
else if (this.type == 756)
{
DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile;
Utils.PlotTileLine(this.Center, this.Center + this.velocity.SafeNormalize(-Vector2.UnitY) * 200f * this.scale, 22f * this.scale, new Utils.TileActionAttempt(DelegateMethods.CutTiles));
}
else if (this.type == 927)
{
DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile;
Utils.PlotTileLine(this.Center, this.Center + this.velocity.SafeNormalize(Vector2.UnitX) * 220f * this.scale, 80f * this.scale, new Utils.TileActionAttempt(DelegateMethods.CutTiles));
}
else if (this.type == 802 || this.type == 842 || this.type == 938 || this.type == 939 || this.type == 940 || this.type == 941 || this.type == 942 || this.type == 943 || this.type == 944 || this.type == 945)
{
DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile;
Utils.PlotTileLine(this.Center, this.Center + this.velocity.SafeNormalize(-Vector2.UnitY) * 10f, 10f * this.scale, new Utils.TileActionAttempt(DelegateMethods.CutTiles));
}
else if (this.type == 611)
{
DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile;
Utils.PlotTileLine(this.Center, this.Center + this.velocity + this.velocity.SafeNormalize(Vector2.Zero) * 48f, (float) this.width * this.scale, new Utils.TileActionAttempt(DelegateMethods.CutTiles));
}
else if (this.type == 697 || this.type == 707)
{
float num = 40f;
if (this.type == 707)
num = 60f;
float f = this.rotation - 0.7853982f * (float) Math.Sign(this.velocity.X);
DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile;
Utils.PlotTileLine(this.Center + f.ToRotationVector2() * -num, this.Center + f.ToRotationVector2() * num, (float) this.width * this.scale, new Utils.TileActionAttempt(DelegateMethods.CutTiles));
}
if (flag)
{
int num1 = (int) ((double) this.position.X / 16.0);
int num2 = (int) (((double) this.position.X + (double) this.width) / 16.0) + 1;
int num3 = (int) ((double) this.position.Y / 16.0);
int num4 = (int) (((double) this.position.Y + (double) this.height) / 16.0) + 1;
if (num1 < 0)
num1 = 0;
if (num2 > Main.maxTilesX)
num2 = Main.maxTilesX;
if (num3 < 0)
num3 = 0;
if (num4 > Main.maxTilesY)
num4 = Main.maxTilesY;
for (int index1 = num1; index1 < num2; ++index1)
{
for (int index2 = num3; index2 < num4; ++index2)
{
if (Main.tile[index1, index2] != null && Main.tileCut[(int) Main.tile[index1, index2].type] && WorldGen.CanCutTile(index1, index2, TileCuttingContext.AttackProjectile))
{
WorldGen.KillTile(index1, index2);
if (Main.netMode != 0)
NetMessage.SendData(17, number2: ((float) index1), number3: ((float) index2));
}
}
}
}
AchievementsHelper.CurrentlyMining = false;
}
private bool CanCutTiles() => this.aiStyle != 45 && this.aiStyle != 137 && this.aiStyle != 92 && this.aiStyle != 105 && this.aiStyle != 106 && !ProjectileID.Sets.IsAGolfBall[this.type] && this.type != 463 && this.type != 69 && this.type != 70 && this.type != 621 && this.type != 10 && this.type != 11 && this.type != 379 && this.type != 407 && this.type != 476 && this.type != 623 && (this.type < 625 || this.type > 628) && this.type != 833 && this.type != 834 && this.type != 835 && this.type != 818 && this.type != 831 && this.type != 820 && this.type != 864;
public bool Colliding(Microsoft.Xna.Framework.Rectangle myRect, Microsoft.Xna.Framework.Rectangle targetRect)
{
if (this.aiStyle == 15)
{
if ((double) this.ai[0] == 0.0)
{
Vector2 mountedCenter = Main.player[this.owner].MountedCenter;
Vector2 vector2 = targetRect.ClosestPointInRect(mountedCenter) - mountedCenter;
vector2.Y /= 0.8f;
float num = 55f;
return (double) vector2.Length() <= (double) num;
}
}
else if (this.type == 623)
{
if ((double) this.ai[0] == 2.0)
{
Microsoft.Xna.Framework.Rectangle rectangle = Utils.CenteredRectangle(this.Center + new Vector2((float) (this.direction * 40), 0.0f), new Vector2(80f, 40f));
if (targetRect.Intersects(rectangle))
return true;
}
}
else
{
if (this.type == 933)
{
float collisionPoint = 0.0f;
float num1 = 40f;
for (int index = 14; index < this.oldPos.Length; index += 15)
{
float num2 = this.localAI[0] - (float) index;
if ((double) num2 >= 0.0 && (double) num2 <= 60.0)
{
Vector2 vector2 = this.oldPos[index] + this.Size / 2f;
Vector2 rotationVector2 = (this.oldRot[index] + 1.570796f).ToRotationVector2();
Projectile._lanceHitboxBounds.X = (int) vector2.X - Projectile._lanceHitboxBounds.Width / 2;
Projectile._lanceHitboxBounds.Y = (int) vector2.Y - Projectile._lanceHitboxBounds.Height / 2;
if (Projectile._lanceHitboxBounds.Intersects(targetRect) && Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), vector2 - rotationVector2 * num1, vector2 + rotationVector2 * num1, 20f, ref collisionPoint))
return true;
}
}
Vector2 rotationVector2_1 = (this.rotation + 1.570796f).ToRotationVector2();
Projectile._lanceHitboxBounds.X = (int) this.position.X - Projectile._lanceHitboxBounds.Width / 2;
Projectile._lanceHitboxBounds.Y = (int) this.position.Y - Projectile._lanceHitboxBounds.Height / 2;
return Projectile._lanceHitboxBounds.Intersects(targetRect) && Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), this.Center - rotationVector2_1 * num1, this.Center + rotationVector2_1 * num1, 20f, ref collisionPoint);
}
if (this.type == 927)
{
for (int index = 1; index <= 5; ++index)
{
Microsoft.Xna.Framework.Rectangle rectangle = myRect;
Vector2 vector2 = this.velocity.SafeNormalize(Vector2.Zero) * (float) this.width * (float) index;
rectangle.Offset((int) vector2.X, (int) vector2.Y);
if (rectangle.Intersects(targetRect))
return true;
}
}
else
{
if (this.type == 877 || this.type == 878 || this.type == 879)
{
float f = (float) ((double) this.rotation - 0.785398185253143 - 1.57079637050629 - (this.spriteDirection == 1 ? 3.14159274101257 : 0.0));
float collisionPoint = 0.0f;
float num = 95f;
Projectile._lanceHitboxBounds.X = (int) this.position.X - Projectile._lanceHitboxBounds.Width / 2;
Projectile._lanceHitboxBounds.Y = (int) this.position.Y - Projectile._lanceHitboxBounds.Height / 2;
return Projectile._lanceHitboxBounds.Intersects(targetRect) && Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), this.Center, this.Center + f.ToRotationVector2() * num, 23f * this.scale, ref collisionPoint);
}
if (this.type == 919 || this.type == 932)
{
double rotation = (double) this.rotation;
float collisionPoint = 0.0f;
float num = 40f;
Vector2 rotationVector2 = ((float) rotation).ToRotationVector2();
Projectile._lanceHitboxBounds.X = (int) this.position.X - Projectile._lanceHitboxBounds.Width / 2;
Projectile._lanceHitboxBounds.Y = (int) this.position.Y - Projectile._lanceHitboxBounds.Height / 2;
return Projectile._lanceHitboxBounds.Intersects(targetRect) && Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), this.Center - rotationVector2 * num, this.Center + rotationVector2 * num, 8f, ref collisionPoint);
}
if (this.type == 923)
{
float collisionPoint = 0.0f;
double scale = (double) this.scale;
double rotation = (double) this.rotation;
Vector2 objectPosition = targetRect.TopLeft();
Vector2 objectDimensions = targetRect.Size();
Vector2 rotationVector2 = ((float) rotation).ToRotationVector2();
float num = this.scale * 0.7f;
return Collision.CheckAABBvLineCollision(objectPosition, objectDimensions, this.Center, this.Center + rotationVector2 * this.scale * 510f, num * 100f, ref collisionPoint) || Collision.CheckAABBvLineCollision(objectPosition, objectDimensions, this.Center, this.Center + rotationVector2 * this.scale * 660f, num * 60f, ref collisionPoint) || Collision.CheckAABBvLineCollision(objectPosition, objectDimensions, this.Center, this.Center + rotationVector2 * this.scale * 800f, num * 10f, ref collisionPoint);
}
if (this.type == 598 && targetRect.Width > 8 && targetRect.Height > 8)
{
targetRect.Inflate(-targetRect.Width / 8, -targetRect.Height / 8);
}
else
{
if (this.type == 872)
{
Microsoft.Xna.Framework.Rectangle hitbox = this.Hitbox;
int num = 80;
for (int index = 0; index < num; index += 2)
{
Vector2 oldPo = this.oldPos[index];
if (!(oldPo == Vector2.Zero))
{
hitbox.X = (int) oldPo.X;
hitbox.Y = (int) oldPo.Y;
if (hitbox.Intersects(targetRect))
return true;
}
}
return false;
}
if (this.type == 871)
{
int pelletStormsCount = this.AI_172_GetPelletStormsCount();
for (int stormIndex = 0; stormIndex < pelletStormsCount; ++stormIndex)
{
Projectile.HallowBossPelletStormInfo pelletStormInfo = this.AI_172_GetPelletStormInfo(stormIndex);
for (int bulletIndex = 0; bulletIndex < pelletStormInfo.BulletsInStorm; ++bulletIndex)
{
if (pelletStormInfo.IsValid(bulletIndex) && pelletStormInfo.GetBulletHitbox(bulletIndex, this.Center).Intersects(targetRect))
return true;
}
}
return false;
}
if (ProjectileID.Sets.IsAWhip[this.type])
{
this._whipPointsForCollision.Clear();
Projectile.FillWhipControlPoints(this, this._whipPointsForCollision);
for (int index = 0; index < this._whipPointsForCollision.Count; ++index)
{
Point point = this._whipPointsForCollision[index].ToPoint();
myRect.Location = new Point(point.X - myRect.Width / 2, point.Y - myRect.Height / 2);
if (myRect.Intersects(targetRect))
return true;
}
return false;
}
if (this.type == 614 && targetRect.Width > 8 && targetRect.Height > 8)
targetRect.Inflate(-targetRect.Width / 8, -targetRect.Height / 8);
else if (this.type == 758)
{
if ((double) this.ai[0] == 2.0 && Utils.CenteredRectangle(this.Center + new Vector2((float) (this.spriteDirection * 30), 0.0f), new Vector2(50f, 20f)).Intersects(targetRect))
return true;
}
else if (this.type == 636 && targetRect.Width > 8 && targetRect.Height > 8)
targetRect.Inflate(-targetRect.Width / 8, -targetRect.Height / 8);
else if (this.type == 607)
{
myRect.X += (int) this.velocity.X;
myRect.Y += (int) this.velocity.Y;
}
else if (this.type == 661)
{
if ((double) Vector2.Distance(myRect.Center.ToVector2(), targetRect.Center.ToVector2()) > 500.0 || !Collision.CanHitLine(myRect.Center.ToVector2(), 0, 0, targetRect.Center.ToVector2(), 0, 0))
return false;
}
else if (this.aiStyle == 137)
return myRect.Intersects(targetRect) && (double) targetRect.Distance(this.Center) < (double) (this.height / 2 - 20) && (this.AI_137_CanHit(targetRect.Center.ToVector2()) || this.AI_137_CanHit(targetRect.TopLeft() + new Vector2((float) (targetRect.Width / 2), 0.0f)));
}
}
}
if (myRect.Intersects(targetRect))
return true;
if (this.type == 461)
{
float collisionPoint = 0.0f;
return Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), this.Center, this.Center + this.velocity * this.localAI[1], 22f * this.scale, ref collisionPoint);
}
if (this.type == 697 || this.type == 707)
{
float f = this.rotation - 0.7853982f * (float) Math.Sign(this.velocity.X);
float collisionPoint = 0.0f;
float num = 50f;
if (this.type == 707)
num = 110f;
return Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), this.Center + f.ToRotationVector2() * -num, this.Center + f.ToRotationVector2() * num, 23f * this.scale, ref collisionPoint);
}
if (this.type == 699)
{
float f = (float) ((double) this.rotation - 0.785398185253143 * (double) Math.Sign(this.velocity.X) + (this.spriteDirection == -1 ? 3.14159274101257 : 0.0));
float collisionPoint = 0.0f;
float num = -95f;
return Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), this.Center, this.Center + f.ToRotationVector2() * num, 23f * this.scale, ref collisionPoint);
}
if (this.type == 642)
{
float collisionPoint = 0.0f;
return Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), this.Center, this.Center + this.velocity * this.localAI[1], 30f * this.scale, ref collisionPoint);
}
if (this.type == 802 || this.type == 842 || this.type == 938 || this.type == 939 || this.type == 940 || this.type == 941 || this.type == 942 || this.type == 943 || this.type == 944 || this.type == 945)
{
float collisionPoint = 0.0f;
return Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), this.Center, this.Center + this.velocity * 6f, 10f * this.scale, ref collisionPoint);
}
if (this.type == 632)
{
float collisionPoint = 0.0f;
return Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), this.Center, this.Center + this.velocity * this.localAI[1], 22f * this.scale, ref collisionPoint);
}
if (this.type == 455)
{
float collisionPoint = 0.0f;
return Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), this.Center, this.Center + this.velocity * this.localAI[1], 36f * this.scale, ref collisionPoint);
}
if (this.type == 611)
{
float collisionPoint = 0.0f;
return Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), this.Center, this.Center + this.velocity + this.velocity.SafeNormalize(Vector2.Zero) * 48f, 16f * this.scale, ref collisionPoint);
}
if (this.type == 684)
{
float collisionPoint = 0.0f;
Vector2 vector2 = this.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(-1.57079637050629) * this.scale;
return Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), this.Center - vector2 * 40f, this.Center + vector2 * 40f, 16f * this.scale, ref collisionPoint);
}
if (this.type == 537)
{
float collisionPoint = 0.0f;
return Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), this.Center, this.Center + this.velocity * this.localAI[1], 22f * this.scale, ref collisionPoint);
}
if (this.type == 756)
{
float collisionPoint = 0.0f;
return Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), this.Center, this.Center + this.velocity.SafeNormalize(-Vector2.UnitY) * 200f * this.scale, 22f * this.scale, ref collisionPoint);
}
if (this.type == 687)
{
float collisionPoint = 0.0f;
float num3 = this.ai[0] / 25f;
if ((double) num3 > 1.0)
num3 = 1f;
float num4 = (float) (((double) this.ai[0] - 38.0) / 40.0);
if ((double) num4 < 0.0)
num4 = 0.0f;
Vector2 lineStart = this.Center + this.rotation.ToRotationVector2() * 400f * num4;
Vector2 lineEnd = this.Center + this.rotation.ToRotationVector2() * 400f * num3;
return Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), lineStart, lineEnd, 40f * this.scale, ref collisionPoint);
}
if (this.type == 466 || this.type == 580 || this.type == 686)
{
for (int index = 0; index < this.oldPos.Length && ((double) this.oldPos[index].X != 0.0 || (double) this.oldPos[index].Y != 0.0); ++index)
{
myRect.X = (int) this.oldPos[index].X;
myRect.Y = (int) this.oldPos[index].Y;
if (myRect.Intersects(targetRect))
return true;
}
return false;
}
if (this.type == 711)
{
if (this.penetrate != -1)
{
for (int index = 0; index < this.oldPos.Length && ((double) this.oldPos[index].X != 0.0 || (double) this.oldPos[index].Y != 0.0); ++index)
{
myRect.X = (int) this.oldPos[index].X;
myRect.Y = (int) this.oldPos[index].Y;
if (myRect.Intersects(targetRect))
return true;
}
}
}
else if (this.type == 464 && (double) this.ai[1] != 1.0)
{
Vector2 spinningpoint = new Vector2(0.0f, -720f).RotatedBy((double) this.velocity.ToRotation()) * (float) ((double) this.ai[0] % 45.0 / 45.0);
for (int index = 0; index < 6; ++index)
{
float num = (float) ((double) index * 6.28318548202515 / 6.0);
if (Utils.CenteredRectangle(this.Center + spinningpoint.RotatedBy((double) num), new Vector2(30f, 30f)).Intersects(targetRect))
return true;
}
}
return false;
}
public void ProjLight()
{
if ((double) this.light <= 0.0)
return;
float r = this.light;
float g = this.light;
float b = this.light;
if (this.type == 446)
{
r *= 0.0f;
b *= 0.8f;
}
else if (this.type == 493 || this.type == 494)
g *= 0.3f;
else if (this.type == 876)
{
r *= 0.1f;
g *= 0.7f;
b *= 1f;
}
else if (this.type == 867)
{
float num = (float) Main.rand.Next(28, 42) * 0.005f + (float) (270 - (int) Main.mouseTextColor) / 500f;
r = 0.1f;
g = (float) (0.300000011920929 + (double) num / 2.0);
b = 0.6f + num;
}
else if (this.type == 332)
{
b *= 0.1f;
g *= 0.6f;
}
else if (this.type == 259)
b *= 0.1f;
else if (this.type == 329)
{
b *= 0.1f;
g *= 0.9f;
}
else if (this.type == 2 || this.type == 82)
{
g *= 0.75f;
b *= 0.55f;
}
else if (this.type == 172)
{
g *= 0.55f;
r *= 0.35f;
}
else if (this.type == 308)
{
g *= 0.7f;
r *= 0.1f;
}
else if (this.type == 304)
{
g *= 0.2f;
b *= 0.1f;
}
else if (this.type == 263)
{
g *= 0.7f;
r *= 0.1f;
}
else if (this.type == 274)
{
g *= 0.1f;
r *= 0.7f;
}
else if (this.type == 254)
r *= 0.1f;
else if (this.type == 94)
{
r *= 0.5f;
g *= 0.0f;
}
else if (this.type == 95 || this.type == 96 || this.type == 103 || this.type == 104)
{
r *= 0.35f;
g *= 1f;
b *= 0.0f;
}
else if (this.type == 4)
{
g *= 0.1f;
r *= 0.5f;
}
else if (this.type == 257)
{
g *= 0.9f;
r *= 0.1f;
}
else if (this.type == 9)
{
g *= 0.1f;
b *= 0.6f;
}
else if (this.type == 488)
{
r = 0.3f;
b = 0.25f;
g = 0.0f;
}
else if (this.type == 92)
{
g *= 0.6f;
r *= 0.8f;
}
else if (this.type == 93)
{
g *= 1f;
r *= 1f;
b *= 0.01f;
}
else if (this.type == 12)
{
r *= 0.9f;
g *= 0.8f;
b *= 0.1f;
}
else if (this.type == 14 || this.type == 110 || this.type == 180 || this.type == 242 || this.type == 302)
{
g *= 0.7f;
b *= 0.1f;
}
else if (this.type == 15)
{
g *= 0.4f;
b *= 0.1f;
r = 1f;
}
else if (this.type == 16)
{
r *= 0.1f;
g *= 0.4f;
b = 1f;
}
else if (this.type == 18)
{
g *= 0.1f;
r *= 0.6f;
}
else if (this.type == 19)
{
g *= 0.5f;
b *= 0.1f;
}
else if (this.type == 20)
{
r *= 0.1f;
b *= 0.3f;
}
else if (this.type == 22)
{
r = 0.0f;
g = 0.0f;
}
else if (this.type == 27)
{
r *= 0.0f;
g *= 0.3f;
b = 1f;
}
else if (this.type == 34)
{
g *= 0.1f;
b *= 0.1f;
}
else if (this.type == 36)
{
r = 0.8f;
g *= 0.2f;
b *= 0.6f;
}
else if (this.type == 41)
{
g *= 0.8f;
b *= 0.6f;
}
else if (this.type == 44 || this.type == 45)
{
b = 1f;
r *= 0.6f;
g *= 0.1f;
}
else if (this.type == 50)
{
r *= 0.7f;
b *= 0.8f;
}
else if (this.type == 515)
{
g *= 0.6f;
b *= 0.85f;
}
else if (this.type == 870)
{
r *= 0.7f;
g = 0.0f;
}
else if (this.type == 53)
{
r *= 0.7f;
g *= 0.8f;
}
else if (this.type == 473)
{
r *= 1.05f;
g *= 0.95f;
b *= 0.55f;
}
else if (this.type == 72)
{
r *= 0.45f;
g *= 0.75f;
b = 1f;
}
else if (this.type == 86)
{
r *= 1f;
g *= 0.45f;
b = 0.75f;
}
else if (this.type == 87)
{
r *= 0.45f;
g = 1f;
b *= 0.75f;
}
else if (this.type == 73)
{
r *= 0.4f;
g *= 0.6f;
b *= 1f;
}
else if (this.type == 74)
{
r *= 1f;
g *= 0.4f;
b *= 0.6f;
}
else if (this.type == 284)
{
r *= 1f;
g *= 0.1f;
b *= 0.8f;
}
else if (this.type == 285)
{
r *= 0.1f;
g *= 0.5f;
b *= 1f;
}
else if (this.type == 286)
{
r *= 1f;
g *= 0.5f;
b *= 0.1f;
}
else if (this.type == 287)
{
r *= 0.9f;
g *= 1f;
b *= 0.4f;
}
else if (this.type == 283)
{
r *= 0.8f;
g *= 0.1f;
}
else if (this.type == 76 || this.type == 77 || this.type == 78)
{
r *= 1f;
g *= 0.3f;
b *= 0.6f;
}
else if (this.type == 79)
{
r = (float) Main.DiscoR / (float) byte.MaxValue;
g = (float) Main.DiscoG / (float) byte.MaxValue;
b = (float) Main.DiscoB / (float) byte.MaxValue;
}
else if (this.type == 80)
{
r *= 0.0f;
g *= 0.8f;
b *= 1f;
}
else if (this.type == 83 || this.type == 88)
{
r *= 0.7f;
g *= 0.0f;
b *= 1f;
}
else if (this.type == 100)
{
r *= 1f;
g *= 0.5f;
b *= 0.0f;
}
else if (this.type == 84 || this.type == 389)
{
r *= 0.8f;
g *= 0.0f;
b *= 0.5f;
}
else if (this.type == 89 || this.type == 90)
{
g *= 0.2f;
b *= 1f;
r *= 0.05f;
}
else if (this.type == 106)
{
r *= 0.0f;
g *= 0.5f;
b *= 1f;
}
else if (this.type == 113)
{
r *= 0.25f;
g *= 0.75f;
b *= 1f;
}
else if (this.type == 114 || this.type == 115)
{
r *= 0.5f;
g *= 0.05f;
b *= 1f;
}
else if (this.type == 116)
b *= 0.25f;
else if (this.type == 131)
{
r *= 0.1f;
g *= 0.4f;
}
else if (this.type == 132 || this.type == 157)
{
r *= 0.2f;
b *= 0.6f;
}
else if (this.type == 156)
{
r *= 1f;
b *= 0.6f;
g = 0.0f;
}
else if (this.type == 173)
{
r *= 0.3f;
b *= 1f;
g = 0.4f;
}
else if (this.type == 207)
{
r *= 0.4f;
b *= 0.4f;
}
else if (this.type == 253)
{
r = 0.0f;
g *= 0.4f;
}
else if (this.type == 211)
{
r *= 0.5f;
g *= 0.9f;
b *= 1f;
this.light = (double) this.localAI[0] != 0.0 ? 1f : 1.5f;
}
else if (this.type == 209)
{
float num1 = (float) (((double) byte.MaxValue - (double) this.alpha) / (double) byte.MaxValue);
float num2 = r * 0.3f;
float num3 = g * 0.4f;
b = b * 1.75f * num1;
r = num2 * num1;
g = num3 * num1;
}
else if (this.type == 226 || this.type == 227 | this.type == 229)
{
r *= 0.25f;
g *= 1f;
b *= 0.5f;
}
else if (this.type == 251)
{
float num4 = (float) Main.DiscoR / (float) byte.MaxValue;
float num5 = (float) Main.DiscoG / (float) byte.MaxValue;
float num6 = (float) Main.DiscoB / (float) byte.MaxValue;
float num7 = (float) (((double) num4 + 1.0) / 2.0);
float num8 = (float) (((double) num5 + 1.0) / 2.0);
float num9 = (float) (((double) num6 + 1.0) / 2.0);
r = num7 * this.light;
g = num8 * this.light;
b = num9 * this.light;
}
else if (this.type == 278 || this.type == 279)
{
r *= 1f;
g *= 1f;
b *= 0.0f;
}
Lighting.AddLight((int) (((double) this.position.X + (double) (this.width / 2)) / 16.0), (int) (((double) this.position.Y + (double) (this.height / 2)) / 16.0), r, g, b);
}
public Microsoft.Xna.Framework.Rectangle getRect() => new Microsoft.Xna.Framework.Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height);
public void Update(int i)
{
if (!this.active)
return;
if (Main.netMode == 1 && (ProjectileID.Sets.IsAGolfBall[this.type] || this.type == 820))
{
int index1 = (int) ((double) this.position.X + (double) (this.width / 2)) / 16;
int index2 = (int) ((double) this.position.Y + (double) (this.height / 2)) / 16;
if (Main.tile[index1, index2] == null)
return;
}
this.numUpdates = this.extraUpdates;
while (this.numUpdates >= 0)
{
--this.numUpdates;
if (this.type == 640 && (double) this.ai[1] > 0.0)
{
--this.ai[1];
}
else
{
if ((double) this.position.X <= (double) Main.leftWorld || (double) this.position.X + (double) this.width >= (double) Main.rightWorld || (double) this.position.Y <= (double) Main.topWorld || (double) this.position.Y + (double) this.height >= (double) Main.bottomWorld)
{
this.active = false;
return;
}
if (!this.noEnchantmentVisuals)
this.UpdateEnchantmentVisuals();
if (this.numUpdates == -1 && (this.minion || this.sentry))
this.damage = (int) ((double) this.originalDamage * (double) Main.player[this.owner].minionDamage);
if (this.minion && this.numUpdates == -1 && this.type != 625 && this.type != 628)
{
this.minionPos = Main.player[this.owner].numMinions;
if ((double) Main.player[this.owner].slotsMinions + (double) this.minionSlots > (double) Main.player[this.owner].maxMinions && this.owner == Main.myPlayer)
{
if ((this.type == 627 || this.type == 626) && this.owner == Main.myPlayer)
{
int byUuid = Projectile.GetByUUID(this.owner, this.ai[0]);
if (byUuid != -1)
{
Projectile projectile1 = Main.projectile[byUuid];
if (projectile1.type != 625)
projectile1.localAI[1] = this.localAI[1];
Projectile projectile2 = Main.projectile[(int) this.localAI[1]];
projectile2.ai[0] = this.ai[0];
projectile2.ai[1] = 1f;
projectile2.netUpdate = true;
}
}
this.Kill();
}
else
{
++Main.player[this.owner].numMinions;
Main.player[this.owner].slotsMinions += this.minionSlots;
}
}
float num1 = (float) (1.0 + (double) Math.Abs(this.velocity.X) / 3.0);
if ((double) this.gfxOffY > 0.0)
{
this.gfxOffY -= num1 * this.stepSpeed;
if ((double) this.gfxOffY < 0.0)
this.gfxOffY = 0.0f;
}
else if ((double) this.gfxOffY < 0.0)
{
this.gfxOffY += num1 * this.stepSpeed;
if ((double) this.gfxOffY > 0.0)
this.gfxOffY = 0.0f;
}
if ((double) this.gfxOffY > 16.0)
this.gfxOffY = 16f;
if ((double) this.gfxOffY < -16.0)
this.gfxOffY = -16f;
Vector2 velocity = this.velocity;
this.oldVelocity = this.velocity;
this.whoAmI = i;
if (this.soundDelay > 0)
--this.soundDelay;
this.netUpdate = false;
for (int index = 0; index < (int) byte.MaxValue; ++index)
{
if (this.playerImmune[index] > 0)
--this.playerImmune[index];
}
if (this.usesLocalNPCImmunity)
{
for (int index = 0; index < 200; ++index)
{
if (this.localNPCImmunity[index] > 0)
--this.localNPCImmunity[index];
}
}
this.AI();
if (this.ShouldUseWindPhysics() && (double) this.Center.Y < Main.worldSurface * 16.0 && Main.tile[(int) this.Center.X / 16, (int) this.Center.Y / 16] != null && Main.tile[(int) this.Center.X / 16, (int) this.Center.Y / 16].wall == (ushort) 0 && ((double) this.velocity.X > 0.0 && (double) Main.windSpeedCurrent < 0.0 || (double) this.velocity.X < 0.0 && (double) Main.windSpeedCurrent > 0.0 || (double) Math.Abs(this.velocity.X) < (double) Math.Abs(Main.windSpeedCurrent * Main.windPhysicsStrength) * 180.0) && (double) Math.Abs(this.velocity.X) < 16.0)
{
this.velocity.X += Main.windSpeedCurrent * Main.windPhysicsStrength;
double num2 = (double) MathHelper.Clamp(this.velocity.X, -16f, 16f);
}
if (this.owner < (int) byte.MaxValue && !Main.player[this.owner].active)
this.Kill();
if (this.type == 242 || this.type == 302 || this.type == 638)
this.wet = false;
if (!this.ignoreWater)
{
bool flag1;
bool flag2;
try
{
flag1 = Collision.LavaCollision(this.position, this.width, this.height);
flag2 = Collision.WetCollision(this.position, this.width, this.height);
if (flag1)
this.lavaWet = true;
if (Collision.honey)
this.honeyWet = true;
}
catch
{
this.active = false;
return;
}
if (this.wet && !this.lavaWet)
{
if (this.type == 85 || this.type == 15 || this.type == 34 || this.type == 188)
this.Kill();
if (this.type == 2)
{
this.type = 1;
this.light = 0.0f;
}
}
if (this.type == 80)
{
flag2 = false;
this.wet = false;
if (flag1 && (double) this.ai[0] >= 0.0)
this.Kill();
}
if (flag2)
{
if (this.type != 155 && this.wetCount == (byte) 0 && !this.wet)
{
if (!flag1)
{
if (this.honeyWet)
{
for (int index3 = 0; index3 < 10; ++index3)
{
int index4 = Dust.NewDust(new Vector2(this.position.X - 6f, (float) ((double) this.position.Y + (double) (this.height / 2) - 8.0)), this.width + 12, 24, 152);
--Main.dust[index4].velocity.Y;
Main.dust[index4].velocity.X *= 2.5f;
Main.dust[index4].scale = 1.3f;
Main.dust[index4].alpha = 100;
Main.dust[index4].noGravity = true;
}
SoundEngine.PlaySound(19, (int) this.position.X, (int) this.position.Y);
}
else
{
for (int index5 = 0; index5 < 10; ++index5)
{
int index6 = Dust.NewDust(new Vector2(this.position.X - 6f, (float) ((double) this.position.Y + (double) (this.height / 2) - 8.0)), this.width + 12, 24, Dust.dustWater());
Main.dust[index6].velocity.Y -= 4f;
Main.dust[index6].velocity.X *= 2.5f;
Main.dust[index6].scale = 1.3f;
Main.dust[index6].alpha = 100;
Main.dust[index6].noGravity = true;
}
SoundEngine.PlaySound(19, (int) this.position.X, (int) this.position.Y);
}
}
else
{
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, 35);
Main.dust[index8].velocity.Y -= 1.5f;
Main.dust[index8].velocity.X *= 2.5f;
Main.dust[index8].scale = 1.3f;
Main.dust[index8].alpha = 100;
Main.dust[index8].noGravity = true;
}
SoundEngine.PlaySound(19, (int) this.position.X, (int) this.position.Y);
}
}
this.wet = true;
}
else if (this.wet)
{
this.wet = false;
if (this.type == 155)
this.velocity.Y *= 0.5f;
else if (this.wetCount == (byte) 0)
{
this.wetCount = (byte) 10;
if (!this.lavaWet)
{
if (this.honeyWet)
{
for (int index9 = 0; index9 < 10; ++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, 152);
--Main.dust[index10].velocity.Y;
Main.dust[index10].velocity.X *= 2.5f;
Main.dust[index10].scale = 1.3f;
Main.dust[index10].alpha = 100;
Main.dust[index10].noGravity = true;
}
SoundEngine.PlaySound(19, (int) this.position.X, (int) this.position.Y);
}
else
{
for (int index11 = 0; index11 < 10; ++index11)
{
int index12 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y + (float) (this.height / 2)), this.width + 12, 24, Dust.dustWater());
Main.dust[index12].velocity.Y -= 4f;
Main.dust[index12].velocity.X *= 2.5f;
Main.dust[index12].scale = 1.3f;
Main.dust[index12].alpha = 100;
Main.dust[index12].noGravity = true;
}
SoundEngine.PlaySound(19, (int) this.position.X, (int) this.position.Y);
}
}
else
{
for (int index13 = 0; index13 < 10; ++index13)
{
int index14 = 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[index14].velocity.Y -= 1.5f;
Main.dust[index14].velocity.X *= 2.5f;
Main.dust[index14].scale = 1.3f;
Main.dust[index14].alpha = 100;
Main.dust[index14].noGravity = true;
}
SoundEngine.PlaySound(19, (int) this.position.X, (int) this.position.Y);
}
}
}
if (!this.wet)
{
this.lavaWet = false;
this.honeyWet = false;
}
if (this.wetCount > (byte) 0)
--this.wetCount;
}
this.oldPosition = this.position;
this.oldDirection = this.direction;
this.HandleMovement(velocity, out int _, out int _);
if (this.AutomaticallyChangesDirection())
{
if ((double) this.velocity.X < 0.0)
this.direction = -1;
else
this.direction = 1;
}
if (!this.active)
return;
this.ProjLight();
if (!this.npcProj && this.friendly && Main.player[this.owner].magicQuiver && this.extraUpdates < 1 && this.arrow)
this.extraUpdates = 1;
if (this.type == 2 || this.type == 82)
Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100);
else if (this.type == 172)
Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 135, Alpha: 100);
else if (this.type == 103)
{
int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 75, Alpha: 100);
if (Main.rand.Next(2) == 0)
{
Main.dust[index].noGravity = true;
Main.dust[index].scale *= 2f;
}
}
else if (this.type == 278)
{
int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 169, Alpha: 100);
if (Main.rand.Next(2) == 0)
{
Main.dust[index].noGravity = true;
Main.dust[index].scale *= 1.5f;
}
}
else if (this.type == 4)
{
if (Main.rand.Next(5) == 0)
Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 14, Alpha: 150, Scale: 1.1f);
}
else if (this.type == 5)
{
int Type;
switch (Main.rand.Next(3))
{
case 0:
Type = 15;
break;
case 1:
Type = 57;
break;
default:
Type = 58;
break;
}
Dust.NewDust(this.position, this.width, this.height, Type, this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 150, Scale: 1.2f);
}
this.Damage();
if (this.type == 434 && (double) this.localAI[0] == 0.0 && this.numUpdates == 0)
{
this.extraUpdates = 1;
this.velocity = Vector2.Zero;
this.localAI[0] = 1f;
this.localAI[1] = 0.9999f;
this.netUpdate = true;
}
if (Main.netMode != 1 && (this.type == 99 || this.type == 655 || this.type == 727))
Collision.SwitchTiles(this.position, this.width, this.height, this.oldPosition, 3);
if (ProjectileID.Sets.TrailingMode[this.type] == 0)
{
for (int index = this.oldPos.Length - 1; index > 0; --index)
this.oldPos[index] = this.oldPos[index - 1];
this.oldPos[0] = this.position;
}
else if (ProjectileID.Sets.TrailingMode[this.type] == 1)
{
if (this.frameCounter == 0 || this.oldPos[0] == Vector2.Zero)
{
for (int index = this.oldPos.Length - 1; index > 0; --index)
this.oldPos[index] = this.oldPos[index - 1];
this.oldPos[0] = this.position;
if (this.velocity == Vector2.Zero && this.type == 466)
{
float num3 = (float) ((double) this.rotation + 1.57079637050629 + (Main.rand.Next(2) == 1 ? -1.0 : 1.0) * 1.57079637050629);
float num4 = (float) (Main.rand.NextDouble() * 2.0 + 2.0);
Vector2 vector2 = new Vector2((float) Math.Cos((double) num3) * num4, (float) Math.Sin((double) num3) * num4);
int index = Dust.NewDust(this.oldPos[this.oldPos.Length - 1], 0, 0, 229, vector2.X, vector2.Y);
Main.dust[index].noGravity = true;
Main.dust[index].scale = 1.7f;
}
if (this.velocity == Vector2.Zero && this.type == 580)
{
float num5 = (float) ((double) this.rotation + 1.57079637050629 + (Main.rand.Next(2) == 1 ? -1.0 : 1.0) * 1.57079637050629);
float num6 = (float) (Main.rand.NextDouble() * 2.0 + 2.0);
Vector2 vector2 = new Vector2((float) Math.Cos((double) num5) * num6, (float) Math.Sin((double) num5) * num6);
int index = Dust.NewDust(this.oldPos[this.oldPos.Length - 1], 0, 0, 229, vector2.X, vector2.Y);
Main.dust[index].noGravity = true;
Main.dust[index].scale = 1.7f;
}
}
}
else if (ProjectileID.Sets.TrailingMode[this.type] == 2)
{
for (int index = this.oldPos.Length - 1; index > 0; --index)
{
this.oldPos[index] = this.oldPos[index - 1];
this.oldRot[index] = this.oldRot[index - 1];
this.oldSpriteDirection[index] = this.oldSpriteDirection[index - 1];
}
this.oldPos[0] = this.position;
this.oldRot[0] = this.rotation;
this.oldSpriteDirection[0] = this.spriteDirection;
}
else if (ProjectileID.Sets.TrailingMode[this.type] == 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.oldSpriteDirection[index] = this.oldSpriteDirection[index - 1];
}
this.oldPos[0] = this.position;
this.oldRot[0] = this.rotation;
this.oldSpriteDirection[0] = this.spriteDirection;
float amount = 0.65f;
int num7 = 1;
for (int index15 = 0; index15 < num7; ++index15)
{
for (int index16 = this.oldPos.Length - 1; index16 > 0; --index16)
{
if (!(this.oldPos[index16] == Vector2.Zero))
{
if ((double) this.oldPos[index16].Distance(this.oldPos[index16 - 1]) > 2.0)
this.oldPos[index16] = Vector2.Lerp(this.oldPos[index16], this.oldPos[index16 - 1], amount);
this.oldRot[index16] = (this.oldPos[index16 - 1] - this.oldPos[index16]).SafeNormalize(Vector2.Zero).ToRotation();
}
}
}
}
else if (ProjectileID.Sets.TrailingMode[this.type] == 4)
{
Vector2 vector2 = Main.player[this.owner].position - Main.player[this.owner].oldPosition;
for (int index = this.oldPos.Length - 1; index > 0; --index)
{
this.oldPos[index] = this.oldPos[index - 1];
this.oldRot[index] = this.oldRot[index - 1];
this.oldSpriteDirection[index] = this.oldSpriteDirection[index - 1];
if (this.numUpdates == 0 && this.oldPos[index] != Vector2.Zero)
this.oldPos[index] += vector2;
}
this.oldPos[0] = this.position;
this.oldRot[0] = this.rotation;
this.oldSpriteDirection[0] = this.spriteDirection;
}
if (ProjectileID.Sets.IsADD2Turret[this.type] && DD2Event.Ongoing)
++this.timeLeft;
--this.timeLeft;
if (this.timeLeft <= 0)
this.Kill();
if (this.penetrate == 0)
this.Kill();
if (this.active && this.owner == Main.myPlayer)
{
if (this.netUpdate2)
this.netUpdate = true;
if (!this.active)
this.netSpam = 0;
if (this.netUpdate)
{
if (this.netSpam < 60)
{
this.netSpam += 5;
NetMessage.SendData(27, number: i);
this.netUpdate2 = false;
}
else
this.netUpdate2 = true;
}
if (this.netSpam > 0)
--this.netSpam;
}
}
}
this.netUpdate = false;
}
private bool AutomaticallyChangesDirection() => (this.aiStyle != 3 || (double) this.ai[0] != 1.0) && (this.aiStyle != 7 || (double) this.ai[0] != 1.0) && (this.aiStyle != 13 || (double) this.ai[0] != 1.0) && this.aiStyle != 65 && this.aiStyle != 69 && this.aiStyle != 114 && this.aiStyle != 123 && this.aiStyle != 112 && !this.manualDirectionChange && this.aiStyle != 67 && this.aiStyle != 26 && this.aiStyle != 15 && this.aiStyle != 150;
private void UpdateEnchantmentVisuals()
{
if (this.npcProj)
return;
if (Main.player[this.owner].frostBurn && (this.melee || this.ranged) && this.friendly && !this.hostile && !this.noEnchantments && Main.rand.Next(2 * (1 + this.extraUpdates)) == 0)
{
int index = Dust.NewDust(this.position, this.width, this.height, 135, this.velocity.X * 0.2f + (float) (this.direction * 3), this.velocity.Y * 0.2f, 100, Scale: 2f);
Main.dust[index].noGravity = true;
Main.dust[index].velocity *= 0.7f;
Main.dust[index].velocity.Y -= 0.5f;
}
if (this.melee && Main.player[this.owner].magmaStone && !this.noEnchantments && Main.rand.Next(3) != 0)
{
int index = Dust.NewDust(new Vector2(this.position.X - 4f, this.position.Y - 4f), this.width + 8, this.height + 8, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, Scale: 2f);
if (Main.rand.Next(2) == 0)
Main.dust[index].scale = 1.5f;
Main.dust[index].noGravity = true;
Main.dust[index].velocity.X *= 2f;
Main.dust[index].velocity.Y *= 2f;
}
if (!this.melee || Main.player[this.owner].meleeEnchant <= (byte) 0 || this.noEnchantments)
return;
if (Main.player[this.owner].meleeEnchant == (byte) 1 && Main.rand.Next(3) == 0)
{
int index = Dust.NewDust(this.position, this.width, this.height, 171, Alpha: 100);
Main.dust[index].noGravity = true;
Main.dust[index].fadeIn = 1.5f;
Main.dust[index].velocity *= 0.25f;
}
if (Main.player[this.owner].meleeEnchant == (byte) 1)
{
if (Main.rand.Next(3) != 0)
return;
int index = Dust.NewDust(this.position, this.width, this.height, 171, Alpha: 100);
Main.dust[index].noGravity = true;
Main.dust[index].fadeIn = 1.5f;
Main.dust[index].velocity *= 0.25f;
}
else if (Main.player[this.owner].meleeEnchant == (byte) 2)
{
if (Main.rand.Next(2) != 0)
return;
int index = Dust.NewDust(this.position, this.width, this.height, 75, this.velocity.X * 0.2f + (float) (this.direction * 3), this.velocity.Y * 0.2f, 100, Scale: 2.5f);
Main.dust[index].noGravity = true;
Main.dust[index].velocity *= 0.7f;
Main.dust[index].velocity.Y -= 0.5f;
}
else if (Main.player[this.owner].meleeEnchant == (byte) 3)
{
if (Main.rand.Next(2) != 0)
return;
int index = Dust.NewDust(this.position, this.width, this.height, 6, this.velocity.X * 0.2f + (float) (this.direction * 3), this.velocity.Y * 0.2f, 100, Scale: 2.5f);
Main.dust[index].noGravity = true;
Main.dust[index].velocity *= 0.7f;
Main.dust[index].velocity.Y -= 0.5f;
}
else if (Main.player[this.owner].meleeEnchant == (byte) 4)
{
if (Main.rand.Next(2) != 0)
return;
int index = Dust.NewDust(this.position, this.width, this.height, 57, this.velocity.X * 0.2f + (float) (this.direction * 3), this.velocity.Y * 0.2f, 100, Scale: 1.1f);
Main.dust[index].noGravity = true;
Main.dust[index].velocity.X /= 2f;
Main.dust[index].velocity.Y /= 2f;
}
else if (Main.player[this.owner].meleeEnchant == (byte) 5)
{
if (Main.rand.Next(2) != 0)
return;
int index = Dust.NewDust(this.position, this.width, this.height, 169, Alpha: 100);
Main.dust[index].velocity.X += (float) this.direction;
Main.dust[index].velocity.Y += 0.2f;
Main.dust[index].noGravity = true;
}
else if (Main.player[this.owner].meleeEnchant == (byte) 6)
{
if (Main.rand.Next(2) != 0)
return;
int index = Dust.NewDust(this.position, this.width, this.height, 135, Alpha: 100);
Main.dust[index].velocity.X += (float) this.direction;
Main.dust[index].velocity.Y += 0.2f;
Main.dust[index].noGravity = true;
}
else if (Main.player[this.owner].meleeEnchant == (byte) 7)
{
Vector2 velocity = this.velocity;
if ((double) velocity.Length() > 4.0)
velocity *= 4f / velocity.Length();
if (Main.rand.Next(20) == 0)
{
int index = Dust.NewDust(this.position, this.width, this.height, Main.rand.Next(139, 143), velocity.X, velocity.Y, Scale: 1.2f);
Main.dust[index].velocity.X *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258);
Main.dust[index].velocity.Y *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258);
Main.dust[index].velocity.X += (float) Main.rand.Next(-50, 51) * 0.05f;
Main.dust[index].velocity.Y += (float) Main.rand.Next(-50, 51) * 0.05f;
Main.dust[index].scale *= (float) (1.0 + (double) Main.rand.Next(-30, 31) * 0.00999999977648258);
}
if (Main.rand.Next(40) != 0)
return;
int Type = Main.rand.Next(276, 283);
int index1 = Gore.NewGore(this.position, velocity, Type);
Main.gore[index1].velocity.X *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258);
Main.gore[index1].velocity.Y *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258);
Main.gore[index1].scale *= (float) (1.0 + (double) Main.rand.Next(-20, 21) * 0.00999999977648258);
Main.gore[index1].velocity.X += (float) Main.rand.Next(-50, 51) * 0.05f;
Main.gore[index1].velocity.Y += (float) Main.rand.Next(-50, 51) * 0.05f;
}
else
{
if (Main.player[this.owner].meleeEnchant != (byte) 8 || Main.rand.Next(4) != 0)
return;
int index = Dust.NewDust(this.position, this.width, this.height, 46, Alpha: 100);
Main.dust[index].noGravity = true;
Main.dust[index].fadeIn = 1.5f;
Main.dust[index].velocity *= 0.25f;
}
}
private void HandleMovement(Vector2 wetVelocity, out int overrideWidth, out int overrideHeight)
{
bool flag1 = false;
overrideWidth = -1;
overrideHeight = -1;
bool flag2 = false;
bool? nullable1 = ProjectileID.Sets.ForcePlateDetection[this.type];
bool flag3 = nullable1.HasValue && !nullable1.Value;
bool flag4 = nullable1.HasValue && nullable1.Value;
if (this.tileCollide)
{
Vector2 velocity1 = this.velocity;
bool flag5 = true;
Vector2? nullable2 = new Vector2?();
if (Main.projPet[this.type])
{
flag5 = false;
if ((double) Main.player[this.owner].position.Y + (double) Main.player[this.owner].height - 12.0 > (double) this.position.Y + (double) this.height)
flag5 = true;
}
if (this.type == 500)
{
flag5 = false;
if ((double) Main.player[this.owner].Bottom.Y > (double) this.Bottom.Y + 4.0)
flag5 = true;
}
if (this.type == 653)
{
flag5 = false;
if ((double) Main.player[this.owner].Bottom.Y > (double) this.Bottom.Y + 4.0)
flag5 = true;
}
if (this.aiStyle == 62)
flag5 = true;
if (this.aiStyle == 66)
flag5 = true;
if (this.type == 317)
flag5 = true;
if (this.type == 373)
flag5 = true;
if (this.aiStyle == 53)
flag5 = false;
if (this.type == 9 || this.type == 12 || this.type == 15 || this.type == 13 || this.type == 31 || this.type == 39 || this.type == 40)
flag5 = false;
if (this.type == 24)
flag5 = false;
switch (this.type)
{
case 663:
case 665:
case 667:
case 677:
case 678:
case 679:
case 688:
case 689:
case 690:
case 691:
case 692:
case 693:
flag5 = false;
break;
case 759:
flag5 = true;
break;
}
if (this.decidesManualFallThrough)
flag5 = this.shouldFallThrough;
if (this.type == 771 || this.type == 822 || this.type == 823 || this.type == 843 || this.type == 846 || this.type == 845 || this.type == 852)
{
overrideWidth = this.width;
overrideHeight = 34;
nullable2 = new Vector2?(new Vector2(0.75f, 0.75f));
}
if (this.type == 824 || this.type == 839 || this.type == 840 || this.type == 850 || this.type == 853)
{
overrideWidth = this.width;
overrideHeight = 58;
nullable2 = new Vector2?(new Vector2(0.75f, 0.75f));
}
if (this.type == 826 || this.type == 830 || this.type == 838)
{
overrideWidth = this.width;
overrideHeight = 38;
nullable2 = new Vector2?(new Vector2(0.75f, 0.75f));
}
if (this.type == 828 || this.type == 829 || this.type == 827 || this.type == 844)
{
overrideWidth = this.width;
overrideHeight = 22;
nullable2 = new Vector2?(new Vector2(0.75f, 0.75f));
}
if (this.aiStyle == 29 || this.type == 28 || this.aiStyle == 49 || this.type == 906 || this.type == 903 || this.type == 904 || this.type == 910)
{
overrideWidth = this.width - 8;
overrideHeight = this.height - 8;
}
else if (this.type == 250 || this.type == 267 || this.type == 297 || this.type == 323 || this.type == 3 || this.type == 711)
{
overrideWidth = 6;
overrideHeight = 6;
}
else if (this.type == 308)
{
overrideWidth = 26;
overrideHeight = this.height;
}
else if (this.type == 663 || this.type == 665 || this.type == 667 || this.type == 677 || this.type == 678 || this.type == 679 || this.type == 691 || this.type == 692 || this.type == 693)
{
overrideWidth = 16;
overrideHeight = this.height;
}
else if (this.type == 688 || this.type == 689 || this.type == 690)
{
overrideWidth = 16;
overrideHeight = this.height;
nullable2 = new Vector2?(new Vector2(0.5f, 1f));
}
else if (this.type == 669 || this.type == 706)
{
overrideWidth = 10;
overrideHeight = 10;
}
else if (this.type == 261 || this.type == 277)
{
overrideWidth = 26;
overrideHeight = 26;
}
else if (this.type == 481 || this.type == 491 || this.type == 106 || this.type == 262 || this.type == 271 || this.type == 270 || this.type == 272 || this.type == 273 || this.type == 274 || this.type == 280 || this.type == 288 || this.type == 301 || this.type == 320 || this.type == 333 || this.type == 335 || this.type == 343 || this.type == 344 || this.type == 497 || this.type == 496 || this.type == 6 || this.type == 19 || this.type == 113 || this.type == 52 || this.type == 520 || this.type == 523 || this.type == 585 || this.type == 598 || this.type == 599 || this.type == 636 || this.type == 837 || this.type == 861 || this.type == 867)
{
overrideWidth = 10;
overrideHeight = 10;
}
else if (this.type == 514)
{
overrideWidth = 4;
overrideHeight = 4;
}
else if (this.type == 248 || this.type == 247 || this.type == 507 || this.type == 508 || this.type == 662 || this.type == 680 || this.type == 685 || this.type == 757 || this.type == 928)
{
overrideWidth = this.width - 12;
overrideHeight = this.height - 12;
}
else if (this.aiStyle == 18 || this.type == 254)
{
overrideWidth = this.width - 36;
overrideHeight = this.height - 36;
}
else if (this.type == 182 || this.type == 190 || this.type == 33 || this.type == 229 || this.type == 237 || this.type == 243 || this.type == 866)
{
overrideWidth = this.width - 20;
overrideHeight = this.height - 20;
}
else if (this.aiStyle == 27)
{
overrideWidth = this.width - 12;
overrideHeight = this.height - 12;
}
else if (this.type == 533 && (double) this.ai[0] >= 6.0)
{
overrideWidth = this.width + 6;
overrideHeight = this.height + 6;
}
else if (this.type == 755 && (double) this.ai[0] >= 0.0)
{
overrideWidth = this.width + 6;
overrideHeight = this.height + 6;
}
else if (this.type == 759)
{
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = -velocity1.X;
if ((double) this.velocity.Y != (double) velocity1.Y)
this.velocity.Y = -velocity1.Y;
}
else if (this.type == 582 || this.type == 634 || this.type == 635 || this.type == 902)
{
overrideWidth = 8;
overrideHeight = 8;
}
else if (this.type == 617)
{
overrideWidth = (int) (20.0 * (double) this.scale);
overrideHeight = (int) (20.0 * (double) this.scale);
}
else if (this.type == 304)
{
overrideWidth = 4;
overrideHeight = 4;
}
else if (this.aiStyle == 9)
{
overrideWidth = 4;
overrideHeight = 4;
}
else if (this.type == 931)
{
overrideWidth = 4;
overrideHeight = 4;
}
if ((this.type != 440 && this.type != 449 && this.type != 606 || (double) this.ai[1] != 1.0) && (this.type != 466 || (double) this.localAI[1] != 1.0) && (this.type != 580 || (double) this.localAI[1] <= 0.0) && (this.type != 640 || (double) this.localAI[1] <= 0.0))
{
if (this.aiStyle == 10)
{
if (this.type >= 736 && this.type <= 738)
this.velocity = Collision.TileCollision(this.position, this.velocity, this.width, this.height, flag5, flag5);
else if (this.type == 42 || this.type == 65 || this.type == 68 || this.type == 354 || this.type == 31 && (double) this.ai[0] == 2.0)
this.velocity = Collision.TileCollision(this.position, this.velocity, this.width, this.height, flag5, flag5);
else
this.velocity = Collision.TileCollision(this.position, this.velocity, this.width, this.height, flag5, flag5);
}
else
{
Vector2 Position = this.position;
int num1 = overrideWidth != -1 ? overrideWidth : this.width;
int num2 = overrideHeight != -1 ? overrideHeight : this.height;
if (overrideHeight != -1 || overrideWidth != -1)
Position = !nullable2.HasValue ? new Vector2(this.position.X + (float) (this.width / 2) - (float) (num1 / 2), this.position.Y + (float) (this.height / 2) - (float) (num2 / 2)) : this.Center - new Vector2((float) num1, (float) num2) * nullable2.Value;
if (this.wet)
{
if (this.honeyWet)
{
Vector2 velocity2 = this.velocity;
this.velocity = Collision.TileCollision(Position, this.velocity, num1, num2, flag5, flag5);
wetVelocity = this.velocity * 0.25f;
if ((double) this.velocity.X != (double) velocity2.X)
wetVelocity.X = this.velocity.X;
if ((double) this.velocity.Y != (double) velocity2.Y)
wetVelocity.Y = this.velocity.Y;
}
else
{
Vector2 velocity3 = this.velocity;
this.velocity = Collision.TileCollision(Position, this.velocity, num1, num2, flag5, flag5);
wetVelocity = this.velocity * 0.5f;
if ((double) this.velocity.X != (double) velocity3.X)
wetVelocity.X = this.velocity.X;
if ((double) this.velocity.Y != (double) velocity3.Y)
wetVelocity.Y = this.velocity.Y;
}
if (!Main.projPet[this.type])
{
Vector4 vector4 = Collision.SlopeCollision(Position, this.velocity, num1, num2, fall: true);
Vector2 vector2 = this.position - Position;
if (this.aiStyle == 137)
{
if ((double) Position.Y != (double) vector4.Y)
flag1 = true;
if ((double) this.velocity.Y != (double) vector4.W)
flag1 = true;
Position.Y = vector4.Y;
this.position.Y = Position.Y + vector2.Y;
this.velocity.Y = vector4.W;
}
else
{
if ((double) Position.X != (double) vector4.X)
flag1 = true;
if ((double) Position.Y != (double) vector4.Y)
flag1 = true;
if ((double) this.velocity.X != (double) vector4.Z)
flag1 = true;
if ((double) this.velocity.Y != (double) vector4.W)
flag1 = true;
Position.X = vector4.X;
Position.Y = vector4.Y;
this.position = Position + vector2;
this.velocity.X = vector4.Z;
this.velocity.Y = vector4.W;
}
}
}
else
{
int num3 = Math.Min(num1, num2);
if (num3 < 3)
num3 = 3;
if (num3 > 16)
num3 = 16;
if ((double) this.velocity.Length() > (double) num3)
{
Vector2 vector2_1 = Collision.TileCollision(Position, this.velocity, num1, num2, flag5, flag5);
float num4 = this.velocity.Length();
float num5 = (float) num3;
Vector2 vector2_2 = Vector2.Normalize(this.velocity);
if ((double) vector2_1.Y == 0.0)
vector2_2.Y = 0.0f;
Vector2 zero1 = Vector2.Zero;
Vector2 zero2 = Vector2.Zero;
Vector2 zero3 = Vector2.Zero;
int num6 = 0;
while ((double) num4 > 0.0)
{
++num6;
if (num6 <= 300)
{
Vector2 oldPosition = Position;
float num7 = num4;
if ((double) num7 > (double) num5)
num7 = num5;
num4 -= num7;
Vector2 Velocity = vector2_2 * num7;
Vector2 vector2_3 = Collision.TileCollision(Position, Velocity, num1, num2, flag5, flag5);
Position += vector2_3;
this.velocity = vector2_3;
if (!Main.projPet[this.type])
{
Vector4 vector4 = Collision.SlopeCollision(Position, this.velocity, num1, num2, fall: true);
Vector2 vector2_4 = this.position - Position;
if (this.aiStyle == 137)
{
if ((double) Position.Y != (double) vector4.Y)
flag1 = true;
if ((double) this.velocity.Y != (double) vector4.W)
flag1 = true;
Position.Y = vector4.Y;
this.position.Y = Position.Y + vector2_4.Y;
this.velocity.Y = vector4.W;
}
else
{
if ((double) Position.X != (double) vector4.X)
flag1 = true;
if ((double) Position.Y != (double) vector4.Y)
flag1 = true;
if ((double) this.velocity.X != (double) vector4.Z)
flag1 = true;
if ((double) this.velocity.Y != (double) vector4.W)
flag1 = true;
Position.X = vector4.X;
Position.Y = vector4.Y;
this.position = Position + vector2_4;
this.velocity.X = vector4.Z;
this.velocity.Y = vector4.W;
}
}
flag2 = true;
if (this.owner == Main.myPlayer && Position != oldPosition && !flag3)
Collision.SwitchTiles(Position, num1, num2, oldPosition, 4);
Vector2 velocity4 = this.velocity;
zero1 += velocity4;
}
else
break;
}
this.velocity = zero1;
if ((double) Math.Abs(this.velocity.X - velocity1.X) < 9.99999974737875E-05)
this.velocity.X = velocity1.X;
if ((double) Math.Abs(this.velocity.Y - velocity1.Y) < 9.99999974737875E-05)
this.velocity.Y = velocity1.Y;
if (!Main.projPet[this.type])
{
Vector4 vector4 = Collision.SlopeCollision(Position, this.velocity, num1, num2, fall: true);
Vector2 vector2_5 = this.position - Position;
if (this.aiStyle == 137)
{
if ((double) Position.Y != (double) vector4.Y)
flag1 = true;
if ((double) this.velocity.Y != (double) vector4.W)
flag1 = true;
Position.Y = vector4.Y;
this.position.Y = Position.Y + vector2_5.Y;
this.velocity.Y = vector4.W;
}
else
{
if ((double) Position.X != (double) vector4.X)
flag1 = true;
if ((double) Position.Y != (double) vector4.Y)
flag1 = true;
if ((double) this.velocity.X != (double) vector4.Z)
flag1 = true;
if ((double) this.velocity.Y != (double) vector4.W)
flag1 = true;
Position.X = vector4.X;
Position.Y = vector4.Y;
this.position = Position + vector2_5;
this.velocity.X = vector4.Z;
this.velocity.Y = vector4.W;
}
}
}
else
{
this.velocity = Collision.TileCollision(Position, this.velocity, num1, num2, flag5, flag5);
if (!Main.projPet[this.type])
{
Vector4 vector4 = Collision.SlopeCollision(Position, this.velocity, num1, num2, fall: true);
Vector2 vector2 = this.position - Position;
if (this.aiStyle == 137)
{
if ((double) Position.Y != (double) vector4.Y)
flag1 = true;
if ((double) this.velocity.Y != (double) vector4.W)
flag1 = true;
Position.Y = vector4.Y;
this.position.Y = Position.Y + vector2.Y;
this.velocity.Y = vector4.W;
}
else
{
if ((double) Position.X != (double) vector4.X)
flag1 = true;
if ((double) Position.Y != (double) vector4.Y)
flag1 = true;
if ((double) this.velocity.X != (double) vector4.Z)
flag1 = true;
if ((double) this.velocity.Y != (double) vector4.W)
flag1 = true;
Position.X = vector4.X;
Position.Y = vector4.Y;
this.position = Position + vector2;
this.velocity.X = vector4.Z;
this.velocity.Y = vector4.W;
}
}
}
}
}
}
if (velocity1 != this.velocity)
flag1 = true;
if (flag1)
{
if (this.owner == Main.myPlayer && this.CanCutTiles() && (this.friendly || this.hostile) && this.damage > 0)
{
int num8 = (int) ((double) this.position.X + (double) this.velocity.X - 1.0) / 16;
int num9 = (int) (((double) this.position.X + (double) this.width + (double) this.velocity.X + 1.0) / 16.0) + 1;
int num10 = (int) ((double) this.position.Y + (double) this.velocity.Y - 1.0) / 16;
int num11 = (int) (((double) this.position.Y + (double) this.height + (double) this.velocity.Y + 1.0) / 16.0) + 1;
if (num8 < 0)
num8 = 0;
if (num9 > Main.maxTilesX)
num9 = Main.maxTilesX;
if (num10 < 0)
num10 = 0;
if (num11 > Main.maxTilesY)
num11 = Main.maxTilesY;
for (int index1 = num8; index1 < num9; ++index1)
{
for (int index2 = num10; index2 < num11; ++index2)
{
if (Main.tile[index1, index2] != null && Main.tile[index1, index2].type == (ushort) 484 && WorldGen.CanCutTile(index1, index2, TileCuttingContext.AttackProjectile))
{
WorldGen.KillTile(index1, index2);
if (Main.netMode != 0)
NetMessage.SendData(17, number2: ((float) index1), number3: ((float) index2));
}
}
}
}
if (this.type == 663 || this.type == 665 || this.type == 667 || this.type == 677 || this.type == 678 || this.type == 679 || this.type == 691 || this.type == 692 || this.type == 693 || this.type == 688 || this.type == 689 || this.type == 690)
{
this.position = this.position + this.velocity;
this.velocity = Vector2.Zero;
}
else if (this.type == 434)
{
this.position = this.position + this.velocity;
this.numUpdates = 0;
}
else if (this.type == 601)
{
if (Main.netMode != 2 && this.alpha > 0)
{
if ((double) this.ai[1] != 0.0)
SoundEngine.PlaySound(SoundID.Item114, this.position);
else
SoundEngine.PlaySound(SoundID.Item115, this.position);
}
if (this.owner == Main.myPlayer)
PortalHelper.TryPlacingPortal(this, velocity1, this.velocity);
this.position = this.position + this.velocity;
this.Kill();
}
else if (this.type == 451)
{
this.ai[0] = 1f;
this.ai[1] = 0.0f;
this.netUpdate = true;
this.velocity = velocity1 / 2f;
}
else if (this.type == 645)
{
this.ai[0] = 0.0f;
this.ai[1] = -1f;
this.netUpdate = true;
}
else if (this.type == 584)
{
bool flag6 = false;
if ((double) this.velocity.X != (double) velocity1.X)
{
this.velocity.X = velocity1.X * -0.75f;
flag6 = true;
}
if ((double) this.velocity.Y != (double) velocity1.Y && (double) velocity1.Y > 2.0 || (double) this.velocity.Y == 0.0)
{
this.velocity.Y = velocity1.Y * -0.75f;
flag6 = true;
}
if (flag6)
{
float num = velocity1.Length() / this.velocity.Length();
if ((double) num == 0.0)
num = 1f;
this.velocity = this.velocity / num;
--this.penetrate;
}
}
else if (this.type == 532)
{
bool flag7 = false;
if ((double) this.velocity.X != (double) velocity1.X)
{
this.velocity.X = velocity1.X * -0.75f;
flag7 = true;
}
if ((double) this.velocity.Y != (double) velocity1.Y && (double) velocity1.Y > 2.0 || (double) this.velocity.Y == 0.0)
{
this.velocity.Y = velocity1.Y * -0.75f;
flag7 = true;
}
if (flag7)
{
float num = velocity1.Length() / this.velocity.Length();
if ((double) num == 0.0)
num = 1f;
this.velocity = this.velocity / num;
--this.penetrate;
Collision.HitTiles(this.position, velocity1, this.width, this.height);
}
}
else if (this.type == 533)
{
float num12 = 1f;
bool flag8 = false;
if ((double) this.velocity.X != (double) velocity1.X)
{
this.velocity.X = velocity1.X * -num12;
flag8 = true;
}
if ((double) this.velocity.Y != (double) velocity1.Y || (double) this.velocity.Y == 0.0)
{
this.velocity.Y = (float) ((double) velocity1.Y * -(double) num12 * 0.5);
flag8 = true;
}
if (flag8)
{
float num13 = velocity1.Length() / this.velocity.Length();
if ((double) num13 == 0.0)
num13 = 1f;
this.velocity = this.velocity / num13;
if ((double) this.ai[0] == 7.0 && (double) this.velocity.Y < -0.1)
this.velocity.Y += 0.1f;
if ((double) this.ai[0] >= 6.0 && (double) this.ai[0] < 9.0)
Collision.HitTiles(this.position, velocity1, this.width, this.height);
}
}
else if (this.type == 502)
{
++this.ai[0];
SoundEngine.PlaySound(37, (int) this.position.X, (int) this.position.Y, 5 + (int) this.ai[0]);
if ((double) this.ai[0] >= 5.0)
{
this.position = this.position + this.velocity;
this.Kill();
}
else
{
if ((double) this.velocity.Y != (double) velocity1.Y)
this.velocity.Y = -velocity1.Y;
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = -velocity1.X;
}
Vector2 spinningpoint = new Vector2(0.0f, -3f - this.ai[0]).RotatedByRandom(3.14159274101257);
float num14 = (float) (10.0 + (double) this.ai[0] * 4.0);
Vector2 vector2 = new Vector2(1.05f, 1f);
for (float num15 = 0.0f; (double) num15 < (double) num14; ++num15)
{
int index = Dust.NewDust(this.Center, 0, 0, 66, newColor: Color.Transparent);
Main.dust[index].position = this.Center;
Main.dust[index].velocity = spinningpoint.RotatedBy(6.28318548202515 * (double) num15 / (double) num14) * vector2 * (float) (0.800000011920929 + (double) Main.rand.NextFloat() * 0.400000005960464);
Main.dust[index].color = Main.hslToRgb(num15 / num14, 1f, 0.5f);
Main.dust[index].noGravity = true;
Main.dust[index].scale = (float) (1.0 + (double) this.ai[0] / 3.0);
}
if (Main.myPlayer == this.owner)
{
int width = this.width;
int height = this.height;
int penetrate = this.penetrate;
this.position = this.Center;
this.width = this.height = 40 + 8 * (int) this.ai[0];
this.Center = this.position;
this.penetrate = -1;
this.Damage();
this.penetrate = penetrate;
this.position = this.Center;
this.width = width;
this.height = height;
this.Center = this.position;
}
}
else if (this.type == 444)
{
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = -velocity1.X;
if ((double) this.velocity.Y != (double) velocity1.Y)
this.velocity.Y = -velocity1.Y;
this.ai[0] = this.velocity.ToRotation();
}
else if (this.type == 617)
{
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = (float) (-(double) velocity1.X * 0.349999994039536);
if ((double) this.velocity.Y != (double) velocity1.Y)
this.velocity.Y = (float) (-(double) velocity1.Y * 0.349999994039536);
}
else if (this.type == 440 || this.type == 449 || this.type == 606)
{
if ((double) this.ai[1] != 1.0)
{
this.ai[1] = 1f;
this.position = this.position + this.velocity;
this.velocity = velocity1;
}
}
else if (this.type == 466 || this.type == 580 || this.type == 640)
{
if ((double) this.localAI[1] < 1.0)
{
this.localAI[1] += 2f;
this.position = this.position + this.velocity;
this.velocity = Vector2.Zero;
}
}
else if (this.type == 851)
{
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = (float) (-(double) velocity1.X * 0.800000011920929);
if ((double) this.velocity.Y != (double) velocity1.Y)
this.velocity.Y = (float) (-(double) velocity1.Y * 0.5);
}
else if (this.type == 855)
{
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = -velocity1.X;
if ((double) this.velocity.Y != (double) velocity1.Y)
{
this.velocity.Y = -velocity1.Y;
if ((double) velocity1.Y < 0.0)
this.velocity.Y *= 0.25f;
}
}
else if (this.aiStyle == 54)
{
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = velocity1.X * -0.6f;
if ((double) this.velocity.Y != (double) velocity1.Y)
this.velocity.Y = velocity1.Y * -0.6f;
}
else if (this.type == 861)
{
float num = -1f;
if ((double) this.ai[1] == 1.0)
num = -0.6f;
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = velocity1.X * num;
if ((double) this.velocity.Y != (double) velocity1.Y && (double) velocity1.Y > 0.7)
this.velocity.Y = velocity1.Y * num;
if ((double) Math.Abs(this.velocity.Y) < 0.5)
this.velocity.Y = 0.0f;
if ((double) this.ai[1] != 1.0)
this.netUpdate = true;
this.ai[1] = 1f;
}
else if (!Main.projPet[this.type] && this.type != 500 && this.type != 820 && this.aiStyle != 160 && this.type != 650 && this.type != 882 && this.type != 888 && this.type != 894 && this.type != 895 && this.type != 898 && this.type != 901)
{
if (this.aiStyle == 99)
{
if (this.type >= 556 && this.type <= 561)
{
bool flag9 = false;
if ((double) this.velocity.X != (double) velocity1.X)
{
flag9 = true;
this.velocity.X = velocity1.X * -1f;
}
if ((double) this.velocity.Y != (double) velocity1.Y)
{
flag9 = true;
this.velocity.Y = velocity1.Y * -1f;
}
if (flag9)
{
Vector2 vector2 = Main.player[this.owner].Center - this.Center;
vector2.Normalize();
vector2 *= this.velocity.Length();
vector2 *= 0.25f;
this.velocity = this.velocity * 0.75f;
this.velocity = this.velocity + vector2;
if ((double) this.velocity.Length() > 6.0)
this.velocity = this.velocity * 0.5f;
}
}
}
else if (this.type == 604)
{
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = -velocity1.X;
if ((double) this.velocity.Y != (double) velocity1.Y)
this.velocity.Y = -velocity1.Y;
}
else if (this.type == 379)
{
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = velocity1.X * -0.6f;
if ((double) this.velocity.Y != (double) velocity1.Y && (double) velocity1.Y > 2.0)
this.velocity.Y = velocity1.Y * -0.6f;
}
else if (this.type == 491)
{
if ((double) this.ai[0] <= 0.0)
this.ai[0] = -10f;
if ((double) this.velocity.X != (double) velocity1.X && (double) Math.Abs(velocity1.X) > 0.0)
this.velocity.X = velocity1.X * -1f;
if ((double) this.velocity.Y != (double) velocity1.Y && (double) Math.Abs(velocity1.Y) > 0.0)
this.velocity.Y = velocity1.Y * -1f;
}
else if (this.type >= 515 && this.type <= 517 || this.type == 637)
{
if ((double) this.velocity.X != (double) velocity1.X && (double) Math.Abs(velocity1.X) > 1.0)
this.velocity.X = velocity1.X * -0.9f;
if ((double) this.velocity.Y != (double) velocity1.Y && (double) Math.Abs(velocity1.Y) > 1.0)
this.velocity.Y = velocity1.Y * -0.9f;
}
else if (this.type == 921 || this.type == 926 || this.type == 937)
{
if ((double) this.velocity.X != (double) velocity1.X && (double) Math.Abs(velocity1.X) > 1.0)
this.velocity.X = velocity1.X * -0.95f;
if ((double) this.velocity.Y != (double) velocity1.Y && (double) Math.Abs(velocity1.Y) > 1.0)
this.velocity.Y = velocity1.Y * -0.95f;
--this.penetrate;
}
else if (this.type == 681)
this.timeLeft = 4;
else if (this.type == 409)
{
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = velocity1.X * -1f;
if ((double) this.velocity.Y != (double) velocity1.Y)
this.velocity.Y = velocity1.Y * -1f;
}
else if (this.type == 254)
{
this.tileCollide = false;
this.velocity = velocity1;
if (this.timeLeft > 30)
this.timeLeft = 30;
}
else if (this.type == 225)
{
++this.ai[1];
if ((double) this.ai[1] == 1.0)
this.damage = (int) ((double) this.damage * 0.660000026226044);
if ((double) this.ai[1] >= 4.0)
{
this.Kill();
return;
}
this.velocity.X = -velocity1.X;
this.velocity.Y = -velocity1.Y;
int targetWithLineOfSight = this.FindTargetWithLineOfSight();
if (targetWithLineOfSight != -1)
{
NPC npc = Main.npc[targetWithLineOfSight];
float t = this.Distance(npc.Center);
Vector2 vector2 = -Vector2.UnitY * MathHelper.Lerp((float) npc.height * 0.1f, (float) npc.height * 0.5f, Utils.GetLerpValue(0.0f, 300f, t, false));
this.velocity = this.DirectionTo(npc.Center + vector2).SafeNormalize(-Vector2.UnitY) * this.velocity.Length();
this.netUpdate = true;
}
}
else if (this.type == 155)
{
if ((double) this.ai[1] > 10.0)
{
NetworkText text = NetworkText.FromKey("Game.BallBounceResult", (object) NetworkText.FromKey(Lang.GetProjectileName(this.type).Key), (object) this.ai[1]);
switch (Main.netMode)
{
case 0:
Main.NewText(text.ToString(), G: (byte) 240, B: (byte) 20);
break;
case 2:
ChatHelper.BroadcastChatMessage(text, new Color((int) byte.MaxValue, 240, 20));
break;
}
}
this.ai[1] = 0.0f;
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = velocity1.X * -0.6f;
if ((double) this.velocity.Y != (double) velocity1.Y && (double) velocity1.Y > 2.0)
this.velocity.Y = velocity1.Y * -0.6f;
}
else if (this.aiStyle == 33)
{
if ((double) this.localAI[0] == 0.0)
{
if (this.wet)
this.position = this.position + velocity1 / 2f;
else
this.position = this.position + velocity1;
this.velocity = this.velocity * 0.0f;
this.localAI[0] = 1f;
}
}
else if (this.type != 308 && this.type != 377)
{
if (this.type == 477)
{
if ((double) this.velocity.Y != (double) velocity1.Y || (double) this.velocity.X != (double) velocity1.X)
{
--this.penetrate;
if (this.penetrate <= 0)
this.Kill();
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = -velocity1.X;
if ((double) this.velocity.Y != (double) velocity1.Y)
this.velocity.Y = -velocity1.Y;
}
if (this.penetrate > 0 && this.owner == Main.myPlayer)
{
int[] numArray = new int[10];
int maxValue = 0;
int num16 = 700;
int num17 = 20;
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].CanBeChasedBy((object) this))
{
float num18 = (this.Center - Main.npc[index].Center).Length();
if ((double) num18 > (double) num17 && (double) num18 < (double) num16 && Collision.CanHitLine(this.Center, 1, 1, Main.npc[index].Center, 1, 1))
{
numArray[maxValue] = index;
++maxValue;
if (maxValue >= 9)
break;
}
}
}
if (maxValue > 0)
{
int index = Main.rand.Next(maxValue);
Vector2 vector2 = Main.npc[numArray[index]].Center - this.Center;
float num19 = this.velocity.Length();
vector2.Normalize();
this.velocity = vector2 * num19;
this.netUpdate = true;
}
}
}
else if (this.type == 94)
{
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = -velocity1.X;
if ((double) this.velocity.Y != (double) velocity1.Y)
this.velocity.Y = -velocity1.Y;
}
else if (this.type == 496)
{
if ((double) this.velocity.X != (double) velocity1.X)
{
if ((double) Math.Abs(this.velocity.X) < 1.0)
this.velocity.X = -velocity1.X;
else
this.Kill();
}
if ((double) this.velocity.Y != (double) velocity1.Y)
{
if ((double) Math.Abs(this.velocity.Y) < 1.0)
this.velocity.Y = -velocity1.Y;
else
this.Kill();
}
}
else if (this.type == 311)
{
if ((double) this.velocity.X != (double) velocity1.X)
{
this.velocity.X = -velocity1.X;
++this.ai[1];
}
if ((double) this.velocity.Y != (double) velocity1.Y)
{
this.velocity.Y = -velocity1.Y;
++this.ai[1];
}
if ((double) this.ai[1] > 4.0)
this.Kill();
}
else if (this.type == 312)
{
if ((double) this.velocity.X != (double) velocity1.X)
{
this.velocity.X = -velocity1.X;
++this.ai[1];
}
if ((double) this.velocity.Y != (double) velocity1.Y)
{
this.velocity.Y = -velocity1.Y;
++this.ai[1];
}
}
else if (this.type == 522 || this.type == 620)
{
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = -velocity1.X;
if ((double) this.velocity.Y != (double) velocity1.Y)
this.velocity.Y = -velocity1.Y;
}
else if (this.type == 524)
{
this.ai[0] += 100f;
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = -velocity1.X;
if ((double) this.velocity.Y != (double) velocity1.Y)
this.velocity.Y = -velocity1.Y;
}
else if (this.aiStyle == 93)
{
if (this.velocity != velocity1)
{
this.ai[1] = 0.0f;
this.ai[0] = 1f;
this.netUpdate = true;
this.tileCollide = false;
this.position = this.position + this.velocity;
this.velocity = velocity1;
this.velocity.Normalize();
this.velocity = this.velocity * 3f;
}
}
else if (this.type == 281)
{
bool flag10 = (double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < 2.0 || (double) this.ai[0] == -1.0;
if ((double) this.ai[0] == -2.0 || (double) this.ai[0] == -3.0)
flag10 = false;
if (flag10)
{
if (Main.myPlayer == this.owner)
{
int Style = (double) this.velocity.X > 0.0 ? 1 : 2;
if (this.damage == 0)
Style += 2;
NPC.ReleaseNPC((int) this.Center.X, (int) this.Bottom.Y - 4, 614, Style, this.owner);
this.ai[0] = -3f;
this.netUpdate = true;
}
}
else
{
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = (float) (-(double) velocity1.X * 0.5);
if ((double) this.velocity.Y != (double) velocity1.Y)
this.velocity.Y = (float) (-(double) velocity1.Y * 0.5);
}
}
else if (this.type == 290 || this.type == 294)
{
if ((double) this.velocity.X != (double) velocity1.X)
{
this.position.X += this.velocity.X;
this.velocity.X = -velocity1.X;
}
if ((double) this.velocity.Y != (double) velocity1.Y)
{
this.position.Y += this.velocity.Y;
this.velocity.Y = -velocity1.Y;
}
}
else if ((this.type == 181 || this.type == 189 || this.type == 357 || this.type == 566) && this.penetrate > 0)
{
if (this.type == 357)
this.damage = (int) ((double) this.damage * 0.9);
--this.penetrate;
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = -velocity1.X;
if ((double) this.velocity.Y != (double) velocity1.Y)
this.velocity.Y = -velocity1.Y;
}
else if (this.type == 307 && (double) this.ai[1] < 5.0)
{
++this.ai[1];
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = -velocity1.X;
if ((double) this.velocity.Y != (double) velocity1.Y)
this.velocity.Y = -velocity1.Y;
}
else if (this.type == 99)
{
if ((double) this.velocity.Y != (double) velocity1.Y && (double) velocity1.Y > 5.0)
{
Collision.HitTiles(this.position, this.velocity, this.width, this.height);
SoundEngine.PlaySound(0, (int) this.position.X, (int) this.position.Y);
this.velocity.Y = (float) (-(double) velocity1.Y * 0.200000002980232);
}
if ((double) this.velocity.X != (double) velocity1.X)
this.Kill();
}
else if (this.type == 727)
{
int Damage = 20;
float KnockBack = 2f;
float num20 = 2f;
if ((double) this.velocity.Y != (double) velocity1.Y && (double) velocity1.Y > 5.0)
{
Collision.HitTiles(this.position, this.velocity, this.width, this.height);
SoundEngine.PlaySound(0, (int) this.position.X, (int) this.position.Y);
this.velocity.Y = (float) (-(double) velocity1.Y * 0.649999976158142);
if (this.owner == Main.myPlayer)
{
int num21 = Main.rand.Next(3, 6);
float num22 = Main.rand.NextFloat();
for (float num23 = 0.0f; (double) num23 < 1.0; num23 += 1f / (float) num21)
{
Vector2 velocity5 = ((float) (((double) num22 + (double) num23) * 6.28318548202515)).ToRotationVector2() * num20;
if ((double) velocity5.Y > 0.0)
velocity5 *= -0.7f;
Projectile.NewProjectile(this.Center, velocity5, 763, Damage, KnockBack, Main.myPlayer);
}
}
}
if ((double) this.velocity.X != (double) velocity1.X)
{
this.Kill();
if (this.owner == Main.myPlayer)
{
int num24 = Main.rand.Next(3, 6);
float num25 = Main.rand.NextFloat();
for (float num26 = 0.0f; (double) num26 < 1.0; num26 += 1f / (float) num24)
{
Vector2 velocity6 = ((float) (((double) num25 + (double) num26) * 6.28318548202515)).ToRotationVector2() * num20;
if ((double) velocity6.Y > 0.0)
velocity6 *= -0.7f;
Projectile.NewProjectile(this.Center, velocity6, 763, Damage, KnockBack, Main.myPlayer);
}
}
}
}
else if (this.type == 655)
{
if ((double) this.velocity.Y != (double) velocity1.Y && (double) velocity1.Y > 5.0)
{
Collision.HitTiles(this.position, this.velocity, this.width, this.height);
SoundEngine.PlaySound(0, (int) this.position.X, (int) this.position.Y);
this.velocity.Y = (float) (-(double) velocity1.Y * 0.200000002980232);
}
if ((double) this.velocity.X != (double) velocity1.X)
this.Kill();
}
else if (this.type == 36)
{
if (this.penetrate > 1)
{
Collision.HitTiles(this.position, this.velocity, this.width, this.height);
SoundEngine.PlaySound(SoundID.Item10, this.position);
--this.penetrate;
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = -velocity1.X;
if ((double) this.velocity.Y != (double) velocity1.Y)
this.velocity.Y = -velocity1.Y;
}
else
this.Kill();
}
else if (this.aiStyle == 21)
{
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = -velocity1.X;
if ((double) this.velocity.Y != (double) velocity1.Y)
this.velocity.Y = -velocity1.Y;
}
else if (this.aiStyle == 17)
{
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = velocity1.X * -0.75f;
if ((double) this.velocity.Y != (double) velocity1.Y && (double) velocity1.Y > 1.5)
this.velocity.Y = velocity1.Y * -0.7f;
}
else if (this.aiStyle == 15)
this.AI_015_HandleMovementCollision(ref wetVelocity, ref velocity1);
else if (this.aiStyle == 9)
{
bool flag11 = this.owner == Main.myPlayer;
if (this.type == 79)
{
bool flag12 = (double) this.ai[0] >= 0.0;
flag11 &= !flag12;
if (flag12)
{
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X *= 0.1f;
if ((double) this.velocity.Y != (double) velocity1.Y)
this.velocity.Y *= 0.1f;
}
}
if (flag11)
this.Kill();
}
else if (this.aiStyle == 39)
{
Collision.HitTiles(this.position, this.velocity, this.width, this.height);
if (this.type == 33 || this.type == 106)
{
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = -velocity1.X;
if ((double) this.velocity.Y != (double) velocity1.Y)
this.velocity.Y = -velocity1.Y;
}
else
{
this.ai[0] = 1f;
if (this.aiStyle == 3)
{
this.velocity.X = -velocity1.X;
this.velocity.Y = -velocity1.Y;
}
}
this.netUpdate = true;
SoundEngine.PlaySound(0, (int) this.position.X, (int) this.position.Y);
}
else if (this.aiStyle == 3 || this.aiStyle == 13 || this.aiStyle == 69 || this.aiStyle == 109)
{
Collision.HitTiles(this.position, this.velocity, this.width, this.height);
if (this.type == 33 || this.type == 106 || this.type == 866)
{
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = -velocity1.X;
if ((double) this.velocity.Y != (double) velocity1.Y)
this.velocity.Y = -velocity1.Y;
}
else
{
this.ai[0] = 1f;
if ((this.aiStyle == 3 || this.aiStyle == 109) && this.type != 383)
{
this.velocity.X = -velocity1.X;
this.velocity.Y = -velocity1.Y;
}
}
this.netUpdate = true;
SoundEngine.PlaySound(0, (int) this.position.X, (int) this.position.Y);
}
else if (this.aiStyle == 8 && this.type != 96)
{
SoundEngine.PlaySound(SoundID.Item10, this.position);
++this.ai[0];
if ((double) this.ai[0] >= 5.0 && this.type != 253 || this.type == 253 && (double) this.ai[0] >= 8.0)
{
this.position = this.position + this.velocity;
this.Kill();
}
else
{
if (this.type == 15 && (double) this.velocity.Y > 4.0)
{
if ((double) this.velocity.Y != (double) velocity1.Y)
this.velocity.Y = (float) (-(double) velocity1.Y * 0.800000011920929);
}
else if ((double) this.velocity.Y != (double) velocity1.Y)
this.velocity.Y = -velocity1.Y;
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = -velocity1.X;
}
}
else if (this.aiStyle == 61)
{
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = velocity1.X * -0.3f;
if ((double) this.velocity.Y != (double) velocity1.Y && (double) velocity1.Y > 1.0)
this.velocity.Y = velocity1.Y * -0.3f;
}
else if (this.aiStyle == 14)
{
if (this.type == 928)
{
int num = 0;
for (int index = 1000; index >= 0; --index)
{
if (index != this.whoAmI && Main.projectile[index].active && Main.projectile[index].owner == this.owner && Main.projectile[index].type == this.type)
{
++num;
if (num >= 2 && this.timeLeft > Main.projectile[index].timeLeft && Main.projectile[index].timeLeft > 30)
Main.projectile[index].timeLeft = 2;
}
}
}
if (this.type == 261 && ((double) this.velocity.X != (double) velocity1.X && ((double) velocity1.X < -3.0 || (double) velocity1.X > 3.0) || (double) this.velocity.Y != (double) velocity1.Y && ((double) velocity1.Y < -3.0 || (double) velocity1.Y > 3.0)))
{
for (int index = 0; index < 10; ++index)
Collision.HitTiles(this.position, this.velocity, this.width, this.height);
SoundEngine.PlaySound(0, (int) this.Center.X, (int) this.Center.Y);
this.MakeBoulderOfEarthExplosion();
}
if (this.type >= 326 && this.type <= 328 && (double) this.velocity.X != (double) velocity1.X)
this.velocity.X = velocity1.X * -0.1f;
if (this.type >= 400 && this.type <= 402)
{
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = velocity1.X * -0.1f;
}
else if (this.type == 870 && (double) this.ai[1] == 0.0)
{
if ((double) this.velocity.X != (double) velocity1.X || (double) this.velocity.Y != (double) velocity1.Y)
{
this.velocity = -velocity1;
this.ai[1] = 1f;
}
}
else if (this.type == 50)
{
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = velocity1.X * -0.2f;
if ((double) this.velocity.Y != (double) velocity1.Y && (double) velocity1.Y > 1.5)
this.velocity.Y = velocity1.Y * -0.2f;
}
else if (this.type == 185)
{
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = velocity1.X * -0.9f;
if ((double) this.velocity.Y != (double) velocity1.Y && (double) velocity1.Y > 1.0)
this.velocity.Y = velocity1.Y * -0.9f;
}
else if (this.type == 277)
{
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = velocity1.X * -0.9f;
if ((double) this.velocity.Y != (double) velocity1.Y && (double) velocity1.Y > 3.0)
this.velocity.Y = velocity1.Y * -0.9f;
}
else if (this.type != 480)
{
if (this.type == 450)
{
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = velocity1.X * -0.1f;
}
else
{
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = velocity1.X * -0.5f;
if ((double) this.velocity.Y != (double) velocity1.Y && (double) velocity1.Y > 1.0)
this.velocity.Y = velocity1.Y * -0.5f;
}
}
}
else if (this.aiStyle == 16)
{
if ((double) this.velocity.X != (double) velocity1.X)
{
this.velocity.X = velocity1.X * -0.4f;
if (this.type == 29)
this.velocity.X *= 0.8f;
}
if ((double) this.velocity.Y != (double) velocity1.Y && (double) velocity1.Y > 0.7 && this.type != 102)
{
this.velocity.Y = velocity1.Y * -0.4f;
if (this.type == 29)
this.velocity.Y *= 0.8f;
}
if (this.type == 134 || this.type == 137 || this.type == 140 || this.type == 143 || this.type == 303 || this.type >= 338 && this.type <= 341 || this.type == 776 || this.type == 780 || this.type == 793 || this.type == 796 || this.type == 799 || this.type == 784 || this.type == 787 || this.type == 790 || this.type == 803 || this.type == 804 || this.type == 808 || this.type == 809 || this.type == 810 || this.type == 805 || this.type == 806 || this.type == 807 || this.type == 930)
{
this.velocity = this.velocity * 0.0f;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 3;
}
}
else if (this.aiStyle == 68)
{
this.velocity = this.velocity * 0.0f;
this.alpha = (int) byte.MaxValue;
this.timeLeft = 3;
this.netUpdate = true;
}
else if (this.type == 870)
{
if ((double) this.velocity.X != (double) velocity1.X)
this.velocity.X = velocity1.X * -0.2f;
if ((double) this.velocity.Y != (double) velocity1.Y && (double) velocity1.Y > 0.0)
this.velocity.Y = velocity1.Y * -0.2f;
}
else
{
this.position = this.position + this.velocity;
this.Kill();
}
}
}
}
}
this.UpdatePosition(wetVelocity);
if (flag2 || flag3 || this.owner != Main.myPlayer || !(this.tileCollide | flag4) || !(this.position != this.oldPosition))
return;
Vector2 Position1 = this.position;
Vector2 oldPosition1 = this.oldPosition;
int Width = overrideWidth != -1 ? overrideWidth : this.width;
int Height = overrideHeight != -1 ? overrideHeight : this.height;
if (overrideHeight != -1 || overrideWidth != -1)
{
Position1 = new Vector2(this.position.X + (float) (this.width / 2) - (float) (Width / 2), this.position.Y + (float) (this.height / 2) - (float) (Height / 2));
oldPosition1 = new Vector2(this.oldPosition.X + (float) (this.width / 2) - (float) (Width / 2), this.oldPosition.Y + (float) (this.height / 2) - (float) (Height / 2));
}
Collision.SwitchTiles(Position1, Width, Height, oldPosition1, 4);
}
private void AI_149_GolfBall()
{
if (!this.npcProj && this.timeLeft < 10)
this.timeLeft = 10;
if ((double) this.ai[1] == -1.0)
{
Tile tileSafely = Framing.GetTileSafely(this.Bottom.ToTileCoordinates());
if (tileSafely.active() && tileSafely.type == (ushort) 494)
return;
this.ai[1] = 0.0f;
this.netUpdate = true;
}
else
{
BallStepResult ballStepResult = GolfHelper.StepGolfBall((Entity) this, ref this.localAI[0]);
if (ballStepResult.State == BallState.Resting)
{
this.damage = 0;
if (Main.netMode == 1 && this.owner == Main.myPlayer && (double) this.localAI[1] != (double) ballStepResult.State)
this.netUpdate = true;
}
this.localAI[1] = (float) ballStepResult.State;
this.rotation += this.localAI[0];
if ((double) this.velocity.Y != 0.0 && ballStepResult.State == BallState.Moving)
this.rotation += (float) ((double) this.velocity.X * 0.100000001490116 + (double) this.velocity.Y * 0.100000001490116);
if (ballStepResult.State == BallState.Moving && this.owner == Main.myPlayer)
{
bool? nullable = ProjectileID.Sets.ForcePlateDetection[135];
if ((!nullable.HasValue ? 0 : (!nullable.Value ? 1 : 0)) == 0 && (double) this.localAI[1] != 0.0)
Collision.SwitchTiles(this.position, this.width, this.height, this.oldPosition, 4);
}
if (ballStepResult.State != BallState.Moving || Main.netMode != 2 || !Main.player.IndexInRange<Player>(this.owner) || !Main.player[this.owner].active)
return;
RemoteClient.CheckSection(this.owner, this.position);
}
}
private void MakeBoulderOfEarthExplosion()
{
this.localAI[0] = 40f;
float MAX_SPREAD = 20f;
int fluff = 10;
int distFluff = 50;
int layerStart = 1;
int num = 6;
if ((double) this.velocity.Length() < 8.0 || (double) Math.Abs(this.velocity.Y) < 4.0)
{
MAX_SPREAD = 15f;
fluff = 7;
distFluff = 30;
num = 4;
}
if ((double) this.velocity.Length() < 4.0 || (double) Math.Abs(this.velocity.Y) < 2.0)
{
MAX_SPREAD = 15f;
fluff = 7;
distFluff = 30;
num = 2;
layerStart = 0;
}
int layerEnd = num;
int layerJump = num - 2;
if (layerJump < 1)
layerJump = 1;
this.CreateGroundExplosion(MAX_SPREAD, fluff, distFluff, layerStart, layerEnd, layerJump);
for (int index = 0; index < 10; ++index)
{
Dust dust = Dust.NewDustPerfect(this.Center + Main.rand.NextVector2Circular((float) (this.width / 2), (float) (this.height / 2)), 228, new Vector2?(Main.rand.NextVector2Circular(3f, 3f)));
dust.scale = 0.6f;
if (index < 5)
{
dust.noGravity = true;
dust.scale = 1.8f;
}
}
}
private void UpdatePosition(Vector2 wetVelocity)
{
if (this.aiStyle == 4 || this.aiStyle == 38 || this.aiStyle == 84 || this.aiStyle == 148 || this.aiStyle == 7 && (double) this.ai[0] == 2.0 || (this.type == 440 || this.type == 449 || this.type == 606) && (double) this.ai[1] == 1.0 || this.aiStyle == 93 && (double) this.ai[0] < 0.0 || this.type == 540 || this.type == 756 || this.type == 818 || this.type == 856 || this.type == 933 || ProjectileID.Sets.IsAGolfBall[this.type])
return;
if (this.wet)
this.position = this.position + wetVelocity;
else
this.position = this.position + this.velocity;
if (!Main.projPet[this.type] || !this.tileCollide)
return;
Vector4 vector4 = Collision.SlopeCollision(this.position, this.velocity, this.width, this.height);
this.position.X = vector4.X;
this.position.Y = vector4.Y;
this.velocity.X = vector4.Z;
this.velocity.Y = vector4.W;
}
public void FishingCheck()
{
if (Main.player[this.owner].wet)
return;
FishingAttempt fisher = new FishingAttempt();
fisher.X = (int) ((double) this.Center.X / 16.0);
fisher.Y = (int) ((double) this.Center.Y / 16.0);
fisher.bobberType = this.type;
Projectile.GetFishingPondState(fisher.X, fisher.Y, out fisher.inLava, out fisher.inHoney, out fisher.waterTilesCount, out fisher.chumsInWater);
if (fisher.waterTilesCount < 75)
{
Main.player[this.owner].displayedFishingInfo = Language.GetTextValue("GameUI.NotEnoughWater");
}
else
{
fisher.playerFishingConditions = Main.player[this.owner].GetFishingConditions();
if (fisher.playerFishingConditions.BaitItemType == 2673)
{
Main.player[this.owner].displayedFishingInfo = Language.GetTextValue("GameUI.FishingWarning");
if (fisher.X >= 380 && fisher.X <= Main.maxTilesX - 380 || fisher.waterTilesCount <= 1000 || NPC.AnyNPCs(370))
return;
this.ai[1] = (float) (Main.rand.Next(-180, -60) - 100);
this.localAI[1] = 1f;
this.netUpdate = true;
}
else
{
fisher.fishingLevel = fisher.playerFishingConditions.FinalFishingLevel;
if (fisher.fishingLevel == 0)
return;
fisher.CanFishInLava = ItemID.Sets.CanFishInLava[fisher.playerFishingConditions.PoleItemType] || ItemID.Sets.IsLavaBait[fisher.playerFishingConditions.BaitItemType] || Main.player[this.owner].accLavaFishing;
if (fisher.chumsInWater > 0)
fisher.fishingLevel += 11;
if (fisher.chumsInWater > 1)
fisher.fishingLevel += 6;
if (fisher.chumsInWater > 2)
fisher.fishingLevel += 3;
Main.player[this.owner].displayedFishingInfo = Language.GetTextValue("GameUI.FishingPower", (object) fisher.fishingLevel);
fisher.waterNeededToFish = 300;
float num1 = (float) (Main.maxTilesX / 4200);
float num2 = num1 * num1;
fisher.atmo = (float) (((double) this.position.Y / 16.0 - (60.0 + 10.0 * (double) num2)) / (Main.worldSurface / 6.0));
if ((double) fisher.atmo < 0.25)
fisher.atmo = 0.25f;
if ((double) fisher.atmo > 1.0)
fisher.atmo = 1f;
fisher.waterNeededToFish = (int) ((double) fisher.waterNeededToFish * (double) fisher.atmo);
fisher.waterQuality = (float) fisher.waterTilesCount / (float) fisher.waterNeededToFish;
if ((double) fisher.waterQuality < 1.0)
fisher.fishingLevel = (int) ((double) fisher.fishingLevel * (double) fisher.waterQuality);
fisher.waterQuality = 1f - fisher.waterQuality;
if (fisher.waterTilesCount < fisher.waterNeededToFish)
Main.player[this.owner].displayedFishingInfo = Language.GetTextValue("GameUI.FullFishingPower", (object) fisher.fishingLevel, (object) -Math.Round((double) fisher.waterQuality * 100.0));
if ((double) Main.player[this.owner].luck < 0.0)
{
if ((double) Main.rand.NextFloat() < -(double) Main.player[this.owner].luck)
fisher.fishingLevel = (int) ((double) fisher.fishingLevel * (0.9 - (double) Main.rand.NextFloat() * 0.3));
}
else if ((double) Main.rand.NextFloat() < (double) Main.player[this.owner].luck)
fisher.fishingLevel = (int) ((double) fisher.fishingLevel * (1.1 + (double) Main.rand.NextFloat() * 0.3));
if (fisher.fishingLevel > 50)
fisher.fishingLevel = (int) (50.0 + (double) (fisher.fishingLevel - 50) * 0.949999988079071);
if (fisher.fishingLevel > 75)
fisher.fishingLevel = (int) (75.0 + (double) (fisher.fishingLevel - 75) * 0.899999976158142);
if (fisher.fishingLevel > 100)
fisher.fishingLevel = (int) (100.0 + (double) (fisher.fishingLevel - 100) * 0.850000023841858);
if (fisher.fishingLevel > 125)
fisher.fishingLevel = (int) (125.0 + (double) (fisher.fishingLevel - 125) * 0.800000011920929);
if (fisher.fishingLevel > 150)
fisher.fishingLevel = (int) (150.0 + (double) (fisher.fishingLevel - 150) * 0.75);
if (fisher.fishingLevel > 175)
fisher.fishingLevel = (int) (175.0 + (double) (fisher.fishingLevel - 175) * 0.699999988079071);
if (fisher.fishingLevel > 200)
fisher.fishingLevel = (int) (200.0 + (double) (fisher.fishingLevel - 200) * 0.649999976158142);
int num3 = (fisher.fishingLevel + 75) / 2;
if (Main.rand.Next(100) > num3)
return;
fisher.heightLevel = 0;
fisher.heightLevel = (double) fisher.Y >= Main.worldSurface * 0.5 ? ((double) fisher.Y >= Main.worldSurface ? ((double) fisher.Y >= Main.rockLayer ? (fisher.Y >= Main.maxTilesY - 300 ? 4 : 3) : 2) : 1) : 0;
this.FishingCheck_RollDropLevels(fisher.fishingLevel, out fisher.common, out fisher.uncommon, out fisher.rare, out fisher.veryrare, out fisher.legendary, out fisher.crate);
this.FishingCheck_ProbeForQuestFish(ref fisher);
this.FishingCheck_RollEnemySpawns(ref fisher);
this.FishingCheck_RollItemDrop(ref fisher);
bool flag = false;
if (fisher.rolledItemDrop > 0)
{
if (Main.player[this.owner].sonarPotion)
{
Item newItem = new Item();
newItem.SetDefaults(fisher.rolledItemDrop);
newItem.position = this.position;
PopupText.sonarText = PopupText.NewText(PopupTextContext.SonarAlert, newItem, 1, true);
if (PopupText.sonarText > -1)
Main.popupText[PopupText.sonarText].sonar = true;
}
float fishingLevel = (float) fisher.fishingLevel;
this.ai[1] = (float) Main.rand.Next(-240, -90) - fishingLevel;
this.localAI[1] = (float) fisher.rolledItemDrop;
this.netUpdate = true;
flag = true;
}
if (fisher.rolledEnemySpawn > 0)
{
if (Main.player[this.owner].sonarPotion)
{
PopupText.sonarText = PopupText.NewText(PopupTextContext.SonarAlert, fisher.rolledEnemySpawn, this.Center, false);
if (PopupText.sonarText > -1)
Main.popupText[PopupText.sonarText].sonar = true;
}
float fishingLevel = (float) fisher.fishingLevel;
this.ai[1] = (float) Main.rand.Next(-240, -90) - fishingLevel;
this.localAI[1] = (float) -fisher.rolledEnemySpawn;
this.netUpdate = true;
flag = true;
}
if (flag)
return;
int num4 = 0;
if (ItemID.Sets.IsLavaBait[fisher.playerFishingConditions.BaitItemType])
++num4;
if (ItemID.Sets.CanFishInLava[fisher.playerFishingConditions.PoleItemType])
++num4;
if (Main.player[this.owner].accLavaFishing)
++num4;
if (num4 < 2)
return;
this.localAI[1] += 240f;
}
}
}
private void FishingCheck_RollEnemySpawns(ref FishingAttempt fisher)
{
if (fisher.inLava || fisher.inHoney || !Main.bloodMoon || Main.dayTime)
return;
int maxValue = 6;
if (fisher.bobberType == 760)
maxValue = 3;
if (Main.rand.Next(maxValue) != 0)
return;
if (Main.hardMode)
{
fisher.rolledEnemySpawn = (int) Utils.SelectRandom<short>(Main.rand, (short) 620, (short) 621, (short) 586, (short) 587);
if (Main.rand.Next(10) != 0)
return;
fisher.rolledEnemySpawn = 618;
}
else
fisher.rolledEnemySpawn = (int) Utils.SelectRandom<short>(Main.rand, (short) 586, (short) 587);
}
private void FishingCheck_RollItemDrop(ref FishingAttempt fisher)
{
if (fisher.rolledEnemySpawn > 0)
return;
if (fisher.inLava)
{
if (!fisher.CanFishInLava)
return;
if (fisher.crate && Main.rand.Next(5) == 0)
fisher.rolledItemDrop = Main.hardMode ? 4878 : 4877;
else if (fisher.legendary && Main.hardMode && Main.rand.Next(3) == 0)
fisher.rolledItemDrop = (int) Main.rand.NextFromList<short>((short) 4819, (short) 4820, (short) 4872, (short) 2331);
else if (fisher.legendary && !Main.hardMode && Main.rand.Next(3) == 0)
fisher.rolledItemDrop = (int) Main.rand.NextFromList<short>((short) 4819, (short) 4820, (short) 4872);
else if (fisher.veryrare)
{
fisher.rolledItemDrop = 2312;
}
else
{
if (!fisher.rare)
return;
fisher.rolledItemDrop = 2315;
}
}
else if (fisher.inHoney)
{
if (fisher.rare || fisher.uncommon && Main.rand.Next(2) == 0)
{
fisher.rolledItemDrop = 2314;
}
else
{
if (!fisher.uncommon || fisher.questFish != 2451)
return;
fisher.rolledItemDrop = 2451;
}
}
else if (Main.rand.Next(50) > fisher.fishingLevel && Main.rand.Next(50) > fisher.fishingLevel && fisher.waterTilesCount < fisher.waterNeededToFish)
fisher.rolledItemDrop = Main.rand.Next(2337, 2340);
else if (fisher.crate)
{
bool hardMode = Main.hardMode;
if (fisher.veryrare || fisher.legendary)
fisher.rolledItemDrop = hardMode ? 3981 : 2336;
else if (fisher.rare && Main.player[this.owner].ZoneDungeon)
fisher.rolledItemDrop = hardMode ? 3984 : 3205;
else if (fisher.rare && Main.player[this.owner].ZoneBeach)
fisher.rolledItemDrop = hardMode ? 5003 : 5002;
else if (fisher.rare && Main.player[this.owner].ZoneCorrupt)
fisher.rolledItemDrop = hardMode ? 3982 : 3203;
else if (fisher.rare && Main.player[this.owner].ZoneCrimson)
fisher.rolledItemDrop = hardMode ? 3983 : 3204;
else if (fisher.rare && Main.player[this.owner].ZoneHallow)
fisher.rolledItemDrop = hardMode ? 3986 : 3207;
else if (fisher.rare && Main.player[this.owner].ZoneJungle)
fisher.rolledItemDrop = hardMode ? 3987 : 3208;
else if (fisher.rare && Main.player[this.owner].ZoneSnow)
fisher.rolledItemDrop = hardMode ? 4406 : 4405;
else if (fisher.rare && Main.player[this.owner].ZoneDesert)
fisher.rolledItemDrop = hardMode ? 4408 : 4407;
else if (fisher.rare && fisher.heightLevel == 0)
fisher.rolledItemDrop = hardMode ? 3985 : 3206;
else if (fisher.uncommon)
fisher.rolledItemDrop = hardMode ? 3980 : 2335;
else
fisher.rolledItemDrop = hardMode ? 3979 : 2334;
}
else if (!NPC.combatBookWasUsed && Main.bloodMoon && fisher.legendary && Main.rand.Next(3) == 0)
fisher.rolledItemDrop = 4382;
else if (fisher.legendary && Main.rand.Next(5) == 0)
fisher.rolledItemDrop = 2423;
else if (fisher.legendary && Main.rand.Next(5) == 0)
fisher.rolledItemDrop = 3225;
else if (fisher.legendary && Main.rand.Next(10) == 0)
fisher.rolledItemDrop = 2420;
else if (!fisher.legendary && !fisher.veryrare && fisher.uncommon && Main.rand.Next(5) == 0)
{
fisher.rolledItemDrop = 3196;
}
else
{
bool flag1 = Main.player[this.owner].ZoneDesert;
if (Main.player[this.owner].ZoneDungeon)
{
flag1 = false;
if (fisher.rolledItemDrop == 0 && fisher.veryrare && Main.rand.Next(7) == 0)
fisher.rolledItemDrop = 3000;
}
else
{
bool flag2 = Main.player[this.owner].ZoneCorrupt;
bool flag3 = Main.player[this.owner].ZoneCrimson;
if (flag2 & flag3)
{
if (Main.rand.Next(2) == 0)
flag3 = false;
else
flag2 = false;
}
if (flag2)
{
if (fisher.legendary && Main.hardMode && Main.player[this.owner].ZoneSnow && fisher.heightLevel == 3 && Main.rand.Next(3) != 0)
fisher.rolledItemDrop = 2429;
else if (fisher.legendary && Main.hardMode && Main.rand.Next(2) == 0)
fisher.rolledItemDrop = 3210;
else if (fisher.rare)
fisher.rolledItemDrop = 2330;
else if (fisher.uncommon && fisher.questFish == 2454)
fisher.rolledItemDrop = 2454;
else if (fisher.uncommon && fisher.questFish == 2485)
fisher.rolledItemDrop = 2485;
else if (fisher.uncommon && fisher.questFish == 2457)
fisher.rolledItemDrop = 2457;
else if (fisher.uncommon)
fisher.rolledItemDrop = 2318;
}
else if (flag3)
{
if (fisher.legendary && Main.hardMode && Main.player[this.owner].ZoneSnow && fisher.heightLevel == 3 && Main.rand.Next(3) != 0)
fisher.rolledItemDrop = 2429;
else if (fisher.legendary && Main.hardMode && Main.rand.Next(2) == 0)
fisher.rolledItemDrop = 3211;
else if (fisher.uncommon && fisher.questFish == 2477)
fisher.rolledItemDrop = 2477;
else if (fisher.uncommon && fisher.questFish == 2463)
fisher.rolledItemDrop = 2463;
else if (fisher.uncommon)
fisher.rolledItemDrop = 2319;
else if (fisher.common)
fisher.rolledItemDrop = 2305;
}
else if (Main.player[this.owner].ZoneHallow)
{
if (fisher.legendary && Main.hardMode && Main.player[this.owner].ZoneSnow && fisher.heightLevel == 3 && Main.rand.Next(3) != 0)
fisher.rolledItemDrop = 2429;
else if (fisher.legendary && Main.hardMode && Main.rand.Next(2) == 0)
fisher.rolledItemDrop = 3209;
else if (fisher.heightLevel > 1 && fisher.veryrare)
fisher.rolledItemDrop = 2317;
else if (fisher.heightLevel > 1 && fisher.rare && fisher.questFish == 2465)
fisher.rolledItemDrop = 2465;
else if (fisher.heightLevel < 2 && fisher.rare && fisher.questFish == 2468)
fisher.rolledItemDrop = 2468;
else if (fisher.rare)
fisher.rolledItemDrop = 2310;
else if (fisher.uncommon && fisher.questFish == 2471)
fisher.rolledItemDrop = 2471;
else if (fisher.uncommon)
fisher.rolledItemDrop = 2307;
}
if (fisher.rolledItemDrop == 0 && Main.player[this.owner].ZoneSnow)
{
if (fisher.heightLevel < 2 && fisher.uncommon && fisher.questFish == 2467)
fisher.rolledItemDrop = 2467;
else if (fisher.heightLevel == 1 && fisher.uncommon && fisher.questFish == 2470)
fisher.rolledItemDrop = 2470;
else if (fisher.heightLevel >= 2 && fisher.uncommon && fisher.questFish == 2484)
fisher.rolledItemDrop = 2484;
else if (fisher.heightLevel > 1 && fisher.uncommon && fisher.questFish == 2466)
fisher.rolledItemDrop = 2466;
else if (fisher.common && Main.rand.Next(12) == 0 || fisher.uncommon && Main.rand.Next(6) == 0)
fisher.rolledItemDrop = 3197;
else if (fisher.uncommon)
fisher.rolledItemDrop = 2306;
else if (fisher.common)
fisher.rolledItemDrop = 2299;
else if (fisher.heightLevel > 1 && Main.rand.Next(3) == 0)
fisher.rolledItemDrop = 2309;
}
if (fisher.rolledItemDrop == 0 && Main.player[this.owner].ZoneJungle)
{
if (fisher.heightLevel == 1 && fisher.uncommon && fisher.questFish == 2452)
fisher.rolledItemDrop = 2452;
else if (fisher.heightLevel == 1 && fisher.uncommon && fisher.questFish == 2483)
fisher.rolledItemDrop = 2483;
else if (fisher.heightLevel == 1 && fisher.uncommon && fisher.questFish == 2488)
fisher.rolledItemDrop = 2488;
else if (fisher.heightLevel >= 1 && fisher.uncommon && fisher.questFish == 2486)
fisher.rolledItemDrop = 2486;
else if (fisher.heightLevel > 1 && fisher.uncommon)
fisher.rolledItemDrop = 2311;
else if (fisher.uncommon)
fisher.rolledItemDrop = 2313;
else if (fisher.common)
fisher.rolledItemDrop = 2302;
}
if (fisher.rolledItemDrop == 0 && Main.player[this.owner].ZoneGlowshroom && fisher.uncommon && fisher.questFish == 2475)
fisher.rolledItemDrop = 2475;
}
if (fisher.rolledItemDrop == 0)
{
if (fisher.heightLevel <= 1 && (fisher.X < 380 || fisher.X > Main.maxTilesX - 380) && fisher.waterTilesCount > 1000)
fisher.rolledItemDrop = !fisher.veryrare || Main.rand.Next(2) != 0 ? (!fisher.veryrare ? (!fisher.rare || Main.rand.Next(5) != 0 ? (!fisher.rare || Main.rand.Next(3) != 0 ? (!fisher.uncommon || fisher.questFish != 2480 ? (!fisher.uncommon || fisher.questFish != 2481 ? (!fisher.uncommon ? (!fisher.common || Main.rand.Next(2) != 0 ? (!fisher.common ? 2297 : 2300) : 2301) : 2316) : 2481) : 2480) : 2332) : 2438) : 2342) : 2341;
else if (flag1)
fisher.rolledItemDrop = !fisher.uncommon || fisher.questFish != 4393 ? (!fisher.uncommon || fisher.questFish != 4394 ? (!fisher.uncommon ? (Main.rand.Next(3) != 0 ? 4401 : 4402) : 4410) : 4394) : 4393;
}
if (fisher.rolledItemDrop != 0)
return;
if (fisher.heightLevel < 2 && fisher.uncommon && fisher.questFish == 2461)
fisher.rolledItemDrop = 2461;
else if (fisher.heightLevel == 0 && fisher.uncommon && fisher.questFish == 2453)
fisher.rolledItemDrop = 2453;
else if (fisher.heightLevel == 0 && fisher.uncommon && fisher.questFish == 2473)
fisher.rolledItemDrop = 2473;
else if (fisher.heightLevel == 0 && fisher.uncommon && fisher.questFish == 2476)
fisher.rolledItemDrop = 2476;
else if (fisher.heightLevel < 2 && fisher.uncommon && fisher.questFish == 2458)
fisher.rolledItemDrop = 2458;
else if (fisher.heightLevel < 2 && fisher.uncommon && fisher.questFish == 2459)
fisher.rolledItemDrop = 2459;
else if (fisher.heightLevel == 0 && fisher.uncommon)
fisher.rolledItemDrop = 2304;
else if (fisher.heightLevel > 0 && fisher.heightLevel < 3 && fisher.uncommon && fisher.questFish == 2455)
fisher.rolledItemDrop = 2455;
else if (fisher.heightLevel == 1 && fisher.uncommon && fisher.questFish == 2479)
fisher.rolledItemDrop = 2479;
else if (fisher.heightLevel == 1 && fisher.uncommon && fisher.questFish == 2456)
fisher.rolledItemDrop = 2456;
else if (fisher.heightLevel == 1 && fisher.uncommon && fisher.questFish == 2474)
fisher.rolledItemDrop = 2474;
else if (fisher.heightLevel > 1 && fisher.rare && Main.rand.Next(5) == 0)
{
if (Main.hardMode && Main.rand.Next(2) == 0)
fisher.rolledItemDrop = 2437;
else
fisher.rolledItemDrop = 2436;
}
else if (fisher.heightLevel > 1 && fisher.legendary && Main.rand.Next(3) != 0)
fisher.rolledItemDrop = 2308;
else if (fisher.heightLevel > 1 && fisher.veryrare && Main.rand.Next(2) == 0)
fisher.rolledItemDrop = 2320;
else if (fisher.heightLevel > 1 && fisher.rare)
fisher.rolledItemDrop = 2321;
else if (fisher.heightLevel > 1 && fisher.uncommon && fisher.questFish == 2478)
fisher.rolledItemDrop = 2478;
else if (fisher.heightLevel > 1 && fisher.uncommon && fisher.questFish == 2450)
fisher.rolledItemDrop = 2450;
else if (fisher.heightLevel > 1 && fisher.uncommon && fisher.questFish == 2464)
fisher.rolledItemDrop = 2464;
else if (fisher.heightLevel > 1 && fisher.uncommon && fisher.questFish == 2469)
fisher.rolledItemDrop = 2469;
else if (fisher.heightLevel > 2 && fisher.uncommon && fisher.questFish == 2462)
fisher.rolledItemDrop = 2462;
else if (fisher.heightLevel > 2 && fisher.uncommon && fisher.questFish == 2482)
fisher.rolledItemDrop = 2482;
else if (fisher.heightLevel > 2 && fisher.uncommon && fisher.questFish == 2472)
fisher.rolledItemDrop = 2472;
else if (fisher.heightLevel > 2 && fisher.uncommon && fisher.questFish == 2460)
fisher.rolledItemDrop = 2460;
else if (fisher.heightLevel > 1 && fisher.uncommon && Main.rand.Next(4) != 0)
fisher.rolledItemDrop = 2303;
else if (fisher.heightLevel > 1 && (fisher.uncommon || fisher.common || Main.rand.Next(4) == 0))
{
if (Main.rand.Next(4) == 0)
fisher.rolledItemDrop = 2303;
else
fisher.rolledItemDrop = 2309;
}
else if (fisher.uncommon && fisher.questFish == 2487)
fisher.rolledItemDrop = 2487;
else if (fisher.waterTilesCount > 1000 && fisher.common)
fisher.rolledItemDrop = 2298;
else
fisher.rolledItemDrop = 2290;
}
}
private void FishingCheck_ProbeForQuestFish(ref FishingAttempt fisher)
{
fisher.questFish = Main.anglerQuestItemNetIDs[Main.anglerQuest];
if (Main.player[this.owner].HasItem(fisher.questFish))
fisher.questFish = -1;
if (!NPC.AnyNPCs(369))
fisher.questFish = -1;
if (!Main.anglerQuestFinished)
return;
fisher.questFish = -1;
}
private void FishingCheck_RollDropLevels(
int fishingLevel,
out bool common,
out bool uncommon,
out bool rare,
out bool veryrare,
out bool legendary,
out bool crate)
{
int num1 = 150;
int maxValue1 = num1 / fishingLevel;
int maxValue2 = num1 * 2 / fishingLevel;
int maxValue3 = num1 * 7 / fishingLevel;
int maxValue4 = num1 * 15 / fishingLevel;
int maxValue5 = num1 * 30 / fishingLevel;
int num2 = 10;
if (Main.player[this.owner].cratePotion)
num2 += 10;
if (maxValue1 < 2)
maxValue1 = 2;
if (maxValue2 < 3)
maxValue2 = 3;
if (maxValue3 < 4)
maxValue3 = 4;
if (maxValue4 < 5)
maxValue4 = 5;
if (maxValue5 < 6)
maxValue5 = 6;
common = false;
uncommon = false;
rare = false;
veryrare = false;
legendary = false;
crate = false;
if (Main.rand.Next(maxValue1) == 0)
common = true;
if (Main.rand.Next(maxValue2) == 0)
uncommon = true;
if (Main.rand.Next(maxValue3) == 0)
rare = true;
if (Main.rand.Next(maxValue4) == 0)
veryrare = true;
if (Main.rand.Next(maxValue5) == 0)
legendary = true;
if (Main.rand.Next(100) >= num2)
return;
crate = true;
}
private static void GetFishingPondState(
int x,
int y,
out bool lava,
out bool honey,
out int numWaters,
out int chumCount)
{
lava = false;
honey = false;
numWaters = 0;
chumCount = 0;
Point tileCoords = new Point(0, 0);
int minX;
int maxX;
Projectile.GetFishingPondWidth(x, y, out minX, out maxX);
for (int i = minX; i <= maxX; ++i)
{
int j = y;
while (Main.tile[i, j].liquid > (byte) 0 && !WorldGen.SolidTile(i, j) && j < Main.maxTilesY - 10)
{
++numWaters;
++j;
if (Main.tile[i, j].lava())
lava = true;
else if (Main.tile[i, j].honey())
honey = true;
tileCoords.X = i;
tileCoords.Y = j;
chumCount += Main.instance.ChumBucketProjectileHelper.GetChumsInLocation(tileCoords);
}
}
if (!honey)
return;
numWaters = (int) ((double) numWaters * 1.5);
}
private static void GetFishingPondWidth(int x, int y, out int minX, out int maxX)
{
minX = x;
maxX = x;
while (minX > 10 && Main.tile[minX, y].liquid > (byte) 0 && !WorldGen.SolidTile(minX, y))
--minX;
while (maxX < Main.maxTilesX - 10 && Main.tile[maxX, y].liquid > (byte) 0 && !WorldGen.SolidTile(maxX, y))
++maxX;
}
public bool CanBeReflected() => this.active && this.friendly && !this.hostile && this.damage > 0 && (this.aiStyle == 1 || this.aiStyle == 2 || this.aiStyle == 8 || this.aiStyle == 21 || this.aiStyle == 24 || this.aiStyle == 28 || this.aiStyle == 29 || this.aiStyle == 131);
public Color GetFairyQueenWeaponsColor(
float alphaChannelMultiplier = 1f,
float lerpToWhite = 0.0f,
float? rawHueOverride = null)
{
float num = this.ai[1];
if (rawHueOverride.HasValue)
num = rawHueOverride.Value;
float Hue = (float) (((double) num + 0.5) % 1.0);
float Saturation = 1f;
float Luminosity = 0.5f;
if (Main.player[this.owner].active)
{
switch (Main.player[this.owner].name)
{
case "Acamaeda":
Hue = MathHelper.Lerp(0.06f, 0.28f, Utils.Turn01ToCyclic010(Hue));
Luminosity = 0.5f;
alphaChannelMultiplier = MathHelper.Lerp(alphaChannelMultiplier, 0.6f, 0.5f);
break;
case "Alchemystics":
Hue = MathHelper.Lerp(0.74f, 0.96f, Utils.Turn01ToCyclic010(Hue));
Luminosity = 0.6f;
alphaChannelMultiplier = MathHelper.Lerp(alphaChannelMultiplier, 0.6f, 0.5f);
break;
case "Antithesis":
Hue = 0.51f;
Luminosity = MathHelper.Lerp(0.0f, 0.5f, (float) (Math.Cos((double) num * 6.28318548202515) * 0.5 + 0.5));
break;
case "Aurora3500":
Hue = MathHelper.Lerp(0.33f, 0.8f, Utils.Turn01ToCyclic010(Hue));
Luminosity = 0.5f;
alphaChannelMultiplier = MathHelper.Lerp(alphaChannelMultiplier, 0.5f, 0.5f);
break;
case "Cenx":
Color color1 = Color.Lerp(new Color(0.3f, 1f, 0.2f), Color.HotPink, MathHelper.SmoothStep(0.0f, 1f, MathHelper.SmoothStep(0.0f, 1f, Utils.PingPongFrom01To010(Hue))));
if ((double) lerpToWhite != 0.0)
color1 = Color.Lerp(color1, Color.White, lerpToWhite);
color1.A = (byte) ((double) color1.A * (double) alphaChannelMultiplier);
return color1;
case "Criddle":
Hue = MathHelper.Lerp(0.05f, 0.15f, Utils.Turn01ToCyclic010(Hue));
Luminosity = 0.5f;
alphaChannelMultiplier = MathHelper.Lerp(alphaChannelMultiplier, 0.5f, 0.5f);
break;
case "Crowno":
Luminosity = MathHelper.Lerp(0.25f, 0.4f, Utils.Turn01ToCyclic010(Hue));
Hue = MathHelper.Lerp(0.7055556f, 0.7833334f, Utils.Turn01ToCyclic010(Hue));
alphaChannelMultiplier = MathHelper.Lerp(alphaChannelMultiplier, 0.5f, 0.5f);
break;
case "Darthkitten":
Hue = 1f;
Luminosity = MathHelper.Lerp(1f, 0.4f, (float) (Math.Cos((double) num * 6.28318548202515) * 0.5 + 0.5));
break;
case "Discipile":
Hue = MathHelper.Lerp(0.1f, 0.15f, Utils.Turn01ToCyclic010(Hue));
Luminosity = 0.5f;
break;
case "Doylee":
Hue = MathHelper.Lerp(0.68f, 1f, Utils.Turn01ToCyclic010(Hue));
Luminosity = 0.5f;
alphaChannelMultiplier = MathHelper.Lerp(alphaChannelMultiplier, 0.6f, 0.5f);
break;
case "Ghostar":
Hue = 0.66f;
Luminosity = MathHelper.Lerp(0.15f, 0.85f, (float) (Math.Cos((double) num * 6.28318548202515) * 0.5 + 0.5));
break;
case "Grox The Great":
Hue = MathHelper.Lerp(0.31f, 0.5f, Utils.Turn01ToCyclic010(Hue));
Luminosity = 0.5f;
alphaChannelMultiplier = MathHelper.Lerp(alphaChannelMultiplier, 1f, 0.8f);
break;
case "Jaxrud":
Hue = MathHelper.Lerp(0.1805556f, 0.4361111f, Utils.Turn01ToCyclic010(Hue));
Luminosity = 0.5f;
break;
case "Jenosis":
Hue = MathHelper.Lerp(0.9f, 1.13f, Utils.Turn01ToCyclic010(Hue)) % 1f;
Luminosity = 0.5f;
alphaChannelMultiplier = MathHelper.Lerp(alphaChannelMultiplier, 0.5f, 0.5f);
break;
case "Kazzymodus":
Hue = 0.33f;
Luminosity = MathHelper.Lerp(0.15f, 0.4f, (float) (Math.Cos((double) num * 6.28318548202515) * 0.5 + 0.5));
break;
case "Khaios":
Hue = 0.33f;
Luminosity = MathHelper.Lerp(0.0f, 0.2f, (float) (Math.Cos((double) num * 6.28318548202515) * 0.5 + 0.5));
break;
case "Lazure":
Hue = MathHelper.Lerp(0.5333334f, 0.9222222f, Utils.Turn01ToCyclic010(Hue));
Luminosity = 0.5f;
break;
case "Leinfors":
Hue = MathHelper.Lerp(0.7f, 0.77f, Utils.Turn01ToCyclic010(Hue));
Luminosity = 0.5f;
break;
case "Loki":
Hue = 0.0f;
Luminosity = MathHelper.Lerp(0.0f, 0.25f, (float) (Math.Cos((double) num * 6.28318548202515) * 0.5 + 0.5));
break;
case "ManaUser":
Hue = MathHelper.Lerp(0.41f, 0.57f, Utils.Turn01ToCyclic010(Hue));
Luminosity = 0.5f;
break;
case "Mid":
Hue = 0.0f;
Luminosity = MathHelper.Lerp(0.0f, 0.9f, (float) (Math.Cos((double) num * 6.28318548202515) * 0.5 + 0.5));
break;
case "Nike Leon":
Hue = MathHelper.Lerp(0.04f, 0.1f, Utils.Turn01ToCyclic010(Hue));
Luminosity = 0.5f;
alphaChannelMultiplier = MathHelper.Lerp(alphaChannelMultiplier, 0.5f, 0.5f);
break;
case "RBrandon":
Hue = 0.03f;
Luminosity = 0.3f;
alphaChannelMultiplier = MathHelper.Lerp(alphaChannelMultiplier, 0.6f, 0.5f);
break;
case "Redigit":
Hue = 0.7f;
Luminosity = 0.5f;
break;
case "Serenity":
Hue = 0.85f;
Luminosity = MathHelper.Lerp(1f, 0.5f, (float) (Math.Cos((double) num * 6.28318548202515) * 0.5 + 0.5));
break;
case "Sigma":
Hue = MathHelper.Lerp(0.0f, 0.12f, Utils.Turn01ToCyclic010(Hue));
Luminosity = 0.5f;
alphaChannelMultiplier = MathHelper.Lerp(alphaChannelMultiplier, 0.6f, 0.5f);
break;
case "Unit One":
Color color2 = Color.Lerp(Color.Yellow, Color.Blue, MathHelper.SmoothStep(0.0f, 1f, Utils.PingPongFrom01To010(Hue)));
if ((double) lerpToWhite != 0.0)
color2 = Color.Lerp(color2, Color.White, lerpToWhite);
color2.A = (byte) ((double) color2.A * (double) alphaChannelMultiplier);
return color2;
case "Vulpes Inculta":
Hue = MathHelper.Lerp(0.65f, 0.75f, Utils.Turn01ToCyclic010(Hue));
Luminosity = 0.5f;
alphaChannelMultiplier = MathHelper.Lerp(alphaChannelMultiplier, 0.5f, 0.5f);
break;
case "Waze3174":
Hue = MathHelper.Lerp(0.33f, 0.0f, Utils.Turn01ToCyclic010(Hue));
Luminosity = 0.3f;
alphaChannelMultiplier = MathHelper.Lerp(alphaChannelMultiplier, 0.6f, 0.5f);
break;
case "Xman101":
Hue = 0.06f;
Luminosity = MathHelper.Lerp(0.0f, 0.5f, (float) (Math.Cos((double) num * 6.28318548202515) * 0.5 + 0.5));
break;
case "Yoraiz0r":
Hue = MathHelper.Lerp(0.9f, 0.95f, Utils.Turn01ToCyclic010(Hue));
Luminosity = 0.5f;
break;
case "Zoomo":
Hue = 0.77f;
Luminosity = 0.5f;
alphaChannelMultiplier = MathHelper.Lerp(alphaChannelMultiplier, 0.6f, 0.5f);
break;
case "darthmorf":
Hue = 0.0f;
Luminosity = MathHelper.Lerp(0.0f, 0.2f, (float) (Math.Cos((double) num * 6.28318548202515) * 0.5 + 0.5));
break;
case "ppowersteef":
Hue = MathHelper.Lerp(0.0f, 0.15f, Utils.Turn01ToCyclic010(Hue));
Luminosity = 0.5f;
alphaChannelMultiplier = MathHelper.Lerp(alphaChannelMultiplier, 0.6f, 0.5f);
break;
}
}
Color color3 = Main.hslToRgb(Hue, Saturation, Luminosity) * this.Opacity;
if ((double) lerpToWhite != 0.0)
color3 = Color.Lerp(color3, Color.White, lerpToWhite);
color3.A = (byte) ((double) color3.A * (double) alphaChannelMultiplier);
return color3;
}
public float GetLastPrismHue(
float laserIndex,
ref float laserLuminance,
ref float laserAlphaMultiplier)
{
if (Main.player[this.owner].active)
{
double forVisualEffects = Main.timeForVisualEffects;
switch (Main.player[this.owner].name)
{
case "Acamaeda":
return (float) (0.180000007152557 + Math.Cos(forVisualEffects / 90.0 * 6.28318548202515) * 0.100000001490116);
case "Aeroblop":
return (float) (0.25 + Math.Cos(forVisualEffects / 180.0 * 6.28318548202515) * 0.100000001490116);
case "Alchemystics":
return (float) (0.730000019073486 + Math.Cos(forVisualEffects / 180.0 * 6.28318548202515) * 0.180000007152557);
case "Antithesis":
laserLuminance = 0.25f;
laserAlphaMultiplier = 0.4f;
return (float) (0.699999988079071 + Math.Cos(forVisualEffects / 180.0 * 6.28318548202515) * 0.0500000007450581);
case "Arkhalis":
case "Darkhalis":
return (float) (0.75 + Math.Cos(forVisualEffects / 180.0 * 6.28318548202515) * 0.0700000002980232);
case "Aurora3500":
laserLuminance = MathHelper.Lerp(0.0f, 0.5f, Utils.GetLerpValue(-1f, 1f, (float) Math.Cos(forVisualEffects / 105.0 * 6.28318548202515), false));
laserAlphaMultiplier = 0.25f;
return 0.35f;
case "Cenx":
return Main.rgbToHsl(Color.Lerp(new Color(0.3f, 1f, 0.2f), Color.HotPink, MathHelper.SmoothStep(0.0f, 1f, MathHelper.SmoothStep(0.0f, 1f, Utils.PingPongFrom01To010(laserIndex / 6f))))).X;
case "Criddle":
return (float) (0.910000026226044 + Math.Cos(forVisualEffects / 180.0 * 6.28318548202515) * 0.189999997615814);
case "Crowno":
laserLuminance = MathHelper.Lerp(0.25f, 0.4f, Utils.GetLerpValue(-1f, 1f, (float) Math.Cos(forVisualEffects / 105.0 * 6.28318548202515), false));
laserAlphaMultiplier = 0.5f;
return MathHelper.Lerp(0.7055556f, 0.7833334f, Utils.Turn01ToCyclic010(laserIndex / 6f));
case "Darthkitten":
laserLuminance = MathHelper.Lerp(0.4f, 0.9f, Utils.GetLerpValue(-1f, 1f, (float) Math.Cos(forVisualEffects / 120.0 * 6.28318548202515), false));
laserAlphaMultiplier = 0.3f;
return 1f;
case "Devalaous":
return (float) (0.660000026226044 + Math.Cos(forVisualEffects / 180.0 * 6.28318548202515) * 0.100000001490116);
case "Discipile":
laserLuminance = MathHelper.Lerp(0.0f, 0.4f, Utils.GetLerpValue(-1f, 1f, (float) Math.Cos(forVisualEffects / 105.0 * 6.28318548202515), false));
laserAlphaMultiplier = 0.35f;
return 0.55f;
case "Doylee":
return (float) (0.839999973773956 + Math.Cos(forVisualEffects / 90.0 * 6.28318548202515) * 0.159999996423721);
case "Ghostar":
laserLuminance = MathHelper.Lerp(0.4f, 0.7f, Utils.GetLerpValue(-1f, 1f, (float) Math.Cos(forVisualEffects / 120.0 * 6.28318548202515), false));
laserAlphaMultiplier = 0.3f;
return 0.66f;
case "Grox The Great":
return (float) (0.409999996423721 + Math.Cos(forVisualEffects / 120.0 * 6.28318548202515) * 0.100000001490116);
case "Jaxrud":
return MathHelper.Lerp(0.1805556f, 0.4361111f, Utils.Turn01ToCyclic010(laserIndex / 6f));
case "Jenosis":
return (float) (0.660000026226044 + Math.Cos(forVisualEffects / 180.0 * 6.28318548202515) * 0.0799999982118607);
case "Kazzymodus":
laserLuminance = MathHelper.Lerp(0.6f, 0.8f, Utils.GetLerpValue(-1f, 1f, (float) Math.Cos(forVisualEffects / 90.0 * 6.28318548202515), false));
laserAlphaMultiplier = 0.3f;
return 0.33f;
case "Khaios":
laserLuminance = MathHelper.Lerp(0.0f, 0.1f, Utils.GetLerpValue(-1f, 1f, (float) Math.Cos(forVisualEffects / 105.0 * 6.28318548202515), false));
laserAlphaMultiplier = 0.25f;
return 0.35f;
case "Lazure":
return MathHelper.Lerp(0.5333334f, 0.9222222f, Utils.Turn01ToCyclic010(laserIndex / 6f));
case "Leinfors":
return (float) (0.730000019073486 + Math.Cos(forVisualEffects / 3.0 * 6.28318548202515) * 0.0299999993294477);
case "Loki":
laserLuminance = MathHelper.Lerp(0.0f, 0.3f, Utils.GetLerpValue(-1f, 1f, (float) Math.Cos(forVisualEffects / 5.0 * 6.28318548202515), false));
laserAlphaMultiplier = 0.4f;
return 0.0f;
case "ManaUser":
return (float) (0.490000009536743 + Math.Cos(forVisualEffects / 140.0 * 6.28318548202515) * 0.0799999982118607);
case "Mid":
laserLuminance = 0.25f;
laserAlphaMultiplier = 0.4f;
return (float) (0.860000014305115 + Math.Cos(forVisualEffects / 270.0 * 6.28318548202515) * 0.129999995231628);
case "Nike Leon":
return (float) (0.0700000002980232 + Math.Cos(forVisualEffects / 180.0 * 6.28318548202515) * 0.0399999991059303);
case "RBrandon":
laserLuminance = MathHelper.Lerp(0.0f, 0.5f, Utils.GetLerpValue(-1f, 1f, (float) Math.Cos(forVisualEffects / 105.0 * 6.28318548202515), false));
laserAlphaMultiplier = 0.4f;
return 1f;
case "Random":
return Main.rand.NextFloat();
case "Redigit":
return 0.7f;
case "Serenity":
laserLuminance = MathHelper.Lerp(0.9f, 0.65f, Utils.GetLerpValue(-1f, 1f, (float) Math.Cos(forVisualEffects / 120.0 * 6.28318548202515), false));
laserAlphaMultiplier = 0.3f;
return 0.85f;
case "Sigma":
return (float) (0.0599999986588955 + Math.Cos(forVisualEffects / 180.0 * 6.28318548202515) * 0.0599999986588955);
case "Suweeka":
return (float) (0.5 + Math.Cos(forVisualEffects / 180.0 * 6.28318548202515) * 0.180000007152557);
case "Tsuki":
case "Yoraiz0r":
return 0.92f;
case "Unit One":
return (float) (0.379999995231628 + Math.Cos(forVisualEffects / 90.0 * 6.28318548202515) * 0.239999994635582);
case "Vulpes Inculta":
return (float) (0.699999988079071 + Math.Cos(forVisualEffects / 180.0 * 6.28318548202515) * 0.0500000007450581);
case "W1K":
return (float) (0.75 + Math.Cos(forVisualEffects / 120.0 * 6.28318548202515) * 0.0500000007450581);
case "Waze3174":
return (float) (0.379999995231628 + Math.Cos(forVisualEffects / 90.0 * 6.28318548202515) * 0.239999994635582);
case "Xman101":
laserLuminance = MathHelper.Lerp(0.9f, 0.55f, Utils.GetLerpValue(-1f, 1f, (float) Math.Cos(forVisualEffects / 120.0 * 6.28318548202515), false));
laserAlphaMultiplier = 0.2f;
return 0.33f;
case "Zoomo":
return 0.77f;
case "darthmorf":
laserLuminance = MathHelper.Lerp(0.0f, 0.2f, Utils.GetLerpValue(-1f, 1f, (float) Math.Cos(forVisualEffects / 105.0 * 6.28318548202515), false));
laserAlphaMultiplier = 0.4f;
return 0.0f;
case "ppowersteef":
laserLuminance = MathHelper.Lerp(0.1f, 0.5f, Utils.GetLerpValue(-1f, 1f, (float) Math.Cos(forVisualEffects / 105.0 * 6.28318548202515), false));
laserAlphaMultiplier = 0.25f;
return 0.6f;
}
}
return (float) (int) laserIndex / 6f;
}
public static int GetByUUID(int owner, float uuid) => Projectile.GetByUUID(owner, (int) uuid);
public static int GetByUUID(int owner, int uuid)
{
if (uuid < 0 || uuid >= 1000 || owner < 0 || owner >= (int) byte.MaxValue)
return -1;
int index = Main.projectileIdentity[owner, uuid];
return index >= 0 && Main.projectile[index].active ? index : -1;
}
public void ProjectileFixDesperation()
{
if (this.owner < 0 || this.owner >= 1000)
return;
switch (this.type)
{
case 461:
case 632:
case 642:
case 644:
for (int index = 0; index < 1000; ++index)
{
if (Main.projectile[index].owner == this.owner && (double) Main.projectile[index].identity == (double) this.ai[1] && Main.projectile[index].active)
{
this.ai[1] = (float) index;
break;
}
}
break;
}
}
public bool ShouldUseWindPhysics()
{
if (Main.windPhysics)
{
bool? nullable = ProjectileID.Sets.WindPhysicsImmunity[this.type];
if (nullable.HasValue)
return !nullable.Value;
int aiStyle = this.aiStyle;
if (aiStyle <= 17)
{
if (aiStyle <= 8)
{
if ((uint) (aiStyle - 1) > 1U && aiStyle != 8)
goto label_12;
}
else if (aiStyle != 10 && aiStyle != 14 && (uint) (aiStyle - 16) > 1U)
goto label_12;
}
else if (aiStyle <= 72)
{
switch (aiStyle - 21)
{
case 0:
case 3:
case 7:
case 8:
case 11:
case 12:
case 13:
case 14:
break;
case 1:
case 2:
case 4:
case 5:
case 6:
case 9:
case 10:
goto label_12;
default:
if (aiStyle == 49 || aiStyle == 72)
break;
goto label_12;
}
}
else if (aiStyle != 93 && aiStyle != 96 && aiStyle != 106)
goto label_12;
return true;
}
label_12:
return false;
}
private void AI_151_SuperStar()
{
this.alpha -= 10;
int num = 100;
if (this.alpha < num)
this.alpha = num;
if (this.soundDelay == 0)
{
this.soundDelay = 20 + Main.rand.Next(40);
SoundEngine.PlaySound(SoundID.Item9, this.position);
}
this.rotation += (float) (((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y)) * 0.00499999988824129) * (float) this.direction;
Vector2 vector2 = new Vector2((float) Main.screenWidth, (float) Main.screenHeight);
if (this.Hitbox.Intersects(Utils.CenteredRectangle(Main.screenPosition + vector2 / 2f, vector2 + new Vector2(400f))) && Main.rand.Next(6) == 0)
Gore.NewGore(this.position, this.velocity * 0.2f, Utils.SelectRandom<int>(Main.rand, 16, 17, 17, 17));
for (int index = 0; index < 2; ++index)
{
if (Main.rand.Next(8) == 0)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 228, Alpha: ((int) sbyte.MaxValue));
dust.velocity *= 0.25f;
dust.scale = 1.3f;
dust.noGravity = true;
dust.velocity += this.velocity.RotatedBy(0.392699092626572 * (1.0 - (double) (2 * index))) * 0.2f;
}
}
}
public bool IsInterruptible(Player player) => this.aiStyle == 160;
public void Interrupt(Player player)
{
if (this.aiStyle != 160)
return;
this.Kill();
player.heldProj = -1;
player.itemAnimation = 0;
player.itemTime = 0;
}
private void AI_152_SuperStarSlash()
{
this.alpha -= 10;
int num = 100;
if (this.alpha < num)
this.alpha = num;
if (this.soundDelay == 0)
{
this.soundDelay = 20 + Main.rand.Next(40);
SoundEngine.PlaySound(SoundID.Item9, this.position);
}
this.rotation = this.velocity.ToRotation() + 1.570796f;
this.tileCollide = false;
}
private void Resize(int newWidth, int newHeight)
{
this.position = this.Center;
this.width = newWidth;
this.height = newHeight;
this.Center = this.position;
}
public void AI()
{
// ISSUE: The method is too long to display (70257 instructions)
}
private void AI_184_BadTorchLuck()
{
this.owner = (int) byte.MaxValue;
if (Main.player[Main.myPlayer].unlockedBiomeTorches)
this.damage = 0;
if ((double) this.localAI[0] == 0.0)
{
this.localAI[0] = 1f;
SoundEngine.PlaySound(SoundID.Item8, this.Center);
}
if ((double) this.ai[1] > 0.0)
this.ai[1] -= this.velocity.Length();
else
this.tileCollide = true;
int Type = (int) this.ai[0];
float num1 = 4f;
for (float num2 = 0.0f; (double) num2 < (double) num1; ++num2)
{
int index = Dust.NewDust(this.position + this.velocity / num1 * num2, 4, 4, Type, Alpha: 100);
if (Main.rand.Next(3) != 0)
Main.dust[index].noGravity = true;
Main.dust[index].velocity *= 0.3f;
if (Type == 66)
{
Main.dust[index].color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB);
Main.dust[index].noGravity = true;
}
}
}
private void AI_121_StardustDragon()
{
Player player = Main.player[this.owner];
if ((int) Main.timeForVisualEffects % 120 == 0)
this.netUpdate = true;
if (!player.active)
{
this.active = false;
}
else
{
int num1 = this.type == 625 ? 1 : 0;
bool flag1 = this.type == 625 || this.type == 626 || this.type == 627 || this.type == 628;
int num2 = 10;
if (flag1)
{
if (player.dead)
player.stardustDragon = false;
if (player.stardustDragon)
this.timeLeft = 2;
num2 = 30;
if (Main.rand.Next(30) == 0)
{
int index = Dust.NewDust(this.position, this.width, this.height, 135, Scale: 2f);
Main.dust[index].noGravity = true;
Main.dust[index].fadeIn = 2f;
Point tileCoordinates = Main.dust[index].position.ToTileCoordinates();
if (WorldGen.InWorld(tileCoordinates.X, tileCoordinates.Y, 5) && WorldGen.SolidTile(tileCoordinates.X, tileCoordinates.Y))
Main.dust[index].noLight = true;
}
}
if (num1 != 0)
{
Vector2 center = player.Center;
float num3 = 700f;
float num4 = 1000f;
int index1 = -1;
if ((double) this.Distance(center) > 2000.0)
{
this.Center = center;
this.netUpdate = true;
}
if (true)
{
NPC minionAttackTargetNpc = this.OwnerMinionAttackTargetNPC;
if (minionAttackTargetNpc != null && minionAttackTargetNpc.CanBeChasedBy((object) this) && (double) this.Distance(minionAttackTargetNpc.Center) < (double) num3 * 2.0)
{
index1 = minionAttackTargetNpc.whoAmI;
if (minionAttackTargetNpc.boss)
{
int whoAmI1 = minionAttackTargetNpc.whoAmI;
}
else
{
int whoAmI2 = minionAttackTargetNpc.whoAmI;
}
}
if (index1 < 0)
{
for (int index2 = 0; index2 < 200; ++index2)
{
NPC npc = Main.npc[index2];
if (npc.CanBeChasedBy((object) this) && (double) player.Distance(npc.Center) < (double) num4 && (double) this.Distance(npc.Center) < (double) num3)
{
index1 = index2;
int num5 = npc.boss ? 1 : 0;
}
}
}
}
if (index1 != -1)
{
NPC npc = Main.npc[index1];
Vector2 vector2 = npc.Center - this.Center;
((double) vector2.X > 0.0).ToDirectionInt();
((double) vector2.Y > 0.0).ToDirectionInt();
float num6 = 0.4f;
if ((double) vector2.Length() < 600.0)
num6 = 0.6f;
if ((double) vector2.Length() < 300.0)
num6 = 0.8f;
if ((double) vector2.Length() > (double) npc.Size.Length() * 0.75)
{
this.velocity = this.velocity + Vector2.Normalize(vector2) * num6 * 1.5f;
if ((double) Vector2.Dot(this.velocity, vector2) < 0.25)
this.velocity = this.velocity * 0.8f;
}
float num7 = 30f;
if ((double) this.velocity.Length() > (double) num7)
this.velocity = Vector2.Normalize(this.velocity) * num7;
}
else
{
float num8 = 0.2f;
Vector2 vector2 = center - this.Center;
if ((double) vector2.Length() < 200.0)
num8 = 0.12f;
if ((double) vector2.Length() < 140.0)
num8 = 0.06f;
if ((double) vector2.Length() > 100.0)
{
if ((double) Math.Abs(center.X - this.Center.X) > 20.0)
this.velocity.X += num8 * (float) Math.Sign(center.X - this.Center.X);
if ((double) Math.Abs(center.Y - this.Center.Y) > 10.0)
this.velocity.Y += num8 * (float) Math.Sign(center.Y - this.Center.Y);
}
else if ((double) this.velocity.Length() > 2.0)
this.velocity = this.velocity * 0.96f;
if ((double) Math.Abs(this.velocity.Y) < 1.0)
this.velocity.Y -= 0.1f;
float num9 = 15f;
if ((double) this.velocity.Length() > (double) num9)
this.velocity = Vector2.Normalize(this.velocity) * num9;
}
this.rotation = this.velocity.ToRotation() + 1.570796f;
int direction1 = this.direction;
this.direction = this.spriteDirection = (double) this.velocity.X > 0.0 ? 1 : -1;
int direction2 = this.direction;
if (direction1 != direction2)
this.netUpdate = true;
float num10 = MathHelper.Clamp(this.localAI[0], 0.0f, 50f);
this.position = this.Center;
this.scale = (float) (1.0 + (double) num10 * 0.00999999977648258);
this.width = this.height = (int) ((double) num2 * (double) this.scale);
this.Center = this.position;
if (this.alpha > 0)
{
for (int index3 = 0; index3 < 2; ++index3)
{
int index4 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 135, Alpha: 100, Scale: 2f);
Main.dust[index4].noGravity = true;
Main.dust[index4].noLight = true;
}
this.alpha -= 42;
if (this.alpha < 0)
this.alpha = 0;
}
}
else
{
bool flag2 = false;
Vector2 vector2_1 = Vector2.Zero;
Vector2 zero = Vector2.Zero;
float num11 = 0.0f;
float num12 = 0.0f;
float num13 = 1f;
if ((double) this.ai[1] == 1.0)
{
this.ai[1] = 0.0f;
this.netUpdate = true;
}
int byUuid = Projectile.GetByUUID(this.owner, (int) this.ai[0]);
if (Main.projectile.IndexInRange<Projectile>(byUuid))
{
Projectile projectile = Main.projectile[byUuid];
if (flag1 && projectile.active && (projectile.type == 625 || projectile.type == 626 || projectile.type == 627))
{
flag2 = true;
vector2_1 = projectile.Center;
Vector2 velocity = projectile.velocity;
num11 = projectile.rotation;
num13 = MathHelper.Clamp(projectile.scale, 0.0f, 50f);
num12 = 16f;
int alpha = projectile.alpha;
projectile.localAI[0] = this.localAI[0] + 1f;
if (projectile.type != 625)
projectile.localAI[1] = (float) this.whoAmI;
if (this.owner == Main.myPlayer && this.type == 628 && projectile.type == 625)
{
projectile.Kill();
this.Kill();
return;
}
}
}
if (!flag2)
{
for (int index = 0; index < 1000; ++index)
{
Projectile projectile = Main.projectile[index];
if (projectile.active && projectile.owner == this.owner && ProjectileID.Sets.StardustDragon[projectile.type] && (double) projectile.localAI[1] == (double) this.ai[0])
{
this.ai[0] = (float) projectile.projUUID;
projectile.localAI[1] = (float) this.whoAmI;
this.netUpdate = true;
}
}
return;
}
if (this.alpha > 0)
{
for (int index5 = 0; index5 < 2; ++index5)
{
int index6 = Dust.NewDust(this.position, this.width, this.height, 135, Alpha: 100, Scale: 2f);
Main.dust[index6].noGravity = true;
Main.dust[index6].noLight = true;
}
}
this.alpha -= 42;
if (this.alpha < 0)
this.alpha = 0;
this.velocity = Vector2.Zero;
Vector2 vector2_2 = vector2_1 - this.Center;
if ((double) num11 != (double) this.rotation)
{
float num14 = MathHelper.WrapAngle(num11 - this.rotation);
vector2_2 = vector2_2.RotatedBy((double) num14 * 0.100000001490116);
}
this.rotation = vector2_2.ToRotation() + 1.570796f;
this.position = this.Center;
this.scale = num13;
this.width = this.height = (int) ((double) num2 * (double) this.scale);
this.Center = this.position;
if (vector2_2 != Vector2.Zero)
this.Center = vector2_1 - Vector2.Normalize(vector2_2) * num12 * num13;
this.spriteDirection = (double) vector2_2.X > 0.0 ? 1 : -1;
}
this.position.X = MathHelper.Clamp(this.position.X, 160f, (float) (Main.maxTilesX * 16 - 160));
this.position.Y = MathHelper.Clamp(this.position.Y, 160f, (float) (Main.maxTilesY * 16 - 160));
}
}
private Projectile FindStardustDragonHeadOfOwner()
{
for (int index = 0; index < 1000; ++index)
{
Projectile projectile = Main.projectile[index];
if (projectile.active && projectile.owner == this.owner && projectile.type == 625)
return projectile;
}
return (Projectile) null;
}
private void AI_183_ZoologistStrike()
{
this.velocity.X *= 0.2f;
this.velocity.Y = 0.0f;
this.spriteDirection = this.direction = 1;
if ((double) this.velocity.X < 0.0)
this.spriteDirection = this.direction = -1;
++this.frame;
if (this.frame < Main.projFrames[this.type])
return;
this.frame = Main.projFrames[this.type] - 1;
}
private void AI_182_FinalFractal()
{
Player player = Main.player[this.owner];
Vector2 mountedCenter = player.MountedCenter;
float lerpValue1 = Utils.GetLerpValue(900f, 0.0f, this.velocity.Length() * 2f, true);
this.localAI[0] += MathHelper.Lerp(0.7f, 2f, lerpValue1);
if ((double) this.localAI[0] >= 120.0)
{
this.Kill();
}
else
{
float lerpValue2 = Utils.GetLerpValue(0.0f, 1f, this.localAI[0] / 60f, true);
double num1 = (double) this.localAI[0] / 60.0;
float num2 = this.ai[0];
float rotation = this.velocity.ToRotation();
float num3 = 3.141593f;
float num4 = (double) this.velocity.X > 0.0 ? 1f : -1f;
float num5 = num3 + (float) ((double) num4 * (double) lerpValue2 * 6.28318548202515);
float x = this.velocity.Length() + Utils.GetLerpValue(0.5f, 1f, lerpValue2, true) * 40f;
float num6 = 60f;
if ((double) x < (double) num6)
x = num6;
Vector2 vector2_1 = mountedCenter + this.velocity + (new Vector2(1f, 0.0f).RotatedBy((double) num5) * new Vector2(x, num2 * MathHelper.Lerp(2f, 1f, lerpValue1))).RotatedBy((double) rotation);
Vector2 vector2_2 = (1f - Utils.GetLerpValue(0.0f, 0.5f, lerpValue2, true)) * new Vector2((float) (((double) this.velocity.X > 0.0 ? 1.0 : -1.0) * -(double) x * 0.100000001490116), (float) (-(double) this.ai[0] * 0.300000011920929));
this.rotation = num5 + rotation + 1.570796f;
this.Center = vector2_1 + vector2_2;
this.spriteDirection = this.direction = (double) this.velocity.X > 0.0 ? 1 : -1;
if ((double) num2 < 0.0)
{
this.rotation = num3 + (float) ((double) num4 * (double) lerpValue2 * -6.28318548202515) + rotation;
this.rotation += 1.570796f;
this.spriteDirection = this.direction = (double) this.velocity.X > 0.0 ? -1 : 1;
}
if (num1 < 1.0)
{
FinalFractalHelper.FinalFractalProfile finalFractalProfile = FinalFractalHelper.GetFinalFractalProfile((int) this.ai[1]);
Vector2 rotationVector2 = (this.rotation - 1.570796f).ToRotationVector2();
Vector2 center = this.Center;
int num7 = (int) ((double) (1 + (int) ((double) this.velocity.Length() / 100.0)) * (double) Utils.GetLerpValue(0.0f, 0.5f, lerpValue2, true) * (double) Utils.GetLerpValue(1f, 0.5f, lerpValue2, true));
if (num7 < 1)
num7 = 1;
for (int index = 0; index < num7; ++index)
finalFractalProfile.dustMethod(center + rotationVector2 * finalFractalProfile.trailWidth * MathHelper.Lerp(0.5f, 1f, Main.rand.NextFloat()), (float) ((double) this.rotation - 1.57079637050629 + 1.57079637050629 * (double) this.spriteDirection), player.velocity);
Vector3 vector3_1 = finalFractalProfile.trailColor.ToVector3();
Vector3 vector3_2 = Vector3.Lerp(Vector3.One, vector3_1, 0.7f);
Lighting.AddLight(this.Center, vector3_1 * 0.5f * this.Opacity);
Lighting.AddLight(mountedCenter, vector3_2 * this.Opacity * 0.15f);
}
this.Opacity = Utils.GetLerpValue(0.0f, 5f, this.localAI[0], true) * Utils.GetLerpValue(120f, 115f, this.localAI[0], true);
}
}
private void AI_181_FairyQueenRangedItemShot()
{
++this.ai[0];
this.alpha = (int) MathHelper.Lerp((float) byte.MaxValue, 0.0f, Utils.GetLerpValue(0.0f, 10f, this.ai[0], true));
this.rotation = this.velocity.ToRotation();
if (Main.rand.Next(6) != 0)
return;
Dust dust = Dust.NewDustPerfect(this.Center, 267);
dust.fadeIn = 1f;
dust.noGravity = true;
dust.alpha = 100;
dust.color = this.GetFairyQueenWeaponsColor(lerpToWhite: (Main.rand.NextFloat() * 0.4f));
dust.noLightEmittence = true;
dust.scale *= 1.5f;
}
private void AI_009_MagicMissiles()
{
if (this.type == 491)
{
this.AI_009_MagicMissiles_Old();
}
else
{
int num1 = 32;
Player player = Main.player[this.owner];
int num2 = Main.maxTilesY * 16;
int num3 = 0;
if ((double) this.ai[0] >= 0.0)
num3 = (int) ((double) this.ai[1] / (double) num2);
bool flag1 = (double) this.ai[0] == -1.0 || (double) this.ai[0] == -2.0;
if (this.type == 34)
{
if (this.frameCounter++ >= 4)
{
this.frameCounter = 0;
if (++this.frame >= Main.projFrames[this.type])
this.frame = 0;
}
if (this.penetrate == 1 && (double) this.ai[0] >= 0.0 && num3 == 0)
{
this.ai[1] += (float) num2;
num3 = 1;
this.netUpdate = true;
}
if (this.penetrate == 1 && (double) this.ai[0] == -1.0)
{
this.ai[0] = -2f;
this.netUpdate = true;
}
if (num3 > 0 || (double) this.ai[0] == -2.0)
++this.localAI[0];
}
if (this.owner == Main.myPlayer)
{
if ((double) this.ai[0] >= 0.0)
{
if (player.channel)
{
Vector2 mouseWorld = Main.MouseWorld;
if ((double) this.ai[0] != (double) mouseWorld.X || (double) this.ai[1] != (double) mouseWorld.Y)
{
this.netUpdate = true;
this.ai[0] = mouseWorld.X;
this.ai[1] = mouseWorld.Y + (float) (num2 * num3);
}
}
else
{
this.netUpdate = true;
this.ai[0] = -1f;
this.ai[1] = -1f;
int targetWithLineOfSight = this.FindTargetWithLineOfSight();
if (targetWithLineOfSight != -1)
this.ai[1] = (float) targetWithLineOfSight;
else if ((double) this.velocity.Length() < 2.0)
this.velocity = this.DirectionFrom(player.Center) * (float) num1;
else
this.velocity = this.velocity.SafeNormalize(Vector2.Zero) * (float) num1;
}
}
if (flag1 && (double) this.ai[1] == -1.0)
{
int targetWithLineOfSight = this.FindTargetWithLineOfSight();
if (targetWithLineOfSight != -1)
{
this.ai[1] = (float) targetWithLineOfSight;
this.netUpdate = true;
}
}
}
Vector2? nullable = new Vector2?();
float amount = 1f;
if ((double) this.ai[0] > 0.0 && (double) this.ai[1] > 0.0)
nullable = new Vector2?(new Vector2(this.ai[0], this.ai[1] % (float) num2));
if (flag1 && (double) this.ai[1] >= 0.0)
{
int index = (int) this.ai[1];
if (Main.npc.IndexInRange<NPC>(index))
{
NPC npc = Main.npc[index];
if (npc.CanBeChasedBy((object) this))
{
nullable = new Vector2?(npc.Center);
float t = this.Distance(nullable.Value);
amount = MathHelper.Lerp(0.0f, 0.2f, Utils.GetLerpValue(200f, 20f, 1f - Utils.GetLerpValue(0.0f, 100f, t, true) * Utils.GetLerpValue(600f, 400f, t, true), true));
}
else
{
this.ai[1] = -1f;
this.netUpdate = true;
}
}
}
bool flag2 = false;
if (flag1)
flag2 = true;
if (nullable.HasValue)
{
Vector2 Other = nullable.Value;
if ((double) this.Distance(Other) >= 64.0)
{
flag2 = true;
Vector2 v = Other - this.Center;
Vector2 vector2 = v.SafeNormalize(Vector2.Zero) * Math.Min((float) num1, v.Length());
if ((double) this.velocity.Length() < 4.0)
this.velocity = this.velocity + this.velocity.SafeNormalize(Vector2.Zero).RotatedBy(0.785398185253143).SafeNormalize(Vector2.Zero) * 4f;
if (this.velocity.HasNaNs())
this.Kill();
this.velocity = Vector2.Lerp(this.velocity, vector2, amount);
}
else
{
this.velocity = this.velocity * 0.3f;
this.velocity = this.velocity + (Other - this.Center) * 0.3f;
flag2 = (double) this.velocity.Length() >= 2.0;
}
if (this.timeLeft < 60)
this.timeLeft = 60;
}
if (flag1 && (double) this.ai[1] < 0.0)
{
if ((double) this.velocity.Length() != (double) num1)
this.velocity = this.velocity.MoveTowards(this.velocity.SafeNormalize(Vector2.UnitY) * (float) num1, 4f);
if (this.timeLeft > 300)
this.timeLeft = 300;
}
this.rotation = !flag2 || !(this.velocity != Vector2.Zero) ? this.rotation.AngleLerp(0.0f, 0.2f) : this.rotation.AngleTowards(this.velocity.ToRotation(), 0.7853982f);
bool flag3 = (double) this.velocity.Length() > 0.100000001490116 && (double) Vector2.Dot(this.oldVelocity.SafeNormalize(Vector2.Zero), this.velocity.SafeNormalize(Vector2.Zero)) < 0.200000002980232;
if (this.type == 16)
{
if (this.soundDelay == 0 && (double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) > 2.0)
{
this.soundDelay = 10;
SoundEngine.PlaySound(SoundID.Item9, this.position);
}
if (Main.rand.Next(9) == 0)
{
int index = Dust.NewDust(this.position, this.width, this.height, 15, Alpha: 100, Scale: 2f);
Main.dust[index].velocity *= 0.3f;
Main.dust[index].position.X = (float) ((double) this.position.X + (double) (this.width / 2) + 4.0) + (float) Main.rand.Next(-4, 5);
Main.dust[index].position.Y = this.position.Y + (float) (this.height / 2) + (float) Main.rand.Next(-4, 5);
Main.dust[index].noGravity = true;
Main.dust[index].velocity += Main.rand.NextVector2Circular(2f, 2f);
}
if (flag3)
{
int num4 = Main.rand.Next(2, 5);
for (int index = 0; index < num4; ++index)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 15, Alpha: 100, Scale: 1.5f);
dust.velocity *= 0.3f;
dust.position = this.Center;
dust.noGravity = true;
dust.velocity += Main.rand.NextVector2Circular(0.5f, 0.5f);
dust.fadeIn = 2.2f;
}
}
}
if (this.type != 34)
return;
float lerpValue = Utils.GetLerpValue(0.0f, 10f, this.localAI[0], true);
Color newColor = Color.Lerp(Color.Transparent, Color.Crimson, lerpValue);
if (Main.rand.Next(6) == 0)
{
Dust dust = Dust.NewDustDirect(this.Center, 0, 0, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, newColor, 3.5f);
dust.noGravity = true;
dust.velocity *= 1.4f;
dust.velocity += Main.rand.NextVector2Circular(1f, 1f);
dust.velocity += this.velocity * 0.15f;
}
if (Main.rand.Next(12) == 0)
{
Dust dust = Dust.NewDustDirect(this.Center, 0, 0, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, newColor, 1.5f);
dust.velocity += Main.rand.NextVector2Circular(1f, 1f);
dust.velocity += this.velocity * 0.15f;
}
if (!flag3)
return;
int num5 = Main.rand.Next(2, 5 + (int) ((double) lerpValue * 4.0));
for (int index = 0; index < num5; ++index)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 6, Alpha: 100, newColor: newColor, Scale: 1.5f);
dust.velocity *= 0.3f;
dust.position = this.Center;
dust.noGravity = true;
dust.velocity += Main.rand.NextVector2Circular(0.5f, 0.5f);
dust.fadeIn = 2.2f;
dust.position += (dust.position - this.Center) * lerpValue * 10f;
}
}
}
private void AI_009_MagicMissiles_Old()
{
if (Main.myPlayer == this.owner && (double) this.ai[0] <= 0.0)
{
if (Main.player[this.owner].channel)
{
float num1 = 12f;
if (this.type == 16)
num1 = 15f;
if (this.type == 491)
num1 = 20f;
Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
float num2 = (float) Main.mouseX + Main.screenPosition.X - vector2.X;
float num3 = (float) Main.mouseY + Main.screenPosition.Y - vector2.Y;
if ((double) Main.player[this.owner].gravDir == -1.0)
num3 = Main.screenPosition.Y + (float) Main.screenHeight - (float) Main.mouseY - vector2.Y;
float num4 = (float) Math.Sqrt((double) num2 * (double) num2 + (double) num3 * (double) num3);
if ((double) this.ai[0] < 0.0)
++this.ai[0];
if (this.type == 491 && (double) num4 < 100.0)
{
if ((double) this.velocity.Length() < (double) num1)
{
this.velocity = this.velocity * 1.1f;
if ((double) this.velocity.Length() > (double) num1)
{
this.velocity.Normalize();
this.velocity = this.velocity * num1;
}
}
if ((double) this.ai[0] == 0.0)
this.ai[0] = -10f;
}
else if ((double) num4 > (double) num1)
{
float num5 = num1 / num4;
float x = num2 * num5;
float y = num3 * num5;
int num6 = (int) ((double) x * 1000.0);
int num7 = (int) ((double) this.velocity.X * 1000.0);
int num8 = (int) ((double) y * 1000.0);
int num9 = (int) ((double) this.velocity.Y * 1000.0);
int num10 = num7;
if (num6 != num10 || num8 != num9)
this.netUpdate = true;
if (this.type == 491)
{
this.velocity = (this.velocity * 4f + new Vector2(x, y)) / 5f;
}
else
{
this.velocity.X = x;
this.velocity.Y = y;
}
}
else
{
int num11 = (int) ((double) num2 * 1000.0);
int num12 = (int) ((double) this.velocity.X * 1000.0);
int num13 = (int) ((double) num3 * 1000.0);
int num14 = (int) ((double) this.velocity.Y * 1000.0);
int num15 = num12;
if (num11 != num15 || num13 != num14)
this.netUpdate = true;
this.velocity.X = num2;
this.velocity.Y = num3;
}
}
else if ((double) this.ai[0] <= 0.0)
{
this.netUpdate = true;
if (this.type != 491)
{
Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
float num16 = (float) Main.mouseX + Main.screenPosition.X - vector2.X;
float num17 = (float) Main.mouseY + Main.screenPosition.Y - vector2.Y;
if ((double) Main.player[this.owner].gravDir == -1.0)
num17 = Main.screenPosition.Y + (float) Main.screenHeight - (float) Main.mouseY - vector2.Y;
float num18 = (float) Math.Sqrt((double) num16 * (double) num16 + (double) num17 * (double) num17);
if ((double) num18 == 0.0 || (double) this.ai[0] < 0.0)
{
vector2 = new Vector2(Main.player[this.owner].position.X + (float) (Main.player[this.owner].width / 2), Main.player[this.owner].position.Y + (float) (Main.player[this.owner].height / 2));
num16 = this.position.X + (float) this.width * 0.5f - vector2.X;
num17 = this.position.Y + (float) this.height * 0.5f - vector2.Y;
num18 = (float) Math.Sqrt((double) num16 * (double) num16 + (double) num17 * (double) num17);
}
float num19 = (float) (12.0 / (double) num18);
float num20 = num16 * num19;
float num21 = num17 * num19;
this.velocity.X = num20;
this.velocity.Y = num21;
if ((double) this.velocity.X == 0.0 && (double) this.velocity.Y == 0.0)
this.Kill();
}
this.ai[0] = 1f;
}
}
bool flag = false;
if (this.type == 491)
{
++this.localAI[0];
if ((double) this.ai[0] > 0.0 && (double) this.localAI[0] > 15.0)
{
this.tileCollide = false;
Vector2 vector2 = Main.player[this.owner].Center - this.Center;
if ((double) vector2.Length() < 20.0)
this.Kill();
vector2.Normalize();
this.velocity = (this.velocity * 5f + vector2 * 25f) / 6f;
}
flag = true;
if ((double) this.ai[0] < 0.0 || (double) this.velocity.X == 0.0 && (double) this.velocity.Y == 0.0)
this.rotation += 0.3f;
else if ((double) this.ai[0] > 0.0)
this.rotation += 0.3f * (float) this.direction;
else
this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57f;
if ((double) Vector2.Distance(this.Center, Main.player[this.owner].Center) > 2000.0)
this.Kill();
if (Main.rand.Next(2) == 0)
{
int Type;
switch (Main.rand.Next(3))
{
case 0:
Type = 15;
break;
case 1:
Type = 57;
break;
default:
Type = 58;
break;
}
int index = Dust.NewDust(this.position, this.width, this.height, Type, this.velocity.X * 0.25f, this.velocity.Y * 0.25f, (int) byte.MaxValue, Scale: 0.7f);
Main.dust[index].velocity *= 0.25f;
Main.dust[index].position = (Main.dust[index].position + this.position) / 2f;
}
}
if (this.type == 79)
{
if (this.soundDelay == 0 && (double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) > 2.0)
{
this.soundDelay = 10;
SoundEngine.PlaySound(SoundID.Item9, this.position);
}
for (int index1 = 0; index1 < 1; ++index1)
{
int index2 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 66, Alpha: 100, newColor: new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), Scale: 2.5f);
Main.dust[index2].velocity *= 0.1f;
Main.dust[index2].velocity += this.velocity * 0.2f;
Main.dust[index2].position.X = (float) ((double) this.position.X + (double) (this.width / 2) + 4.0) + (float) Main.rand.Next(-2, 3);
Main.dust[index2].position.Y = this.position.Y + (float) (this.height / 2) + (float) Main.rand.Next(-2, 3);
Main.dust[index2].noGravity = true;
}
}
if (this.type == 16)
{
if (this.soundDelay == 0 && (double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) > 2.0)
{
this.soundDelay = 10;
SoundEngine.PlaySound(SoundID.Item9, this.position);
}
if (Main.rand.Next(9) == 0)
{
int index = Dust.NewDust(this.position, this.width, this.height, 15, Alpha: 100, Scale: 2f);
Main.dust[index].velocity *= 0.3f;
Main.dust[index].position.X = (float) ((double) this.position.X + (double) (this.width / 2) + 4.0) + (float) Main.rand.Next(-4, 5);
Main.dust[index].position.Y = this.position.Y + (float) (this.height / 2) + (float) Main.rand.Next(-4, 5);
Main.dust[index].noGravity = true;
Main.dust[index].velocity += Main.rand.NextVector2Circular(2f, 2f);
}
flag = true;
if (this.velocity != Vector2.Zero)
this.rotation = this.velocity.ToRotation();
}
if (this.type == 34)
{
if (Main.rand.Next(12) == 0)
{
Dust dust = Dust.NewDustDirect(this.Center, 0, 0, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, Scale: 3.5f);
dust.noGravity = true;
dust.velocity *= 1.4f;
dust.velocity += Main.rand.NextVector2Circular(1f, 1f);
dust.velocity += this.velocity * 0.15f;
}
if (Main.rand.Next(24) == 0)
{
Dust dust = Dust.NewDustDirect(this.Center, 0, 0, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, Scale: 1.5f);
dust.velocity += Main.rand.NextVector2Circular(1f, 1f);
dust.velocity += this.velocity * 0.15f;
}
flag = true;
if (this.velocity != Vector2.Zero)
this.rotation = this.velocity.ToRotation();
}
if (!flag && this.velocity != Vector2.Zero)
this.rotation = (float) ((double) this.velocity.ToRotation() - 3.14159274101257 + 0.785398185253143);
if ((double) this.velocity.Y <= 16.0)
return;
this.velocity.Y = 16f;
}
private void AI_015_HandleMovementCollision(ref Vector2 wetVelocity, ref Vector2 lastVelocity)
{
int num1 = 10;
int num2 = 0;
Vector2 velocity = this.velocity;
float num3 = 0.2f;
if ((double) this.ai[0] == 1.0 || (double) this.ai[0] == 5.0)
num3 = 0.4f;
if ((double) this.ai[0] == 6.0)
num3 = 0.0f;
if ((double) lastVelocity.X != (double) this.velocity.X)
{
if ((double) Math.Abs(lastVelocity.X) > 4.0)
num2 = 1;
this.velocity.X = -lastVelocity.X * num3;
++this.localAI[0];
}
if ((double) lastVelocity.Y != (double) this.velocity.Y)
{
if ((double) Math.Abs(lastVelocity.Y) > 4.0)
num2 = 1;
this.velocity.Y = -lastVelocity.Y * num3;
++this.localAI[0];
}
if ((double) this.ai[0] == 1.0)
{
this.ai[0] = 5f;
this.localNPCHitCooldown = num1;
this.netUpdate = true;
Point tileCoordinates1 = this.TopLeft.ToTileCoordinates();
Point tileCoordinates2 = this.BottomRight.ToTileCoordinates();
num2 = 2;
bool causedShockwaves;
this.CreateImpactExplosion(2, this.Center, ref tileCoordinates1, ref tileCoordinates2, this.width, out causedShockwaves);
this.CreateImpactExplosion2_FlailTileCollision(this.Center, causedShockwaves, velocity);
this.position = this.position - velocity;
}
if (num2 > 0)
{
this.netUpdate = true;
for (int index = 0; index < num2; ++index)
Collision.HitTiles(this.position, velocity, this.width, this.height);
SoundEngine.PlaySound(0, (int) this.position.X, (int) this.position.Y);
}
if (((double) this.ai[0] == 3.0 || (double) this.ai[0] == 0.0 || (double) this.ai[0] == 5.0 ? 1 : ((double) this.ai[0] == 6.0 ? 1 : 0)) == 0 && (double) this.localAI[0] >= 10.0)
{
this.ai[0] = 4f;
this.netUpdate = true;
}
if (!this.wet)
return;
wetVelocity = this.velocity;
}
private void ResetLocalNPCHitImmunity()
{
for (int index = 0; index < 200; ++index)
this.localNPCImmunity[index] = 0;
}
private void AI_015_Flails()
{
Player player = Main.player[this.owner];
if (!player.active || player.dead || player.noItems || player.CCed || (double) Vector2.Distance(this.Center, player.Center) > 900.0)
this.Kill();
else if (Main.myPlayer == this.owner && Main.mapFullscreen)
{
this.Kill();
}
else
{
if (this.type == 948 && this.wet && !this.lavaWet)
{
this.type = 947;
this.netUpdate = true;
}
Vector2 mountedCenter = player.MountedCenter;
bool doFastThrowDust = false;
bool flag1 = true;
bool flag2 = false;
int num1 = 10;
float num2 = 24f;
float num3 = 800f;
float num4 = 3f;
float num5 = 16f;
float num6 = 6f;
float num7 = 48f;
float num8 = 1f;
float num9 = 14f;
int num10 = 60;
int num11 = 10;
int num12 = 20;
int num13 = 10;
int num14 = num1 + 5;
switch (this.type)
{
case 25:
num1 = 15;
num2 = 14f;
num5 = 10f;
num7 = 15f;
break;
case 26:
num1 = 15;
num2 = 16f;
num5 = 12f;
num7 = 16f;
break;
case 35:
num1 = 15;
num2 = 17f;
num5 = 14f;
num7 = 18f;
break;
case 63:
num1 = 13;
num2 = 21f;
num5 = 20f;
num7 = 24f;
num12 = 15;
break;
case 154:
num1 = 15;
num2 = 15f;
num5 = 11f;
num7 = 16f;
break;
case 247:
num1 = 13;
num2 = 23f;
num12 = 15;
break;
case 757:
num1 = 13;
num2 = 22f;
num5 = 22f;
num7 = 26f;
num12 = 15;
break;
case 947:
case 948:
num1 = 13;
num2 = 12f;
num5 = 8f;
num7 = 13f;
break;
}
float num15 = 1f / player.meleeSpeed;
float num16 = num2 * num15;
float maxAmountAllowedToMove1 = num8 * num15;
float maxAmountAllowedToMove2 = num9 * num15;
float maxAmountAllowedToMove3 = num4 * num15;
float num17 = num5 * num15;
float maxAmountAllowedToMove4 = num6 * num15;
float num18 = num7 * num15;
float num19 = num16 * (float) num1;
float num20 = num19 + 160f;
this.localNPCHitCooldown = num11;
switch ((int) this.ai[0])
{
case 0:
flag2 = true;
if (this.owner == Main.myPlayer)
{
Vector2 vector2 = mountedCenter.DirectionTo(Main.MouseWorld).SafeNormalize(Vector2.UnitX * (float) player.direction);
player.ChangeDir((double) vector2.X > 0.0 ? 1 : -1);
if (!player.channel)
{
this.ai[0] = 1f;
this.ai[1] = 0.0f;
this.velocity = vector2 * num16 + player.velocity;
this.Center = mountedCenter;
this.netUpdate = true;
this.ResetLocalNPCHitImmunity();
this.localNPCHitCooldown = num13;
break;
}
}
++this.localAI[1];
Vector2 vector2_1 = new Vector2((float) player.direction).RotatedBy(31.4159278869629 * ((double) this.localAI[1] / 60.0) * (double) player.direction);
vector2_1.Y *= 0.8f;
if ((double) vector2_1.Y * (double) player.gravDir > 0.0)
vector2_1.Y *= 0.5f;
this.Center = mountedCenter + vector2_1 * 30f;
this.velocity = Vector2.Zero;
this.localNPCHitCooldown = num12;
break;
case 1:
doFastThrowDust = true;
bool flag3 = (double) this.ai[1]++ >= (double) num1 | (double) this.Distance(mountedCenter) >= (double) num3;
if (player.controlUseItem)
{
this.ai[0] = 6f;
this.ai[1] = 0.0f;
this.netUpdate = true;
this.velocity = this.velocity * 0.2f;
if (Main.myPlayer == this.owner && this.type == 757)
{
Projectile.NewProjectile(this.Center, this.velocity, 928, this.damage, this.knockBack, Main.myPlayer);
break;
}
break;
}
if (flag3)
{
this.ai[0] = 2f;
this.ai[1] = 0.0f;
this.netUpdate = true;
this.velocity = this.velocity * 0.3f;
if (Main.myPlayer == this.owner && this.type == 757)
Projectile.NewProjectile(this.Center, this.velocity, 928, this.damage, this.knockBack, Main.myPlayer);
}
player.ChangeDir((double) player.Center.X < (double) this.Center.X ? 1 : -1);
this.localNPCHitCooldown = num13;
break;
case 2:
Vector2 vector2_2 = this.DirectionTo(mountedCenter).SafeNormalize(Vector2.Zero);
if ((double) this.Distance(mountedCenter) <= (double) num17)
{
this.Kill();
return;
}
if (player.controlUseItem)
{
this.ai[0] = 6f;
this.ai[1] = 0.0f;
this.netUpdate = true;
this.velocity = this.velocity * 0.2f;
break;
}
this.velocity = this.velocity * 0.98f;
this.velocity = this.velocity.MoveTowards(vector2_2 * num17, maxAmountAllowedToMove3);
player.ChangeDir((double) player.Center.X < (double) this.Center.X ? 1 : -1);
break;
case 3:
if (!player.controlUseItem)
{
this.ai[0] = 4f;
this.ai[1] = 0.0f;
this.netUpdate = true;
break;
}
float num21 = this.Distance(mountedCenter);
this.tileCollide = (double) this.ai[1] == 1.0;
bool flag4 = (double) num21 <= (double) num19;
if (flag4 != this.tileCollide)
{
this.tileCollide = flag4;
this.ai[1] = this.tileCollide ? 1f : 0.0f;
this.netUpdate = true;
}
if ((double) num21 > (double) num10)
{
if ((double) num21 >= (double) num19)
{
this.velocity = this.velocity * 0.5f;
this.velocity = this.velocity.MoveTowards(this.DirectionTo(mountedCenter).SafeNormalize(Vector2.Zero) * maxAmountAllowedToMove2, maxAmountAllowedToMove2);
}
this.velocity = this.velocity * 0.98f;
this.velocity = this.velocity.MoveTowards(this.DirectionTo(mountedCenter).SafeNormalize(Vector2.Zero) * maxAmountAllowedToMove2, maxAmountAllowedToMove1);
}
else
{
if ((double) this.velocity.Length() < 6.0)
{
this.velocity.X *= 0.96f;
this.velocity.Y += 0.2f;
}
if ((double) player.velocity.X == 0.0)
this.velocity.X *= 0.96f;
}
player.ChangeDir((double) player.Center.X < (double) this.Center.X ? 1 : -1);
break;
case 4:
this.tileCollide = false;
Vector2 vector2_3 = this.DirectionTo(mountedCenter).SafeNormalize(Vector2.Zero);
if ((double) this.Distance(mountedCenter) <= (double) num18)
{
this.Kill();
return;
}
this.velocity = this.velocity * 0.98f;
this.velocity = this.velocity.MoveTowards(vector2_3 * num18, maxAmountAllowedToMove4);
Vector2 Target = this.Center + this.velocity;
Vector2 vector2_4 = mountedCenter.DirectionFrom(Target).SafeNormalize(Vector2.Zero);
if ((double) Vector2.Dot(vector2_3, vector2_4) < 0.0)
{
this.Kill();
return;
}
player.ChangeDir((double) player.Center.X < (double) this.Center.X ? 1 : -1);
break;
case 5:
if ((double) this.ai[1]++ >= (double) num14)
{
this.ai[0] = 6f;
this.ai[1] = 0.0f;
this.netUpdate = true;
break;
}
this.localNPCHitCooldown = num13;
this.velocity.Y += 0.6f;
this.velocity.X *= 0.95f;
player.ChangeDir((double) player.Center.X < (double) this.Center.X ? 1 : -1);
break;
case 6:
if (!player.controlUseItem || (double) this.Distance(mountedCenter) > (double) num20)
{
this.ai[0] = 4f;
this.ai[1] = 0.0f;
this.netUpdate = true;
break;
}
this.velocity.Y += 0.8f;
this.velocity.X *= 0.95f;
player.ChangeDir((double) player.Center.X < (double) this.Center.X ? 1 : -1);
break;
}
if (this.type == 247)
{
flag1 = false;
float num22 = (float) (((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y)) * 0.00999999977648258);
this.rotation += (double) this.velocity.X > 0.0 ? num22 : -num22;
if ((double) this.ai[0] == 0.0)
this.rotation += 0.418879f * (float) player.direction;
float num23 = 600f;
NPC npc1 = (NPC) null;
if (this.owner == Main.myPlayer)
{
++this.localAI[0];
if ((double) this.localAI[0] >= 20.0)
{
this.localAI[0] = 17f;
for (int index = 0; index < 200; ++index)
{
NPC npc2 = Main.npc[index];
if (npc2.CanBeChasedBy((object) this))
{
float num24 = this.Distance(npc2.Center);
if ((double) num24 < (double) num23 && Collision.CanHit(this.position, this.width, this.height, npc2.position, npc2.width, npc2.height))
{
npc1 = npc2;
num23 = num24;
}
}
}
}
if (npc1 != null)
{
this.localAI[0] = 0.0f;
float num25 = 14f;
Vector2 center = this.Center;
Projectile.NewProjectile(center, center.DirectionTo(npc1.Center) * num25, 248, (int) ((double) this.damage / 1.5), this.knockBack / 2f, Main.myPlayer);
}
}
}
this.direction = (double) this.velocity.X > 0.0 ? 1 : -1;
this.spriteDirection = this.direction;
this.ownerHitCheck = flag2;
if (flag1)
{
if ((double) this.velocity.Length() > 1.0)
this.rotation = this.velocity.ToRotation() + this.velocity.X * 0.1f;
else
this.rotation += this.velocity.X * 0.1f;
}
this.timeLeft = 2;
player.heldProj = this.whoAmI;
player.SetDummyItemTime(2);
player.itemRotation = this.DirectionFrom(mountedCenter).ToRotation();
if ((double) this.Center.X < (double) mountedCenter.X)
player.itemRotation += 3.141593f;
player.itemRotation = MathHelper.WrapAngle(player.itemRotation);
this.AI_015_Flails_Dust(doFastThrowDust);
}
}
private void AI_015_HandleMovementCollision_Old(
ref Vector2 wetVelocity,
ref Vector2 lastVelocity)
{
bool flag = false;
if ((double) lastVelocity.X != (double) this.velocity.X)
{
if ((double) Math.Abs(lastVelocity.X) > 4.0)
flag = true;
this.position.X += this.velocity.X;
this.velocity.X = (float) (-(double) lastVelocity.X * 0.200000002980232);
}
if ((double) lastVelocity.Y != (double) this.velocity.Y)
{
if ((double) Math.Abs(lastVelocity.Y) > 4.0)
flag = true;
this.position.Y += this.velocity.Y;
this.velocity.Y = (float) (-(double) lastVelocity.Y * 0.200000002980232);
}
this.ai[0] = 1f;
if (flag)
{
this.netUpdate = true;
Collision.HitTiles(this.position, this.velocity, this.width, this.height);
SoundEngine.PlaySound(0, (int) this.position.X, (int) this.position.Y);
}
if (!this.wet)
return;
wetVelocity = this.velocity;
}
private void AI_015_Flails_Old()
{
this.AI_015_Flails_Dust(false);
bool flag1 = Main.player[this.owner].dead;
if (!flag1)
flag1 = (double) (Main.player[this.owner].Center - this.Center).Length() > 2000.0;
if (flag1)
{
this.Kill();
}
else
{
Main.player[this.owner].SetDummyItemTime(10);
if ((double) this.position.X + (double) (this.width / 2) > (double) Main.player[this.owner].position.X + (double) (Main.player[this.owner].width / 2))
{
Main.player[this.owner].ChangeDir(1);
this.direction = 1;
}
else
{
Main.player[this.owner].ChangeDir(-1);
this.direction = -1;
}
Vector2 mountedCenter = Main.player[this.owner].MountedCenter;
Vector2 vector2_1 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
float num1 = mountedCenter.X - vector2_1.X;
float num2 = mountedCenter.Y - vector2_1.Y;
float num3 = (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2);
if ((double) this.ai[0] == 0.0)
{
float num4 = 160f;
if (this.type == 63)
num4 *= 1.5f;
if (this.type == 247)
num4 *= 1.5f;
if (this.type == 757)
num4 *= 1.5f;
this.tileCollide = true;
if ((double) num3 > (double) num4)
{
this.ai[0] = 1f;
this.netUpdate = true;
}
else if (!Main.player[this.owner].channel)
{
if ((double) this.velocity.Y < 0.0)
this.velocity.Y *= 0.9f;
++this.velocity.Y;
this.velocity.X *= 0.9f;
}
}
else if ((double) this.ai[0] == 1.0)
{
float meleeSpeed = Main.player[this.owner].meleeSpeed;
float num5 = 14f / meleeSpeed;
float num6 = 0.9f / meleeSpeed;
float num7 = 300f / meleeSpeed;
int num8 = 60;
if (this.type == 63)
{
num7 *= 1.5f;
num5 *= 1.5f;
num6 *= 1.5f;
}
if (this.type == 247)
{
num7 *= 1.5f;
num5 = 15.9f;
num6 *= 2f;
num8 = 100;
}
if (this.type == 757)
{
num7 *= 1.5f;
num5 = 15.9f;
num6 *= 2f;
num8 = 100;
}
double num9 = (double) Math.Abs(num1);
double num10 = (double) Math.Abs(num2);
if ((double) this.ai[1] == 1.0)
this.tileCollide = false;
if (!Main.player[this.owner].channel || (double) num3 > (double) num7 || !this.tileCollide)
{
this.ai[1] = 1f;
if (this.tileCollide)
this.netUpdate = true;
this.tileCollide = false;
if ((double) num3 < 20.0)
this.Kill();
}
if (!this.tileCollide)
num6 *= 2f;
if ((double) num3 > (double) num8 || !this.tileCollide)
{
float num11 = num5 / num3;
num1 *= num11;
num2 *= num11;
Vector2 vector2_2 = new Vector2(this.velocity.X, this.velocity.Y);
float num12 = num1 - this.velocity.X;
float num13 = num2 - this.velocity.Y;
float num14 = (float) Math.Sqrt((double) num12 * (double) num12 + (double) num13 * (double) num13);
float num15 = num6 / num14;
float num16 = num12 * num15;
float num17 = num13 * num15;
this.velocity.X *= 0.98f;
this.velocity.Y *= 0.98f;
this.velocity.X += num16;
this.velocity.Y += num17;
}
else
{
if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < 6.0)
{
this.velocity.X *= 0.96f;
this.velocity.Y += 0.2f;
}
if ((double) Main.player[this.owner].velocity.X == 0.0)
this.velocity.X *= 0.96f;
}
}
if (this.type == 247)
{
if ((double) this.velocity.X < 0.0)
this.rotation -= (float) (((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y)) * 0.00999999977648258);
else
this.rotation += (float) (((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y)) * 0.00999999977648258);
float num18 = this.position.X;
float num19 = this.position.Y;
float num20 = 600f;
bool flag2 = false;
if (this.owner == Main.myPlayer)
{
++this.localAI[1];
if ((double) this.localAI[1] > 20.0)
{
this.localAI[1] = 20f;
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].CanBeChasedBy((object) this))
{
float num21 = Main.npc[index].position.X + (float) (Main.npc[index].width / 2);
float num22 = Main.npc[index].position.Y + (float) (Main.npc[index].height / 2);
float num23 = Math.Abs(this.position.X + (float) (this.width / 2) - num21) + Math.Abs(this.position.Y + (float) (this.height / 2) - num22);
if ((double) num23 < (double) num20 && Collision.CanHit(this.position, this.width, this.height, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height))
{
num20 = num23;
num18 = num21;
num19 = num22;
flag2 = true;
}
}
}
}
}
if (!flag2)
return;
this.localAI[1] = 0.0f;
vector2_1 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
float num24 = num18 - vector2_1.X;
float num25 = num19 - vector2_1.Y;
float num26 = (float) (14.0 / Math.Sqrt((double) num24 * (double) num24 + (double) num25 * (double) num25));
float SpeedX = num24 * num26;
float SpeedY = num25 * num26;
Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX, SpeedY, 248, (int) ((double) this.damage / 1.5), this.knockBack / 2f, Main.myPlayer);
}
else
this.rotation = (float) Math.Atan2((double) num2, (double) num1) - this.velocity.X * 0.1f;
}
}
private void AI_015_Flails_Dust(bool doFastThrowDust)
{
if (this.type == 25)
{
int maxValue = 15;
if (doFastThrowDust)
maxValue = 1;
if (Main.rand.Next(maxValue) != 0)
return;
Dust.NewDust(this.position, this.width, this.height, 14, Alpha: 150, Scale: 1.3f);
}
else if (this.type == 757)
{
int maxValue1 = 4;
if ((double) this.velocity.Length() < 8.0)
maxValue1 = 10;
if (doFastThrowDust)
maxValue1 /= 2;
for (int index = 0; index < 2; ++index)
{
if (Main.rand.Next(maxValue1) == 0)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 5, Scale: 0.8f);
dust.velocity += this.velocity / 4f;
dust.fadeIn = 1.3f;
}
}
int maxValue2 = 40;
if (doFastThrowDust)
maxValue2 /= 2;
for (float num = 0.0f; (double) num < 1.0; num += 0.1f)
{
if (Main.rand.Next(maxValue2) == 0)
Dust.NewDustDirect(Vector2.Lerp(Main.player[this.owner].Center, this.Center, Main.rand.NextFloat()) + new Vector2(-8f), 16, 16, 5, Scale: 1.3f).velocity += this.velocity / 4f;
}
}
else if (this.type == 26)
{
int index = Dust.NewDust(this.position, this.width, this.height, 172, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 100, Scale: 1.5f);
Main.dust[index].noGravity = true;
Main.dust[index].velocity.X /= 2f;
Main.dust[index].velocity.Y /= 2f;
}
else if (this.type == 948 && !this.wet)
{
int index = Dust.NewDust(this.position, this.width, this.height, 6, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 100, Scale: 1.2f);
Main.dust[index].noGravity = true;
Main.dust[index].velocity.X *= 4f;
Main.dust[index].velocity.Y *= 4f;
Main.dust[index].velocity = (Main.dust[index].velocity + this.velocity) / 2f;
}
else if (this.type == 35)
{
int index = Dust.NewDust(this.position, this.width, this.height, 6, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 100, Scale: 3f);
Main.dust[index].noGravity = true;
Main.dust[index].velocity.X *= 2f;
Main.dust[index].velocity.Y *= 2f;
}
else
{
if (this.type != 154)
return;
int index = Dust.NewDust(this.position, this.width, this.height, 115, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 140, Scale: 1.5f);
Main.dust[index].noGravity = true;
Main.dust[index].velocity *= 0.25f;
}
}
private void AI_100_Medusa()
{
Player player = Main.player[this.owner];
Vector2 zero1 = Vector2.Zero;
if (this.type == 535)
{
zero1.X = (float) player.direction * 6f;
zero1.Y = player.gravDir * -14f;
bool flag1 = true;
bool flag2 = (double) this.ai[0] > 0.0;
if (!player.dead)
this.timeLeft = 3;
if ((double) this.ai[0] > 0.0)
--this.ai[0];
if (flag2)
{
if (this.frame < 8)
this.frame = 8;
if (this.frame >= 12)
this.frame = 8;
++this.frameCounter;
if (++this.frameCounter >= 5)
{
this.frameCounter = 0;
if (++this.frame >= 12)
this.frame = 8;
}
}
else if (++this.frameCounter >= 5)
{
this.frameCounter = 0;
if (++this.frame >= 8)
this.frame = 0;
}
Vector2 center1 = player.Center;
Vector2 vector2_1 = Main.screenPosition + new Vector2((float) Main.mouseX, (float) Main.mouseY) - center1;
if ((double) player.gravDir == -1.0)
vector2_1.Y = (float) (Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - center1.Y;
Vector2 vector2_2 = new Vector2((float) Math.Sign((double) vector2_1.X == 0.0 ? (float) player.direction : vector2_1.X), 0.0f);
if ((double) vector2_2.X != (double) this.velocity.X || (double) vector2_2.Y != (double) this.velocity.Y)
this.netUpdate = true;
this.velocity = vector2_2;
if (flag2 && this.soundDelay == 0)
SoundEngine.PlaySound(4, (int) this.position.X, (int) this.position.Y, 17);
this.soundDelay = flag2 ? 4 : 0;
if (Main.myPlayer == this.owner)
{
Vector2 Position2 = player.Center + new Vector2((float) (player.direction * 4), player.gravDir * 2f);
if (!player.channel)
{
this.Kill();
return;
}
if ((!flag2 ? 1 : ((double) this.ai[0] % 15.0 == 0.0 ? 1 : 0)) != 0)
{
bool flag3 = false;
for (int index = 0; index < 200; ++index)
{
NPC npc = Main.npc[index];
if (npc.active && (double) this.Distance(npc.Center) < 250.0 && npc.CanBeChasedBy((object) this) && Collision.CanHitLine(npc.position, npc.width, npc.height, Position2, 0, 0))
{
flag3 = true;
break;
}
}
if (flag3)
{
if (!flag1 || player.CheckMana(player.inventory[player.selectedItem].mana, true))
{
int damage = this.damage;
Vector2 center2 = this.Center;
int num1 = 0;
float num2 = 0.0f;
Projectile._medusaHeadTargetList.Clear();
for (int index = 0; index < 200; ++index)
{
NPC npc = Main.npc[index];
float num3 = this.Distance(npc.Center);
if (npc.active && (double) num3 < 250.0 && npc.CanBeChasedBy((object) this) && Collision.CanHitLine(npc.position, npc.width, npc.height, center2, 0, 0))
Projectile._medusaHeadTargetList.Add(Tuple.Create<int, float>(index, num3));
}
Projectile._medusaHeadTargetList.Sort((IComparer<Tuple<int, float>>) Projectile._medusaTargetComparer);
for (int index1 = 0; index1 < Projectile._medusaHeadTargetList.Count && index1 < 3; ++index1)
{
Tuple<int, float> medusaHeadTarget = Projectile._medusaHeadTargetList[index1];
NPC npc = Main.npc[medusaHeadTarget.Item1];
Vector2 v = npc.Center - center2;
num2 += v.ToRotation();
++num1;
int index2 = Projectile.NewProjectile(center2.X, center2.Y, v.X, v.Y, 536, 0, 0.0f, this.owner, (float) this.whoAmI);
Main.projectile[index2].Center = npc.Center;
Main.projectile[index2].damage = damage;
Main.projectile[index2].Damage();
Main.projectile[index2].damage = 0;
Main.projectile[index2].Center = center2;
this.ai[0] = 180f;
}
float num4 = num1 == 0 ? (player.direction == 1 ? 0.0f : 3.141593f) : num2 / (float) num1;
for (int index = 0; index < 4; ++index)
{
Vector2 zero2 = Vector2.Zero;
Vector2 vector2_3 = Main.rand.Next(4) == 0 ? Vector2.UnitX.RotatedByRandom(6.28318548202515) * new Vector2(200f, 50f) * (float) ((double) Main.rand.NextFloat() * 0.699999988079071 + 0.300000011920929) : Vector2.UnitX.RotatedByRandom(3.14159274101257).RotatedBy((double) num4) * new Vector2(200f, 50f) * (float) ((double) Main.rand.NextFloat() * 0.699999988079071 + 0.300000011920929);
Projectile.NewProjectile(center2.X, center2.Y, vector2_3.X, vector2_3.Y, 536, 0, 0.0f, this.owner, (float) this.whoAmI);
}
this.ai[0] = 60f;
this.netUpdate = true;
}
}
}
}
Lighting.AddLight(this.Center, 0.9f, 0.75f, 0.1f);
}
this.rotation = (double) player.gravDir == 1.0 ? 0.0f : 3.141593f;
this.spriteDirection = this.direction;
this.timeLeft = 2;
Vector2 vector2_4 = Main.OffsetsPlayerOnhand[player.bodyFrame.Y / 56] * 2f;
if (player.direction != 1)
vector2_4.X = (float) player.bodyFrame.Width - vector2_4.X;
Vector2 vector2_5 = vector2_4 - (player.bodyFrame.Size() - new Vector2((float) player.width, 42f)) / 2f;
this.Center = (player.position + vector2_5 + zero1 - this.velocity).Floor();
player.ChangeDir(this.direction);
player.heldProj = this.whoAmI;
player.SetDummyItemTime(2);
}
private void AI_120_StardustGuardian()
{
Player player = Main.player[this.owner];
if (!player.active)
{
this.active = false;
}
else
{
bool flag1 = this.type == 623;
Vector2 Other = player.Center;
float num1 = 100f;
float lookupRange = 500f;
float num2 = 500f;
float num3 = 100f;
bool flag2 = true;
if (flag1)
{
if (player.dead)
player.stardustGuardian = false;
if (player.stardustGuardian)
this.timeLeft = 2;
num1 = 150f;
Other.X -= (float) ((5 + player.width / 2) * player.direction);
Other.Y -= 25f;
Lighting.AddLight(this.Center, 0.9f, 0.9f, 0.7f);
if ((double) this.ai[0] != 3.0 && this.alpha == (int) byte.MaxValue)
{
this.alpha = 0;
for (int index1 = 0; index1 < 30; ++index1)
{
int index2 = Dust.NewDust(this.position, this.width, this.height, 135, Alpha: 200, Scale: 1.7f);
Main.dust[index2].noGravity = true;
Main.dust[index2].velocity *= 3f;
Main.dust[index2].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]);
int index3 = Dust.NewDust(this.position, this.width, this.height, 135, Alpha: 100);
Main.dust[index3].velocity *= 2f;
Main.dust[index3].noGravity = true;
Main.dust[index3].fadeIn = 2.5f;
Main.dust[index3].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]);
}
}
}
if ((double) this.ai[0] != 0.0)
{
Main.player[this.owner].tankPet = this.whoAmI;
Main.player[this.owner].tankPetReset = false;
}
if ((double) this.ai[0] == 0.0)
{
this.Center = Vector2.Lerp(this.Center, Other, 0.05f);
this.velocity = this.velocity * 0.5f;
this.direction = this.spriteDirection = player.direction;
if (flag1 && ++this.frameCounter >= 9)
{
this.frameCounter = 0;
if (++this.frame >= 8)
this.frame = 0;
}
int targetNPCIndex = -1;
float distanceToClosestTarget = lookupRange;
bool flag3 = flag2;
if (flag1 && (double) Math.Abs(this.Center.X - Other.X) > (double) num1 + 20.0)
flag3 = false;
if (flag3)
this.AI_120_StardustGuardian_FindTarget(lookupRange, ref targetNPCIndex, ref distanceToClosestTarget);
if (targetNPCIndex != -1)
{
NPC npc = Main.npc[targetNPCIndex];
this.direction = this.spriteDirection = ((double) npc.Center.X > (double) this.Center.X).ToDirectionInt();
float num4 = Math.Abs(Other.X - this.Center.X);
float num5 = Math.Abs(npc.Center.X - this.Center.X);
float num6 = Math.Abs(Other.Y - this.Center.Y);
float num7 = Math.Abs(npc.Center.Y - this.Bottom.Y);
float directionInt = (float) ((double) npc.Center.Y > (double) this.Bottom.Y).ToDirectionInt();
if (((double) num4 < (double) num1 || ((double) Other.X - (double) this.Center.X) * (double) this.direction < 0.0) && (double) num5 > 20.0 && (double) num5 < (double) num1 - (double) num4 + 100.0)
this.velocity.X += 0.1f * (float) this.direction;
else
this.velocity.X *= 0.7f;
if (((double) num6 < (double) num3 || ((double) Other.Y - (double) this.Bottom.Y) * (double) directionInt < 0.0) && (double) num7 > 10.0 && (double) num7 < (double) num3 - (double) num6 + 10.0)
this.velocity.Y += 0.1f * directionInt;
else
this.velocity.Y *= 0.7f;
if (this.owner == Main.myPlayer && (double) num5 < (double) num2)
{
this.ai[0] = 2f;
this.ai[1] = (float) targetNPCIndex;
this.netUpdate = true;
}
}
}
else if ((double) this.ai[0] == 1.0)
{
if (player.HasMinionRestTarget)
{
Other = player.MinionRestTargetPoint;
}
else
{
this.ai[0] = 0.0f;
this.netUpdate = true;
}
int targetNPCIndex = -1;
float distanceToClosestTarget = lookupRange;
bool flag4 = true;
if (flag1 && (double) Math.Abs(this.Center.X - Other.X) > (double) num1 + 20.0)
flag4 = false;
if (flag4)
this.AI_120_StardustGuardian_FindTarget(lookupRange, ref targetNPCIndex, ref distanceToClosestTarget);
if (targetNPCIndex != -1)
{
NPC npc = Main.npc[targetNPCIndex];
this.direction = this.spriteDirection = ((double) npc.Center.X > (double) this.Center.X).ToDirectionInt();
float num8 = Math.Abs(Other.X - this.Center.X);
float num9 = Math.Abs(npc.Center.X - this.Center.X);
float num10 = Math.Abs(Other.Y - this.Center.Y);
float num11 = Math.Abs(npc.Center.Y - this.Bottom.Y);
float directionInt = (float) ((double) npc.Center.Y > (double) this.Bottom.Y).ToDirectionInt();
if (((double) num8 < (double) num1 || ((double) Other.X - (double) this.Center.X) * (double) this.direction < 0.0) && (double) num9 > 20.0 && (double) num9 < (double) num1 - (double) num8 + 100.0)
this.velocity.X += 0.1f * (float) this.direction;
else
this.velocity.X *= 0.7f;
if (((double) num10 < (double) num3 || ((double) Other.Y - (double) this.Bottom.Y) * (double) directionInt < 0.0) && (double) num11 > 10.0 && (double) num11 < (double) num3 - (double) num10 + 10.0)
this.velocity.Y += 0.1f * directionInt;
else
this.velocity.Y *= 0.7f;
if (this.owner == Main.myPlayer && (double) num9 < (double) num2)
{
this.ai[0] = 2f;
this.ai[1] = (float) targetNPCIndex;
this.netUpdate = true;
}
}
else
{
if ((double) Math.Abs(Other.X - this.Center.X) > (double) num1 + 40.0)
{
this.ai[0] = 3f;
this.netUpdate = true;
}
else if ((double) Math.Abs(Other.X - this.Center.X) > 20.0)
{
this.direction = this.spriteDirection = ((double) Other.X > (double) this.Center.X).ToDirectionInt();
this.velocity.X += 0.06f * (float) this.direction;
}
else
{
this.velocity.X *= 0.8f;
this.direction = this.spriteDirection = ((double) player.Center.X < (double) this.Center.X).ToDirectionInt();
}
if ((double) Math.Abs(Other.Y - this.Center.Y) > (double) num3)
{
this.ai[0] = 3f;
this.netUpdate = true;
}
else if ((double) Math.Abs(Other.Y - this.Center.Y) > 10.0)
this.velocity.Y += 0.06f * (float) Math.Sign(Other.Y - this.Center.Y);
else
this.velocity.Y *= 0.8f;
}
if (flag1 && ++this.frameCounter >= 9)
{
this.frameCounter = 0;
if (++this.frame >= Main.projFrames[this.type] - 4)
this.frame = 0;
}
}
else if ((double) this.ai[0] == 2.0)
{
if (flag1)
{
int num12 = 3;
if (this.frame < 12)
this.frame = 12;
if (this.frame == 12 || this.frame == 13)
num12 = 8;
if (++this.frameCounter >= num12)
{
this.frameCounter = 0;
if (++this.frame >= 19)
this.frame = 14;
}
}
bool flag5 = false;
if (flag2)
flag5 = (double) this.Distance(player.Center) < (double) lookupRange;
NPC npc = (NPC) null;
int index = (int) this.ai[1];
if (Main.npc.IndexInRange<NPC>(index))
{
npc = Main.npc[index];
if (!npc.CanBeChasedBy((object) this) || (double) this.Distance(npc.Center) > (double) num2)
npc = (NPC) null;
}
if (!flag5 || npc == null)
{
this.ai[1] = 0.0f;
this.ai[0] = 0.0f;
this.netUpdate = true;
if (this.frame < 18)
this.frame = 18;
}
else
{
int num13 = (double) (npc.Center - player.Center).X > 1.0 ? 1 : -1;
Vector2 targetPosition = npc.Center + new Vector2((float) -num13 * (float) ((double) npc.width * 0.5 + 70.0), -10f) - this.Center;
float maxAmountAllowedToMove = 6f * Utils.Remap(targetPosition.Length(), 50f, 400f, 1f, 4f);
int num14 = 32;
this.velocity = this.velocity.MoveTowards(Vector2.Zero.MoveTowards(targetPosition, maxAmountAllowedToMove), (float) num14);
this.direction = this.spriteDirection = num13;
if ((double) this.localAI[0]++ >= 3.0)
{
this.localAI[0] = 0.0f;
int targetNPCIndex = -1;
float distanceToClosestTarget = -1f;
this.AI_120_StardustGuardian_FindTarget(lookupRange, ref targetNPCIndex, ref distanceToClosestTarget);
if (targetNPCIndex != -1)
{
this.ai[1] = (float) targetNPCIndex;
this.netUpdate = true;
}
}
}
}
else
{
double num15 = (double) this.ai[0];
}
if ((double) this.ai[0] != 3.0)
return;
if (player.HasMinionRestTarget)
{
Other = player.MinionRestTargetPoint;
}
else
{
this.ai[0] = 0.0f;
this.netUpdate = true;
}
if (this.alpha == 0)
{
this.alpha = (int) byte.MaxValue;
for (int index4 = 0; index4 < 30; ++index4)
{
int index5 = Dust.NewDust(this.position, this.width, this.height, 135, Alpha: 200, Scale: 1.7f);
Main.dust[index5].noGravity = true;
Main.dust[index5].velocity *= 3f;
Main.dust[index5].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]);
int index6 = Dust.NewDust(this.position, this.width, this.height, 135, Alpha: 100);
Main.dust[index6].velocity *= 2f;
Main.dust[index6].noGravity = true;
Main.dust[index6].fadeIn = 2.5f;
Main.dust[index6].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]);
}
}
else
{
for (int index7 = 0; index7 < 2; ++index7)
{
int index8 = Dust.NewDust(this.position, this.width, this.height, 135, Alpha: 200, Scale: 1.7f);
Main.dust[index8].noGravity = true;
Main.dust[index8].velocity *= 3f;
Main.dust[index8].noLight = true;
Main.dust[index8].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]);
int index9 = Dust.NewDust(this.position, this.width, this.height, 135, Alpha: 100);
Main.dust[index9].velocity *= 2f;
Main.dust[index9].noGravity = true;
Main.dust[index9].fadeIn = 2.5f;
Main.dust[index9].noLight = true;
Main.dust[index9].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]);
}
}
this.velocity = this.velocity * 0.7f;
this.Center = Vector2.Lerp(this.Center, Other, 0.2f);
if ((double) this.Distance(Other) >= 10.0)
return;
this.ai[0] = 1f;
this.netUpdate = true;
}
}
private void AI_120_StardustGuardian_FindTarget(
float lookupRange,
ref int targetNPCIndex,
ref float distanceToClosestTarget)
{
Vector2 center = Main.player[this.owner].Center;
for (int index = 0; index < 200; ++index)
{
NPC npc = Main.npc[index];
if (npc.CanBeChasedBy((object) this))
{
float num = center.Distance(npc.Center);
if ((double) num < (double) lookupRange)
{
targetNPCIndex = index;
distanceToClosestTarget = num;
lookupRange = num;
}
}
}
}
private void AI_180_FairyQueenSunDance()
{
if ((double) this.localAI[0] == 0.0)
SoundEngine.PlaySound(SoundID.Item159, this.Center);
++this.localAI[0];
float num1 = 180f;
double num2 = (double) this.ai[0] / 6.28318548202515;
float num3 = 0.3490659f;
if ((double) this.localAI[0] >= (double) num1)
{
this.Kill();
}
else
{
this.alpha -= 15;
if (this.alpha < 0)
this.alpha = 0;
this.scale = Utils.GetLerpValue(0.0f, 20f, this.localAI[0], true) * Utils.GetLerpValue(num1, num1 - 60f, this.localAI[0], true);
this.rotation = this.ai[0] + Utils.GetLerpValue(50f, num1, this.localAI[0], true) * num3;
int index = (int) this.ai[1];
if (Main.npc.IndexInRange<NPC>(index))
{
NPC npc = Main.npc[index];
if (npc.active && npc.type == 636)
this.Center = npc.Center;
this.velocity = Vector2.Zero;
Vector2 rotationVector2 = this.rotation.ToRotationVector2();
Vector3 vector3 = Main.hslToRgb((float) (((double) this.ai[0] / 6.28318548202515 + (double) this.localAI[0] / (double) num1) % 1.0), 1f, 0.85f).ToVector3() * this.scale;
float num4 = 800f * this.scale;
DelegateMethods.v3_1 = vector3;
for (float num5 = 0.0f; (double) num5 <= 1.0; num5 += 0.08333334f)
{
Point tileCoordinates = (this.Center + rotationVector2 * num4 * num5).ToTileCoordinates();
DelegateMethods.CastLightOpen(tileCoordinates.X, tileCoordinates.Y);
}
}
else
this.Kill();
}
}
private void AI_179_FairyQueenLance()
{
++this.localAI[0];
if ((double) this.localAI[0] >= 60.0)
{
this.velocity = this.ai[0].ToRotationVector2() * 40f;
if (Main.rand.Next(3) == 0)
{
Dust dust = Dust.NewDustPerfect(this.Center, 267);
dust.fadeIn = 1f;
dust.noGravity = true;
dust.alpha = 100;
dust.color = Color.Lerp(this.AI_171_GetColor(), Color.White, Main.rand.NextFloat() * 0.4f);
dust.noLightEmittence = true;
dust.scale *= 1.5f;
}
}
if ((double) this.localAI[0] >= 360.0)
{
this.Kill();
}
else
{
this.alpha = (int) MathHelper.Lerp((float) byte.MaxValue, 0.0f, Utils.GetLerpValue(0.0f, 20f, this.localAI[0], true));
this.rotation = this.ai[0];
}
}
private void AI_176_EdgyLightning()
{
int index = (int) this.ai[0] - 1;
if (index != -1 && (!Main.npc[index].CanBeChasedBy((object) this) || this.localNPCImmunity[index] != 0))
{
this.ai[0] = 0.0f;
index = -1;
}
if (index == -1)
{
NPC targetWithinRange = this.FindTargetWithinRange(400f);
if (targetWithinRange != null)
{
index = targetWithinRange.whoAmI;
this.ai[0] = (float) (index + 1);
this.netUpdate = true;
}
}
if (index != -1)
{
Vector2 vec = this.DirectionTo(Main.npc[index].Center);
if (vec.HasNaNs())
{
this.Kill();
}
else
{
this.velocity = vec * 10f;
this.rotation = this.velocity.ToRotation();
if (++this.frameCounter < 3)
return;
this.frameCounter = 0;
this.frame = Main.rand.Next(Main.projFrames[this.type]);
}
}
else
this.Kill();
}
private NPC FindTargetWithinRange(float maxRange)
{
NPC npc1 = (NPC) null;
float num1 = maxRange;
for (int index = 0; index < 200; ++index)
{
NPC npc2 = Main.npc[index];
if (npc2.CanBeChasedBy((object) this) && this.localNPCImmunity[index] == 0)
{
float num2 = this.Distance(npc2.Center);
if ((double) num1 > (double) num2)
{
num1 = num2;
npc1 = npc2;
}
}
}
return npc1;
}
private void AI_177_IceWhipSlicer()
{
Player player = Main.player[this.owner];
if (!player.active || player.dead)
{
player.coolWhipBuff = false;
this.Kill();
}
else
{
if (player.coolWhipBuff)
this.timeLeft = 2;
int index = (int) this.ai[0] - 1;
if (index != -1 && (!Main.npc[index].CanBeChasedBy((object) this) || this.localNPCImmunity[index] > 0))
{
this.ai[0] = 0.0f;
index = -1;
}
if (index == -1)
{
NPC targetWithinRange = this.FindTargetWithinRange(400f);
if (targetWithinRange != null)
{
index = targetWithinRange.whoAmI;
this.ai[0] = (float) (index + 1);
this.netUpdate = true;
}
}
float num1 = 8f;
float amount = 0.3f;
if (index != -1)
{
NPC npc = Main.npc[index];
float num2 = this.Distance(npc.Center);
if ((double) num1 > (double) num2)
num1 = num2;
Vector2 vec = this.DirectionTo(npc.Center);
if (!vec.HasNaNs())
this.velocity = Vector2.Lerp(this.velocity, vec * num1, amount);
}
else
this.velocity = this.velocity * 0.92f;
this.rotation += (float) (0.0209439527243376 + (double) Math.Abs(this.velocity.X) * 0.200000002980232);
if (Main.rand.Next(3) != 0)
return;
Dust dust = Dust.NewDustDirect(this.Center, 0, 0, 43, this.velocity.X, this.velocity.Y, 254, Color.White, 0.5f);
Vector2 vector2 = Main.rand.NextVector2Circular(1f, 1f);
dust.position = this.Center + vector2 * 10f;
dust.velocity = vector2;
}
}
private void AI_178_FireExplosion()
{
if ((double) this.localAI[0] == 0.0)
{
SoundEngine.PlaySound(SoundID.Item14, this.position);
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 < 30; ++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 / 2f;
Main.dust[index5].velocity *= 2f;
Main.dust[index5].noGravity = true;
Main.dust[index5].fadeIn = 2.5f;
}
for (int index6 = 0; index6 < 10; ++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 < 10; ++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 < 2; ++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.localAI[0];
if ((double) this.localAI[0] < 10.0)
return;
this.Kill();
}
private void AI_175_TitaniumStormShards()
{
Player player = Main.player[this.owner];
if (!player.active || player.dead || !player.hasTitaniumStormBuff)
{
this.Kill();
}
else
{
if (this.frameCounter == 0)
{
this.frameCounter = 1;
this.frame = Main.rand.Next(12);
this.rotation = Main.rand.NextFloat() * 6.283185f;
}
this.rotation += (float) Math.PI / 200f;
int index;
int totalIndexesInGroup;
this.AI_GetMyGroupIndexAndFillBlackList((List<int>) null, out index, out totalIndexesInGroup);
double num1 = ((double) index / (double) totalIndexesInGroup + (double) player.miscCounterNormalized * 6.0) * 6.28318548202515;
float num2 = (float) (24.0 + (double) totalIndexesInGroup * 6.0);
this.Center = this.Center + (player.position - player.oldPosition);
Vector2 rotationVector2 = ((float) num1).ToRotationVector2();
this.localAI[0] = rotationVector2.Y;
this.Center = Vector2.Lerp(this.Center, player.Center + rotationVector2 * new Vector2(1f, 0.05f) * num2, 0.3f);
}
}
private void AI_174_MultisegmentPet()
{
Player player = Main.player[this.owner];
if (!player.active)
{
this.active = false;
}
else
{
if (this.type == 883)
{
if (player.dead)
player.petFlagEaterOfWorldsPet = false;
if (player.petFlagEaterOfWorldsPet)
this.timeLeft = 2;
}
if (this.type == 887)
{
if (player.dead)
player.petFlagDestroyerPet = false;
if (player.petFlagDestroyerPet)
this.timeLeft = 2;
}
if (this.type == 893)
{
if (player.dead)
player.petFlagLunaticCultistPet = false;
if (player.petFlagLunaticCultistPet)
this.timeLeft = 2;
}
Vector2 center = player.Center;
if ((double) this.Distance(center) > 2000.0)
{
this.Center = center;
this.velocity = Vector2.Zero;
this.netUpdate = true;
}
float num1 = (center - this.Center).Length();
float num2 = Math.Min(12f, Math.Max(4f, player.velocity.Length()));
double num3 = (double) this.velocity.Length();
if (this.velocity == Vector2.Zero)
{
this.velocity.X = 2f * (float) player.direction;
Vector2 position = this.position;
for (int index = 0; index < this.oldPos.Length; ++index)
{
position -= this.velocity;
this.oldPos[index] = position;
}
}
if ((double) num1 >= 120.0)
{
float targetAngle = this.AngleTo(center);
this.velocity = this.velocity.ToRotation().AngleTowards(targetAngle, MathHelper.ToRadians(5f)).ToRotationVector2() * num2;
}
if ((double) this.velocity.Length() > (double) num2)
this.velocity = this.velocity.SafeNormalize(Vector2.Zero) * num2;
if ((double) Math.Abs(this.velocity.Y) < 1.0)
this.velocity.Y -= 0.1f;
this.rotation = this.velocity.ToRotation() + 1.570796f;
int direction1 = this.direction;
this.direction = this.spriteDirection = (double) this.velocity.X > 0.0 ? 1 : -1;
int direction2 = this.direction;
if (direction1 != direction2)
this.netUpdate = true;
this.position.X = MathHelper.Clamp(this.position.X, 160f, (float) (Main.maxTilesX * 16 - 160));
this.position.Y = MathHelper.Clamp(this.position.Y, 160f, (float) (Main.maxTilesY * 16 - 160));
}
}
private void AI_173_HallowBossRainbowTrail()
{
this.Opacity = Utils.GetLerpValue(0.0f, 60f, (float) this.timeLeft, true) * Utils.GetLerpValue(660f, 600f, (float) this.timeLeft, true);
float num1 = (float) Math.PI / 360f;
float num2 = 30f;
this.velocity = this.velocity.RotatedBy((double) this.ai[0]);
if ((double) this.ai[0] < (double) num1)
this.ai[0] += num1 / num2;
this.rotation = this.velocity.ToRotation() + 1.570796f;
}
public Color AI_173_GetColor()
{
if (!NPC.ShouldEmpressBeEnraged())
return Main.hslToRgb((float) (((double) this.ai[1] + 0.0) % 1.0), 1f, 0.5f) * this.Opacity;
float lerpValue = Utils.GetLerpValue(0.0f, 60f, (float) (int) Main.time, true);
return Color.Lerp(Color.White, Main.OurFavoriteColor, lerpValue) * this.Opacity;
}
private void AI_171_HallowBossRainbowStreak()
{
bool flag1 = false;
bool flag2 = false;
float from = 140f;
float num1 = 30f;
float num2 = 0.98f;
float num3 = 0.05f;
float num4 = 0.1f;
float num5 = 30f;
if (this.type == 931)
{
from = 180f;
num1 = 20f;
num5 = 30f;
num2 = 0.97f;
num3 = 0.075f;
num4 = 0.125f;
if (this.timeLeft == 238)
{
int alpha = this.alpha;
this.alpha = 0;
Color queenWeaponsColor = this.GetFairyQueenWeaponsColor();
this.alpha = alpha;
for (int index = 0; index < 3; ++index)
{
Dust dust = Dust.NewDustPerfect(this.Center, 267, new Vector2?(Main.rand.NextVector2CircularEdge(3f, 3f) * (float) ((double) Main.rand.NextFloat() * 0.5 + 0.5)), newColor: queenWeaponsColor);
dust.scale *= 1.2f;
dust.noGravity = true;
}
}
}
if ((double) this.timeLeft > (double) from)
flag1 = true;
else if ((double) this.timeLeft > (double) num1)
flag2 = true;
if (flag1)
{
float num6 = (float) Math.Cos((double) this.whoAmI % 6.0 / 6.0 + (double) this.position.X / 320.0 + (double) this.position.Y / 160.0);
this.velocity = this.velocity * num2;
this.velocity = this.velocity.RotatedBy((double) num6 * 6.28318548202515 * 0.125 * 1.0 / 30.0);
}
if (this.friendly)
{
int index = (int) this.ai[0];
if (Main.npc.IndexInRange<NPC>(index) && !Main.npc[index].CanBeChasedBy((object) this))
{
index = -1;
this.ai[0] = -1f;
this.netUpdate = true;
}
if (index == -1)
{
int targetWithLineOfSight = this.FindTargetWithLineOfSight();
if (targetWithLineOfSight != -1)
{
this.ai[0] = (float) targetWithLineOfSight;
this.netUpdate = true;
}
}
}
if (flag2)
{
int index = (int) this.ai[0];
Vector2 vector2 = this.velocity;
if (this.hostile && Main.player.IndexInRange<Player>(index))
vector2 = this.DirectionTo(Main.player[index].Center) * num5;
if (this.friendly)
{
if (Main.npc.IndexInRange<NPC>(index))
vector2 = this.DirectionTo(Main.npc[index].Center) * num5;
else
this.timeLeft -= 2;
}
float amount = MathHelper.Lerp(num3, num4, Utils.GetLerpValue(from, 30f, (float) this.timeLeft, true));
this.velocity = Vector2.SmoothStep(this.velocity, vector2, amount);
if (this.type == 931)
this.velocity = this.velocity * MathHelper.Lerp(0.85f, 1f, Utils.GetLerpValue(0.0f, 90f, (float) this.timeLeft, true));
}
this.Opacity = Utils.GetLerpValue(240f, 220f, (float) this.timeLeft, true);
this.rotation = this.velocity.ToRotation() + 1.570796f;
}
public Color AI_171_GetColor()
{
if (!NPC.ShouldEmpressBeEnraged())
return Main.hslToRgb((float) (((double) this.ai[1] + 0.5) % 1.0), 1f, 0.5f) * this.Opacity;
float lerpValue = Utils.GetLerpValue(0.0f, 60f, (float) (int) Main.time, true);
return Color.Lerp(Color.White, Main.OurFavoriteColor, lerpValue) * this.Opacity;
}
private void AI_172_HallowBossRainbowPelletStorm()
{
if ((double) this.localAI[1] <= 90.0)
{
++this.localAI[1];
this.scale = 0.5f;
this.Opacity = 0.5f;
float lerpValue = Utils.GetLerpValue(0.0f, 90f, this.localAI[1], false);
this.scale = MathHelper.Lerp(5f, 1f, lerpValue);
this.Opacity = (float) (1.0 - (1.0 - (double) lerpValue * (double) lerpValue));
}
else
{
this.scale = 1f;
this.Opacity = 1f;
float num = (float) (150.0 + 10.0 * (double) this.AI_172_GetPelletStormsCount());
++this.localAI[0];
if ((double) this.localAI[0] >= (double) num)
{
this.Kill();
}
else
{
this.velocity = Vector2.Zero;
this.rotation = 0.0f;
int pelletStormsCount = this.AI_172_GetPelletStormsCount();
for (int stormIndex = 0; stormIndex < pelletStormsCount; ++stormIndex)
{
Projectile.HallowBossPelletStormInfo pelletStormInfo = this.AI_172_GetPelletStormInfo(stormIndex);
for (int bulletIndex = 0; bulletIndex < pelletStormInfo.BulletsInStorm; ++bulletIndex)
{
if (pelletStormInfo.IsValid(bulletIndex))
pelletStormInfo.GetBulletPosition(bulletIndex, this.Center);
}
}
}
}
}
public int AI_172_GetPelletStormsCount() => 6;
public Projectile.HallowBossPelletStormInfo AI_172_GetPelletStormInfo(int stormIndex)
{
float from = (float) (0.0 + (double) stormIndex * 10.0);
float to = (float) (90.0 + (double) stormIndex * 10.0);
return new Projectile.HallowBossPelletStormInfo()
{
StartAngle = (float) ((double) stormIndex * 1.04719758033752 - 1.57079637050629 + (double) stormIndex * 0.628318548202515),
AnglePerBullet = 2.094395f,
BulletsInStorm = 3,
BulletsProgressInStormStartNormalized = Utils.GetLerpValue(from, to, this.localAI[0], false),
BulletsProgressInStormBonusByIndexNormalized = 0.0f,
StormTotalRange = 500f,
BulletSize = new Vector2(16f, 16f)
};
}
private int FindTargetWithLineOfSight(float maxRange = 800f)
{
float num1 = maxRange;
int num2 = -1;
for (int index = 0; index < 200; ++index)
{
NPC npc = Main.npc[index];
bool flag = npc.CanBeChasedBy((object) this);
if (this.localNPCImmunity[index] != 0)
flag = false;
if (flag)
{
float num3 = this.Distance(Main.npc[index].Center);
if ((double) num3 < (double) num1 && Collision.CanHit(this.position, this.width, this.height, npc.position, npc.width, npc.height))
{
num1 = num3;
num2 = index;
}
}
}
return num2;
}
private void AI_170_FairyGlowstick()
{
Point tileCoordinates = this.Center.ToTileCoordinates();
Vector2 vector2_1 = tileCoordinates.ToVector2();
int num1 = 10;
Vector2 zero = Vector2.Zero;
int num2 = 0;
float num3 = 3f;
if ((double) this.ai[1] == 1.0)
{
SoundEngine.PlaySound(SoundID.Item28, this.position);
this.rotation = 0.0f;
this.velocity.X = 0.0f;
this.ai[1] = 2f;
}
++this.frameCounter;
if (this.frameCounter > 4)
{
this.frameCounter = 0;
++this.frame;
if (this.frame >= Main.projFrames[this.type])
this.frame = 0;
}
if ((double) this.velocity.Length() > 1.0 && this.timeLeft % 10 == 0)
{
for (int i = tileCoordinates.X - num1; i < tileCoordinates.X + num1 + 1; ++i)
{
for (int j = tileCoordinates.Y - num1; j < tileCoordinates.Y + num1 + 1; ++j)
{
if (WorldGen.SolidTile(i, j))
{
Vector2 v = vector2_1 - new Vector2((float) i, (float) j);
Vector2 vector2_2 = v.SafeNormalize(Vector2.Zero) * Math.Max((float) num1 - v.Length(), 0.0f) * num3;
zero += vector2_2;
++num2;
}
}
}
if (num2 > 0)
zero /= (float) num2;
if ((double) zero.Length() > 1.0)
this.velocity = zero;
}
this.velocity = this.velocity * 0.95f;
if ((double) this.velocity.Length() >= 1.0)
return;
this.velocity = Vector2.Zero;
this.netUpdate = true;
}
private void AI_169_Smolstars()
{
Player player = Main.player[this.owner];
int num1 = this.type == 864 ? 1 : 0;
Vector2 vector2_1 = player.Top + new Vector2(0.0f, -30f);
if (num1 != 0)
{
if (player.dead)
player.smolstar = false;
if (player.smolstar)
this.timeLeft = 2;
if ((double) this.ai[0] == 0.0)
{
int index;
int totalIndexesInGroup;
this.AI_GetMyGroupIndexAndFillBlackList((List<int>) null, out index, out totalIndexesInGroup);
float num2 = 6.283185f / (float) totalIndexesInGroup;
float num3 = (float) totalIndexesInGroup * 0.66f;
Vector2 vector2_2 = new Vector2(30f, 6f) / 5f * (float) (totalIndexesInGroup - 1);
Vector2 vector2_3 = Vector2.UnitY.RotatedBy((double) num2 * (double) index + (double) Main.GlobalTimeWrappedHourly % (double) num3 / (double) num3 * 6.28318548202515);
Vector2 vec = vector2_1 + vector2_3 * vector2_2;
vec.Y += player.gfxOffY;
vector2_1 = vec.Floor();
}
}
if ((double) this.ai[0] == 0.0)
{
Vector2 vector2_4 = vector2_1 - this.Center;
float num4 = 10f + Utils.GetLerpValue(200f, 600f, vector2_4.Length(), true) * 30f;
if ((double) vector2_4.Length() >= 3000.0)
this.Center = vector2_1;
this.velocity = vector2_4;
if ((double) this.velocity.Length() > (double) num4)
this.velocity = this.velocity * (num4 / this.velocity.Length());
int startAttackRange = 800;
int attackTarget = -1;
this.Minion_FindTargetInRange(startAttackRange, ref attackTarget, false);
if (attackTarget != -1)
{
this.ai[0] = 60f;
this.ai[1] = (float) attackTarget;
this.netUpdate = true;
}
float targetAngle = this.velocity.SafeNormalize(Vector2.UnitY).ToRotation() + 1.570796f;
if ((double) vector2_4.Length() < 40.0)
targetAngle = Vector2.UnitY.ToRotation() + 1.570796f;
this.rotation = this.rotation.AngleLerp(targetAngle, 0.2f);
}
else if ((double) this.ai[0] == -1.0)
{
if ((double) this.ai[1] == 0.0)
{
SoundEngine.PlaySound(0, (int) this.position.X, (int) this.position.Y);
for (int index = 0; index < 2; ++index)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 15, this.oldVelocity.X * 0.2f, this.oldVelocity.Y * 0.2f, Scale: 1.4f);
if (Main.rand.Next(3) != 0)
{
dust.scale *= 1.3f;
dust.velocity *= 1.1f;
}
dust.noGravity = true;
dust.fadeIn = 0.0f;
}
this.velocity = this.velocity + Main.rand.NextVector2CircularEdge(4f, 4f);
}
++this.ai[1];
this.rotation += (float) ((double) this.velocity.X * 0.100000001490116 + (double) this.velocity.Y * 0.0500000007450581);
this.velocity = this.velocity * 0.92f;
if ((double) this.ai[1] < 9.0)
return;
this.ai[0] = 0.0f;
this.ai[1] = 0.0f;
}
else
{
NPC npc = (NPC) null;
int index1 = (int) this.ai[1];
if (Main.npc.IndexInRange<NPC>(index1) && Main.npc[index1].CanBeChasedBy((object) this))
npc = Main.npc[index1];
if (npc == null)
{
this.ai[0] = -1f;
this.ai[1] = 0.0f;
this.netUpdate = true;
}
else if ((double) player.Distance(npc.Center) >= 900.0)
{
this.ai[0] = 0.0f;
this.ai[1] = 0.0f;
this.netUpdate = true;
}
else
{
Vector2 vector2_5 = npc.Center - this.Center;
float num5 = 16f;
this.velocity = vector2_5;
if ((double) this.velocity.Length() > (double) num5)
this.velocity = this.velocity * (num5 / this.velocity.Length());
this.rotation = this.rotation.AngleLerp(this.velocity.SafeNormalize(Vector2.UnitY).ToRotation() + 1.570796f, 0.4f);
}
float num6 = 0.1f;
float num7 = (float) (this.width * 5);
for (int index2 = 0; index2 < 1000; ++index2)
{
if (index2 != this.whoAmI && Main.projectile[index2].active && Main.projectile[index2].owner == this.owner && Main.projectile[index2].type == this.type && (double) Math.Abs(this.position.X - Main.projectile[index2].position.X) + (double) Math.Abs(this.position.Y - Main.projectile[index2].position.Y) < (double) num7)
{
if ((double) this.position.X < (double) Main.projectile[index2].position.X)
this.velocity.X -= num6;
else
this.velocity.X += num6;
if ((double) this.position.Y < (double) Main.projectile[index2].position.Y)
this.velocity.Y -= num6;
else
this.velocity.Y += num6;
}
}
}
}
private void AI_019_Spears()
{
Player player = Main.player[this.owner];
Vector2 vector2_1 = player.RotatedRelativePoint(player.MountedCenter);
this.direction = player.direction;
player.heldProj = this.whoAmI;
player.itemTime = player.itemAnimation;
this.Center = vector2_1;
bool flag1 = Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3;
int itemAnimationMax = player.itemAnimationMax;
int itemAnimation = player.itemAnimation;
int frames = Main.player[this.owner].itemAnimationMax / 3;
float num1 = MathHelper.Min((float) itemAnimation, (float) frames);
float num2 = (float) itemAnimation - num1;
float num3 = 0.0f;
float num4 = 0.0f;
float num5 = 0.0f;
bool flag2 = false;
switch (this.type)
{
case 46:
num3 = 3f;
num5 = 1.6f;
num4 = 1.4f;
break;
case 47:
num3 = 4f;
num5 = 1.2f;
num4 = 0.9f;
break;
case 49:
this.spriteDirection = -this.direction;
num3 = 4f;
num5 = 1.1f;
num4 = 0.85f;
break;
case 64:
case 215:
this.spriteDirection = -this.direction;
num3 = 3f;
num5 = 1.9f;
num4 = 1.7f;
break;
case 66:
case 97:
case 212:
case 218:
this.spriteDirection = -this.direction;
num3 = 3f;
num5 = 2.1f;
num4 = 1.9f;
break;
case 105:
num3 = 3f;
num5 = 2.4f;
num4 = 2.1f;
break;
case 130:
this.spriteDirection = -this.direction;
num3 = 3f;
num5 = 1.3f;
num4 = 1f;
break;
case 153:
this.spriteDirection = -this.direction;
num3 = 4f;
num5 = 1.5f;
num4 = 1.3f;
break;
case 222:
num3 = 3f;
num5 = 2.4f;
num4 = 2.1f;
break;
case 342:
num3 = 3f;
num5 = 2.4f;
num4 = 2.1f;
break;
case 367:
this.spriteDirection = -this.direction;
num3 = 3f;
num5 = 1.6f;
num4 = 1.5f;
break;
case 368:
this.spriteDirection = -this.direction;
num3 = 3f;
num5 = 1.5f;
num4 = 1.4f;
break;
case 730:
this.spriteDirection = -this.direction;
num3 = 8f;
num5 = 1.5f;
num4 = 1.2f;
break;
case 877:
case 878:
case 879:
this.alpha -= 40;
if (this.alpha < 0)
this.alpha = 0;
num3 = 28f;
num5 = 0.4f;
num4 = 0.4f;
flag2 = true;
break;
}
float num6 = (float) (itemAnimationMax - frames) - num2;
float num7 = (float) frames - num1;
this.position = this.position + this.velocity * (float) ((double) num3 + (double) num4 * (double) num6 - (double) num5 * (double) num7);
switch (this.type)
{
case 130:
if (((double) this.localAI[0] == 0.0 || (double) this.localAI[0] == 4.0 || (double) this.localAI[0] == 8.0 || (double) this.localAI[0] == 12.0 || (double) this.localAI[0] == 16.0 || (double) this.localAI[0] == 20.0 || (double) this.localAI[0] == 24.0) && this.owner == Main.myPlayer)
Projectile.NewProjectile(this.Center.X, this.Center.Y, this.velocity.X, this.velocity.Y, 131, this.damage / 3, 0.0f, this.owner);
++this.localAI[0];
break;
case 222:
if (flag1 && (double) this.localAI[0] == 0.0 && Main.myPlayer == this.owner)
{
this.localAI[0] = 1f;
Projectile.NewProjectile(this.Center.X, this.Center.Y, this.velocity.X, this.velocity.Y, 228, this.damage, this.knockBack, this.owner);
break;
}
break;
case 342:
if (flag1 && (double) this.localAI[0] == 0.0 && Main.myPlayer == this.owner)
{
this.localAI[0] = 1f;
if (Collision.CanHit(player.position, player.width, player.height, this.position, this.width, this.height))
{
Projectile.NewProjectile(this.Center.X, this.Center.Y, this.velocity.X * 2.4f, this.velocity.Y * 2.4f, 343, (int) ((double) this.damage * 0.8), this.knockBack * 0.85f, this.owner);
break;
}
break;
}
break;
case 730:
if ((double) this.localAI[0] == 0.0 && Main.myPlayer == this.owner)
{
this.localAI[0] = 1f;
Vector2 vector2_2 = this.velocity * 4f;
Projectile.NewProjectile(this.Center.X, this.Center.Y, vector2_2.X, vector2_2.Y, 732, (int) ((double) this.damage * 1.25), this.knockBack * 0.5f, this.owner);
break;
}
break;
}
if (flag2 && player.channel && player.itemAnimation < frames)
player.SetDummyItemTime(frames);
if (player.itemAnimation == 0)
this.Kill();
this.rotation = (float) (Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57079637050629 + 0.785398185253143);
if (this.spriteDirection == -1)
this.rotation -= 1.570796f;
if (this.type == 878 || this.type == 879)
{
float num8 = 6f;
float num9 = 0.8f;
float num10 = Vector2.Dot(this.velocity.SafeNormalize(Vector2.UnitX * (float) player.direction), player.velocity.SafeNormalize(Vector2.UnitX * (float) player.direction));
float num11 = player.velocity.Length();
if ((double) num11 > (double) num8 && (double) num10 > (double) num9)
{
int maxValue = 8;
if ((double) num11 > (double) num8 + 1.0)
maxValue = 5;
if ((double) num11 > (double) num8 + 2.0)
maxValue = 2;
int Type1 = 14;
int Type2 = 27;
int num12 = 4;
if (this.type == 879)
{
Type1 = 43;
Type2 = 57;
}
if (Main.rand.Next(maxValue + 3) == 0)
Dust.NewDust(this.Center - new Vector2((float) num12, (float) num12), num12 * 2, num12 * 2, Type1, Alpha: 150, Scale: 1.4f);
if (Main.rand.Next(maxValue) == 0)
{
int index1 = Dust.NewDust(this.Center - new Vector2((float) num12, (float) num12), num12 * 2, num12 * 2, Type2, this.velocity.X * 0.2f + (float) (this.direction * 3), this.velocity.Y * 0.2f, 100, Scale: 1.2f);
Main.dust[index1].noGravity = true;
Main.dust[index1].velocity *= 0.25f;
int index2 = Dust.NewDust(this.Center - new Vector2((float) num12, (float) num12), num12 * 2, num12 * 2, Type2, Alpha: 150, Scale: 1.4f);
Main.dust[index2].velocity *= 0.25f;
}
}
}
if (this.type == 46)
{
if (Main.rand.Next(5) == 0)
Dust.NewDust(this.position, this.width, this.height, 14, Alpha: 150, Scale: 1.4f);
int index3 = Dust.NewDust(this.position, this.width, this.height, 27, this.velocity.X * 0.2f + (float) (this.direction * 3), this.velocity.Y * 0.2f, 100, Scale: 1.2f);
Main.dust[index3].noGravity = true;
Main.dust[index3].velocity /= 2f;
int index4 = Dust.NewDust(this.position - this.velocity * 2f, this.width, this.height, 27, Alpha: 150, Scale: 1.4f);
Main.dust[index4].velocity /= 5f;
}
if (this.type == 730)
{
if (Main.rand.Next(5) == 0)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 226, Alpha: 150, Scale: 0.7f);
dust.noGravity = true;
dust.velocity *= 1.4f;
}
if (Main.rand.Next(5) != 0)
return;
Dust.NewDustDirect(this.position, this.width, this.height, 226, Alpha: 150, Scale: 0.5f).velocity.Y -= 0.5f;
}
else if (this.type == 105)
{
if (Main.rand.Next(3) == 0)
{
int index = Dust.NewDust(this.position, this.width, this.height, 57, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 200, Scale: 1.2f);
Main.dust[index].velocity += this.velocity * 0.3f;
Main.dust[index].velocity *= 0.2f;
}
if (Main.rand.Next(4) != 0)
return;
int index5 = Dust.NewDust(this.position, this.width, this.height, 43, Alpha: 254, Scale: 0.3f);
Main.dust[index5].velocity += this.velocity * 0.5f;
Main.dust[index5].velocity *= 0.5f;
}
else
{
if (this.type != 153)
return;
int index = Dust.NewDust(this.position - this.velocity * 3f, this.width, this.height, 115, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 140);
Main.dust[index].noGravity = true;
Main.dust[index].fadeIn = 1.25f;
Main.dust[index].velocity *= 0.25f;
}
}
private void AI_019_Spears_Old()
{
Vector2 vector2_1 = Main.player[this.owner].RotatedRelativePoint(Main.player[this.owner].MountedCenter);
this.direction = Main.player[this.owner].direction;
Main.player[this.owner].heldProj = this.whoAmI;
Main.player[this.owner].itemTime = Main.player[this.owner].itemAnimation;
this.position.X = vector2_1.X - (float) (this.width / 2);
this.position.Y = vector2_1.Y - (float) (this.height / 2);
bool flag = Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3;
if (!Main.player[this.owner].frozen)
{
if (this.type == 46)
{
if ((double) this.ai[0] == 0.0)
{
this.ai[0] = 3f;
this.netUpdate = true;
}
if (flag)
this.ai[0] -= 1.6f;
else
this.ai[0] += 1.4f;
}
else if (this.type == 105)
{
if ((double) this.ai[0] == 0.0)
{
this.ai[0] = 3f;
this.netUpdate = true;
}
if (flag)
this.ai[0] -= 2.4f;
else
this.ai[0] += 2.1f;
}
else if (this.type == 367)
{
this.spriteDirection = -this.direction;
if ((double) this.ai[0] == 0.0)
{
this.ai[0] = 3f;
this.netUpdate = true;
}
if (flag)
this.ai[0] -= 1.6f;
else
this.ai[0] += 1.5f;
}
else if (this.type == 368)
{
this.spriteDirection = -this.direction;
if ((double) this.ai[0] == 0.0)
{
this.ai[0] = 3f;
this.netUpdate = true;
}
if (flag)
this.ai[0] -= 1.5f;
else
this.ai[0] += 1.4f;
}
else if (this.type == 222)
{
if ((double) this.ai[0] == 0.0)
{
this.ai[0] = 3f;
this.netUpdate = true;
}
if (flag)
{
this.ai[0] -= 2.4f;
if ((double) this.localAI[0] == 0.0 && Main.myPlayer == this.owner)
{
this.localAI[0] = 1f;
Projectile.NewProjectile(this.Center.X + this.velocity.X * this.ai[0], this.Center.Y + this.velocity.Y * this.ai[0], this.velocity.X, this.velocity.Y, 228, this.damage, this.knockBack, this.owner);
}
}
else
this.ai[0] += 2.1f;
}
else if (this.type == 342)
{
if ((double) this.ai[0] == 0.0)
{
this.ai[0] = 3f;
this.netUpdate = true;
}
if (flag)
{
this.ai[0] -= 2.4f;
if ((double) this.localAI[0] == 0.0 && Main.myPlayer == this.owner)
{
this.localAI[0] = 1f;
if (Collision.CanHit(Main.player[this.owner].position, Main.player[this.owner].width, Main.player[this.owner].height, new Vector2(this.Center.X + this.velocity.X * this.ai[0], this.Center.Y + this.velocity.Y * this.ai[0]), this.width, this.height))
Projectile.NewProjectile(this.Center.X + this.velocity.X * this.ai[0], this.Center.Y + this.velocity.Y * this.ai[0], this.velocity.X * 2.4f, this.velocity.Y * 2.4f, 343, (int) ((double) this.damage * 0.8), this.knockBack * 0.85f, this.owner);
}
}
else
this.ai[0] += 2.1f;
}
else if (this.type == 47)
{
if ((double) this.ai[0] == 0.0)
{
this.ai[0] = 4f;
this.netUpdate = true;
}
if (flag)
this.ai[0] -= 1.2f;
else
this.ai[0] += 0.9f;
}
else if (this.type == 153)
{
this.spriteDirection = -this.direction;
if ((double) this.ai[0] == 0.0)
{
this.ai[0] = 4f;
this.netUpdate = true;
}
if (flag)
this.ai[0] -= 1.5f;
else
this.ai[0] += 1.3f;
}
else if (this.type == 49)
{
if ((double) this.ai[0] == 0.0)
{
this.ai[0] = 4f;
this.netUpdate = true;
}
if (flag)
this.ai[0] -= 1.1f;
else
this.ai[0] += 0.85f;
}
else if (this.type == 730)
{
this.spriteDirection = -this.direction;
if ((double) this.ai[0] == 0.0)
{
this.ai[0] = 8f;
this.netUpdate = true;
if ((double) this.localAI[0] == 0.0 && Main.myPlayer == this.owner)
{
this.localAI[0] = 1f;
Vector2 vector2_2 = this.velocity * 4f;
Projectile.NewProjectile(this.Center.X + this.velocity.X * this.ai[0], this.Center.Y + this.velocity.Y * this.ai[0], vector2_2.X, vector2_2.Y, 732, (int) ((double) this.damage * 1.25), this.knockBack * 0.5f, this.owner);
}
}
if (flag)
this.ai[0] -= 1.5f;
else
this.ai[0] += 1.2f;
}
else if (this.type == 64 || this.type == 215)
{
this.spriteDirection = -this.direction;
if ((double) this.ai[0] == 0.0)
{
this.ai[0] = 3f;
this.netUpdate = true;
}
if (flag)
this.ai[0] -= 1.9f;
else
this.ai[0] += 1.7f;
}
else if (this.type == 66 || this.type == 97 || this.type == 212 || this.type == 218)
{
this.spriteDirection = -this.direction;
if ((double) this.ai[0] == 0.0)
{
this.ai[0] = 3f;
this.netUpdate = true;
}
if (flag)
this.ai[0] -= 2.1f;
else
this.ai[0] += 1.9f;
}
else if (this.type == 130)
{
this.spriteDirection = -this.direction;
if ((double) this.ai[0] == 0.0)
{
this.ai[0] = 3f;
this.netUpdate = true;
}
if (flag)
this.ai[0] -= 1.3f;
else
++this.ai[0];
}
}
this.position = this.position + this.velocity * this.ai[0];
if (this.type == 130)
{
if ((double) this.ai[1] == 0.0 || (double) this.ai[1] == 4.0 || (double) this.ai[1] == 8.0 || (double) this.ai[1] == 12.0 || (double) this.ai[1] == 16.0 || (double) this.ai[1] == 20.0 || (double) this.ai[1] == 24.0)
Projectile.NewProjectile(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2), this.velocity.X, this.velocity.Y, 131, this.damage / 3, 0.0f, this.owner);
++this.ai[1];
}
if (Main.player[this.owner].itemAnimation == 0)
this.Kill();
this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 2.355f;
if (this.spriteDirection == -1)
this.rotation -= 1.57f;
if (this.type == 46)
{
if (Main.rand.Next(5) == 0)
Dust.NewDust(this.position, this.width, this.height, 14, Alpha: 150, Scale: 1.4f);
int index1 = Dust.NewDust(this.position, this.width, this.height, 27, this.velocity.X * 0.2f + (float) (this.direction * 3), this.velocity.Y * 0.2f, 100, Scale: 1.2f);
Main.dust[index1].noGravity = true;
Main.dust[index1].velocity.X /= 2f;
Main.dust[index1].velocity.Y /= 2f;
int index2 = Dust.NewDust(this.position - this.velocity * 2f, this.width, this.height, 27, Alpha: 150, Scale: 1.4f);
Main.dust[index2].velocity.X /= 5f;
Main.dust[index2].velocity.Y /= 5f;
}
if (this.type == 730)
{
if (Main.rand.Next(5) == 0)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 226, Alpha: 150, Scale: 0.7f);
dust.noGravity = true;
dust.velocity *= 1.4f;
}
if (Main.rand.Next(5) != 0)
return;
Dust.NewDustDirect(this.position, this.width, this.height, 226, Alpha: 150, Scale: 0.5f).velocity.Y -= 0.5f;
}
else if (this.type == 105)
{
if (Main.rand.Next(3) == 0)
{
int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 57, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 200, Scale: 1.2f);
Main.dust[index].velocity += this.velocity * 0.3f;
Main.dust[index].velocity *= 0.2f;
}
if (Main.rand.Next(4) != 0)
return;
int index3 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 43, Alpha: 254, Scale: 0.3f);
Main.dust[index3].velocity += this.velocity * 0.5f;
Main.dust[index3].velocity *= 0.5f;
}
else
{
if (this.type != 153)
return;
int index = Dust.NewDust(this.position - this.velocity * 3f, this.width, this.height, 115, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 140);
Main.dust[index].noGravity = true;
Main.dust[index].fadeIn = 1.25f;
Main.dust[index].velocity *= 0.25f;
}
}
private void AI_168_FirstFractal()
{
float from = 60f;
if ((double) ++this.localAI[0] >= (double) from - 1.0)
{
this.Kill();
}
else
{
if (this.frameCounter == 0)
{
this.frameCounter = 1;
this.frame = Main.rand.Next(15);
}
this.velocity = this.velocity.RotatedBy((double) this.ai[0]);
this.Opacity = Utils.GetLerpValue(0.0f, 12f, this.localAI[0], true) * Utils.GetLerpValue(from, from - 12f, this.localAI[0], true);
this.direction = (double) this.velocity.X > 0.0 ? 1 : -1;
this.spriteDirection = this.direction;
this.rotation = 0.7853982f * (float) this.spriteDirection + this.velocity.ToRotation();
if (this.spriteDirection == -1)
this.rotation += 3.141593f;
if ((double) this.localAI[0] <= 7.0)
return;
Vector2 vector2 = this.Center - new Vector2(5f);
if (Main.rand.Next(15) != 0)
return;
Dust dust = Dust.NewDustPerfect(this.Center, 278, Alpha: 100, newColor: Color.Lerp(this.GetFirstFractalColor(), Color.White, Main.rand.NextFloat() * 0.3f));
dust.scale = 0.7f;
dust.noGravity = true;
dust.velocity *= 0.5f;
dust.velocity += this.velocity * 2f;
}
}
private void AI_167_SparkleGuitar()
{
float num = 90f;
if ((double) ++this.localAI[0] >= (double) num - 1.0)
{
this.Kill();
}
else
{
float amount = this.localAI[0] / num;
Vector2 center = Main.player[this.owner].Center;
Vector2 vector2_1 = new Vector2(this.ai[0], this.ai[1]);
Vector2 vector2_2 = -this.velocity;
Vector2 vector2_3 = center + vector2_2 * 2f;
Vector2 vector2_4 = vector2_1 + vector2_2 * (float) (1.0 - (double) amount * 3.0);
this.Center = Vector2.CatmullRom(vector2_3, center, vector2_1, vector2_4, amount);
if (this.type != 856)
return;
Lighting.AddLight(this.Center, Color.HotPink.ToVector3() * 0.3f);
this.rotation = (float) (6.28318548202515 * (double) amount * 1.0);
}
}
private void AI_164_StormTigerGem()
{
Player master = Main.player[this.owner];
if (this.type == 831)
{
if (master.dead)
master.stormTiger = false;
if (master.stormTiger)
this.timeLeft = 2;
if (++this.frameCounter >= 4)
{
this.frameCounter = 0;
if (++this.frame >= 6)
this.frame = 0;
}
}
List<int> blacklistedTargets = Projectile._ai164_blacklistedTargets;
blacklistedTargets.Clear();
int index;
int totalIndexesInGroup;
this.AI_GetMyGroupIndexAndFillBlackList(blacklistedTargets, out index, out totalIndexesInGroup);
this.Center = Projectile.AI_164_GetHomeLocation(master, index, totalIndexesInGroup);
}
public static Vector2 AI_164_GetHomeLocation(
Player master,
int stackedIndex,
int totalIndexes)
{
int num1 = master.bodyFrame.Height;
if (num1 == 0)
num1 = 1;
Vector2 vector2_1 = Main.OffsetsPlayerHeadgear[master.bodyFrame.Y / num1];
vector2_1.Y -= 2f;
float num2 = master.miscCounterNormalized * 2f;
int num3 = stackedIndex / 4;
int num4 = totalIndexes / 4;
if (totalIndexes % 4 > 0)
++num4;
int num5 = (totalIndexes - num3 * 4) % 4;
if (num5 == 0)
num5 = 4;
if (num4 - 1 != num3)
num5 = 4;
int num6 = stackedIndex % num5;
float num7 = (float) num6 / (float) num5;
float num8 = num2 + (float) num3 / 8f;
if (stackedIndex >= (num4 - 1) * 4 && num3 > 0)
{
num8 = 0.0f;
switch (num5)
{
case 1:
num7 = 0.0f;
break;
case 2:
num7 = (float) (0.25 + (double) num6 * 0.5);
break;
case 3:
num7 = (float) (num6 - 1) / 6f;
break;
case 4:
num7 = (float) (((double) num6 - 1.5) / 6.0);
break;
}
}
Vector2 vector2_2 = new Vector2(0.0f, (float) (-8 - 12 * num3)).RotatedBy(((double) num8 + (double) num7) * 6.28318548202515);
Vector2 vector2_3 = vector2_1 + (vector2_2 + new Vector2(0.0f, master.gravDir * -40f));
Vector2 mountedCenter = master.MountedCenter;
int direction = master.direction;
Vector2 vector2_4 = new Vector2(0.0f, master.gravDir * -21f);
Vector2 vec = mountedCenter + vector2_4 + vector2_3;
vec.Y += master.gfxOffY;
return vec.Floor();
}
private void AI_162_TigerPounce()
{
if ((double) this.ai[0] < 0.0)
{
this.Opacity = 0.0f;
++this.ai[0];
}
else
{
bool flag = true;
if (this.frameCounter == 0)
{
this.frameCounter = 1;
this.localAI[0] = this.Center.X;
this.localAI[1] = this.Center.Y;
flag = true;
}
Vector2 vector2_1 = new Vector2(this.localAI[0], this.localAI[1]);
Vector2 vector2_2 = vector2_1 + this.velocity;
float y = Vector2.Distance(vector2_1, vector2_2) * 1.5f;
float num1 = 0.1f;
Vector2 vector2_3 = Vector2.Lerp(vector2_1, vector2_2, 0.0f - num1) + new Vector2(0.0f, y);
Vector2 vector2_4 = Vector2.Lerp(vector2_1, vector2_2, 1f + num1) + new Vector2(0.0f, y);
if ((double) this.Opacity < 1.0)
this.Opacity += 0.1f;
int num2 = Math.Sign(vector2_2.X - vector2_1.X);
this.rotation += (float) num2 * -0.2f;
this.spriteDirection = num2;
if ((double) this.ai[1] < 1.0)
this.ai[1] = 60f;
this.ai[0] += 1f / this.ai[1];
float num3 = Utils.Clamp<float>(this.ai[0], 0.0f, 1f);
Vector2 vector2_5 = vector2_1;
Vector2 vector2_6 = vector2_2;
Vector2 vector2_7 = vector2_4;
double num4 = (double) num3;
Vector2 Destination = Vector2.CatmullRom(vector2_3, vector2_5, vector2_6, vector2_7, (float) num4);
if (flag)
{
for (float num5 = 0.0f; (double) num5 < 1.0; num5 += 0.5f)
{
if (Main.rand.Next(19) == 0)
{
Vector2 vector2_8 = this.Center + this.DirectionTo(Destination).SafeNormalize(Vector2.UnitY) * 100f;
Dust dust = Dust.NewDustPerfect(this.Center + this.Size * Main.rand.NextVector2Square(0.0f, 1f), 278, new Vector2?(Main.rand.NextVector2Circular(3f, 3f)), 100, Color.White * 0.4f);
dust.velocity.Y += -0.6f;
dust.velocity += this.velocity * 0.1f;
Main.rand.Next(5);
dust.velocity = (vector2_8 - this.Center) * 0.05f;
dust.fadeIn = 0.0f;
dust.scale = 0.7f;
dust.noGravity = true;
}
}
if (Main.rand.Next(2) == 0)
{
Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, 269)];
dust.fadeIn = 0.7f;
dust.scale = 0.4f;
dust.velocity += this.velocity * (1f / 1000f);
dust.noLight = true;
}
}
this.Center = Destination;
if ((double) this.ai[0] < 1.0)
return;
this.Kill();
}
}
private void AI_016()
{
if (this.wet && (this.type == 799 || this.type == 800 || this.type == 801 || this.type == 810 || this.type == 906 || this.type == 784 || this.type == 785 || this.type == 786 || this.type == 805 || this.type == 903 || this.type == 787 || this.type == 788 || this.type == 789 || this.type == 806 || this.type == 904 || this.type == 790 || this.type == 791 || this.type == 792 || this.type == 807 || this.type == 905))
this.timeLeft = 1;
if (this.type == 108 || this.type == 164)
{
++this.ai[0];
if ((double) this.ai[0] > 3.0)
this.Kill();
}
if (this.type == 102)
{
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].active() && TileID.Sets.Platforms[(int) Main.tile[x, y].type])
{
this.Kill();
return;
}
}
if (this.type == 75)
{
for (int index = 0; index < (int) byte.MaxValue; ++index)
{
if (Main.player[index].active && !Main.player[index].dead && !Main.player[index].ghost && (double) (this.Center - Main.player[index].Center).Length() < 40.0)
{
this.Kill();
return;
}
}
}
bool flag1 = false;
if (this.type == 37 || this.type == 397 || this.type == 470 || this.type == 519 || this.type == 773 || this.type == 911)
{
try
{
int num1 = (int) ((double) this.position.X / 16.0) - 1;
int num2 = (int) (((double) this.position.X + (double) this.width) / 16.0) + 2;
int num3 = (int) ((double) this.position.Y / 16.0) - 1;
int num4 = (int) (((double) this.position.Y + (double) this.height) / 16.0) + 2;
if (num1 < 0)
num1 = 0;
if (num2 > Main.maxTilesX)
num2 = Main.maxTilesX;
if (num3 < 0)
num3 = 0;
if (num4 > Main.maxTilesY)
num4 = Main.maxTilesY;
for (int index1 = num1; index1 < num2; ++index1)
{
for (int index2 = num3; index2 < num4; ++index2)
{
if (Main.tile[index1, index2] != null && Main.tile[index1, index2].nactive() && Main.tileSolid[(int) Main.tile[index1, index2].type] && !Main.tileSolidTop[(int) Main.tile[index1, index2].type])
{
Vector2 vector2;
vector2.X = (float) (index1 * 16);
vector2.Y = (float) (index2 * 16);
if ((double) this.position.X + (double) this.width - 4.0 > (double) vector2.X && (double) this.position.X + 4.0 < (double) vector2.X + 16.0 && (double) this.position.Y + (double) this.height - 4.0 > (double) vector2.Y && (double) this.position.Y + 4.0 < (double) vector2.Y + 16.0)
{
if (this.type == 911 && this.owner == Main.myPlayer && (double) this.localAI[0] == 0.0)
{
float num5 = 12f;
if ((double) Vector2.Distance(this.Center, vector2 + new Vector2(8f, 8f)) < (double) num5)
this.Center = this.Center + this.velocity.SafeNormalize(Vector2.Zero) * -4f;
this.localAI[0] = 1f;
this.netUpdate = true;
}
this.velocity.X = 0.0f;
this.velocity.Y = -0.2f;
flag1 = true;
}
}
}
}
}
catch
{
}
}
if (flag1 && this.type == 911)
{
Point tileCoordinates = this.Center.ToTileCoordinates();
if (WorldGen.SolidOrSlopedTile(Framing.GetTileSafely(tileCoordinates.X, tileCoordinates.Y)))
this.Center = this.Center + (tileCoordinates.ToWorldCoordinates() - this.Center).SafeNormalize(Vector2.Zero) * -4f;
}
if (flag1 && this.type == 773)
{
Player player = Main.player[this.owner];
Vector2 v = this.DirectionTo(player.Center).SafeNormalize(Vector2.UnitX * (float) player.direction);
float rotation = this.rotation;
float targetAngle = v.ToRotation() + 1.570796f;
this.rotation = this.rotation.AngleLerp(targetAngle, 0.2f);
this.rotation = this.rotation.AngleTowards(targetAngle, 0.05f);
Vector2 rotationVector2 = (this.rotation - 1.570796f).ToRotationVector2();
if (Main.rand.Next(3) == 0)
{
Dust dust = Dust.NewDustPerfect(this.Center + rotationVector2 * 10f, 59, new Vector2?(rotationVector2 * 2f + Main.rand.NextVector2Circular(0.25f, 0.25f)), Scale: 2f);
dust.noGravity = true;
if (Main.rand.Next(3) == 0)
{
dust.velocity *= 1.5f;
dust.noGravity = false;
dust.scale /= 2f;
}
}
if (Main.rand.Next(3) == 0)
{
Point digDirectionSnap8 = this.GetScarabBombDigDirectionSnap8();
Dust.NewDustPerfect(this.Center + rotationVector2 * -10f, 59, new Vector2?(digDirectionSnap8.ToVector2() * 1.5f), Scale: 2f).noGravity = true;
}
if (Main.rand.Next(15) == 0)
{
Dust dust = Dust.NewDustPerfect(this.Center + rotationVector2 * 10f, 88, new Vector2?(rotationVector2 * 3f + Main.rand.NextVector2Circular(0.25f, 0.25f)), Scale: 2f);
dust.noGravity = true;
if (Main.rand.Next(3) == 0)
dust.velocity *= 1.5f;
}
bool flag2 = Main.rand.Next(30) == 0;
if ((double) rotation != (double) this.rotation && Main.rand.Next(40) == 0)
flag2 = true;
if (flag2)
{
float num6 = 6.283185f * Main.rand.NextFloat();
for (float num7 = 0.0f; (double) num7 < 1.0; num7 += 0.1428571f)
{
Vector2 vector2 = ((num7 * 6.283185f + num6).ToRotationVector2() * new Vector2(1f, 0.3f)).RotatedBy((double) targetAngle);
Dust dust = Dust.NewDustPerfect(this.Center + vector2 + rotationVector2 * 8f, 59, new Vector2?(rotationVector2 * 3f + vector2));
dust.noGravity = true;
dust.fadeIn = 1.6f;
}
}
if (++this.frameCounter >= 3)
{
this.frameCounter = 0;
if (++this.frame >= 4)
this.frame = 0;
}
}
if (this.type == 519)
{
++this.localAI[1];
float num = 180f - this.localAI[1];
if ((double) num < 0.0)
num = 0.0f;
++this.frameCounter;
if ((double) num < 15.0)
++this.frameCounter;
if ((double) this.frameCounter >= ((double) num / 10.0 + 6.0) / 2.0)
{
++this.frame;
this.frameCounter = 0;
if (this.frame >= Main.projFrames[this.type])
this.frame = 0;
}
}
if (this.type == 681 && (double) this.localAI[1] == 0.0)
this.localAI[1] = 1f;
int Type1 = 6;
if (this.type == 776 || this.type == 780 || this.type == 803 || this.type == 804)
Type1 = 228;
else if (this.type == 784 || this.type == 805)
Type1 = Main.rand.Next(3) == 0 ? 6 : Dust.dustWater();
else if (this.type == 787 || this.type == 806)
Type1 = Main.rand.Next(3) == 0 ? 6 : 35;
else if (this.type == 790 || this.type == 807)
Type1 = Main.rand.Next(3) == 0 ? 6 : 152;
if (this.type == 102)
{
if ((double) this.velocity.Y > 10.0)
this.velocity.Y = 10f;
if ((double) this.localAI[0] == 0.0)
{
this.localAI[0] = 1f;
SoundEngine.PlaySound(SoundID.Item10, this.position);
}
++this.frameCounter;
if (this.frameCounter > 3)
{
++this.frame;
this.frameCounter = 0;
}
if (this.frame > 1)
this.frame = 0;
if ((double) this.velocity.Y == 0.0)
{
this.position.X += (float) (this.width / 2);
this.position.Y += (float) (this.height / 2);
this.width = 128;
this.height = 128;
this.position.X -= (float) (this.width / 2);
this.position.Y -= (float) (this.height / 2);
this.damage = 40;
this.knockBack = 8f;
this.timeLeft = 3;
this.netUpdate = true;
}
}
if (this.type == 303 && this.timeLeft <= 3 && this.hostile)
{
this.position.X += (float) (this.width / 2);
this.position.Y += (float) (this.height / 2);
this.width = 128;
this.height = 128;
this.position.X -= (float) (this.width / 2);
this.position.Y -= (float) (this.height / 2);
}
if (this.owner == Main.myPlayer && this.timeLeft <= 3)
{
this.tileCollide = false;
this.ai[1] = 0.0f;
this.alpha = (int) byte.MaxValue;
if (this.type == 28 || this.type == 37 || this.type == 516 || this.type == 519)
{
this.Resize(128, 128);
this.damage = 100;
this.knockBack = 8f;
}
else if (this.type == 773)
{
this.Resize(48, 96);
this.damage = 100;
this.knockBack = 8f;
}
else if (this.type == 29 || this.type == 470 || this.type == 637)
{
this.Resize(250, 250);
this.damage = 250;
this.knockBack = 10f;
}
else if (this.type == 30 || this.type == 397 || this.type == 517 || this.type == 588)
{
this.Resize(128, 128);
this.knockBack = 8f;
}
else if (this.type == 681)
{
this.Resize(80, 80);
this.knockBack = 8f;
}
else if (this.type == 779 || this.type == 783 || this.type == 862 || this.type == 863)
{
this.Resize(48, 48);
this.knockBack = 8f;
}
else if (this.type == 133 || this.type == 134 || this.type == 135 || this.type == 136 || this.type == 137 || this.type == 138 || this.type == 338 || this.type == 339 || this.type == 930)
{
this.Resize(128, 128);
this.knockBack = 8f;
}
else if (this.type == 794 || this.type == 797 || this.type == 795 || this.type == 798 || this.type == 793 || this.type == 796 || this.type == 808 || this.type == 808)
{
this.Resize(250, 250);
this.knockBack = 12f;
}
else if (this.type == 776 || this.type == 780 || this.type == 777 || this.type == 781 || this.type == 778 || this.type == 782 || this.type == 803 || this.type == 804)
{
this.Resize(128, 128);
this.knockBack = 12f;
}
else if (this.type == 784 || this.type == 785 || this.type == 786 || this.type == 805 || this.type == 903 || this.type == 787 || this.type == 788 || this.type == 789 || this.type == 806 || this.type == 904 || this.type == 790 || this.type == 791 || this.type == 792 || this.type == 807 || this.type == 905 || this.type == 799 || this.type == 800 || this.type == 801 || this.type == 810 || this.type == 906 || this.type == 910 || this.type == 911)
{
if (this.type == 903 || this.type == 904 || this.type == 905 || this.type == 906 || this.type == 910 || this.type == 911)
this.damage = 100;
this.Resize(48, 48);
this.knockBack = 12f;
}
else if (this.type == 139 || this.type == 140 || this.type == 141 || this.type == 142 || this.type == 143 || this.type == 144 || this.type == 340 || this.type == 341)
{
this.Resize(200, 200);
this.knockBack = 10f;
}
}
else
{
if (this.type != 30 && this.type != 75 && this.type != 517 && this.type != 681 && this.type != 588 && this.type != 397 && this.type != 108 && this.type != 133 && this.type != 134 && this.type != 135 && this.type != 136 && this.type != 137 && this.type != 138 && this.type != 139 && this.type != 140 && this.type != 141 && this.type != 142 && this.type != 143 && this.type != 144 && this.type != 164 && this.type != 303 && this.type != 338 && this.type != 339 && this.type != 340 && this.type != 341 && (this.type < 776 || this.type > 801) && (this.type < 803 || this.type > 810) && this.type != 930)
this.damage = 0;
if (this.type == 338 || this.type == 339 || this.type == 340 || this.type == 341 || this.type == 803 || this.type == 804 || this.type == 808 || this.type == 809 || this.type == 810 || this.type == 805 || this.type == 806 || this.type == 807 || this.type == 930)
{
++this.localAI[1];
if ((double) this.localAI[1] > 6.0)
{
this.alpha = 0;
}
else
{
this.alpha = (int) ((double) byte.MaxValue - 42.0 * (double) this.localAI[1]) + 100;
if (this.alpha > (int) byte.MaxValue)
this.alpha = (int) byte.MaxValue;
}
for (int index3 = 0; index3 < 2; ++index3)
{
float num8 = 0.0f;
float num9 = 0.0f;
if (index3 == 1)
{
num8 = this.velocity.X * 0.5f;
num9 = this.velocity.Y * 0.5f;
}
if ((double) this.localAI[1] > 9.0)
{
if (Main.rand.Next(2) == 0)
{
int index4 = Dust.NewDust(new Vector2(this.position.X + 3f + num8, this.position.Y + 3f + num9) - this.velocity * 0.5f, this.width - 8, this.height - 8, Type1, Alpha: 100);
Main.dust[index4].scale *= (float) (1.39999997615814 + (double) Main.rand.Next(10) * 0.100000001490116);
Main.dust[index4].velocity *= 0.2f;
Main.dust[index4].noGravity = true;
if (Main.dust[index4].type == 152)
{
Main.dust[index4].scale *= 0.5f;
Main.dust[index4].velocity += this.velocity * 0.1f;
}
else if (Main.dust[index4].type == 35)
{
Main.dust[index4].scale *= 0.5f;
Main.dust[index4].velocity += this.velocity * 0.1f;
}
else if (Main.dust[index4].type == Dust.dustWater())
{
Main.dust[index4].scale *= 0.65f;
Main.dust[index4].velocity += this.velocity * 0.1f;
}
if (this.type == 808 || this.type == 809)
{
Dust dust1 = Main.dust[index4];
if (dust1.dustIndex != 6000)
{
dust1 = Dust.NewDustPerfect(dust1.position, dust1.type, new Vector2?(dust1.velocity), dust1.alpha, dust1.color, dust1.scale + 0.5f);
dust1.velocity = Main.rand.NextVector2Circular(3f, 3f);
dust1.noGravity = true;
}
if (dust1.dustIndex != 6000)
{
Dust dust2 = Dust.NewDustPerfect(dust1.position, dust1.type, new Vector2?(dust1.velocity), dust1.alpha, dust1.color, dust1.scale + 0.5f);
dust2.velocity = ((float) (6.28318548202515 * ((double) this.timeLeft / 20.0))).ToRotationVector2() * 3f;
dust2.noGravity = true;
}
}
}
if (Main.rand.Next(2) == 0)
{
int index5 = Dust.NewDust(new Vector2(this.position.X + 3f + num8, this.position.Y + 3f + num9) - this.velocity * 0.5f, this.width - 8, this.height - 8, 31, Alpha: 100, Scale: 0.5f);
Main.dust[index5].fadeIn = (float) (0.5 + (double) Main.rand.Next(5) * 0.100000001490116);
Main.dust[index5].velocity *= 0.05f;
}
}
}
float num10 = this.position.X;
float num11 = this.position.Y;
float num12 = 600f;
if (this.type == 930)
num12 = 650f;
bool flag3 = false;
++this.ai[0];
if ((double) this.ai[0] > 30.0)
{
this.ai[0] = 30f;
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].CanBeChasedBy((object) this))
{
float num13 = Main.npc[index].position.X + (float) (Main.npc[index].width / 2);
float num14 = Main.npc[index].position.Y + (float) (Main.npc[index].height / 2);
float num15 = Math.Abs(this.position.X + (float) (this.width / 2) - num13) + Math.Abs(this.position.Y + (float) (this.height / 2) - num14);
if ((double) num15 < (double) num12 && Collision.CanHit(this.position, this.width, this.height, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height))
{
num12 = num15;
num10 = num13;
num11 = num14;
flag3 = true;
}
}
}
}
if (!flag3)
{
num10 = (float) ((double) this.position.X + (double) (this.width / 2) + (double) this.velocity.X * 100.0);
num11 = (float) ((double) this.position.Y + (double) (this.height / 2) + (double) this.velocity.Y * 100.0);
}
float num16 = 16f;
if (this.type == 930)
num16 = 12f;
Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
float num17 = num10 - vector2.X;
float num18 = num11 - vector2.Y;
float num19 = (float) Math.Sqrt((double) num17 * (double) num17 + (double) num18 * (double) num18);
float num20 = num16 / num19;
float num21 = num17 * num20;
float num22 = num18 * num20;
this.velocity.X = (float) (((double) this.velocity.X * 11.0 + (double) num21) / 12.0);
this.velocity.Y = (float) (((double) this.velocity.Y * 11.0 + (double) num22) / 12.0);
}
else if (this.type == 134 || this.type == 137 || this.type == 140 || this.type == 143 || this.type == 303 || this.type == 776 || this.type == 780 || this.type == 793 || this.type == 796 || this.type == 799 || this.type == 784 || this.type == 787 || this.type == 790)
{
if ((double) Math.Abs(this.velocity.X) >= 8.0 || (double) Math.Abs(this.velocity.Y) >= 8.0)
{
for (int index6 = 0; index6 < 2; ++index6)
{
float num23 = 0.0f;
float num24 = 0.0f;
if (index6 == 1)
{
num23 = this.velocity.X * 0.5f;
num24 = this.velocity.Y * 0.5f;
}
int index7 = Dust.NewDust(new Vector2(this.position.X + 3f + num23, this.position.Y + 3f + num24) - this.velocity * 0.5f, this.width - 8, this.height - 8, Type1, Alpha: 100);
Main.dust[index7].scale *= (float) (2.0 + (double) Main.rand.Next(10) * 0.100000001490116);
Main.dust[index7].velocity *= 0.2f;
Main.dust[index7].noGravity = true;
if (Main.dust[index7].type == 152)
{
Main.dust[index7].scale *= 0.5f;
Main.dust[index7].velocity += this.velocity * 0.1f;
}
else if (Main.dust[index7].type == 35)
{
Main.dust[index7].scale *= 0.5f;
Main.dust[index7].velocity += this.velocity * 0.1f;
}
else if (Main.dust[index7].type == Dust.dustWater())
{
Main.dust[index7].scale *= 0.65f;
Main.dust[index7].velocity += this.velocity * 0.1f;
}
if (this.type == 793 || this.type == 796)
{
Dust dust3 = Main.dust[index7];
if (dust3.dustIndex != 6000)
{
dust3 = Dust.NewDustPerfect(dust3.position, dust3.type, new Vector2?(dust3.velocity), dust3.alpha, dust3.color, dust3.scale);
dust3.velocity = Main.rand.NextVector2Circular(3f, 3f);
dust3.noGravity = true;
}
if (dust3.dustIndex != 6000)
{
Dust dust4 = Dust.NewDustPerfect(dust3.position, dust3.type, new Vector2?(dust3.velocity), dust3.alpha, dust3.color, dust3.scale);
dust4.velocity = ((float) (6.28318548202515 * ((double) this.timeLeft / 20.0))).ToRotationVector2() * 3f;
dust4.noGravity = true;
}
}
int index8 = Dust.NewDust(new Vector2(this.position.X + 3f + num23, this.position.Y + 3f + num24) - this.velocity * 0.5f, this.width - 8, this.height - 8, 31, Alpha: 100, Scale: 0.5f);
Main.dust[index8].fadeIn = (float) (1.0 + (double) Main.rand.Next(5) * 0.100000001490116);
Main.dust[index8].velocity *= 0.05f;
}
}
if ((double) Math.Abs(this.velocity.X) < 15.0 && (double) Math.Abs(this.velocity.Y) < 15.0)
this.velocity = this.velocity * 1.1f;
}
else if (this.type == 133 || this.type == 136 || this.type == 139 || this.type == 142 || this.type == 777 || this.type == 781 || this.type == 794 || this.type == 797 || this.type == 800 || this.type == 785 || this.type == 788 || this.type == 791)
{
int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100);
Main.dust[index].scale *= (float) (1.0 + (double) Main.rand.Next(10) * 0.100000001490116);
Main.dust[index].velocity *= 0.2f;
Main.dust[index].noGravity = true;
}
else if (this.type == 135 || this.type == 138 || this.type == 141 || this.type == 144 || this.type == 778 || this.type == 782 || this.type == 795 || this.type == 798 || this.type == 801 || this.type == 786 || this.type == 789 || this.type == 792)
{
if ((double) this.velocity.X > -0.2 && (double) this.velocity.X < 0.2 && (double) this.velocity.Y > -0.2 && (double) this.velocity.Y < 0.2)
{
this.alpha += 2;
if (this.alpha > 200)
this.alpha = 200;
}
else
{
this.alpha = 0;
int index = Dust.NewDust(new Vector2(this.position.X + 3f, this.position.Y + 3f) - this.velocity * 0.5f, this.width - 8, this.height - 8, 31, Alpha: 100);
Main.dust[index].scale *= (float) (1.60000002384186 + (double) Main.rand.Next(5) * 0.100000001490116);
Main.dust[index].velocity *= 0.05f;
Main.dust[index].noGravity = true;
}
}
else if (this.type == 779 || this.type == 783 || this.type == 862 || this.type == 863)
{
if (Main.rand.Next(25) == 0)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 228, (float) (-(double) this.velocity.X / 10.0), (float) (-(double) this.velocity.Y / 10.0), 100);
dust.noGravity = true;
dust.velocity *= 0.0f;
dust.scale = 1.3f;
}
if (Main.rand.Next(5) == 0)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 31, (float) (-(double) this.velocity.X / 10.0), (float) (-(double) this.velocity.Y / 10.0), 100);
dust.noGravity = true;
dust.velocity *= 0.0f;
dust.scale = 1.3f;
}
if (this.frameCounter == 0)
{
this.frameCounter = 1;
this.frame = Main.rand.Next(4);
}
}
else if (this.type != 30 && this.type != 517 && this.type != 681 && this.type != 397 && this.type != 519 && this.type != 588 && this.type != 779 && this.type != 783 && this.type != 862 && this.type != 863 && Main.rand.Next(2) == 0)
{
int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100);
Main.dust[index].scale = (float) (0.100000001490116 + (double) Main.rand.Next(5) * 0.100000001490116);
Main.dust[index].fadeIn = (float) (1.5 + (double) Main.rand.Next(5) * 0.100000001490116);
Main.dust[index].noGravity = true;
Main.dust[index].position = this.Center + new Vector2(0.0f, (float) (-this.height / 2)).RotatedBy((double) this.rotation) * 1.1f;
int Type2 = 6;
if (this.type == 773)
Type2 = 59;
if (this.type == 903)
Type2 = Dust.dustWater();
if (this.type == 904)
Type2 = 35;
if (this.type == 905)
Type2 = 152;
if (this.type == 910 || this.type == 911)
Type2 = 0;
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, Type2, Alpha: 100);
dust.scale = (float) (1.0 + (double) Main.rand.Next(5) * 0.100000001490116);
dust.noGravity = true;
dust.position = this.Center + new Vector2(0.0f, (float) (-this.height / 2 - 6)).RotatedBy((double) this.rotation) * 1.1f;
}
else if (this.type == 681)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 6, Alpha: 100);
dust.scale = (float) (1.0 + (double) Main.rand.Next(5) * 0.100000001490116);
dust.noGravity = true;
dust.position = this.Center + new Vector2((float) (6 * Math.Sign(this.velocity.X)), (float) (-this.height / 2 - 6)).RotatedBy((double) this.rotation) * 1.1f;
}
}
++this.ai[0];
if (this.type == 338 || this.type == 339 || this.type == 340 || this.type == 341 || this.type == 803 || this.type == 804 || this.type == 808 || this.type == 809 || this.type == 810 || this.type == 805 || this.type == 806 || this.type == 807 || this.type == 930)
{
if ((double) this.velocity.X < 0.0)
{
this.spriteDirection = -1;
this.rotation = (float) Math.Atan2(-(double) this.velocity.Y, -(double) this.velocity.X) - 1.57f;
}
else
{
this.spriteDirection = 1;
this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57f;
}
}
else if (this.type == 134 || this.type == 137 || this.type == 140 || this.type == 143 || this.type == 303 || this.type == 776 || this.type == 780 || this.type == 793 || this.type == 796 || this.type == 799 || this.type == 784 || this.type == 787 || this.type == 790)
{
if (this.velocity != Vector2.Zero)
this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57f;
}
else if (this.type == 135 || this.type == 138 || this.type == 141 || this.type == 144 || this.type == 778 || this.type == 782 || this.type == 795 || this.type == 798 || this.type == 801 || this.type == 786 || this.type == 789 || this.type == 792)
{
this.velocity.Y += 0.2f;
this.velocity = this.velocity * 0.97f;
if ((double) this.velocity.X > -0.1 && (double) this.velocity.X < 0.1)
this.velocity.X = 0.0f;
if ((double) this.velocity.Y > -0.1 && (double) this.velocity.Y < 0.1)
this.velocity.Y = 0.0f;
}
else if (this.type == 133 || this.type == 136 || this.type == 139 || this.type == 142 || this.type == 777 || this.type == 781 || this.type == 794 || this.type == 797 || this.type == 800 || this.type == 785 || this.type == 788 || this.type == 791)
{
if ((double) this.ai[0] > 15.0)
{
if ((double) this.velocity.Y == 0.0)
this.velocity.X *= 0.95f;
this.velocity.Y += 0.2f;
}
}
else if ((this.type == 30 || this.type == 397 || this.type == 517 || this.type == 681 || this.type == 588 || this.type == 779 || this.type == 783 || this.type == 862 || this.type == 863) && (double) this.ai[0] > 10.0 || this.type != 30 && this.type != 397 && this.type != 517 && this.type != 588 && this.type != 779 && this.type != 783 && this.type != 862 && this.type != 863 && (double) this.ai[0] > 5.0)
{
this.ai[0] = 10f;
if ((double) this.velocity.Y == 0.0 && (double) this.velocity.X != 0.0)
{
this.velocity.X *= 0.97f;
if (this.type == 29 || this.type == 470 || this.type == 637)
this.velocity.X *= 0.99f;
if ((double) this.velocity.X > -0.01 && (double) this.velocity.X < 0.01)
{
this.velocity.X = 0.0f;
this.netUpdate = true;
}
}
this.velocity.Y += 0.2f;
if (this.type == 911)
{
this.velocity.X = MathHelper.Clamp(this.velocity.X, -8f, 8f);
this.velocity.Y = MathHelper.Clamp(this.velocity.Y, -8f, 8f);
}
}
if (this.type == 519)
{
this.rotation += this.velocity.X * 0.06f;
}
else
{
if (this.type == 134 || this.type == 137 || this.type == 140 || this.type == 143 || this.type == 303 || this.type >= 338 && this.type <= 341 || this.type == 776 || this.type == 780 || this.type == 793 || this.type == 796 || this.type == 799 || this.type == 784 || this.type == 787 || this.type == 790 || this.type == 803 || this.type == 804 || this.type == 808 || this.type == 809 || this.type == 810 || this.type == 805 || this.type == 806 || this.type == 807 || this.type == 930)
return;
this.rotation += this.velocity.X * 0.1f;
}
}
private void AI_166_Dove()
{
int num1 = this.type == 855 ? 1 : 0;
if ((double) this.localAI[0] == 0.0)
{
this.localAI[0] = 1f;
this.frame = Main.rand.Next(4);
}
int num2 = 4;
if (num1 != 0)
num2 = 6;
if (++this.frameCounter > num2)
{
this.frameCounter = 0;
if (++this.frame > 3)
this.frame = 0;
}
this.spriteDirection = -1;
if ((double) this.velocity.X > 0.0)
this.spriteDirection = 1;
if (num1 != 0)
{
Lighting.AddLight(this.Center, new Vector3(1f, 0.6f, 0.1f) * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue));
this.rotation = this.velocity.X * 0.2f;
if ((double) this.velocity.Y < -1.0)
{
this.velocity.Y *= 0.99f;
}
else
{
this.velocity.Y += (float) Math.Sin((double) (this.timeLeft % 200) / 200.0 * 6.28318548202515) * 0.25f;
if ((double) this.velocity.Y > 0.5)
this.velocity.Y *= 0.8f;
this.velocity.Y = MathHelper.Clamp(this.velocity.Y, -1.5f, 1.5f);
}
float num3 = Main.WindForVisuals;
if ((double) num3 == 0.0)
num3 = 0.1f;
this.velocity.X += 0.0525f * num3;
this.velocity.X = MathHelper.Clamp(this.velocity.X, -2f, 2f);
}
else
{
this.rotation = this.velocity.X * 0.15f;
this.velocity.Y -= 0.025f;
if ((double) this.velocity.Y < -3.0)
this.velocity.Y = -3f;
this.velocity.X = MathHelper.Clamp(this.velocity.X, -5f, 5f);
}
if (this.timeLeft < 90)
this.alpha += 3;
if (this.alpha < (int) byte.MaxValue)
return;
this.Kill();
}
private void AI_161_RapierStabs()
{
Player player = Main.player[this.owner];
this.rotation = this.velocity.ToRotation() + 1.570796f;
++this.ai[0];
this.Opacity = Utils.GetLerpValue(0.0f, 7f, this.ai[0], true) * Utils.GetLerpValue(16f, 12f, this.ai[0], true);
this.Center = player.RotatedRelativePoint(player.MountedCenter, addGfxOffY: false) + this.velocity * (this.ai[0] - 1f);
this.spriteDirection = (double) Vector2.Dot(this.velocity, Vector2.UnitX) < 0.0 ? -1 : 1;
if ((double) this.ai[0] >= 16.0)
this.Kill();
else
player.heldProj = this.whoAmI;
}
private void AI_165_Whip()
{
Player player = Main.player[this.owner];
this.rotation = this.velocity.ToRotation() + 1.570796f;
++this.ai[0];
float timeToFlyOut;
Projectile.GetWhipSettings(this, out timeToFlyOut, out int _, out float _);
this.Center = Main.GetPlayerArmPosition(this) + this.velocity * (this.ai[0] - 1f);
this.spriteDirection = (double) Vector2.Dot(this.velocity, Vector2.UnitX) < 0.0 ? -1 : 1;
if ((double) this.ai[0] >= (double) timeToFlyOut || player.itemAnimation == 0)
{
this.Kill();
}
else
{
player.heldProj = this.whoAmI;
player.itemAnimation = player.itemAnimationMax - (int) ((double) this.ai[0] / (double) this.MaxUpdates);
player.itemTime = player.itemAnimation;
if ((double) this.ai[0] == (double) (int) ((double) timeToFlyOut / 2.0))
{
this._whipPointsForCollision.Clear();
Projectile.FillWhipControlPoints(this, this._whipPointsForCollision);
Vector2 position = this._whipPointsForCollision[this._whipPointsForCollision.Count - 1];
SoundEngine.PlaySound(SoundID.Item153, position);
}
switch (this.type)
{
case 847:
float t1 = this.ai[0] / timeToFlyOut;
if ((double) Utils.GetLerpValue(0.1f, 0.7f, t1, true) * (double) Utils.GetLerpValue(0.9f, 0.7f, t1, true) <= 0.5 || Main.rand.Next(3) == 0)
break;
this._whipPointsForCollision.Clear();
Projectile.FillWhipControlPoints(this, this._whipPointsForCollision);
int index1 = Main.rand.Next(this._whipPointsForCollision.Count - 10, this._whipPointsForCollision.Count);
Microsoft.Xna.Framework.Rectangle r1 = Utils.CenteredRectangle(this._whipPointsForCollision[index1], new Vector2(30f, 30f));
int Type = 57;
if (Main.rand.Next(3) == 0)
Type = 43;
Dust dust1 = Dust.NewDustDirect(r1.TopLeft(), r1.Width, r1.Height, Type, Alpha: 100, newColor: Color.White);
dust1.position = this._whipPointsForCollision[index1];
dust1.fadeIn = 0.3f;
Vector2 spinningpoint = this._whipPointsForCollision[index1] - this._whipPointsForCollision[index1 - 1];
dust1.noGravity = true;
dust1.velocity *= 0.5f;
dust1.velocity += spinningpoint.RotatedBy((double) player.direction * 1.57079637050629);
dust1.velocity *= 0.5f;
break;
case 848:
float t2 = this.ai[0] / timeToFlyOut;
float num1 = Utils.GetLerpValue(0.1f, 0.7f, t2, true) * Utils.GetLerpValue(0.9f, 0.7f, t2, true);
if ((double) num1 <= 0.100000001490116 || (double) Main.rand.NextFloat() >= (double) num1 / 2.0)
break;
this._whipPointsForCollision.Clear();
Projectile.FillWhipControlPoints(this, this._whipPointsForCollision);
Microsoft.Xna.Framework.Rectangle r2 = Utils.CenteredRectangle(this._whipPointsForCollision[this._whipPointsForCollision.Count - 1], new Vector2(30f, 30f));
int index2 = Dust.NewDust(r2.TopLeft(), r2.Width, r2.Height, 172, Alpha: 100, Scale: 1.5f);
Main.dust[index2].noGravity = true;
Main.dust[index2].velocity.X /= 2f;
Main.dust[index2].velocity.Y /= 2f;
break;
case 849:
float t3 = this.ai[0] / timeToFlyOut;
double lerpValue1 = (double) Utils.GetLerpValue(0.1f, 0.7f, t3, true);
double lerpValue2 = (double) Utils.GetLerpValue(0.9f, 0.7f, t3, true);
if ((double) t3 <= 0.400000005960464 || Main.rand.Next(9) == 0)
break;
this._whipPointsForCollision.Clear();
Projectile.FillWhipControlPoints(this, this._whipPointsForCollision);
Microsoft.Xna.Framework.Rectangle r3 = Utils.CenteredRectangle(this._whipPointsForCollision[this._whipPointsForCollision.Count - 1], new Vector2(30f, 30f));
Vector2 vector2_1 = this._whipPointsForCollision[this._whipPointsForCollision.Count - 2].DirectionTo(this._whipPointsForCollision[this._whipPointsForCollision.Count - 1]).SafeNormalize(Vector2.Zero);
Dust dust2 = Dust.NewDustDirect(r3.TopLeft(), r3.Width, r3.Height, 191, Scale: 1.3f);
dust2.noGravity = true;
dust2.velocity += vector2_1 * 2f;
if (Main.rand.Next(2) == 0)
ParticleOrchestrator.RequestParticleSpawn(true, ParticleOrchestraType.BlackLightningSmall, new ParticleOrchestraSettings()
{
MovementVector = vector2_1,
PositionInWorld = r3.Center.ToVector2()
}, new int?(this.owner));
Lighting.AddLight(r3.Center.ToVector2(), new Vector3(0.2f, 0.0f, 0.4f));
break;
case 912:
float t4 = this.ai[0] / timeToFlyOut;
float num2 = Utils.GetLerpValue(0.1f, 0.7f, t4, true) * Utils.GetLerpValue(0.9f, 0.7f, t4, true);
if ((double) num2 <= 0.100000001490116 || (double) Main.rand.NextFloat() >= (double) num2 / 2.0)
break;
this._whipPointsForCollision.Clear();
Projectile.FillWhipControlPoints(this, this._whipPointsForCollision);
Microsoft.Xna.Framework.Rectangle r4 = Utils.CenteredRectangle(this._whipPointsForCollision[this._whipPointsForCollision.Count - 1], new Vector2(30f, 30f));
Vector2 vector2_2 = this._whipPointsForCollision[this._whipPointsForCollision.Count - 2].DirectionTo(this._whipPointsForCollision[this._whipPointsForCollision.Count - 1]).SafeNormalize(Vector2.Zero);
for (int index3 = 0; index3 < 3; ++index3)
{
Dust dust3 = Dust.NewDustDirect(r4.TopLeft(), r4.Width, r4.Height, 16, Scale: 1.2f);
dust3.noGravity = true;
dust3.velocity += vector2_2 * 2f;
}
for (int index4 = 0; index4 < 1; ++index4)
Dust.NewDustDirect(r4.TopLeft(), r4.Width, r4.Height, 13, Scale: 0.8f).velocity += vector2_2 * 2f;
for (int index5 = 0; index5 < 3; ++index5)
{
if (Main.rand.Next(2) != 0)
{
Dust dust4 = Dust.NewDustDirect(r4.TopLeft(), r4.Width, r4.Height, 261, newColor: Color.Transparent, Scale: 0.8f);
dust4.velocity += vector2_2 * 2f;
dust4.velocity *= 0.3f;
dust4.noGravity = true;
}
}
Lighting.AddLight(r4.Center.ToVector2(), new Vector3(0.1f, 0.1f, 0.2f));
break;
case 913:
float t5 = this.ai[0] / timeToFlyOut;
float num3 = Utils.GetLerpValue(0.1f, 0.7f, t5, true) * Utils.GetLerpValue(0.9f, 0.7f, t5, true);
if ((double) num3 <= 0.100000001490116 || (double) Main.rand.NextFloat() >= (double) num3)
break;
this._whipPointsForCollision.Clear();
Projectile.FillWhipControlPoints(this, this._whipPointsForCollision);
Microsoft.Xna.Framework.Rectangle r5 = Utils.CenteredRectangle(this._whipPointsForCollision[this._whipPointsForCollision.Count - 1], new Vector2(20f, 20f));
Vector2 vector2_3 = this._whipPointsForCollision[this._whipPointsForCollision.Count - 2].DirectionTo(this._whipPointsForCollision[this._whipPointsForCollision.Count - 1]).SafeNormalize(Vector2.Zero);
for (int index6 = 0; index6 < 3; ++index6)
{
if (Main.rand.Next(3) == 0)
{
if (Main.rand.Next(7) == 0)
{
Dust dust5 = Dust.NewDustDirect(r5.TopLeft(), r5.Width, r5.Height, 31);
dust5.velocity.X /= 2f;
dust5.velocity.Y /= 2f;
dust5.velocity += vector2_3 * 2f;
dust5.fadeIn = (float) (1.0 + (double) Main.rand.NextFloat() * 0.600000023841858);
dust5.noGravity = true;
}
else
{
Dust dust6 = Dust.NewDustDirect(r5.TopLeft(), r5.Width, r5.Height, 6, Scale: 1.2f);
dust6.velocity += vector2_3 * 2f;
if (Main.rand.Next(3) != 0)
{
dust6.fadeIn = (float) (0.699999988079071 + (double) Main.rand.NextFloat() * 0.899999976158142);
dust6.scale = 0.6f;
dust6.noGravity = true;
}
}
}
}
break;
case 914:
float t6 = this.ai[0] / timeToFlyOut;
float num4 = Utils.GetLerpValue(0.1f, 0.7f, t6, true) * Utils.GetLerpValue(0.9f, 0.7f, t6, true);
if ((double) num4 <= 0.100000001490116 || (double) Main.rand.NextFloat() >= (double) num4 / 2.0)
break;
this._whipPointsForCollision.Clear();
Projectile.FillWhipControlPoints(this, this._whipPointsForCollision);
Microsoft.Xna.Framework.Rectangle r6 = Utils.CenteredRectangle(this._whipPointsForCollision[this._whipPointsForCollision.Count - 1], new Vector2(30f, 30f));
Vector2 vector2_4 = this._whipPointsForCollision[this._whipPointsForCollision.Count - 2].DirectionTo(this._whipPointsForCollision[this._whipPointsForCollision.Count - 1]).SafeNormalize(Vector2.Zero);
Dust dust7 = Dust.NewDustDirect(r6.TopLeft(), r6.Width, r6.Height, 39, Scale: 1.2f);
dust7.noGravity = Main.rand.Next(3) == 0;
dust7.velocity += vector2_4 * 2f;
break;
case 915:
float t7 = this.ai[0] / timeToFlyOut;
if ((double) Utils.GetLerpValue(0.1f, 0.7f, t7, true) * (double) Utils.GetLerpValue(0.9f, 0.7f, t7, true) <= 0.100000001490116)
break;
this._whipPointsForCollision.Clear();
Projectile.FillWhipControlPoints(this, this._whipPointsForCollision);
Microsoft.Xna.Framework.Rectangle r7 = Utils.CenteredRectangle(this._whipPointsForCollision[this._whipPointsForCollision.Count - 1], new Vector2(30f, 30f));
Vector2 vector2_5 = this._whipPointsForCollision[this._whipPointsForCollision.Count - 2].DirectionTo(this._whipPointsForCollision[this._whipPointsForCollision.Count - 1]).SafeNormalize(Vector2.Zero);
Dust rf = Dust.NewDustDirect(r7.TopLeft(), r7.Width, r7.Height, 267, newColor: Main.hslToRgb((float) ((double) player.miscCounterNormalized * 9.0 % 1.0), 1f, 0.5f), Scale: 1.3f);
rf.velocity *= Main.rand.NextFloat() * 0.8f;
rf.noGravity = true;
rf.scale = (float) (0.899999976158142 + (double) Main.rand.NextFloat() * 0.899999976158142);
rf.fadeIn = Main.rand.NextFloat() * 0.9f;
rf.velocity += vector2_5 * 2f;
if (rf.dustIndex == 6000)
break;
Dust dust8 = Dust.CloneDust(rf);
dust8.scale /= 2f;
dust8.fadeIn *= 0.85f;
dust8.color = new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue);
break;
}
}
}
public static void FillWhipControlPoints(Projectile proj, List<Vector2> controlPoints)
{
float timeToFlyOut;
int segments;
float rangeMultiplier;
Projectile.GetWhipSettings(proj, out timeToFlyOut, out segments, out rangeMultiplier);
float num1 = proj.ai[0] / timeToFlyOut;
float num2 = 0.5f;
float y = 1f + num2;
float num3 = (float) (31.4159278869629 * (1.0 - (double) num1 * (double) y)) * (float) -proj.spriteDirection / (float) segments;
float num4 = num1 * y;
float amount = 0.0f;
if ((double) num4 > 1.0)
{
amount = (num4 - 1f) / num2;
num4 = MathHelper.Lerp(1f, 0.0f, amount);
}
float num5 = proj.ai[0] - 1f;
float num6 = (float) (Main.player[proj.owner].HeldItem.useAnimation * 2) * num1;
float num7 = proj.velocity.Length() * num6 * num4 * rangeMultiplier / (float) segments;
float num8 = 1f;
Vector2 playerArmPosition = Main.GetPlayerArmPosition(proj);
Vector2 vector2_1 = playerArmPosition;
double num9 = 0.0;
float f1 = (float) (num9 - 1.57079637050629);
Vector2 vector2_2 = vector2_1;
float f2 = (float) (num9 + 1.57079637050629 + 1.57079637050629 * (double) proj.spriteDirection);
Vector2 vector2_3 = vector2_1;
float f3 = (float) (num9 + 1.57079637050629);
controlPoints.Add(playerArmPosition);
for (int index = 0; index < segments; ++index)
{
float num10 = (float) index / (float) segments;
float num11 = num3 * num10 * num8;
Vector2 vector2_4 = vector2_1 + f1.ToRotationVector2() * num7;
Vector2 vector2_5 = vector2_3 + f3.ToRotationVector2() * (num7 * 2f);
Vector2 vector2_6 = vector2_2 + f2.ToRotationVector2() * (num7 * 2f);
float num12 = 1f - num4;
float num13 = (float) (1.0 - (double) num12 * (double) num12);
Vector2 vector2_7 = Vector2.Lerp(vector2_6, Vector2.Lerp(vector2_5, vector2_4, (float) ((double) num13 * 0.899999976158142 + 0.100000001490116)), (float) ((double) num13 * 0.699999988079071 + 0.300000011920929));
Vector2 spinningpoint = playerArmPosition + (vector2_7 - playerArmPosition) * new Vector2(1f, y);
float num14 = amount;
float num15 = num14 * num14;
double radians = (double) proj.rotation + 4.71238899230957 * (double) num15 * (double) proj.spriteDirection;
Vector2 center = playerArmPosition;
Vector2 vector2_8 = spinningpoint.RotatedBy(radians, center);
controlPoints.Add(vector2_8);
f1 += num11;
f3 += num11;
f2 += num11;
vector2_1 = vector2_4;
vector2_3 = vector2_5;
vector2_2 = vector2_6;
}
}
public static void GetWhipSettings(
Projectile proj,
out float timeToFlyOut,
out int segments,
out float rangeMultiplier)
{
timeToFlyOut = (float) (Main.player[proj.owner].itemAnimationMax * proj.MaxUpdates);
segments = 20;
rangeMultiplier = 1f;
switch (proj.type)
{
case 841:
rangeMultiplier *= 0.75f;
break;
case 847:
segments = 20;
rangeMultiplier *= 1.2f;
break;
case 848:
rangeMultiplier = 0.7f;
break;
case 849:
segments = 30;
rangeMultiplier = 1.2f;
break;
case 912:
rangeMultiplier *= 1.3f;
break;
case 913:
rangeMultiplier *= 1.2f;
break;
case 914:
rangeMultiplier *= 0.9f;
break;
case 915:
segments = 40;
rangeMultiplier = 1.5f;
break;
}
}
private void AI_160_Kites()
{
Player player = Main.player[this.owner];
Vector2 vector2_1 = player.RotatedRelativePoint(player.MountedCenter);
this.timeLeft = 60;
bool flag = false;
if (player.CCed || player.noItems)
flag = true;
else if (player.inventory[player.selectedItem].shoot != this.type)
flag = true;
else if (player.pulley)
flag = true;
else if (player.dead)
flag = true;
if (!flag)
flag = (double) (player.Center - this.Center).Length() > 2000.0;
if (flag)
{
this.Kill();
}
else
{
float min = 4f;
float max = 500f;
float num1 = max / 2f;
if (this.owner == Main.myPlayer && this.extraUpdates == 0)
{
double num2 = (double) this.ai[0];
if ((double) this.ai[0] == 0.0)
this.ai[0] = num1;
float num3 = this.ai[0];
if (Main.mouseRight)
num3 -= 5f;
if (Main.mouseLeft)
num3 += 5f;
this.ai[0] = MathHelper.Clamp(num3, min, max);
double num4 = (double) num3;
if (num2 != num4)
this.netUpdate = true;
}
if (this.numUpdates == 1)
this.extraUpdates = 0;
int num5 = 0;
float cloudAlpha = Main.cloudAlpha;
float x = 0.0f;
if (WorldGen.InAPlaceWithWind(this.position, this.width, this.height))
x = Main.WindForVisuals;
float num6 = Utils.GetLerpValue(0.2f, 0.5f, Math.Abs(x), true) * 0.5f;
switch (num5)
{
case 0:
Vector2 mouseWorld = Main.MouseWorld;
Vector2 Other = this.Center + new Vector2(x, (float) Math.Sin((double) Main.GlobalTimeWrappedHourly) + cloudAlpha * 5f) * 25f;
Vector2 vector2_2 = (Other - this.Center).SafeNormalize(Vector2.Zero) * (float) (3.0 + (double) cloudAlpha * 7.0);
if ((double) num6 == 0.0)
vector2_2 = this.velocity;
float t = this.Distance(Other);
float lerpValue = Utils.GetLerpValue(5f, 10f, t, true);
float y = this.velocity.Y;
if ((double) t > 10.0)
this.velocity = Vector2.Lerp(this.velocity, vector2_2, 0.075f * lerpValue);
this.velocity.Y = y;
this.velocity.Y -= num6;
this.velocity.Y += (float) (0.0199999995529652 + (double) num6 * 0.25);
this.velocity.Y = MathHelper.Clamp(this.velocity.Y, -2f, 2f);
if ((double) this.Center.Y + (double) this.velocity.Y < (double) Other.Y)
this.velocity.Y = MathHelper.Lerp(this.velocity.Y, (float) ((double) this.velocity.Y + (double) num6 + 0.00999999977648258), 0.75f);
this.velocity.X *= 0.98f;
float num7 = this.Distance(vector2_1);
float num8 = this.ai[0];
if ((double) num7 > (double) num8)
{
Vector2 vector2_3 = this.DirectionTo(vector2_1);
float num9 = num7 - num8;
this.Center = this.Center + vector2_3 * num9;
int num10 = (double) Vector2.Dot(vector2_3, Vector2.UnitY) < 0.800000011920929 ? 1 : ((double) num6 > 0.0 ? 1 : 0);
this.velocity.Y += vector2_3.Y * 0.05f;
if (num10 != 0)
this.velocity.Y -= 0.15f;
this.velocity.X += vector2_3.X * 0.2f;
if ((double) num8 == (double) min && this.owner == Main.myPlayer)
{
this.Kill();
return;
}
break;
}
break;
case 1:
this.velocity = Vector2.Lerp(this.velocity, this.DirectionTo(vector2_1) * 16f, 1f);
if ((double) this.Distance(vector2_1) < 10.0 && this.owner == Main.myPlayer)
{
this.Kill();
return;
}
break;
}
this.timeLeft = 2;
Vector2 vector2_4 = this.Center - vector2_1;
int dir = (double) vector2_4.X > 0.0 ? 1 : -1;
if ((double) Math.Abs(vector2_4.X) > (double) Math.Abs(vector2_4.Y) / 2.0)
player.ChangeDir(dir);
Vector2 vector2_5 = this.DirectionTo(vector2_1).SafeNormalize(Vector2.Zero);
if (((double) num6 != 0.0 ? 0 : ((double) this.velocity.Y > -0.0199999995529652 ? 1 : 0)) != 0)
{
this.rotation *= 0.95f;
}
else
{
float num11 = (-vector2_5).ToRotation() + 0.7853982f;
if (this.spriteDirection == -1)
num11 -= 1.570796f * (float) player.direction;
this.rotation = num11 + this.velocity.X * 0.05f;
}
float num12 = this.velocity.Length();
switch (this.type)
{
case 771:
case 822:
case 823:
case 827:
case 830:
case 838:
case 843:
case 844:
case 845:
case 846:
case 850:
case 852:
this.frame = 0;
break;
case 824:
case 839:
case 840:
case 853:
if ((double) num6 < 0.150000005960464)
{
this.frame = 0;
break;
}
++this.frameCounter;
if ((double) this.frameCounter > (1.0 - (double) num6) * 10.0)
{
this.frameCounter = 0;
this.frame = Main.rand.Next(4);
break;
}
break;
case 826:
this.frame = (int) this.ai[1];
break;
case 828:
case 829:
this.frame = (double) num12 >= 6.0 ? 0 : 1;
break;
default:
this.frame = (double) num12 >= 3.0 ? ((double) num12 >= 5.0 ? ((double) num12 >= 7.0 ? 3 : 2) : 1) : 0;
break;
}
this.spriteDirection = player.direction;
}
}
private void AI_159_PaperAirplanes()
{
if ((double) this.ai[1] == 0.0)
{
this.direction = (double) this.velocity.X > 0.0 ? 1 : -1;
this.rotation = this.velocity.ToRotation();
this.ai[1] = 1f;
this.ai[0] = (float) -Main.rand.Next(30, 80);
this.netUpdate = true;
}
if (this.wet && this.owner == Main.myPlayer)
this.Kill();
++this.ai[0];
Vector2 spinningpoint = this.rotation.ToRotationVector2() * 8f;
float y = (float) Math.Sin(6.28318548202515 * (Main.timeForVisualEffects % 90.0 / 90.0)) * (float) this.direction * Main.WindForVisuals;
Vector2 v = spinningpoint + new Vector2(Main.WindForVisuals, y);
Vector2 vector2 = Vector2.UnitX * (float) this.direction;
bool flag = this.direction == Math.Sign(Main.WindForVisuals) && (double) this.velocity.Length() > 3.0;
int num1 = (double) this.ai[0] < 20.0 ? 0 : ((double) this.ai[0] <= 69.0 ? 1 : 0);
if ((double) this.ai[0] == 70.0)
this.ai[0] = (float) -Main.rand.Next(120, 600);
int num2 = flag ? 1 : 0;
int num3 = num1 & num2;
if (num3 != 0)
{
float lerpValue = Utils.GetLerpValue(0.0f, 30f, this.ai[0], true);
v = spinningpoint.RotatedBy((double) -this.direction * 6.28318548202515 * 0.0199999995529652 * (double) lerpValue);
}
this.velocity = v.SafeNormalize(Vector2.UnitY) * this.velocity.Length();
if (num3 == 0)
{
float num4 = MathHelper.Lerp(0.15f, 0.05f, Math.Abs(Main.WindForVisuals));
if (this.timeLeft % 40 < 20)
this.velocity.Y -= num4;
else
this.velocity.Y += num4;
if ((double) this.velocity.Y < -2.0)
this.velocity.Y = -2f;
if ((double) this.velocity.Y > 2.0)
this.velocity.Y = 2f;
this.velocity.X = MathHelper.Clamp(this.velocity.X + Main.WindForVisuals * (3f / 500f), -6f, 6f);
if ((double) this.velocity.X * (double) this.oldVelocity.X < 0.0)
{
this.direction *= -1;
this.ai[0] = (float) -Main.rand.Next(120, 300);
this.netUpdate = true;
}
}
this.rotation = this.velocity.ToRotation();
this.spriteDirection = this.direction;
}
private void AI_158_BabyBird()
{
Player master = Main.player[this.owner];
if (this.type == 759)
{
if (master.dead)
master.babyBird = false;
if (master.babyBird)
this.timeLeft = 2;
if (++this.frameCounter >= 6)
{
this.frameCounter = 0;
if (++this.frame >= Main.projFrames[this.type] - 1)
this.frame = 0;
}
}
float num1 = 6f;
float num2 = 8f;
int startAttackRange = 800;
float num3 = 150f;
int attackTarget = -1;
this.Minion_FindTargetInRange(startAttackRange, ref attackTarget, false);
if (attackTarget != -1)
{
NPC npc = Main.npc[attackTarget];
if ((double) master.Distance(npc.Center) > (double) startAttackRange)
attackTarget = -1;
}
if (attackTarget != -1)
{
if (!Collision.SolidCollision(this.position, this.width, this.height))
this.tileCollide = true;
NPC npc = Main.npc[attackTarget];
float num4 = this.Distance(npc.Center);
if (new Microsoft.Xna.Framework.Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height).Intersects(new Microsoft.Xna.Framework.Rectangle((int) npc.position.X, (int) npc.position.Y, npc.width, npc.height)))
{
this.tileCollide = false;
if ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y) < (double) num2)
this.velocity = this.velocity * 1.1f;
if ((double) this.velocity.Length() > (double) num2)
this.velocity = this.velocity * (num1 / this.velocity.Length());
}
else if ((double) num4 > (double) num3)
{
this.velocity = Vector2.Lerp(this.velocity, this.DirectionTo(npc.Center) * num1, 0.075f);
}
else
{
this.tileCollide = false;
Vector2 vector2 = this.DirectionTo(npc.Center);
this.velocity = this.velocity + new Vector2((float) Math.Sign(vector2.X), (float) Math.Sign(vector2.Y)) * 0.3f;
if ((double) this.velocity.Length() > (double) num2)
this.velocity = this.velocity * (num2 / this.velocity.Length());
}
float num5 = 0.025f;
float num6 = (float) (this.width * 3);
for (int index = 0; index < 1000; ++index)
{
if (index != this.whoAmI && Main.projectile[index].active && Main.projectile[index].owner == this.owner && Main.projectile[index].type == this.type && (double) Math.Abs(this.position.X - Main.projectile[index].position.X) + (double) Math.Abs(this.position.Y - Main.projectile[index].position.Y) < (double) num6)
{
if ((double) this.position.X < (double) Main.projectile[index].position.X)
this.velocity.X -= num5;
else
this.velocity.X += num5;
if ((double) this.position.Y < (double) Main.projectile[index].position.Y)
this.velocity.Y -= num5;
else
this.velocity.Y += num5;
}
}
this.rotation = this.velocity.X * 0.1f;
this.direction = (double) this.velocity.X > 0.0 ? 1 : -1;
this.spriteDirection = (double) this.velocity.X > 0.0 ? 1 : -1;
}
else
{
this.tileCollide = false;
List<int> blacklistedTargets = Projectile._ai158_blacklistedTargets;
blacklistedTargets.Clear();
int index1;
this.AI_GetMyGroupIndexAndFillBlackList(blacklistedTargets, out index1, out int _);
this.localAI[0] = (float) index1;
Vector2 homeLocation = Projectile.AI_158_GetHomeLocation(master, index1);
float t = this.Distance(homeLocation);
bool flag = (double) master.gravDir > 0.0 && (double) master.fullRotation == 0.0 && (double) master.headRotation == 0.0;
if ((double) t > 2000.0)
{
this.Center = homeLocation;
this.frame = Main.projFrames[this.type] - 1;
this.frameCounter = 0;
this.velocity = Vector2.Zero;
this.direction = this.spriteDirection = master.direction;
this.rotation = 0.0f;
}
else if ((double) t > 40.0)
{
float num7 = num1 + t * (3f / 500f);
this.velocity = Vector2.Lerp(this.velocity, this.DirectionTo(homeLocation) * MathHelper.Lerp(1f, 5f, Utils.GetLerpValue(40f, 800f, t, true)) * num7, 0.025f);
if ((double) this.velocity.Length() > (double) num7)
this.velocity = this.velocity * (num7 / this.velocity.Length());
float num8 = 0.05f;
float width = (float) this.width;
for (int index2 = 0; index2 < 1000; ++index2)
{
if (index2 != this.whoAmI && Main.projectile[index2].active && Main.projectile[index2].owner == this.owner && Main.projectile[index2].type == this.type && (double) Math.Abs(this.position.X - Main.projectile[index2].position.X) + (double) Math.Abs(this.position.Y - Main.projectile[index2].position.Y) < (double) width)
{
if ((double) this.position.X < (double) Main.projectile[index2].position.X)
this.velocity.X -= num8;
else
this.velocity.X += num8;
if ((double) this.position.Y < (double) Main.projectile[index2].position.Y)
this.velocity.Y -= num8;
else
this.velocity.Y += num8;
}
}
this.rotation = this.velocity.X * 0.04f;
this.direction = (double) this.velocity.X > 0.0 ? 1 : -1;
this.spriteDirection = (double) this.velocity.X > 0.0 ? 1 : -1;
}
else if ((double) t > 8.0 + (double) master.velocity.Length())
{
Vector2 vector2 = this.DirectionTo(homeLocation);
this.velocity = this.velocity + new Vector2((float) Math.Sign(vector2.X), (float) Math.Sign(vector2.Y)) * 0.05f;
if ((double) this.velocity.Length() > (double) num1)
this.velocity = this.velocity * (num1 / this.velocity.Length());
this.rotation = this.velocity.X * 0.1f;
this.direction = (double) this.velocity.X > 0.0 ? 1 : -1;
this.spriteDirection = (double) this.velocity.X > 0.0 ? 1 : -1;
}
else
{
if (!flag)
return;
this.Center = homeLocation;
this.frame = Main.projFrames[this.type] - 1;
this.frameCounter = 0;
this.velocity = Vector2.Zero;
this.direction = this.spriteDirection = master.direction;
this.rotation = 0.0f;
}
}
}
public static Vector2 AI_158_GetHomeLocation(Player master, int stackedIndex)
{
int num = master.bodyFrame.Height;
if (num == 0)
num = 1;
Vector2 vector2_1 = Main.OffsetsPlayerHeadgear[master.bodyFrame.Y / num];
vector2_1.Y -= 2f;
switch (stackedIndex % 6)
{
case 1:
vector2_1 += new Vector2((float) (master.direction * 8), master.gravDir * -2f);
break;
case 2:
vector2_1 += new Vector2((float) (master.direction * -10), master.gravDir * -2f);
break;
case 3:
Vector2 vector2_2 = vector2_1;
int direction1 = master.direction;
Vector2 vector2_3 = new Vector2(0.0f, master.gravDir * -10f);
vector2_1 = vector2_2 + vector2_3;
break;
case 4:
vector2_1 += new Vector2((float) (master.direction * 10), master.gravDir * -10f);
break;
case 5:
vector2_1 += new Vector2((float) (master.direction * -12), master.gravDir * -10f);
break;
}
Vector2 vector2_4 = vector2_1 + new Vector2(0.0f, master.gravDir * -16f) * (float) (stackedIndex / 6);
Vector2 vector2_5 = master.RotatedRelativePoint(master.MountedCenter);
int direction2 = master.direction;
Vector2 vector2_6 = new Vector2(0.0f, master.gravDir * -21f);
return (vector2_5 + vector2_6 + vector2_4).Floor();
}
private void Minion_FindTargetInRange(
int startAttackRange,
ref int attackTarget,
bool skipIfCannotHitWithOwnBody,
Func<Entity, int, bool> customEliminationCheck = null)
{
float maxDistance = (float) startAttackRange;
float val1 = maxDistance;
float val2 = maxDistance;
NPC minionAttackTargetNpc = this.OwnerMinionAttackTargetNPC;
if (minionAttackTargetNpc != null && minionAttackTargetNpc.CanBeChasedBy((object) this) && this.IsInRangeOfMeOrMyOwner((Entity) minionAttackTargetNpc, maxDistance, out float _, out float _, out bool _))
{
attackTarget = minionAttackTargetNpc.whoAmI;
}
else
{
if (attackTarget >= 0)
return;
for (int index = 0; index < 200; ++index)
{
NPC npc = Main.npc[index];
float myDistance;
float playerDistance;
bool closerIsMe;
if (npc.CanBeChasedBy((object) this) && this.IsInRangeOfMeOrMyOwner((Entity) npc, maxDistance, out myDistance, out playerDistance, out closerIsMe) && (!skipIfCannotHitWithOwnBody || this.CanHitWithOwnBody((Entity) npc)) && (customEliminationCheck == null || customEliminationCheck((Entity) npc, attackTarget)))
{
attackTarget = index;
float num = closerIsMe ? myDistance : playerDistance;
if ((double) val1 > (double) myDistance)
val1 = myDistance;
if ((double) val2 > (double) playerDistance)
val2 = playerDistance;
maxDistance = Math.Max(val1, val2);
}
}
}
}
private bool AI_067_CustomEliminationCheck_Pirates(Entity otherEntity, int currentTarget) => true;
private bool AI_067_TigerSpecialAttack()
{
List<NPC> npcList = new List<NPC>();
Vector2 center = Main.player[this.owner].Center;
Microsoft.Xna.Framework.Rectangle rectangle = Utils.CenteredRectangle(center, new Vector2(1600f, 800f));
int num1 = Main.player[this.owner].ownedProjectileCounts[831] + 1;
for (int index = 0; index < 200; ++index)
{
NPC npc = Main.npc[index];
if (npc.CanBeChasedBy((object) this) && npc.Hitbox.Intersects(rectangle))
npcList.Add(npc);
}
if (npcList.Count == 0)
return false;
NPC npc1 = npcList[0];
for (int index = 1; index < npcList.Count; ++index)
{
if ((double) Vector2.Distance(npc1.Center, center) > (double) Vector2.Distance(npcList[index].Center, center))
npc1 = npcList[index];
}
npcList.Remove(npc1);
NPC npc2 = (NPC) null;
if (npcList.Count > 0)
{
npc2 = npcList[0];
for (int index = 1; index < npcList.Count; ++index)
{
if ((double) this.Distance(npc2.Center) > (double) this.Distance(npcList[index].Center))
npc2 = npcList[index];
}
npcList.Remove(npc2);
}
List<Vector2> vector2List = new List<Vector2>();
if (npc2 != null)
vector2List.Add(npc2.Center);
int num2 = 0;
while (npcList.Count > 0 && vector2List.Count < num1 - 1)
{
int index = Main.rand.Next(npcList.Count);
Vector2 vector2 = npcList[index].velocity * 4f * (float) (num2 + 1);
vector2List.Add(npcList[index].Center + vector2);
npcList.RemoveAt(index);
++num2;
}
if (npc1 != null)
vector2List.Add(npc1.Center);
Vector2 position = this.Center;
float num3 = (float) Math.Min(20, 30 / vector2List.Count);
float num4 = 0.0f;
for (int index = 0; index < vector2List.Count; ++index)
{
float num5 = 20f;
Vector2 vector2 = vector2List[index];
vector2.X += (double) position.X < (double) vector2.X ? num5 : -num5;
Vector2 velocity = vector2 - position;
int num6 = (int) Math.Min((double) num3, 4.0 + Math.Ceiling((double) velocity.Length() / 50.0));
if (num6 < 5)
num6 = 5;
Projectile.NewProjectile(position, velocity, 818, this.damage, 0.0f, this.owner, (float) (-(double) num4 * 4.0), (float) (num6 * 4));
position = vector2;
num4 += (float) num6;
}
this.Center = position;
this.ai[0] = 4f;
this.ai[1] = num4;
this.netUpdate = true;
return true;
}
private void AI_067_FreakingPirates()
{
Player player = Main.player[this.owner];
if (!player.active)
{
this.active = false;
}
else
{
bool flag1 = this.type == 393 || this.type == 394 || this.type == 395;
bool flag2 = this.type == 758;
bool flag3 = this.type == 833 || this.type == 834 || this.type == 835;
bool flag4 = this.type == 834 || this.type == 835;
int startAttackRange = 450;
float num1 = 500f;
float num2 = 300f;
if (flag1)
{
if (player.dead)
player.pirateMinion = false;
if (player.pirateMinion)
this.timeLeft = 2;
startAttackRange = 800;
}
Color color;
if (flag3)
{
if (player.dead)
player.stormTiger = false;
if (player.stormTiger)
this.timeLeft = 2;
startAttackRange = 800;
if ((double) this.ai[0] != 4.0)
{
if (this.velocity != Vector2.Zero && Main.rand.Next(18) == 0)
{
Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, 269)];
dust.fadeIn = 0.5f;
dust.scale = 0.3f;
dust.noLight = true;
dust.velocity += this.velocity * 0.005f;
}
if (this.type == 833)
Lighting.AddLight(this.Center, Vector3.One * 0.5f);
if (this.type == 834)
Lighting.AddLight(this.Center, Vector3.One * 0.8f);
if (this.type == 835)
{
Vector2 center = this.Center;
color = Color.Lerp(Main.OurFavoriteColor, Color.White, 0.8f);
Vector3 rgb = color.ToVector3() * 1f;
Lighting.AddLight(center, rgb);
}
}
if (this.owner == Main.myPlayer)
{
if ((double) this.localAI[0] <= 0.0)
{
int num3;
switch (this.type)
{
case 834:
num3 = 300;
break;
case 835:
num3 = 240;
break;
default:
num3 = 360;
break;
}
if (this.damage != 0)
this.localAI[0] = this.AI_067_TigerSpecialAttack() ? (float) num3 : 10f;
}
else
--this.localAI[0];
}
}
if (flag2)
{
if (player.dead)
player.vampireFrog = false;
if (player.vampireFrog)
this.timeLeft = 2;
startAttackRange = 800;
}
if (this.type == 500)
{
num1 = 200f;
if (player.dead)
player.crimsonHeart = false;
if (player.crimsonHeart)
this.timeLeft = 2;
}
if (this.type == 653)
{
num1 = 300f;
if (player.dead)
player.companionCube = false;
if (player.companionCube)
this.timeLeft = 2;
}
if (flag3 && (double) this.ai[0] == 4.0)
{
this.velocity = Vector2.Zero;
this.frame = 9;
if (flag4)
this.frame = 11;
--this.ai[1];
if ((double) this.ai[1] > 0.0)
return;
this.ai[0] = 0.0f;
this.ai[1] = 0.0f;
this.netUpdate = true;
}
Vector2 vector2_1 = player.Center;
if (flag1)
{
vector2_1.X -= (float) ((15 + player.width / 2) * player.direction);
vector2_1.X -= (float) (this.minionPos * 20 * player.direction);
}
else if (flag3)
{
vector2_1.X -= (float) ((15 + player.width / 2) * player.direction);
vector2_1.X -= (float) (this.minionPos * 40 * player.direction);
}
else if (flag2)
{
vector2_1.X -= (float) ((35 + player.width / 2) * player.direction);
vector2_1.X -= (float) (this.minionPos * 40 * player.direction);
}
else if (this.type == 500)
{
vector2_1.X -= (float) ((15 + player.width / 2) * player.direction);
vector2_1.X -= (float) (40 * player.direction);
}
else if (this.type == 653)
vector2_1.X = player.Center.X;
if (this.type == 500)
{
Lighting.AddLight(this.Center, 0.9f, 0.1f, 0.3f);
int num4 = 6;
if (this.frame == 0 || this.frame == 2)
num4 = 12;
if (++this.frameCounter >= num4)
{
this.frameCounter = 0;
if (++this.frame >= Main.projFrames[this.type])
this.frame = 0;
}
this.rotation += this.velocity.X / 20f;
Vector2 spinninpoint = (-Vector2.UnitY).RotatedBy((double) this.rotation).RotatedBy((double) this.direction * 0.200000002980232);
int index = Dust.NewDust(this.Center + spinninpoint * 10f - new Vector2(4f), 0, 0, 5, spinninpoint.X, spinninpoint.Y, newColor: Color.Transparent);
Main.dust[index].scale = 1f;
Main.dust[index].velocity = spinninpoint.RotatedByRandom(0.785398185253143) * 3.5f;
Main.dust[index].noGravity = true;
Main.dust[index].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cLight, Main.player[this.owner]);
}
if (this.type == 653)
{
this.rotation += this.velocity.X / 20f;
if (this.owner >= 0 && this.owner < (int) byte.MaxValue)
{
--Projectile._CompanionCubeScreamCooldown[this.owner];
if ((double) Projectile._CompanionCubeScreamCooldown[this.owner] < 0.0)
Projectile._CompanionCubeScreamCooldown[this.owner] = 0.0f;
}
Tile tileSafely = Framing.GetTileSafely(this.Center);
if (tileSafely.liquid > (byte) 0 && tileSafely.lava())
++this.localAI[0];
else
--this.localAI[0];
this.localAI[0] = MathHelper.Clamp(this.localAI[0], 0.0f, 20f);
if ((double) this.localAI[0] >= 20.0)
{
if ((double) Projectile._CompanionCubeScreamCooldown[this.owner] == 0.0)
{
Projectile._CompanionCubeScreamCooldown[this.owner] = 3600f;
SoundEngine.PlaySound(Main.rand.Next(10) == 0 ? SoundID.NPCDeath61 : SoundID.NPCDeath59, this.position);
}
this.Kill();
}
color = Lighting.GetColor((int) this.Center.X / 16, (int) this.Center.Y / 16);
Vector3 vector3_1 = color.ToVector3();
color = Lighting.GetColor((int) player.Center.X / 16, (int) player.Center.Y / 16);
Vector3 vector3_2 = color.ToVector3();
if ((double) vector3_1.Length() < 0.150000005960464 && (double) vector3_2.Length() < 0.150000005960464)
++this.localAI[1];
else if ((double) this.localAI[1] > 0.0)
--this.localAI[1];
this.localAI[1] = MathHelper.Clamp(this.localAI[1], -3600f, 120f);
if ((double) this.localAI[1] > (double) Main.rand.Next(30, 120) && !player.immune && player.velocity == Vector2.Zero)
{
if (Main.rand.Next(5) == 0)
{
SoundEngine.PlaySound(SoundID.Item16, this.Center);
this.localAI[1] = -600f;
}
else
{
SoundEngine.PlaySound(SoundID.Item1, this.Center);
player.Hurt(PlayerDeathReason.ByOther(6), 3, 0);
player.immune = false;
player.immuneTime = 0;
this.localAI[1] = (float) (Main.rand.Next(30) * -10 - 300);
}
}
}
bool flag5 = true;
if (this.type == 500 || this.type == 653)
flag5 = false;
this.shouldFallThrough = (double) player.position.Y + (double) player.height - 12.0 > (double) this.position.Y + (double) this.height;
this.friendly = false;
int num5 = 0;
int num6 = 15;
int attackTarget = -1;
bool flag6 = true;
if (flag2)
{
num6 = 20;
num5 = 60;
}
if (flag3)
{
flag6 = false;
this.friendly = true;
this.originalDamage = player.highestStormTigerGemOriginalDamage;
}
if ((double) this.ai[0] == 0.0 & flag5)
this.Minion_FindTargetInRange(startAttackRange, ref attackTarget, true, new Func<Entity, int, bool>(this.AI_067_CustomEliminationCheck_Pirates));
if ((double) this.ai[0] == 1.0)
{
this.tileCollide = false;
float num7 = 0.2f;
float num8 = 10f;
int num9 = 200;
if ((double) num8 < (double) Math.Abs(player.velocity.X) + (double) Math.Abs(player.velocity.Y))
num8 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y);
Vector2 vector2_2 = player.Center - this.Center;
double num10 = (double) vector2_2.Length();
if (num10 > 2000.0)
this.position = player.Center - new Vector2((float) this.width, (float) this.height) / 2f;
if (num10 < (double) num9 && (double) player.velocity.Y == 0.0 && (double) this.position.Y + (double) this.height <= (double) player.position.Y + (double) player.height && !Collision.SolidCollision(this.position, this.width, this.height))
{
this.ai[0] = 0.0f;
this.netUpdate = true;
if ((double) this.velocity.Y < -6.0)
this.velocity.Y = -6f;
}
if (num10 >= 60.0)
{
vector2_2.Normalize();
Vector2 vector2_3 = vector2_2 * num8;
if ((double) this.velocity.X < (double) vector2_3.X)
{
this.velocity.X += num7;
if ((double) this.velocity.X < 0.0)
this.velocity.X += num7 * 1.5f;
}
if ((double) this.velocity.X > (double) vector2_3.X)
{
this.velocity.X -= num7;
if ((double) this.velocity.X > 0.0)
this.velocity.X -= num7 * 1.5f;
}
if ((double) this.velocity.Y < (double) vector2_3.Y)
{
this.velocity.Y += num7;
if ((double) this.velocity.Y < 0.0)
this.velocity.Y += num7 * 1.5f;
}
if ((double) this.velocity.Y > (double) vector2_3.Y)
{
this.velocity.Y -= num7;
if ((double) this.velocity.Y > 0.0)
this.velocity.Y -= num7 * 1.5f;
}
}
if ((double) this.velocity.X != 0.0)
this.spriteDirection = Math.Sign(this.velocity.X);
if (flag1)
{
++this.frameCounter;
if (this.frameCounter > 3)
{
++this.frame;
this.frameCounter = 0;
}
if (this.frame < 10 | this.frame > 13)
this.frame = 10;
this.rotation = this.velocity.X * 0.1f;
}
if (flag2)
{
int num11 = 3;
if (++this.frameCounter >= num11 * 4)
this.frameCounter = 0;
this.frame = 14 + this.frameCounter / num11;
this.rotation = this.velocity.X * 0.15f;
}
if (flag3)
{
this.frame = 8;
if (flag4)
this.frame = 10;
this.rotation += 0.6f * (float) this.spriteDirection;
}
}
if ((double) this.ai[0] == 2.0 && (double) this.ai[1] < 0.0)
{
this.friendly = false;
++this.ai[1];
if (num6 >= 0)
{
this.ai[1] = 0.0f;
this.ai[0] = 0.0f;
this.netUpdate = true;
return;
}
}
else if ((double) this.ai[0] == 2.0)
{
this.spriteDirection = this.direction;
this.rotation = 0.0f;
if (flag1)
{
this.friendly = true;
this.frame = 4 + (int) ((double) num6 - (double) this.ai[1]) / (num6 / 3);
if ((double) this.velocity.Y != 0.0)
this.frame += 3;
}
if (flag2)
{
float num12 = ((float) num6 - this.ai[1]) / (float) num6;
if ((double) num12 > 0.25 && (double) num12 < 0.75)
this.friendly = true;
int num13 = (int) ((double) num12 * 5.0);
if (num13 > 2)
num13 = 4 - num13;
this.frame = (double) this.velocity.Y == 0.0 ? 18 + num13 : 21 + num13;
if ((double) this.velocity.Y == 0.0)
this.velocity.X *= 0.8f;
}
this.velocity.Y += 0.4f;
if ((double) this.velocity.Y > 10.0)
this.velocity.Y = 10f;
--this.ai[1];
if ((double) this.ai[1] <= 0.0)
{
if (num5 > 0)
{
this.ai[1] = (float) -num5;
}
else
{
this.ai[1] = 0.0f;
this.ai[0] = 0.0f;
this.netUpdate = true;
return;
}
}
}
if (attackTarget >= 0)
{
float maxDistance = (float) startAttackRange;
float num14 = 20f;
if (flag2)
num14 = 50f;
NPC npc = Main.npc[attackTarget];
Vector2 center = npc.Center;
vector2_1 = center;
if (this.IsInRangeOfMeOrMyOwner((Entity) npc, maxDistance, out float _, out float _, out bool _))
{
this.shouldFallThrough = (double) npc.Center.Y > (double) this.Bottom.Y;
bool flag7 = (double) this.velocity.Y == 0.0;
if (this.wet && (double) this.velocity.Y > 0.0 && !this.shouldFallThrough)
flag7 = true;
if ((double) center.Y < (double) this.Center.Y - 30.0 & flag7)
{
float num15 = (float) Math.Sqrt(((double) center.Y - (double) this.Center.Y) * -1.0 * 2.0 * 0.400000005960464);
if ((double) num15 > 26.0)
num15 = 26f;
this.velocity.Y = -num15;
}
if (flag6 && (double) Vector2.Distance(this.Center, vector2_1) < (double) num14)
{
if ((double) this.velocity.Length() > 10.0)
this.velocity = this.velocity / (this.velocity.Length() / 10f);
this.ai[0] = 2f;
this.ai[1] = (float) num6;
this.netUpdate = true;
this.direction = (double) center.X - (double) this.Center.X > 0.0 ? 1 : -1;
}
if (flag3 && this.Hitbox.Intersects(npc.Hitbox) && (double) this.velocity.Y >= 0.0)
{
this.velocity.Y = -4f;
this.velocity.X = (float) (this.direction * 10);
}
}
if (flag2)
{
int num16 = 1;
if ((double) center.X - (double) this.Center.X < 0.0)
num16 = -1;
vector2_1.X += (float) (20 * -num16);
}
}
if ((double) this.ai[0] == 0.0 && attackTarget < 0)
{
if (Main.player[this.owner].rocketDelay2 > 0)
{
this.ai[0] = 1f;
this.netUpdate = true;
}
Vector2 vector2_4 = player.Center - this.Center;
if ((double) vector2_4.Length() > 2000.0)
this.position = player.Center - new Vector2((float) this.width, (float) this.height) / 2f;
else if ((double) vector2_4.Length() > (double) num1 || (double) Math.Abs(vector2_4.Y) > (double) num2)
{
this.ai[0] = 1f;
this.netUpdate = true;
if ((double) this.velocity.Y > 0.0 && (double) vector2_4.Y < 0.0)
this.velocity.Y = 0.0f;
if ((double) this.velocity.Y < 0.0 && (double) vector2_4.Y > 0.0)
this.velocity.Y = 0.0f;
}
}
if ((double) this.ai[0] == 0.0)
{
if (attackTarget < 0)
{
if ((double) this.Distance(player.Center) > 60.0 && (double) this.Distance(vector2_1) > 60.0 && Math.Sign(vector2_1.X - player.Center.X) != Math.Sign(this.Center.X - player.Center.X))
vector2_1 = player.Center;
Microsoft.Xna.Framework.Rectangle r1 = Utils.CenteredRectangle(vector2_1, this.Size);
for (int index = 0; index < 20 && !Collision.SolidCollision(r1.TopLeft(), r1.Width, r1.Height); ++index)
{
r1.Y += 16;
vector2_1.Y += 16f;
}
Vector2 vector2_5 = Collision.TileCollision(player.Center - this.Size / 2f, vector2_1 - player.Center, this.width, this.height);
vector2_1 = player.Center - this.Size / 2f + vector2_5;
if ((double) this.Distance(vector2_1) < 32.0)
{
float num17 = player.Center.Distance(vector2_1);
if ((double) player.Center.Distance(this.Center) < (double) num17)
vector2_1 = this.Center;
}
Vector2 vector2_6 = player.Center - vector2_1;
if ((double) vector2_6.Length() > (double) num1 || (double) Math.Abs(vector2_6.Y) > (double) num2)
{
Microsoft.Xna.Framework.Rectangle r2 = Utils.CenteredRectangle(player.Center, this.Size);
Vector2 vector2_7 = vector2_1 - player.Center;
Vector2 vector2_8 = r2.TopLeft();
for (float num18 = 0.0f; (double) num18 < 1.0; num18 += 0.05f)
{
Vector2 vector2_9 = r2.TopLeft() + vector2_7 * num18;
if (!Collision.SolidCollision(r2.TopLeft() + vector2_7 * num18, r1.Width, r1.Height))
vector2_8 = vector2_9;
else
break;
}
vector2_1 = vector2_8 + this.Size / 2f;
}
}
this.tileCollide = true;
float num19 = 0.5f;
float num20 = 4f;
float num21 = 4f;
float num22 = 0.1f;
if (flag1 && attackTarget != -1)
{
num19 = 1f;
num20 = 8f;
num21 = 8f;
}
if (flag2 && attackTarget != -1)
{
num19 = 0.7f;
num20 = 6f;
num21 = 6f;
}
if (flag3 && attackTarget != -1)
{
num19 = 0.7f;
num20 = 6f;
num21 = 6f;
}
if ((double) num21 < (double) Math.Abs(player.velocity.X) + (double) Math.Abs(player.velocity.Y))
{
num21 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y);
num19 = 0.7f;
}
int num23 = 0;
bool flag8 = false;
float num24 = vector2_1.X - this.Center.X;
Vector2 vector2_10 = vector2_1 - this.Center;
if (this.type == 653 && (double) Math.Abs(num24) < 150.0)
{
this.rotation = this.rotation.AngleTowards(0.0f, 0.2f);
this.velocity.X *= 0.9f;
if ((double) Math.Abs(this.velocity.X) < 0.1)
this.velocity.X = 0.0f;
}
else if ((double) Math.Abs(num24) > 5.0)
{
if ((double) num24 < 0.0)
{
num23 = -1;
if ((double) this.velocity.X > -(double) num20)
this.velocity.X -= num19;
else
this.velocity.X -= num22;
}
else
{
num23 = 1;
if ((double) this.velocity.X < (double) num20)
this.velocity.X += num19;
else
this.velocity.X += num22;
}
bool flag9 = true;
if (flag1)
flag9 = false;
if (this.type == 653)
flag9 = false;
if (flag2 && attackTarget == -1)
flag9 = false;
if (flag3)
flag9 = (double) vector2_10.Y < -80.0;
if (flag9)
flag8 = true;
}
else
{
this.velocity.X *= 0.9f;
if ((double) Math.Abs(this.velocity.X) < (double) num19 * 2.0)
this.velocity.X = 0.0f;
}
bool flag10 = (double) Math.Abs(vector2_10.X) >= 64.0 || (double) vector2_10.Y <= -48.0 && (double) Math.Abs(vector2_10.X) >= 8.0;
if ((uint) num23 > 0U & flag10)
{
int num25 = (int) ((double) this.position.X + (double) (this.width / 2)) / 16;
int num26 = (int) this.position.Y / 16;
int i = num25 + num23 + (int) this.velocity.X;
for (int j = num26; j < num26 + this.height / 16 + 1; ++j)
{
if (WorldGen.SolidTile(i, j))
flag8 = true;
}
}
if (this.type == 500 && (double) this.velocity.X != 0.0)
flag8 = true;
if (this.type == 653 && (double) Math.Abs(this.velocity.X) > 3.0)
flag8 = true;
Collision.StepUp(ref this.position, ref this.velocity, this.width, this.height, ref this.stepSpeed, ref this.gfxOffY);
float num27 = Utils.GetLerpValue(0.0f, 100f, vector2_10.Y, true) * Utils.GetLerpValue(-2f, -6f, this.velocity.Y, true);
if ((double) this.velocity.Y == 0.0 && flag8)
{
for (int index = 0; index < 3; ++index)
{
int i1 = (int) ((double) this.position.X + (double) (this.width / 2)) / 16;
if (index == 0)
i1 = (int) this.position.X / 16;
if (index == 2)
i1 = (int) ((double) this.position.X + (double) this.width) / 16;
int j = (int) ((double) this.position.Y + (double) this.height) / 16;
if (WorldGen.SolidTile(i1, j) || Main.tile[i1, j].halfBrick() || Main.tile[i1, j].slope() > (byte) 0 || TileID.Sets.Platforms[(int) Main.tile[i1, j].type] && Main.tile[i1, j].active() && !Main.tile[i1, j].inActive())
{
try
{
int num28 = (int) ((double) this.position.X + (double) (this.width / 2)) / 16;
int num29 = (int) ((double) this.position.Y + (double) (this.height / 2)) / 16;
int i2 = num28 + num23 + (int) this.velocity.X;
if (!WorldGen.SolidTile(i2, num29 - 1) && !WorldGen.SolidTile(i2, num29 - 2))
this.velocity.Y = -5.1f;
else if (!WorldGen.SolidTile(i2, num29 - 2))
this.velocity.Y = -7.1f;
else if (WorldGen.SolidTile(i2, num29 - 5))
this.velocity.Y = -11.1f;
else if (WorldGen.SolidTile(i2, num29 - 4))
this.velocity.Y = -10.1f;
else
this.velocity.Y = -9.1f;
}
catch
{
this.velocity.Y = -9.1f;
}
}
}
if ((double) vector2_1.Y - (double) this.Center.Y < -48.0)
{
float num30 = (vector2_1.Y - this.Center.Y) * -1f;
if ((double) num30 < 60.0)
this.velocity.Y = -6f;
else if ((double) num30 < 80.0)
this.velocity.Y = -7f;
else if ((double) num30 < 100.0)
this.velocity.Y = -8f;
else if ((double) num30 < 120.0)
this.velocity.Y = -9f;
else if ((double) num30 < 140.0)
this.velocity.Y = -10f;
else if ((double) num30 < 160.0)
this.velocity.Y = -11f;
else if ((double) num30 < 190.0)
this.velocity.Y = -12f;
else if ((double) num30 < 210.0)
this.velocity.Y = -13f;
else if ((double) num30 < 270.0)
this.velocity.Y = -14f;
else if ((double) num30 < 310.0)
this.velocity.Y = -15f;
else
this.velocity.Y = -16f;
}
if (this.wet && (double) num27 == 0.0)
this.velocity.Y *= 2f;
}
if ((double) this.velocity.X > (double) num21)
this.velocity.X = num21;
if ((double) this.velocity.X < -(double) num21)
this.velocity.X = -num21;
if ((double) this.velocity.X < 0.0)
this.direction = -1;
if ((double) this.velocity.X > 0.0)
this.direction = 1;
if ((double) this.velocity.X == 0.0)
this.direction = (double) player.Center.X > (double) this.Center.X ? 1 : -1;
if ((double) this.velocity.X > (double) num19 && num23 == 1)
this.direction = 1;
if ((double) this.velocity.X < -(double) num19 && num23 == -1)
this.direction = -1;
this.spriteDirection = this.direction;
if (flag1)
{
this.rotation = 0.0f;
if ((double) this.velocity.Y == 0.0)
{
if ((double) this.velocity.X == 0.0)
{
this.frame = 0;
this.frameCounter = 0;
}
else if ((double) Math.Abs(this.velocity.X) >= 0.5)
{
this.frameCounter += (int) Math.Abs(this.velocity.X);
++this.frameCounter;
if (this.frameCounter > 10)
{
++this.frame;
this.frameCounter = 0;
}
if (this.frame >= 4)
this.frame = 0;
}
else
{
this.frame = 0;
this.frameCounter = 0;
}
}
else if ((double) this.velocity.Y != 0.0)
{
this.frameCounter = 0;
this.frame = 14;
}
}
if (flag2)
{
this.rotation = 0.0f;
if ((double) this.velocity.Y == 0.0)
{
if ((double) this.velocity.X == 0.0)
{
int num31 = 4;
if (++this.frameCounter >= 7 * num31 && Main.rand.Next(50) == 0)
this.frameCounter = 0;
int num32 = this.frameCounter / num31;
if (num32 >= 4)
num32 = 6 - num32;
if (num32 < 0)
num32 = 0;
this.frame = 1 + num32;
}
else if ((double) Math.Abs(this.velocity.X) >= 0.5)
{
this.frameCounter += (int) Math.Abs(this.velocity.X);
++this.frameCounter;
int num33 = 15;
if (this.frameCounter >= 8 * num33)
this.frameCounter = 0;
this.frame = this.frameCounter / num33 + 5;
}
else
{
this.frame = 0;
this.frameCounter = 0;
}
}
else if ((double) this.velocity.Y != 0.0)
{
if ((double) this.velocity.Y < 0.0)
{
if (this.frame > 9 || this.frame < 5)
{
this.frame = 5;
this.frameCounter = 0;
}
if (++this.frameCounter >= 1 && this.frame < 9)
{
++this.frame;
this.frameCounter = 0;
}
}
else
{
if (this.frame > 13 || this.frame < 9)
{
this.frame = 9;
this.frameCounter = 0;
}
if (++this.frameCounter >= 2 && this.frame < 11)
{
++this.frame;
this.frameCounter = 0;
}
}
}
}
if (flag3)
{
int num34 = 8;
if (flag4)
num34 = 10;
this.rotation = 0.0f;
if ((double) this.velocity.Y == 0.0)
{
if ((double) this.velocity.X == 0.0)
{
this.frame = 0;
this.frameCounter = 0;
}
else if ((double) Math.Abs(this.velocity.X) >= 0.5)
{
this.frameCounter += (int) Math.Abs(this.velocity.X);
++this.frameCounter;
if (this.frameCounter > 10)
{
++this.frame;
this.frameCounter = 0;
}
if (this.frame >= num34 || this.frame < 2)
this.frame = 2;
}
else
{
this.frame = 0;
this.frameCounter = 0;
}
}
else if ((double) this.velocity.Y != 0.0)
{
this.frameCounter = 0;
this.frame = 1;
if (flag4)
this.frame = 9;
}
}
this.velocity.Y += (float) (0.400000005960464 + (double) num27 * 1.0);
if ((double) this.velocity.Y > 10.0)
this.velocity.Y = 10f;
}
if (!flag1)
return;
++this.localAI[0];
if ((double) this.velocity.X == 0.0)
++this.localAI[0];
if ((double) this.localAI[0] < (double) Main.rand.Next(900, 1200))
return;
this.localAI[0] = 0.0f;
for (int index1 = 0; index1 < 6; ++index1)
{
Vector2 Position = this.Center + Vector2.UnitX * (float) -this.direction * 8f - Vector2.One * 5f + Vector2.UnitY * 8f;
double num35 = (double) -this.direction;
color = new Color();
Color newColor = color;
int index2 = Dust.NewDust(Position, 3, 6, 216, (float) num35, 1f, newColor: newColor);
Main.dust[index2].velocity /= 2f;
Main.dust[index2].scale = 0.8f;
}
int index3 = Gore.NewGore(this.Center + Vector2.UnitX * (float) -this.direction * 8f, Vector2.Zero, Main.rand.Next(580, 583));
Main.gore[index3].velocity /= 2f;
Main.gore[index3].velocity.Y = Math.Abs(Main.gore[index3].velocity.Y);
Main.gore[index3].velocity.X = -Math.Abs(Main.gore[index3].velocity.X) * (float) this.direction;
}
}
private void AI_157_SharpTears()
{
bool flag1 = (double) this.ai[0] < 20.0;
bool flag2 = (double) this.ai[0] > 20.0;
bool flag3 = (double) this.ai[0] >= 30.0;
++this.ai[0];
if ((double) this.localAI[0] == 0.0)
{
this.localAI[0] = 1f;
this.rotation = this.velocity.ToRotation();
this.frame = Main.rand.Next(6);
for (int index = 0; index < 30; ++index)
{
Dust dust = Dust.NewDustPerfect(this.Center + Main.rand.NextVector2Circular(24f, 24f), 5, new Vector2?(this.velocity * MathHelper.Lerp(0.2f, 0.7f, Main.rand.NextFloat())));
dust.velocity += Main.rand.NextVector2Circular(0.5f, 0.5f);
dust.scale = (float) (0.800000011920929 + (double) Main.rand.NextFloat() * 0.5);
}
for (int index = 0; index < 30; ++index)
{
Dust dust = Dust.NewDustPerfect(this.Center + Main.rand.NextVector2Circular(24f, 24f), 5, new Vector2?(Main.rand.NextVector2Circular(2f, 2f) + this.velocity * MathHelper.Lerp(0.2f, 0.5f, Main.rand.NextFloat())));
dust.velocity += Main.rand.NextVector2Circular(0.5f, 0.5f);
dust.scale = (float) (0.800000011920929 + (double) Main.rand.NextFloat() * 0.5);
dust.fadeIn = 1f;
}
SoundEngine.PlaySound(SoundID.Item113, this.Center);
}
if (flag1)
{
this.Opacity += 0.1f;
this.scale = this.Opacity * this.ai[1];
for (int index = 0; index < 2; ++index)
{
Dust dust = Dust.NewDustPerfect(this.Center + Main.rand.NextVector2Circular(16f, 16f), 5, new Vector2?(this.velocity * MathHelper.Lerp(0.2f, 0.5f, Main.rand.NextFloat())));
dust.velocity += Main.rand.NextVector2Circular(0.5f, 0.5f);
dust.velocity *= 0.5f;
dust.scale = (float) (0.800000011920929 + (double) Main.rand.NextFloat() * 0.5);
}
}
if (flag2)
{
this.Opacity -= 0.2f;
for (int index = 0; index < 2; ++index)
{
Dust dust = Dust.NewDustPerfect(this.Center + Main.rand.NextVector2Circular(16f, 16f), 5, new Vector2?(this.velocity * MathHelper.Lerp(0.2f, 0.5f, Main.rand.NextFloat())));
dust.velocity += Main.rand.NextVector2Circular(0.5f, 0.5f);
dust.velocity *= 0.5f;
dust.scale = (float) (0.800000011920929 + (double) Main.rand.NextFloat() * 0.5);
}
}
if (flag3)
this.Kill();
Lighting.AddLight(this.Center, new Vector3(0.5f, 0.1f, 0.1f) * this.scale);
}
private bool IsInRangeOfMeOrMyOwner(
Entity entity,
float maxDistance,
out float myDistance,
out float playerDistance,
out bool closerIsMe)
{
myDistance = Vector2.Distance(entity.Center, this.Center);
if ((double) myDistance < (double) maxDistance && !this.CanHitWithOwnBody(entity))
myDistance = float.PositiveInfinity;
playerDistance = Vector2.Distance(entity.Center, Main.player[this.owner].Center);
if ((double) playerDistance < (double) maxDistance && !this.CanHitWithMeleeWeapon(entity))
playerDistance = float.PositiveInfinity;
closerIsMe = (double) myDistance < (double) playerDistance;
return closerIsMe ? (double) myDistance <= (double) maxDistance : (double) playerDistance <= (double) maxDistance;
}
private void AI_156_BatOfLight()
{
List<int> blacklistedTargets = Projectile._ai156_blacklistedTargets;
Player player = Main.player[this.owner];
int num1 = this.type == 755 ? 1 : 0;
bool flag = this.type == 946;
if (num1 != 0)
{
if (player.dead)
player.batsOfLight = false;
if (player.batsOfLight)
this.timeLeft = 2;
DelegateMethods.v3_1 = this.AI_156_GetColor().ToVector3();
Point tileCoordinates = this.Center.ToTileCoordinates();
DelegateMethods.CastLightOpen(tileCoordinates.X, tileCoordinates.Y);
if (++this.frameCounter >= 6)
{
this.frameCounter = 0;
if (++this.frame >= Main.projFrames[this.type] - 1)
this.frame = 0;
}
int num2 = player.direction;
if ((double) this.velocity.X != 0.0)
num2 = Math.Sign(this.velocity.X);
this.spriteDirection = num2;
}
if (flag)
{
if (player.dead)
player.empressBlade = false;
if (player.empressBlade)
this.timeLeft = 2;
DelegateMethods.v3_1 = this.AI_156_GetColor().ToVector3();
Point tileCoordinates = this.Center.ToTileCoordinates();
DelegateMethods.CastLightOpen(tileCoordinates.X, tileCoordinates.Y);
}
blacklistedTargets.Clear();
this.AI_156_Think(blacklistedTargets);
}
public Color AI_156_GetColor()
{
if (this.aiStyle != 156)
return Color.Transparent;
int num = this.type == 755 ? 1 : 0;
int type = this.type;
return num != 0 ? Color.Crimson : Color.Transparent;
}
private void AI_156_Think(List<int> blacklist)
{
bool flag1 = this.type == 755;
bool flag2 = this.type == 946;
int num1 = 60;
int num2 = num1 - 1;
int num3 = num1 + 60;
int num4 = num3 - 1;
int num5 = num1 + 1;
if (flag2)
{
num1 = 40;
num2 = num1 - 1;
num3 = num1 + 40;
num4 = num3 - 1;
num5 = num1 + 1;
}
if ((double) this.ai[0] == -1.0)
{
int index;
int totalIndexesInGroup;
this.AI_GetMyGroupIndexAndFillBlackList(blacklist, out index, out totalIndexesInGroup);
Vector2 idleSpot;
float idleRotation;
this.AI_156_GetIdlePosition(index, totalIndexesInGroup, out idleSpot, out idleRotation);
this.velocity = Vector2.Zero;
this.Center = this.Center.MoveTowards(idleSpot, 32f);
this.rotation = this.rotation.AngleLerp(idleRotation, 0.2f);
if ((double) this.Distance(idleSpot) >= 2.0)
return;
this.ai[0] = 0.0f;
this.netUpdate = true;
}
else if ((double) this.ai[0] == 0.0)
{
if (flag1)
{
int index;
int totalIndexesInGroup;
this.AI_GetMyGroupIndexAndFillBlackList(blacklist, out index, out totalIndexesInGroup);
Vector2 idleSpot;
this.AI_156_GetIdlePosition(index, totalIndexesInGroup, out idleSpot, out float _);
this.velocity = Vector2.Zero;
this.Center = Vector2.SmoothStep(this.Center, idleSpot, 0.45f);
if (Main.rand.Next(20) == 0)
{
int num6 = this.AI_156_TryAttackingNPCs(blacklist);
if (num6 != -1)
{
this.ai[0] = (float) num1;
this.ai[1] = (float) num6;
this.netUpdate = true;
return;
}
}
}
if (!flag2)
return;
int index1;
int totalIndexesInGroup1;
this.AI_GetMyGroupIndexAndFillBlackList(blacklist, out index1, out totalIndexesInGroup1);
Vector2 idleSpot1;
float idleRotation;
this.AI_156_GetIdlePosition(index1, totalIndexesInGroup1, out idleSpot1, out idleRotation);
this.velocity = Vector2.Zero;
this.Center = Vector2.SmoothStep(this.Center, idleSpot1, 0.45f);
this.rotation = this.rotation.AngleLerp(idleRotation, 0.45f);
if (Main.rand.Next(20) != 0)
return;
int num7 = this.AI_156_TryAttackingNPCs(blacklist);
if (num7 == -1)
return;
this.ai[0] = (float) Main.rand.NextFromList<int>(num1, num3);
this.ai[0] = (float) num3;
this.ai[1] = (float) num7;
this.netUpdate = true;
}
else
{
Vector2 vector2_1;
if (flag1)
{
int index = (int) this.ai[1];
if (!Main.npc.IndexInRange<NPC>(index))
{
this.ai[0] = 0.0f;
this.netUpdate = true;
return;
}
NPC npc = Main.npc[index];
if (!npc.CanBeChasedBy((object) this))
{
this.ai[0] = 0.0f;
this.netUpdate = true;
return;
}
--this.ai[0];
if ((double) this.ai[0] >= (double) num2)
{
this.velocity = this.velocity * 0.8f;
if ((double) this.ai[0] != (double) num2)
return;
this.localAI[0] = this.Center.X;
this.localAI[1] = this.Center.Y;
return;
}
float lerpValue = Utils.GetLerpValue((float) num2, 0.0f, this.ai[0], true);
Vector2 vector2_2 = new Vector2(this.localAI[0], this.localAI[1]);
if ((double) lerpValue >= 0.5)
vector2_2 = Main.player[this.owner].Center;
Vector2 center = npc.Center;
float rotation = (center - vector2_2).ToRotation();
double num8 = (double) center.X > (double) vector2_2.X ? -3.14159274101257 : 3.14159274101257;
float f = (float) (num8 + -num8 * (double) lerpValue * 2.0);
Vector2 spinningpoint = f.ToRotationVector2();
spinningpoint.Y *= (float) Math.Sin((double) this.identity * 2.29999995231628) * 0.5f;
spinningpoint = spinningpoint.RotatedBy((double) rotation);
vector2_1 = center - vector2_2;
float num9 = vector2_1.Length() / 2f;
this.Center = Vector2.Lerp(vector2_2, center, 0.5f) + spinningpoint * num9;
this.velocity = MathHelper.WrapAngle((float) ((double) rotation + (double) f + 0.0)).ToRotationVector2() * 10f;
this.position = this.position - this.velocity;
if ((double) this.ai[0] == 0.0)
{
int num10 = this.AI_156_TryAttackingNPCs(blacklist);
if (num10 != -1)
{
this.ai[0] = (float) num1;
this.ai[1] = (float) num10;
this.netUpdate = true;
return;
}
this.ai[1] = 0.0f;
this.netUpdate = true;
}
}
if (!flag2)
return;
bool skipBodyCheck = true;
int num11 = 0;
int num12 = num2;
int num13 = 0;
if ((double) this.ai[0] >= (double) num5)
{
num11 = 1;
num12 = num4;
num13 = num5;
}
int index2 = (int) this.ai[1];
if (!Main.npc.IndexInRange<NPC>(index2))
{
int num14 = this.AI_156_TryAttackingNPCs(blacklist, skipBodyCheck);
if (num14 != -1)
{
this.ai[0] = (float) Main.rand.NextFromList<int>(num1, num3);
this.ai[1] = (float) num14;
this.netUpdate = true;
}
else
{
this.ai[0] = -1f;
this.ai[1] = 0.0f;
this.netUpdate = true;
}
}
else
{
NPC npc = Main.npc[index2];
if (!npc.CanBeChasedBy((object) this))
{
int num15 = this.AI_156_TryAttackingNPCs(blacklist, skipBodyCheck);
if (num15 != -1)
{
this.ai[0] = (float) Main.rand.NextFromList<int>(num1, num3);
this.ai[1] = (float) num15;
this.netUpdate = true;
}
else
{
this.ai[0] = -1f;
this.ai[1] = 0.0f;
this.netUpdate = true;
}
}
else
{
--this.ai[0];
if ((double) this.ai[0] >= (double) num12)
{
this.direction = (double) this.Center.X < (double) npc.Center.X ? 1 : -1;
if ((double) this.ai[0] == (double) num12)
{
this.localAI[0] = this.Center.X;
this.localAI[1] = this.Center.Y;
}
}
float lerpValue1 = Utils.GetLerpValue((float) num12, (float) num13, this.ai[0], true);
if (num11 == 0)
{
Vector2 vector2_3 = new Vector2(this.localAI[0], this.localAI[1]);
if ((double) lerpValue1 >= 0.5)
vector2_3 = Vector2.Lerp(npc.Center, Main.player[this.owner].Center, 0.5f);
Vector2 center1 = npc.Center;
float rotation = (center1 - vector2_3).ToRotation();
double num16 = this.direction == 1 ? -3.14159274101257 : 3.14159274101257;
float f1 = (float) (num16 + -num16 * (double) lerpValue1 * 2.0);
Vector2 vector2_4 = f1.ToRotationVector2();
vector2_4.Y *= 0.5f;
vector2_4.Y *= (float) (0.800000011920929 + Math.Sin((double) this.identity * 2.29999995231628) * 0.200000002980232);
Vector2 spinningpoint = vector2_4;
double radians = (double) rotation;
vector2_1 = new Vector2();
Vector2 center2 = vector2_1;
vector2_4 = spinningpoint.RotatedBy(radians, center2);
vector2_1 = center1 - vector2_3;
float num17 = vector2_1.Length() / 2f;
this.Center = Vector2.Lerp(vector2_3, center1, 0.5f) + vector2_4 * num17;
float f2 = MathHelper.WrapAngle((float) ((double) rotation + (double) f1 + 0.0));
this.rotation = f2 + 1.570796f;
this.velocity = f2.ToRotationVector2() * 10f;
this.position = this.position - this.velocity;
}
if (num11 == 1)
{
Vector2 vector2_5 = new Vector2(this.localAI[0], this.localAI[1]) + new Vector2(0.0f, Utils.GetLerpValue(0.0f, 0.4f, lerpValue1, true) * -100f);
Vector2 v = npc.Center - vector2_5;
Vector2 vector2_6 = v.SafeNormalize(Vector2.Zero) * MathHelper.Clamp(v.Length(), 60f, 150f);
Vector2 vector2_7 = npc.Center + vector2_6;
float lerpValue2 = Utils.GetLerpValue(0.4f, 0.6f, lerpValue1, true);
float lerpValue3 = Utils.GetLerpValue(0.6f, 1f, lerpValue1, true);
this.rotation = this.rotation.AngleTowards(v.SafeNormalize(Vector2.Zero).ToRotation() + 1.570796f, 0.6283185f);
this.Center = Vector2.Lerp(vector2_5, npc.Center, lerpValue2);
if ((double) lerpValue3 > 0.0)
this.Center = Vector2.Lerp(npc.Center, vector2_7, lerpValue3);
}
if ((double) this.ai[0] != (double) num13)
return;
int num18 = this.AI_156_TryAttackingNPCs(blacklist, skipBodyCheck);
if (num18 != -1)
{
this.ai[0] = (float) Main.rand.NextFromList<int>(num1, num3);
this.ai[1] = (float) num18;
this.netUpdate = true;
}
else
{
this.ai[0] = -1f;
this.ai[1] = 0.0f;
this.netUpdate = true;
}
}
}
}
}
private int AI_156_TryAttackingNPCs(List<int> blackListedTargets, bool skipBodyCheck = false)
{
Vector2 center = Main.player[this.owner].Center;
int num1 = -1;
float num2 = -1f;
for (int index = 0; index < 200; ++index)
{
NPC npc = Main.npc[index];
if (npc.CanBeChasedBy((object) this) && (npc.boss || !blackListedTargets.Contains(index)))
{
float num3 = npc.Distance(center);
if ((double) num3 <= 1000.0 && ((double) num3 <= (double) num2 || (double) num2 == -1.0) && (skipBodyCheck || this.CanHitWithOwnBody((Entity) npc)))
{
num2 = num3;
num1 = index;
}
}
}
return num1;
}
private void AI_GetMyGroupIndexAndFillBlackList(
List<int> blackListedTargets,
out int index,
out int totalIndexesInGroup)
{
index = 0;
totalIndexesInGroup = 0;
for (int index1 = 0; index1 < 1000; ++index1)
{
Projectile projectile = Main.projectile[index1];
if (projectile.active && projectile.owner == this.owner && projectile.type == this.type && (projectile.type != 759 || projectile.frame == Main.projFrames[projectile.type] - 1))
{
if (this.whoAmI > index1)
++index;
++totalIndexesInGroup;
}
}
}
private void AI_156_GetIdlePosition(
int stackedIndex,
int totalIndexes,
out Vector2 idleSpot,
out float idleRotation)
{
Player player = Main.player[this.owner];
int num1 = this.type == 755 ? 1 : 0;
bool flag = this.type == 946;
idleRotation = 0.0f;
idleSpot = Vector2.Zero;
if (num1 != 0)
{
float num2 = (float) (((double) totalIndexes - 1.0) / 2.0);
idleSpot = player.Center + -Vector2.UnitY.RotatedBy(4.39822959899902 / (double) totalIndexes * ((double) stackedIndex - (double) num2)) * 40f;
idleRotation = 0.0f;
}
if (!flag)
return;
int num3 = stackedIndex + 1;
idleRotation = (float) ((double) num3 * 6.28318548202515 * 0.0166666675359011 * (double) player.direction + 1.57079637050629);
idleRotation = MathHelper.WrapAngle(idleRotation);
int num4 = num3 % totalIndexes;
Vector2 vector2 = new Vector2(0.0f, 0.5f).RotatedBy(((double) player.miscCounterNormalized * (2.0 + (double) num4) + (double) num4 * 0.5 + (double) player.direction * 1.29999995231628) * 6.28318548202515) * 4f;
idleSpot = idleRotation.ToRotationVector2() * 10f + player.MountedCenter + new Vector2((float) (player.direction * (num3 * -6 - 16)), player.gravDir * -15f);
idleSpot += vector2;
idleRotation += 1.570796f;
}
private void AI_155_MysticSnakeCoil()
{
if (Main.netMode != 1 && !Main.player[this.owner].active)
{
float num = this.ai[0];
float y = this.position.Y;
Point tileCoordinates = this.Center.ToTileCoordinates();
Point end = new Point(tileCoordinates.X, (int) y / 16);
this.AI_155_RemoveRope(new Point(tileCoordinates.X, (int) num / 16), end);
this.Kill();
}
else
{
int num1 = 80;
int num2 = 1800;
if ((double) this.ai[1] == 0.0)
{
this.spriteDirection = (double) Main.player[this.owner].Center.X > (double) this.Center.X ? -1 : 1;
this.ai[1] = 1f;
this.velocity.Y = -5f;
}
if ((double) this.ai[1] == 1.0)
{
if (Main.rand.Next(6) == 0)
{
Dust dust = Dust.NewDustDirect(this.TopLeft + new Vector2(-6f, 0.0f), 24, 16, 27, Alpha: 150, newColor: Color.Transparent, Scale: 0.6f);
dust.velocity *= 1f;
dust.velocity.X *= 0.5f;
dust.velocity.Y = -3f;
dust.fadeIn = 1.2f;
dust.noGravity = true;
}
this.alpha = Utils.Clamp<int>(this.alpha - 5, 0, (int) byte.MaxValue);
if (++this.frameCounter >= 12)
{
this.frameCounter = 0;
if (++this.frame >= 4)
this.frame = 0;
}
if (Main.myPlayer == this.owner)
{
float num3 = this.ai[0];
float y1 = this.position.Y;
Point tileCoordinates = this.Center.ToTileCoordinates();
Point point1 = new Point(tileCoordinates.X, (int) y1 / 16);
Point point2 = new Point(tileCoordinates.X, (int) num3 / 16);
bool flag = point2.Y - point1.Y >= num1;
int x = point2.X;
if (!WorldGen.InWorld(x, point1.Y, 40) || !WorldGen.InWorld(x, point2.Y, 40))
flag = true;
if (!flag)
{
for (int y2 = point2.Y; y2 >= point1.Y; --y2)
{
if (Main.tile[x, y2].active() && !Main.tileCut[(int) Main.tile[x, y2].type] && Main.tile[x, y2].type != (ushort) 504)
{
flag = true;
break;
}
}
}
if (flag)
{
int num4 = 0;
for (int y3 = point2.Y; y3 > point1.Y; --y3)
{
if ((WorldGen.TileEmpty(x, y3) || Main.tileCut[(int) Main.tile[x, y3].type]) && WorldGen.PlaceTile(x, y3, 504, plr: this.owner))
{
++num4;
if (Main.netMode == 1)
NetMessage.SendData(17, number: 1, number2: ((float) x), number3: ((float) y3), number4: 504f);
}
}
this.timeLeft = num2;
this.ai[1] = 2f;
this.netUpdate = true;
this.Top = new Vector2((float) (x * 16 + 8), (float) (point1.Y * 16 + 16));
this.velocity = Vector2.Zero;
}
}
}
if ((double) this.ai[1] != 2.0)
return;
this.alpha = 0;
int timeLeft = this.timeLeft;
float num5 = this.ai[0];
float y4 = this.position.Y;
Point tileCoordinates1 = this.Center.ToTileCoordinates();
Point end = new Point(tileCoordinates1.X, (int) y4 / 16);
Point start = new Point(tileCoordinates1.X, (int) num5 / 16);
int x1 = start.X;
if ((double) this.localAI[0] == 0.0)
{
this.localAI[0] = 1f;
for (int y5 = start.Y; y5 >= end.Y; --y5)
{
Tile tile = Main.tile[x1, y5];
if (tile.active() && tile.type == (ushort) 504)
this.AI_155_SpawnRopeIn(x1, y5);
}
}
else
{
for (int y6 = start.Y; y6 >= end.Y; --y6)
{
Tile tile = Main.tile[x1, y6];
if (tile.active() && tile.type == (ushort) 504 && Main.rand.Next(80) == 0)
{
Dust dust = Dust.NewDustDirect(new Vector2((float) (x1 * 16 - 6), (float) (y6 * 16)), 28, 16, 27, Alpha: 150, newColor: Color.Transparent, Scale: 0.6f);
dust.velocity *= 1f;
dust.velocity.X = 0.0f;
dust.fadeIn = 1.2f;
dust.noGravity = true;
}
}
}
if (this.timeLeft == 4)
{
for (int y7 = start.Y; y7 >= end.Y; --y7)
{
Tile tile = Main.tile[x1, y7];
if (tile.active() && tile.type == (ushort) 504)
this.AI_155_SpawnRopeIn(x1, y7);
}
}
if (this.timeLeft > 4)
return;
if (!WorldGen.InWorld(x1, end.Y, 20) || !WorldGen.InWorld(x1, start.Y, 20))
{
this.Kill();
}
else
{
if (Main.myPlayer == this.owner)
this.AI_155_RemoveRope(start, end);
this.Kill();
}
}
}
private void AI_155_RemoveRope(Point start, Point end)
{
int x = start.X;
for (int y = start.Y; y >= end.Y; --y)
{
Tile tile = Main.tile[x, y];
if (tile.active() && tile.type == (ushort) 504)
{
WorldGen.KillTile(x, y);
if (Main.netMode != 0)
NetMessage.SendData(17, number2: ((float) x), number3: ((float) y));
}
}
}
private void AI_155_SpawnRopeIn(int x, int y)
{
Vector2 Position = new Vector2((float) (x * 16 + 8), (float) (y * 16 + 8));
if (Main.rand.Next(4) != 0)
{
Gore gore = Gore.NewGoreDirect(Position, Vector2.Zero, Main.rand.Next(61, 64));
gore.velocity = Main.rand.NextVector2Circular(1.5f, 0.8f);
gore.velocity.X += (float) (0.100000001490116 * ((double) gore.velocity.X > 0.0 ? 1.0 : -1.0));
gore.position = Position - new Vector2(16f, 16f);
gore.alpha = 170;
}
for (int index = 0; index < 5; ++index)
{
if (Main.rand.Next(8) == 0)
Dust.NewDustDirect(Position + new Vector2(-8f), 16, 16, 31, Alpha: 100, newColor: Color.Transparent).velocity *= 0.4f;
Dust dust = Dust.NewDustDirect(Position + new Vector2(-8f), 16, 16, 27, Alpha: 100, newColor: Color.Transparent, Scale: 1.7f);
dust.velocity *= 2f;
dust.noGravity = true;
}
}
private void AI_154_VoidLens()
{
Main.CurrentFrameFlags.HadAnActiveInteractibleProjectile = true;
if (this.owner == Main.myPlayer)
{
for (int index = 0; index < 1000; ++index)
{
if (index != this.whoAmI)
{
Projectile projectile = Main.projectile[index];
if (projectile.active && projectile.owner == this.owner && projectile.type == this.type)
{
if (this.timeLeft >= Main.projectile[index].timeLeft)
{
Main.projectile[index].Kill();
}
else
{
this.Kill();
return;
}
}
}
}
}
this.velocity = this.velocity * 0.94f;
this.direction = 1;
if (++this.frameCounter >= 5)
{
this.frameCounter = 0;
if (++this.frame >= Main.projFrames[this.type])
this.frame = 0;
}
if ((double) this.Opacity < 1.0)
{
this.Opacity += 0.03f;
if ((double) this.Opacity > 1.0)
this.Opacity = 1f;
}
new VoidLensHelper(this).Update();
}
private void AI_153_ToiletPop()
{
Vector2 center = this.Center;
float SpeedY = -2f;
int num1 = 0;
int num2;
if ((double) this.ai[0] == 0.0)
{
num2 = 6;
num1 = 1;
}
else if ((double) this.ai[0] <= 10.0)
{
if (Main.rand.Next(5) == 0)
num1 = 1;
num2 = 2;
}
else
{
this.Kill();
return;
}
++this.ai[0];
for (int index = 0; index < num2; ++index)
{
Dust dust = Dust.NewDustDirect(center, 3, 6, 216, SpeedY: SpeedY);
dust.velocity.X *= 0.5f;
dust.velocity.Y = -Math.Abs(dust.velocity.Y);
dust.position -= dust.velocity;
dust.scale = 0.8f;
}
for (int index = 0; index < num1; ++index)
{
Gore gore = Gore.NewGoreDirect(center, Vector2.UnitY * -3f + Main.rand.NextVector2Circular(1f, 1f), Main.rand.Next(580, 583));
gore.velocity.Y = -Math.Abs(gore.velocity.Y);
}
}
private void AI_150_GolfClubHelper()
{
Player player = Main.player[this.owner];
if (!player.active)
this.Kill();
else if ((double) player.gravDir == -1.0)
{
player.SetDummyItemTime(0);
this.Kill();
}
else
{
bool flag = false;
Microsoft.Xna.Framework.Rectangle rectangle = Utils.CenteredRectangle(player.Center, new Vector2(500f, 500f));
for (int index = 0; index < 1000; ++index)
{
Projectile projectile = Main.projectile[index];
if (projectile.active && projectile.owner == Main.myPlayer && ProjectileID.Sets.IsAGolfBall[projectile.type] && rectangle.Contains(projectile.Center.ToPoint()))
{
flag = true;
break;
}
}
if (!flag && this.owner == Main.myPlayer && (double) this.ai[0] == 0.0)
player.TryPlacingAGolfBallNearANearbyTee(Main.player[this.owner].Center);
if (!player.channel && (double) this.ai[0] == 0.0)
{
SoundEngine.PlaySound(SoundID.Item1, player.Center);
for (int number = 0; number < 1000; ++number)
{
Projectile projectile = Main.projectile[number];
Vector2 shotVector = Main.MouseWorld - projectile.Center;
if (projectile.active && ProjectileID.Sets.IsAGolfBall[projectile.type] && projectile.owner == this.owner && GolfHelper.ValidateShot((Entity) projectile, player, ref shotVector))
{
float num1 = Main.rand.NextFloatDirection();
for (float num2 = 0.0f; (double) num2 < 1.0; num2 += 0.1f)
{
Dust dust = Dust.NewDustPerfect(projectile.Center, 31, new Vector2?((6.283185f * num2 + num1).ToRotationVector2() * 0.8f), (int) sbyte.MaxValue);
dust.fadeIn = 0.0f;
if ((double) num2 % 0.200000002980232 == 0.0)
dust.velocity *= 0.4f;
}
SoundEngine.PlaySound(SoundID.Item126, projectile.Center);
if (this.owner == Main.myPlayer)
{
GolfHelper.ShotStrength shotStrength = GolfHelper.CalculateShotStrength(this, (Entity) projectile);
Vector2 velocity = Vector2.Normalize(shotVector) * shotStrength.AbsoluteStrength;
GolfHelper.HitGolfBall((Entity) projectile, velocity, shotStrength.RoughLandResistance);
NetMessage.SendData(27, number: number);
}
}
}
this.ai[0] = 1f;
this.ai[1] = 0.0f;
this.netUpdate = true;
}
if ((double) this.ai[0] == 1.0)
{
++this.ai[1];
if ((double) this.ai[1] >= (double) (player.HeldItem.useAnimation + 30))
{
this.Kill();
return;
}
this.velocity = Vector2.Zero;
player.ChangeDir(this.direction);
player.heldProj = this.whoAmI;
int frames = player.HeldItem.useAnimation - (int) this.ai[1];
if (frames < 2)
frames = 2;
player.SetDummyItemTime(frames);
}
if ((double) this.ai[0] != 0.0)
return;
if (this.owner == Main.myPlayer)
{
Vector2 mouseWorld = Main.MouseWorld;
if (mouseWorld != this.Center)
{
this.netUpdate = true;
this.Center = mouseWorld;
}
if (Main.mouseRight && Main.mouseRightRelease)
{
this.Kill();
player.mouseInterface = true;
Main.blockMouse = true;
player.SetItemTime(0);
player.itemAnimation = 0;
player.itemAnimationMax = 0;
player.reuseDelay = 0;
return;
}
}
if (this.position != this.oldPosition)
{
if ((double) this.Center.X - (double) player.Center.X > 0.0)
this.direction = 1;
else
this.direction = -1;
}
this.velocity = Vector2.Zero;
player.ChangeDir(this.direction);
player.heldProj = this.whoAmI;
++this.ai[1];
int val1 = player.HeldItem.useAnimation * 4;
if ((double) this.ai[1] > (double) (val1 * 3))
this.ai[1] = (float) val1;
int frames1 = player.HeldItem.useAnimation + Math.Min(val1, (int) this.ai[1]);
if (frames1 < 2)
frames1 = 2;
player.SetDummyItemTime(frames1);
}
}
public Color GetCeleb2Color()
{
switch ((int) this.ai[0])
{
case 0:
return Color.Red;
case 1:
return Color.DarkOrange;
case 2:
return Color.Gold;
case 3:
return Color.LimeGreen;
case 4:
return Color.RoyalBlue;
case 5:
return new Color(80, 20, 180);
case 6:
return Color.HotPink;
default:
return Color.Transparent;
}
}
private void AI_007_GrapplingHooks()
{
if (Main.player[this.owner].dead || Main.player[this.owner].stoned || Main.player[this.owner].webbed || Main.player[this.owner].frozen)
{
this.Kill();
}
else
{
Vector2 mountedCenter = Main.player[this.owner].MountedCenter;
Vector2 vector2_1 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
float num1 = mountedCenter.X - vector2_1.X;
float num2 = mountedCenter.Y - vector2_1.Y;
float num3 = (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2);
this.rotation = (float) Math.Atan2((double) num2, (double) num1) - 1.57f;
if ((double) this.ai[0] == 2.0 && this.type == 865)
{
float num4 = 1.570796f;
this.rotation = (float) (int) Math.Round((double) this.rotation / (double) num4) * num4;
}
if (Main.myPlayer == this.owner)
{
int i = (int) ((double) this.Center.X / 16.0);
int j = (int) ((double) this.Center.Y / 16.0);
if (i > 0 && j > 0 && i < Main.maxTilesX && j < Main.maxTilesY && Main.tile[i, j].nactive() && Main.tile[i, j].type >= (ushort) 481 && Main.tile[i, j].type <= (ushort) 483 && Main.rand.Next(16) == 0)
{
WorldGen.KillTile(i, j);
if (Main.netMode != 0)
NetMessage.SendData(17, number2: ((float) i), number3: ((float) j));
}
}
if ((double) num3 > 2500.0)
this.Kill();
if (this.type == 256)
this.rotation = (float) Math.Atan2((double) num2, (double) num1) + 3.925f;
if (this.type == 446)
{
Lighting.AddLight(mountedCenter, 0.0f, 0.4f, 0.3f);
++this.localAI[0];
if ((double) this.localAI[0] >= 28.0)
this.localAI[0] = 0.0f;
DelegateMethods.v3_1 = new Vector3(0.0f, 0.4f, 0.3f);
Utils.PlotTileLine(this.Center, mountedCenter, 8f, new Utils.TileActionAttempt(DelegateMethods.CastLightOpen));
}
if (this.type == 652 && ++this.frameCounter >= 7)
{
this.frameCounter = 0;
if (++this.frame >= Main.projFrames[this.type])
this.frame = 0;
}
if (this.type >= 646 && this.type <= 649)
{
Vector3 rgb = Vector3.Zero;
switch (this.type)
{
case 646:
rgb = new Vector3(0.7f, 0.5f, 0.1f);
break;
case 647:
rgb = new Vector3(0.0f, 0.6f, 0.7f);
break;
case 648:
rgb = new Vector3(0.6f, 0.2f, 0.6f);
break;
case 649:
rgb = new Vector3(0.6f, 0.6f, 0.9f);
break;
}
Lighting.AddLight(mountedCenter, rgb);
Lighting.AddLight(this.Center, rgb);
DelegateMethods.v3_1 = rgb;
Utils.PlotTileLine(this.Center, mountedCenter, 8f, new Utils.TileActionAttempt(DelegateMethods.CastLightOpen));
}
if ((double) this.ai[0] == 0.0)
{
if ((double) num3 > 300.0 && this.type == 13 || (double) num3 > 400.0 && this.type == 32 || (double) num3 > 440.0 && this.type == 73 || (double) num3 > 440.0 && this.type == 74 || (double) num3 > 300.0 && this.type == 165 || (double) num3 > 350.0 && this.type == 256 || (double) num3 > 500.0 && this.type == 315 || (double) num3 > 550.0 && this.type == 322 || (double) num3 > 400.0 && this.type == 331 || (double) num3 > 550.0 && this.type == 332 || (double) num3 > 400.0 && this.type == 372 || (double) num3 > 300.0 && this.type == 396 || (double) num3 > 550.0 && this.type >= 646 && this.type <= 649 || (double) num3 > 600.0 && this.type == 652 || (double) num3 > 300.0 && this.type == 865 || (double) num3 > 500.0 && this.type == 935 || (double) num3 > 480.0 && this.type >= 486 && this.type <= 489 || (double) num3 > 500.0 && this.type == 446)
this.ai[0] = 1f;
else if (this.type >= 230 && this.type <= 235)
{
int num5 = 300 + (this.type - 230) * 30;
if ((double) num3 > (double) num5)
this.ai[0] = 1f;
}
else if (this.type == 753)
{
int num6 = 420;
if ((double) num3 > (double) num6)
this.ai[0] = 1f;
}
Vector2 vector2_2 = this.Center - new Vector2(5f);
Vector2 vector2_3 = this.Center + new Vector2(5f);
Point tileCoordinates1 = (vector2_2 - new Vector2(16f)).ToTileCoordinates();
Vector2 vector2_4 = new Vector2(32f);
Point tileCoordinates2 = (vector2_3 + vector2_4).ToTileCoordinates();
int num7 = tileCoordinates1.X;
int num8 = tileCoordinates2.X;
int num9 = tileCoordinates1.Y;
int num10 = tileCoordinates2.Y;
if (num7 < 0)
num7 = 0;
if (num8 > Main.maxTilesX)
num8 = Main.maxTilesX;
if (num9 < 0)
num9 = 0;
if (num10 > Main.maxTilesY)
num10 = Main.maxTilesY;
Player player = Main.player[this.owner];
List<Point> pointList = new List<Point>();
for (int index1 = 0; index1 < player.grapCount; ++index1)
{
Projectile projectile = Main.projectile[player.grappling[index1]];
if (projectile.aiStyle == 7 && (double) projectile.ai[0] == 2.0)
{
Point tileCoordinates3 = projectile.Center.ToTileCoordinates();
Tile tileSafely1 = Framing.GetTileSafely(tileCoordinates3);
if (tileSafely1.type == (ushort) 314 || TileID.Sets.Platforms[(int) tileSafely1.type])
{
for (int index2 = -2; index2 <= 2; ++index2)
{
for (int index3 = -2; index3 <= 2; ++index3)
{
Point pt = new Point(tileCoordinates3.X + index2, tileCoordinates3.Y + index3);
Tile tileSafely2 = Framing.GetTileSafely(pt);
if (tileSafely2.type == (ushort) 314 || TileID.Sets.Platforms[(int) tileSafely2.type])
pointList.Add(pt);
}
}
}
}
}
for (int index4 = num7; index4 < num8; ++index4)
{
for (int index5 = num9; index5 < num10; ++index5)
{
if (Main.tile[index4, index5] == null)
Main.tile[index4, index5] = new Tile();
Vector2 vector2_5;
vector2_5.X = (float) (index4 * 16);
vector2_5.Y = (float) (index5 * 16);
if ((double) vector2_2.X + 10.0 > (double) vector2_5.X && (double) vector2_2.X < (double) vector2_5.X + 16.0 && (double) vector2_2.Y + 10.0 > (double) vector2_5.Y && (double) vector2_2.Y < (double) vector2_5.Y + 16.0)
{
Tile theTile = Main.tile[index4, index5];
if (theTile.nactive() && this.AI_007_GrapplingHooks_CanTileBeLatchedOnTo(theTile) && !pointList.Contains(new Point(index4, index5)) && (this.type != 403 || theTile.type == (ushort) 314) && !Main.player[this.owner].IsBlacklistedForGrappling(new Point(index4, index5)))
{
if (Main.player[this.owner].grapCount < 10)
{
Main.player[this.owner].grappling[Main.player[this.owner].grapCount] = this.whoAmI;
++Main.player[this.owner].grapCount;
}
if (Main.myPlayer == this.owner)
{
int num11 = 0;
int index6 = -1;
int num12 = 100000;
if (this.type == 73 || this.type == 74)
{
for (int index7 = 0; index7 < 1000; ++index7)
{
if (index7 != this.whoAmI && Main.projectile[index7].active && Main.projectile[index7].owner == this.owner && Main.projectile[index7].aiStyle == 7 && (double) Main.projectile[index7].ai[0] == 2.0)
Main.projectile[index7].Kill();
}
}
else
{
int num13 = 3;
if (this.type == 165)
num13 = 8;
if (this.type == 256)
num13 = 2;
if (this.type == 372)
num13 = 2;
if (this.type == 652)
num13 = 1;
if (this.type >= 646 && this.type <= 649)
num13 = 4;
for (int index8 = 0; index8 < 1000; ++index8)
{
if (Main.projectile[index8].active && Main.projectile[index8].owner == this.owner && Main.projectile[index8].aiStyle == 7)
{
if (Main.projectile[index8].timeLeft < num12)
{
index6 = index8;
num12 = Main.projectile[index8].timeLeft;
}
++num11;
}
}
if (num11 > num13)
Main.projectile[index6].Kill();
}
WorldGen.KillTile(index4, index5, true, true);
SoundEngine.PlaySound(0, index4 * 16, index5 * 16);
this.velocity.X = 0.0f;
this.velocity.Y = 0.0f;
this.ai[0] = 2f;
this.position.X = (float) (index4 * 16 + 8 - this.width / 2);
this.position.Y = (float) (index5 * 16 + 8 - this.height / 2);
Microsoft.Xna.Framework.Rectangle? tileVisualHitbox = WorldGen.GetTileVisualHitbox(index4, index5);
if (tileVisualHitbox.HasValue)
this.Center = tileVisualHitbox.Value.Center.ToVector2();
this.damage = 0;
this.netUpdate = true;
if (Main.myPlayer == this.owner)
{
if (this.type == 935)
Main.player[this.owner].DoQueenSlimeHookTeleport(this.Center);
NetMessage.SendData(13, number: this.owner);
break;
}
break;
}
}
}
}
if ((double) this.ai[0] == 2.0)
break;
}
}
else if ((double) this.ai[0] == 1.0)
{
float num14 = 11f;
if (this.type == 32)
num14 = 15f;
if (this.type == 73 || this.type == 74)
num14 = 17f;
if (this.type == 315)
num14 = 20f;
if (this.type == 322)
num14 = 22f;
if (this.type >= 230 && this.type <= 235)
num14 = (float) (11.0 + (double) (this.type - 230) * 0.75);
if (this.type == 753)
num14 = 15f;
if (this.type == 446)
num14 = 20f;
if (this.type >= 486 && this.type <= 489)
num14 = 18f;
if (this.type >= 646 && this.type <= 649)
num14 = 24f;
if (this.type == 652)
num14 = 24f;
if (this.type == 332)
num14 = 17f;
if ((double) num3 < 24.0)
this.Kill();
float num15 = num14 / num3;
float num16 = num1 * num15;
float num17 = num2 * num15;
this.velocity.X = num16;
this.velocity.Y = num17;
}
else
{
if ((double) this.ai[0] != 2.0)
return;
Point tileCoordinates = this.Center.ToTileCoordinates();
if (Main.tile[tileCoordinates.X, tileCoordinates.Y] == null)
Main.tile[tileCoordinates.X, tileCoordinates.Y] = new Tile();
bool flag = true;
if ((!Main.tile[tileCoordinates.X, tileCoordinates.Y].nactive() ? 0 : (this.AI_007_GrapplingHooks_CanTileBeLatchedOnTo(Main.tile[tileCoordinates.X, tileCoordinates.Y]) ? 1 : 0)) != 0)
flag = false;
if (flag)
{
this.ai[0] = 1f;
}
else
{
if (Main.player[this.owner].grapCount >= 10)
return;
Main.player[this.owner].grappling[Main.player[this.owner].grapCount] = this.whoAmI;
++Main.player[this.owner].grapCount;
}
}
}
}
private bool AI_007_GrapplingHooks_CanTileBeLatchedOnTo(Tile theTile) => ((Main.tileSolid[(int) theTile.type] | theTile.type == (ushort) 314 ? 1 : 0) | (this.type != 865 ? 0 : (TileID.Sets.IsATreeTrunk[(int) theTile.type] ? 1 : 0)) | (this.type != 865 ? 0 : (theTile.type == (ushort) 323 ? 1 : 0))) != 0;
private void AI_147_Celeb2Rocket()
{
int index1 = 0;
int index2 = 1;
int index3 = 1;
++this.localAI[index1];
this.alpha = 0;
this.rotation = this.velocity.ToRotation() + 1.570796f;
int num1 = (int) this.ai[0];
Lighting.AddLight(this.Center, this.GetCeleb2Color().ToVector3() * 0.5f);
switch (num1)
{
case 0:
if ((double) this.localAI[index1] >= 20.0)
{
this.velocity.Y += 0.12f;
this.penetrate = -1;
}
if ((double) this.velocity.Y > 16.0)
this.velocity.Y = 16f;
if ((double) this.localAI[index1] <= 20.0 || (double) this.localAI[index1] % 20.0 != 0.0)
break;
this.AI_147_Explosion();
break;
case 1:
if ((double) this.localAI[index1] == 10.0)
this.velocity.Y -= 10f;
if ((double) this.localAI[index1] >= 10.0)
this.velocity.Y += 0.25f;
if ((double) this.velocity.Y > 16.0)
this.velocity.Y = 16f;
if ((double) this.localAI[index1] < 10.0)
break;
this.scale += 0.015f;
if ((double) this.scale > 2.5)
this.scale = 2.5f;
if ((double) this.localAI[index1] % 10.0 != 0.0)
break;
double y = (double) this.velocity.Y;
for (float num2 = 0.0f; (double) num2 < 1.0; num2 += 0.12f)
{
Vector2 spinningpoint = (Vector2.UnitX * -8f + -Vector2.UnitY.RotatedBy((double) num2 * 6.28318548202515) * new Vector2(2f, 4f)).RotatedBy((double) this.rotation - 1.57079637050629);
int index4 = Dust.NewDust(this.Center, 0, 0, 267, newColor: Color.Lerp(this.GetCeleb2Color(), Color.White, Main.rand.NextFloat() * 0.3f));
Main.dust[index4].scale = 0.9f;
Main.dust[index4].fadeIn = 1.1f;
Main.dust[index4].noGravity = true;
Main.dust[index4].position = this.Center + spinningpoint;
Main.dust[index4].velocity = -this.velocity * 0.35f + spinningpoint * 0.35f;
Main.dust[index4].velocity *= this.scale;
if ((double) this.localAI[index1] == 10.0)
Main.dust[index4].velocity = spinningpoint.RotatedBy((double) this.velocity.ToRotation()) * 0.3f;
}
break;
case 2:
if ((double) this.localAI[index1] >= 60.0)
this.velocity.Y += 0.15f;
if ((double) this.velocity.Y <= 16.0)
break;
this.velocity.Y = 16f;
break;
case 3:
float num3 = this.localAI[index2];
if ((double) num3 == 0.0)
{
float num4 = this.velocity.Length();
this.localAI[index2] = num4;
num3 = num4;
}
if ((double) this.localAI[index1] >= 25.0 && (double) this.ai[index3] == 0.0)
{
if ((double) this.localAI[index1] >= 20.0)
this.velocity.Y += 0.15f;
if ((double) this.velocity.Y > 16.0)
this.velocity.Y = 16f;
}
if ((double) this.localAI[index1] < 20.0)
break;
float num5 = this.position.X;
float num6 = this.position.Y;
float num7 = 800f;
bool flag = false;
int num8 = 0;
if ((double) this.ai[index3] == 0.0)
{
for (int index5 = 0; index5 < 200; ++index5)
{
if (Main.npc[index5].CanBeChasedBy((object) this) && ((double) this.ai[index3] == 0.0 || (double) this.ai[index3] == (double) (index5 + 1)))
{
float num9 = Main.npc[index5].position.X + (float) (Main.npc[index5].width / 2);
float num10 = Main.npc[index5].position.Y + (float) (Main.npc[index5].height / 2);
float num11 = Math.Abs(this.position.X + (float) (this.width / 2) - num9) + Math.Abs(this.position.Y + (float) (this.height / 2) - num10);
if ((double) num11 < (double) num7 && Collision.CanHit(new Vector2(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2)), 1, 1, Main.npc[index5].position, Main.npc[index5].width, Main.npc[index5].height))
{
num7 = num11;
num5 = num9;
num6 = num10;
flag = true;
num8 = index5;
}
}
}
if (flag)
this.ai[1] = (float) (num8 + 1);
flag = false;
}
if ((double) this.ai[index3] != 0.0)
{
int index6 = (int) ((double) this.ai[index3] - 1.0);
if (Main.npc[index6].active && Main.npc[index6].CanBeChasedBy((object) this, true))
{
float num12 = Main.npc[index6].position.X + (float) (Main.npc[index6].width / 2);
float num13 = Main.npc[index6].position.Y + (float) (Main.npc[index6].height / 2);
if ((double) Math.Abs(this.position.X + (float) (this.width / 2) - num12) + (double) Math.Abs(this.position.Y + (float) (this.height / 2) - num13) < 1000.0)
{
flag = true;
num5 = Main.npc[index6].position.X + (float) (Main.npc[index6].width / 2);
num6 = Main.npc[index6].position.Y + (float) (Main.npc[index6].height / 2);
}
}
}
if (!this.friendly)
flag = false;
if (!flag)
break;
double num14 = (double) num3;
Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
float num15 = num5 - vector2.X;
float num16 = num6 - vector2.Y;
double num17 = Math.Sqrt((double) num15 * (double) num15 + (double) num16 * (double) num16);
float num18 = (float) (num14 / num17);
float num19 = num15 * num18;
float num20 = num16 * num18;
int num21 = 8;
this.velocity.X = (this.velocity.X * (float) (num21 - 1) + num19) / (float) num21;
this.velocity.Y = (this.velocity.Y * (float) (num21 - 1) + num20) / (float) num21;
break;
case 4:
if ((double) this.localAI[index1] == 1.0 && (double) this.ai[1] == 1.0)
this.localAI[index1] += 45f;
float x = this.velocity.SafeNormalize(Vector2.Zero).RotatedBy((double) this.localAI[index1] * 0.0698131695389748).X;
this.position = this.position + this.velocity.SafeNormalize(Vector2.Zero).RotatedBy(1.57079637050629) * x * 3f;
this.scale = 2f;
if ((double) this.localAI[index1] >= 10.0)
this.velocity.Y += 0.04f;
if ((double) this.velocity.Y <= 16.0)
break;
this.velocity.Y = 16f;
break;
case 5:
if ((double) this.localAI[index1] >= 40.0)
this.velocity.Y += 0.08f;
if ((double) this.velocity.Y <= 16.0)
break;
this.velocity.Y = 16f;
break;
case 6:
if ((double) this.localAI[index1] >= 30.0)
this.velocity.Y += 0.1f;
if ((double) this.velocity.Y <= 16.0)
break;
this.velocity.Y = 16f;
break;
}
}
private void AI_148_StarSpawner()
{
if (Main.dayTime)
{
this.Kill();
}
else
{
this.ai[0] += (float) Main.dayRate;
if ((double) this.localAI[0] == 0.0 && Main.netMode != 2)
{
this.localAI[0] = 1f;
if ((double) Main.LocalPlayer.position.Y < Main.worldSurface * 16.0)
Star.StarFall(this.position.X);
}
if (this.owner != Main.myPlayer || (double) this.ai[0] < 180.0)
return;
if ((double) this.ai[1] > -1.0)
{
this.velocity.X *= 0.35f;
if ((double) this.Center.X < (double) Main.player[(int) this.ai[1]].Center.X)
this.velocity.X = Math.Abs(this.velocity.X);
else
this.velocity.X = -Math.Abs(this.velocity.X);
}
Projectile.NewProjectile(this.position.X, this.position.Y, this.velocity.X, this.velocity.Y, 12, 1000, 10f, Main.myPlayer);
this.Kill();
}
}
private void AI_147_Explosion()
{
switch ((int) this.ai[0])
{
case 0:
for (int index = 0; index < 4; ++index)
Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
for (int index1 = 0; index1 < 20; ++index1)
{
int index2 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 130, Alpha: 200, Scale: 1.2f);
Main.dust[index2].noGravity = true;
Main.dust[index2].velocity *= 3f;
int index3 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 130, Alpha: 200, Scale: 0.5f);
Main.dust[index3].velocity *= 1.2f;
Main.dust[index3].noGravity = true;
}
for (int index4 = 0; index4 < 1; ++index4)
{
int index5 = 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[index5].velocity *= 0.3f;
Main.gore[index5].velocity.X += (float) Main.rand.Next(-10, 11) * 0.05f;
Main.gore[index5].velocity.Y += (float) Main.rand.Next(-10, 11) * 0.05f;
}
break;
case 1:
Color celeb2Color1 = this.GetCeleb2Color();
Vector2 center1 = this.Center;
double num1 = (double) Main.rand.NextFloat();
for (float num2 = 0.0f; (double) num2 < 1.0; num2 += 0.0125f)
{
Dust dust = Dust.NewDustPerfect(center1, 278, Alpha: 200, newColor: Color.Lerp(celeb2Color1, Color.White, Main.rand.NextFloat() * 0.6f));
dust.scale = 1.1f;
dust.fadeIn = 1.3f;
dust.velocity *= (float) ((double) Main.rand.NextFloat() * 2.0 + 2.0);
if ((double) dust.velocity.Y > 0.0)
dust.velocity *= 0.3f;
dust.velocity *= 2f;
}
for (int index6 = 0; index6 < 3; ++index6)
{
int index7 = 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[index7].velocity *= 0.3f;
Main.gore[index7].velocity.X += (float) Main.rand.Next(-10, 11) * 0.05f;
Main.gore[index7].velocity.Y += (float) Main.rand.Next(-10, 11) * 0.05f;
}
this.CreateGroundExplosion(40f, 20, 100, 2, 10, 2);
break;
case 2:
Vector2 center2 = this.Center;
Color celeb2Color2 = this.GetCeleb2Color();
float num3 = 0.05f;
float num4 = 0.13f;
bool flag = Main.rand.Next(4) == 0;
if (flag)
{
num3 = 0.1f;
num4 = 0.1f;
}
float num5 = Main.rand.NextFloatDirection();
for (float num6 = 0.0f; (double) num6 < 5.0; ++num6)
{
Vector2 spinningpoint = new Vector2(0.0f, -100f);
Vector2 vector2_1 = center2 + spinningpoint.RotatedBy((double) num5 + (double) num6 * 1.25663709640503);
Vector2 vector2_2 = center2 + spinningpoint.RotatedBy((double) num5 + ((double) num6 + 1.0) * 1.25663709640503);
Vector2 vector2_3 = center2 + spinningpoint.RotatedBy((double) num5 + ((double) num6 + 0.5) * 1.25663709640503) * 0.4f;
for (int index = 0; index < 2; ++index)
{
Vector2 vector2_4 = vector2_1;
Vector2 vector2_5 = vector2_3;
if (index == 1)
{
vector2_4 = vector2_3;
vector2_5 = vector2_2;
}
for (float amount = 0.0f; (double) amount < 1.0; amount += num4)
{
Vector2 vector2_6 = Vector2.Lerp(vector2_4, vector2_5, amount);
Vector2 Position = Vector2.Lerp(vector2_6, center2, 0.9f);
Vector2 vector2_7 = (vector2_6 - Position).SafeNormalize(Vector2.Zero);
Dust dust = Dust.NewDustPerfect(Position, 267, new Vector2?(Vector2.Zero), newColor: celeb2Color2, Scale: 0.5f);
dust.fadeIn = 1.2f;
dust.noGravity = true;
dust.velocity = vector2_7 * Vector2.Distance(vector2_6, Position) * num3;
}
}
}
if (flag)
{
for (int index = 0; index < 4; ++index)
Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
for (int index8 = 0; index8 < 60; ++index8)
{
int index9 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 228, Alpha: 200, Scale: 2.5f);
Main.dust[index9].noGravity = true;
Main.dust[index9].velocity *= 8f;
int index10 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 228, Alpha: 200, Scale: 1.5f);
Main.dust[index10].velocity *= 4.2f;
Main.dust[index10].noGravity = true;
}
for (int index11 = 0; index11 < 1; ++index11)
{
int index12 = 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[index12].velocity *= 0.3f;
Main.gore[index12].velocity.X += (float) Main.rand.Next(-10, 11) * 0.05f;
Main.gore[index12].velocity.Y += (float) Main.rand.Next(-10, 11) * 0.05f;
}
break;
}
for (int index = 0; index < 4; ++index)
Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
for (int index13 = 0; index13 < 40; ++index13)
{
int index14 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 228, Alpha: 200, Scale: 2.5f);
Main.dust[index14].noGravity = true;
Main.dust[index14].velocity *= 4f;
int index15 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 228, Alpha: 200, Scale: 1.5f);
Main.dust[index15].velocity *= 2.2f;
Main.dust[index15].noGravity = true;
}
for (int index16 = 0; index16 < 1; ++index16)
{
int index17 = 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[index17].velocity *= 0.3f;
Main.gore[index17].velocity.X += (float) Main.rand.Next(-10, 11) * 0.05f;
Main.gore[index17].velocity.Y += (float) Main.rand.Next(-10, 11) * 0.05f;
}
break;
case 3:
Color celeb2Color3 = this.GetCeleb2Color();
Vector2 center3 = this.Center;
for (int index = 0; index < 4; ++index)
Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
float num7 = Main.rand.NextFloat() * 6.283185f;
for (int index = 0; index < 40; ++index)
{
Dust dust = Dust.NewDustPerfect(center3, 278, Alpha: 100, newColor: Color.Lerp(celeb2Color3, Color.White, Main.rand.NextFloat() * 0.3f));
dust.scale = (float) (1.29999995231628 * ((double) dust.velocity.Length() / 2.0));
dust.fadeIn = (float) (1.5 * ((double) dust.velocity.Length() / 2.0));
dust.noGravity = true;
dust.velocity *= 6f;
if ((double) Math.Abs(dust.velocity.X) > (double) Math.Abs(dust.velocity.Y))
dust.velocity.Y *= 0.1f;
else
dust.velocity.X *= 0.1f;
dust.velocity = dust.velocity.RotatedBy((double) num7);
}
for (int index18 = 0; index18 < 1; ++index18)
{
int index19 = 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[index19].velocity *= 0.3f;
Main.gore[index19].velocity.X += (float) Main.rand.Next(-10, 11) * 0.05f;
Main.gore[index19].velocity.Y += (float) Main.rand.Next(-10, 11) * 0.05f;
}
break;
case 4:
this.GetCeleb2Color();
Vector2 center4 = this.Center;
double num8 = (double) Main.rand.NextFloat();
for (float num9 = 0.0f; (double) num9 < 1.0; num9 += 0.025f)
{
Dust dust = Dust.NewDustPerfect(center4, 132, Alpha: 200);
dust.scale = 1.1f;
dust.fadeIn = 1.5f;
dust.velocity *= (float) ((double) Main.rand.NextFloat() * 2.0 + 2.0);
if ((double) dust.velocity.Y > 0.0)
dust.velocity *= 0.3f;
dust.velocity *= 2f;
}
for (int index20 = 0; index20 < 3; ++index20)
{
int index21 = 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[index21].velocity *= 0.3f;
Main.gore[index21].velocity.X += (float) Main.rand.Next(-10, 11) * 0.05f;
Main.gore[index21].velocity.Y += (float) Main.rand.Next(-10, 11) * 0.05f;
}
break;
case 5:
Color celeb2Color4 = this.GetCeleb2Color();
Vector2 center5 = this.Center;
for (int index22 = 0; index22 < 20; ++index22)
{
int index23 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 278, Alpha: 200, newColor: Color.Lerp(celeb2Color4, Color.White, Main.rand.NextFloat() * 0.4f), Scale: 2.5f);
Main.dust[index23].fadeIn = 1.3f;
Main.dust[index23].scale = 1.1f;
Main.dust[index23].velocity *= 2f;
int index24 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 27, Alpha: 200, newColor: celeb2Color4, Scale: 2.5f);
Main.dust[index24].velocity *= 1.2f;
Main.dust[index24].noGravity = true;
}
break;
case 6:
Color celeb2Color5 = this.GetCeleb2Color();
Vector2 center6 = this.Center;
for (int index = 0; index < 4; ++index)
Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.5f);
for (float num10 = 0.0f; (double) num10 < 1.0; num10 += 0.015f)
{
Vector2 vector2 = Vector2.UnitY.RotatedBy((double) num10 * 6.28318548202515) * (float) (1.0 + (double) Main.rand.NextFloatDirection() * 0.100000001490116);
Dust dust = Dust.NewDustPerfect(center6 + vector2, 134, new Vector2?(Vector2.Zero), newColor: celeb2Color5);
dust.scale = 1.4f;
dust.velocity = vector2 * 5f;
dust.velocity.Y += -3f;
dust.velocity *= 2f;
}
for (float num11 = 0.0f; (double) num11 < 1.0; num11 += 0.025f)
{
Vector2 vector2 = Vector2.UnitY.RotatedBy((double) num11 * 6.28318548202515) * (float) (1.0 + (double) Main.rand.NextFloatDirection() * 0.200000002980232);
Dust dust = Dust.NewDustPerfect(center6 + vector2, 267, new Vector2?(Vector2.Zero), newColor: celeb2Color5);
dust.noGravity = true;
dust.scale = 0.4f;
dust.fadeIn = 1.2f;
dust.velocity = vector2 * 4f;
dust.velocity.Y += -3f;
dust.velocity *= 2f;
}
for (float num12 = 0.0f; (double) num12 < 1.0; num12 += 0.07f)
{
Vector2 vector2 = Vector2.UnitY.RotatedBy((double) num12 * 6.28318548202515) * (float) (1.0 + (double) Main.rand.NextFloatDirection() * 0.300000011920929);
Dust dust = Dust.NewDustPerfect(center6 + vector2, 267, new Vector2?(Vector2.Zero), newColor: celeb2Color5);
dust.noGravity = true;
dust.scale = 0.4f;
dust.fadeIn = 1.3f;
dust.velocity = vector2 * 7f;
dust.velocity.Y += -3f;
dust.velocity *= 2f;
}
for (int index25 = 0; index25 < 1; ++index25)
{
int index26 = 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[index26].velocity *= 0.3f;
Main.gore[index26].velocity.X += (float) Main.rand.Next(-10, 11) * 0.05f;
Main.gore[index26].velocity.Y += (float) Main.rand.Next(-10, 11) * 0.05f;
}
break;
}
}
private void CreateGroundExplosion(
float MAX_SPREAD,
int fluff,
int distFluff,
int layerStart,
int layerEnd,
int layerJump)
{
Point tileCoordinates1 = this.TopLeft.ToTileCoordinates();
Point tileCoordinates2 = this.BottomRight.ToTileCoordinates();
tileCoordinates1.X -= fluff;
tileCoordinates1.Y -= fluff;
tileCoordinates2.X += fluff;
tileCoordinates2.Y += fluff;
int num1 = tileCoordinates1.X / 2 + tileCoordinates2.X / 2;
int num2 = this.width / 2 + distFluff;
for (int index1 = layerStart; index1 < layerEnd; index1 += layerJump)
{
int num3 = index1;
for (int x = tileCoordinates1.X; x <= tileCoordinates2.X; ++x)
{
for (int y = tileCoordinates1.Y; y <= tileCoordinates2.Y; ++y)
{
if (!WorldGen.InWorld(x, y, 10))
return;
if ((double) Vector2.Distance(this.Center, new Vector2((float) (x * 16), (float) (y * 16))) <= (double) num2)
{
Tile tileSafely1 = Framing.GetTileSafely(x, y);
if (tileSafely1.active() && Main.tileSolid[(int) tileSafely1.type] && !Main.tileSolidTop[(int) tileSafely1.type] && !Main.tileFrameImportant[(int) tileSafely1.type])
{
Tile tileSafely2 = Framing.GetTileSafely(x, y - 1);
if (!tileSafely2.active() || !Main.tileSolid[(int) tileSafely2.type] || Main.tileSolidTop[(int) tileSafely2.type])
{
int tileDustAmount = WorldGen.KillTile_GetTileDustAmount(true, tileSafely1);
for (int index2 = 0; index2 < tileDustAmount; ++index2)
{
Dust dust = Main.dust[WorldGen.KillTile_MakeTileDust(x, y, tileSafely1)];
dust.velocity.Y -= (float) (3.0 + (double) num3 * 1.5);
dust.velocity.Y *= Main.rand.NextFloat();
dust.scale += (float) num3 * 0.03f;
}
if (num3 >= 2)
{
for (int index3 = 0; index3 < tileDustAmount - 1; ++index3)
{
Dust dust = Main.dust[WorldGen.KillTile_MakeTileDust(x, y, tileSafely1)];
dust.velocity.Y -= 1f + (float) num3;
dust.velocity.Y *= Main.rand.NextFloat();
}
}
if (tileDustAmount > 0 && Main.rand.Next(3) != 0)
{
float num4 = (float) Math.Abs(num1 - x) / (MAX_SPREAD / 2f);
Gore gore = Gore.NewGoreDirect(this.position, Vector2.Zero, 61 + Main.rand.Next(3), (float) (1.0 - (double) num3 * 0.150000005960464 + (double) num4 * 0.5));
gore.velocity.Y -= (float) (0.100000001490116 + (double) num3 * 0.5 + (double) num4 * (double) num3 * 1.0);
gore.velocity.Y *= Main.rand.NextFloat();
gore.position = new Vector2((float) (x * 16 + 20), (float) (y * 16 + 20));
}
}
}
}
}
}
}
}
public void CheckUsability(Player player, ref bool currentlyUsable)
{
if (this.aiStyle != 160)
return;
currentlyUsable = false;
}
private void AI_163_Chum()
{
float num1 = 0.05f;
float num2 = (float) (this.width / 2);
for (int index = 0; index < 1000; ++index)
{
if (index != this.whoAmI && Main.projectile[index].active && Main.projectile[index].type == this.type && (double) Math.Abs(this.position.X - Main.projectile[index].position.X) + (double) Math.Abs(this.position.Y - Main.projectile[index].position.Y) < (double) num2)
{
if ((double) this.position.X < (double) Main.projectile[index].position.X)
this.velocity.X -= num1;
else
this.velocity.X += num1;
if ((double) this.position.Y < (double) Main.projectile[index].position.Y)
this.velocity.Y -= num1;
else
this.velocity.Y += num1;
}
}
if (this.wet)
{
this.velocity.X *= 0.9f;
int index1 = (int) ((double) this.Center.X + (double) ((this.width / 2 + 8) * this.direction)) / 16;
int index2 = (int) ((double) this.Center.Y / 16.0);
double num3 = (double) this.position.Y / 16.0;
int index3 = (int) (((double) this.position.Y + (double) this.height) / 16.0);
if (Main.tile[index1, index2] == null)
Main.tile[index1, index2] = new Tile();
if (Main.tile[index1, index3] == null)
Main.tile[index1, index3] = new Tile();
if ((double) this.velocity.Y > 0.0)
this.velocity.Y *= 0.5f;
float waterLine = this.AI_061_FishingBobber_GetWaterLine((int) ((double) this.Center.X / 16.0), (int) ((double) this.Center.Y / 16.0));
if ((double) this.Center.Y > (double) waterLine)
{
this.velocity.Y -= 0.1f;
if ((double) this.velocity.Y < -8.0)
this.velocity.Y = -8f;
if ((double) this.Center.Y + (double) this.velocity.Y < (double) waterLine)
this.velocity.Y = waterLine - this.Center.Y;
}
else
this.velocity.Y = waterLine - this.Center.Y;
}
else
{
if ((double) this.velocity.Y == 0.0)
this.velocity.X *= 0.95f;
this.velocity.X *= 0.98f;
this.velocity.Y += 0.3f;
if ((double) this.velocity.Y > 15.8999996185303)
this.velocity.Y = 15.9f;
}
if (this.frameCounter == 0)
{
this.frameCounter = 1;
this.frame = Main.rand.Next(4);
}
if (this.frameCounter < 10 && this.wet)
{
++this.frameCounter;
for (float num4 = 0.0f; (double) num4 < 1.0; num4 += 0.5f)
{
Gore gore = Gore.NewGoreDirect(this.position + Vector2.UnitY * 6f, Vector2.Zero, 1201, this.scale * 0.7f);
gore.velocity = Main.rand.NextVector2CircularEdge(10f, 10f);
if ((double) gore.velocity.Y > 0.0)
gore.velocity.Y *= -1f;
}
for (float num5 = 0.0f; (double) num5 < 2.0; ++num5)
{
Gore gore = Gore.NewGoreDirect(this.position + Vector2.UnitY * 6f, Vector2.Zero, 1208, (float) ((double) this.scale * 0.699999988079071 + (double) Main.rand.NextFloat() * 0.150000005960464));
gore.velocity = Main.rand.NextVector2CircularEdge(4f, 4f);
if ((double) gore.velocity.Y > 0.0)
gore.velocity.Y *= -1f;
}
}
this.scale = Utils.GetLerpValue(0.0f, 60f, (float) this.timeLeft, true);
this.rotation += this.velocity.X * 0.14f;
bool flag = !this.wet && (double) this.velocity.Length() < 0.800000011920929;
int maxValue = this.wet ? 90 : 5;
if (Main.rand.Next(maxValue) == 0 && !flag)
{
Gore gore = Gore.NewGoreDirect(this.position + Vector2.UnitY * 6f, Vector2.Zero, 1201, this.scale * 0.7f);
if (this.wet)
gore.velocity = Vector2.UnitX * Main.rand.NextFloatDirection() * 0.75f + Vector2.UnitY * Main.rand.NextFloat();
else if ((double) gore.velocity.Y < 0.0)
gore.velocity.Y = -gore.velocity.Y;
}
Vector2 spot = this.Center + Vector2.UnitY * 16f;
if ((double) this.ai[0] >= 10.0 && this.timeLeft > 60)
{
this.timeLeft = 60;
this.netUpdate = true;
}
if ((double) this.ai[0] >= 10.0 || this.timeLeft <= 60)
return;
Main.instance.ChumBucketProjectileHelper.AddChumLocation(spot);
}
private void ReduceRemainingChumsInPool()
{
int x = (int) this.Center.X / 16;
int y = (int) this.Center.Y / 16;
List<Tuple<int, Point>> tupleList = new List<Tuple<int, Point>>();
List<int> intList = new List<int>();
for (int index = 0; index < 1000; ++index)
{
Projectile projectile = Main.projectile[index];
if (projectile.active && projectile.owner == Main.myPlayer && projectile.timeLeft > 60 && projectile.type == 820)
tupleList.Add(new Tuple<int, Point>(index, (projectile.Center + Vector2.UnitY * 16f).ToTileCoordinates()));
}
if (tupleList.Count == 0)
return;
int minX;
int maxX;
Projectile.GetFishingPondWidth(x, y, out minX, out maxX);
Point point = new Point();
for (int i = minX; i <= maxX; ++i)
{
point.X = i;
int j = y;
while (Main.tile[i, j].liquid > (byte) 0 && !WorldGen.SolidTile(i, j) && j < Main.maxTilesY - 10)
{
++j;
point.Y = j;
for (int index = tupleList.Count - 1; index >= 0; --index)
{
if (tupleList[index].Item2 == point)
{
intList.Add(tupleList[index].Item1);
tupleList.RemoveAt(index);
}
}
if (tupleList.Count == 0)
break;
}
if (tupleList.Count == 0)
break;
}
for (int index = 0; index < intList.Count; ++index)
{
Projectile projectile = Main.projectile[intList[index]];
++projectile.ai[0];
projectile.netUpdate = true;
}
}
private void AI_061_FishingBobber()
{
Player player = Main.player[this.owner];
this.timeLeft = 60;
bool flag1 = false;
if (player.inventory[player.selectedItem].fishingPole == 0 || player.CCed || player.noItems)
flag1 = true;
else if (player.inventory[player.selectedItem].shoot != this.type)
flag1 = true;
else if (player.pulley)
flag1 = true;
else if (player.dead)
flag1 = true;
if (flag1)
{
this.Kill();
}
else
{
if ((double) this.ai[1] > 0.0 && (double) this.localAI[1] != 0.0)
{
this.localAI[1] = 0.0f;
if (!this.lavaWet && !this.honeyWet)
this.AI_061_FishingBobber_DoASplash();
}
if ((double) this.ai[0] >= 1.0)
{
if ((double) this.ai[0] == 2.0)
{
++this.ai[0];
SoundEngine.PlaySound(SoundID.Item17, this.position);
if (!this.lavaWet && !this.honeyWet)
this.AI_061_FishingBobber_DoASplash();
}
if ((double) this.localAI[0] < 100.0)
++this.localAI[0];
if (this.frameCounter == 0)
{
this.frameCounter = 1;
this.ReduceRemainingChumsInPool();
}
this.tileCollide = false;
int num1 = 10;
Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
float num2 = player.position.X + (float) (player.width / 2) - vector2.X;
float num3 = player.position.Y + (float) (player.height / 2) - vector2.Y;
float num4 = (float) Math.Sqrt((double) num2 * (double) num2 + (double) num3 * (double) num3);
if ((double) num4 > 3000.0)
this.Kill();
float num5 = (float) (15.8999996185303 / (double) num4);
float num6 = num2 * num5;
float num7 = num3 * num5;
this.velocity.X = (this.velocity.X * (float) (num1 - 1) + num6) / (float) num1;
this.velocity.Y = (this.velocity.Y * (float) (num1 - 1) + num7) / (float) num1;
this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57f;
if (Main.myPlayer != this.owner || !this.Hitbox.Intersects(player.Hitbox))
return;
this.Kill();
}
else
{
bool flag2 = false;
Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
float num8 = player.position.X + (float) (player.width / 2) - vector2.X;
float num9 = player.position.Y + (float) (player.height / 2) - vector2.Y;
this.rotation = (float) Math.Atan2((double) num9, (double) num8) + 1.57f;
if (Math.Sqrt((double) num8 * (double) num8 + (double) num9 * (double) num9) > 900.0)
this.ai[0] = 1f;
if (this.wet)
{
this.rotation = 0.0f;
this.velocity.X *= 0.9f;
int index1 = (int) ((double) this.Center.X + (double) ((this.width / 2 + 8) * this.direction)) / 16;
int index2 = (int) ((double) this.Center.Y / 16.0);
double num10 = (double) this.position.Y / 16.0;
int index3 = (int) (((double) this.position.Y + (double) this.height) / 16.0);
if (Main.tile[index1, index2] == null)
Main.tile[index1, index2] = new Tile();
if (Main.tile[index1, index3] == null)
Main.tile[index1, index3] = new Tile();
if ((double) this.velocity.Y > 0.0)
this.velocity.Y *= 0.5f;
float waterLine = this.AI_061_FishingBobber_GetWaterLine((int) ((double) this.Center.X / 16.0), (int) ((double) this.Center.Y / 16.0));
if ((double) this.Center.Y > (double) waterLine)
{
this.velocity.Y -= 0.1f;
if ((double) this.velocity.Y < -8.0)
this.velocity.Y = -8f;
if ((double) this.Center.Y + (double) this.velocity.Y < (double) waterLine)
this.velocity.Y = waterLine - this.Center.Y;
}
else
this.velocity.Y = waterLine - this.Center.Y;
if ((double) this.velocity.Y >= -0.01 && (double) this.velocity.Y <= 0.01)
flag2 = true;
}
else
{
if ((double) this.velocity.Y == 0.0)
this.velocity.X *= 0.95f;
this.velocity.X *= 0.98f;
this.velocity.Y += 0.2f;
if ((double) this.velocity.Y > 15.8999996185303)
this.velocity.Y = 15.9f;
}
if (Main.myPlayer == this.owner && player.GetFishingConditions().BaitItemType == 2673)
player.displayedFishingInfo = Language.GetTextValue("GameUI.FishingWarning");
if ((double) this.ai[1] != 0.0)
flag2 = true;
if (!flag2)
return;
if ((double) this.ai[1] == 0.0 && Main.myPlayer == this.owner)
{
int finalFishingLevel = player.GetFishingConditions().FinalFishingLevel;
if (Main.rand.Next(300) < finalFishingLevel)
this.localAI[1] += (float) Main.rand.Next(1, 3);
this.localAI[1] += (float) (finalFishingLevel / 30);
this.localAI[1] += (float) Main.rand.Next(1, 3);
if (Main.rand.Next(60) == 0)
this.localAI[1] += 60f;
if ((double) this.localAI[1] <= 660.0)
return;
this.localAI[1] = 0.0f;
this.FishingCheck();
}
else
{
if ((double) this.ai[1] >= 0.0)
return;
if ((double) this.velocity.Y == 0.0 || this.honeyWet && (double) Math.Abs(this.velocity.Y) <= 0.00999999977648258)
{
this.velocity.Y = (float) Main.rand.Next(100, 500) * 0.015f;
this.velocity.X = (float) Main.rand.Next(-100, 101) * 0.015f;
this.wet = false;
this.lavaWet = false;
this.honeyWet = false;
}
this.ai[1] += (float) Main.rand.Next(1, 5);
if ((double) this.ai[1] < 0.0)
return;
this.ai[1] = 0.0f;
this.localAI[1] = 0.0f;
this.netUpdate = true;
}
}
}
}
private float AI_061_FishingBobber_GetWaterLine(int X, int Y)
{
float num = this.position.Y + (float) this.height;
if (Main.tile[X, Y - 1] == null)
Main.tile[X, Y - 1] = new Tile();
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 - 1].liquid > (byte) 0)
num = (float) (Y * 16) - (float) ((int) Main.tile[X, Y - 1].liquid / 16);
else if (Main.tile[X, Y].liquid > (byte) 0)
num = (float) ((Y + 1) * 16) - (float) ((int) Main.tile[X, Y].liquid / 16);
else if (Main.tile[X, Y + 1].liquid > (byte) 0)
num = (float) ((Y + 2) * 16) - (float) ((int) Main.tile[X, Y + 1].liquid / 16);
return num;
}
private void AI_061_FishingBobber_DoASplash()
{
for (int index1 = 0; index1 < 100; ++index1)
{
int index2 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y - 10f), this.width + 12, 24, Dust.dustWater());
Main.dust[index2].velocity.Y -= 4f;
Main.dust[index2].velocity.X *= 2.5f;
Main.dust[index2].scale = 0.8f;
Main.dust[index2].alpha = 100;
Main.dust[index2].noGravity = true;
}
SoundEngine.PlaySound(19, (int) this.position.X, (int) this.position.Y, 0);
}
private void AI_061_FishingBobber_GiveItemToPlayer(Player thePlayer, int itemType)
{
Item newItem = new Item();
newItem.SetDefaults(itemType);
if (itemType == 3196)
{
int finalFishingLevel = thePlayer.GetFishingConditions().FinalFishingLevel;
int minValue = (finalFishingLevel / 20 + 3) / 2;
int num1 = (finalFishingLevel / 10 + 6) / 2;
if (Main.rand.Next(50) < finalFishingLevel)
++num1;
if (Main.rand.Next(100) < finalFishingLevel)
++num1;
if (Main.rand.Next(150) < finalFishingLevel)
++num1;
if (Main.rand.Next(200) < finalFishingLevel)
++num1;
int num2 = Main.rand.Next(minValue, num1 + 1);
newItem.stack = num2;
}
if (itemType == 3197)
{
int finalFishingLevel = thePlayer.GetFishingConditions().FinalFishingLevel;
int minValue = (finalFishingLevel / 4 + 15) / 2;
int num3 = (finalFishingLevel / 2 + 30) / 2;
if (Main.rand.Next(50) < finalFishingLevel)
num3 += 4;
if (Main.rand.Next(100) < finalFishingLevel)
num3 += 4;
if (Main.rand.Next(150) < finalFishingLevel)
num3 += 4;
if (Main.rand.Next(200) < finalFishingLevel)
num3 += 4;
int num4 = Main.rand.Next(minValue, num3 + 1);
newItem.stack = num4;
}
newItem.newAndShiny = true;
if (thePlayer.GetItem(this.owner, newItem, new GetItemSettings()).stack > 0)
{
int number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, itemType, noGrabDelay: true);
if (Main.netMode != 1)
return;
NetMessage.SendData(21, number: number, number2: 1f);
}
else
{
newItem.position.X = this.Center.X - (float) (newItem.width / 2);
newItem.position.Y = this.Center.Y - (float) (newItem.height / 2);
newItem.active = true;
PopupText.NewText(PopupTextContext.RegularItemPickup, newItem, 0);
}
}
private void AI_146_DD2Victory()
{
}
private void BetsySharpnel(int npcIndex)
{
if ((double) this.ai[1] == -1.0 || this.owner != Main.myPlayer)
return;
Vector2 spinningpoint = new Vector2(0.0f, 6f);
Vector2 center = this.Center;
float num1 = 0.7853982f;
int num2 = 5;
float num3 = (float) -((double) num1 * 2.0) / (float) (num2 - 1);
for (int index1 = 0; index1 < num2; ++index1)
{
int index2 = Projectile.NewProjectile(center, spinningpoint.RotatedBy((double) num1 + (double) num3 * (double) index1), 710, this.damage, this.knockBack, this.owner, ai1: -1f);
this.CopyLocalNPCImmunityTimes(Main.projectile[index2]);
}
}
private void CopyLocalNPCImmunityTimes(Projectile p)
{
for (int index = 0; index < this.localNPCImmunity.Length; ++index)
p.localNPCImmunity[index] = this.localNPCImmunity[index];
}
private void AI_001()
{
if (this.type == 469 && this.wet && !this.honeyWet)
this.Kill();
if (this.type == 601)
{
Color portalColor = PortalHelper.GetPortalColor(this.owner, (int) this.ai[0]);
Lighting.AddLight(this.Center + this.velocity * 3f, portalColor.ToVector3() * 0.5f);
if (this.alpha > 0 && this.alpha <= 15)
{
Color color = portalColor;
color.A = byte.MaxValue;
for (int index = 0; index < 4; ++index)
{
Dust dust = Main.dust[Dust.NewDust(this.Center, 0, 0, 264)];
dust.position = this.Center;
dust.velocity = this.velocity * 2f + Utils.RandomVector2(Main.rand, -1f, 1f);
dust.color = color;
dust.scale = 1.2f;
dust.noLight = true;
dust.noGravity = true;
dust.customData = (object) Main.player[this.owner];
}
if ((double) this.ai[0] != 0.0)
SoundEngine.PlaySound(SoundID.Item114, this.position);
else
SoundEngine.PlaySound(SoundID.Item115, this.position);
}
this.alpha -= 15;
if (this.alpha < 0)
this.alpha = 0;
if (++this.frameCounter >= 4)
{
this.frameCounter = 0;
if (++this.frame >= Main.projFrames[this.type])
this.frame = 0;
}
if (this.alpha == 0)
{
Color color = portalColor;
color.A = byte.MaxValue;
Dust dust = Main.dust[Dust.NewDust(this.Center, 0, 0, 263)];
dust.position = this.Center;
dust.velocity = this.velocity / 4f;
dust.color = color;
dust.noGravity = true;
dust.scale = 0.6f;
}
}
if (this.type == 472)
{
int index1 = Dust.NewDust(this.position, this.width, this.height, 30);
Main.dust[index1].noGravity = true;
Main.dust[index1].velocity *= 0.25f;
Main.dust[index1].velocity += this.velocity * 0.75f;
if ((double) this.localAI[0] == 0.0)
{
this.localAI[0] = 1f;
SoundEngine.PlaySound(SoundID.Item17, this.position);
for (int index2 = 0; index2 < 20; ++index2)
{
int index3 = Dust.NewDust(this.position, this.width, this.height, 30);
Main.dust[index3].noGravity = true;
Main.dust[index3].velocity *= 0.25f;
Main.dust[index3].velocity += this.velocity;
Main.dust[index3].velocity.X *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258);
Main.dust[index3].velocity.Y *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258);
}
}
}
if (this.type == 323)
{
this.alpha -= 50;
if (this.alpha < 0)
this.alpha = 0;
}
if (this.type == 436)
{
if ((double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item12, this.position);
}
this.alpha -= 40;
if (this.alpha < 0)
this.alpha = 0;
this.spriteDirection = this.direction;
++this.frameCounter;
if (this.frameCounter >= 3)
{
++this.frame;
this.frameCounter = 0;
if (this.frame >= 4)
this.frame = 0;
}
Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.3f, 1.1f, 0.5f);
}
if (this.type == 467)
{
if ((double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item34, this.position);
}
else if ((double) this.ai[1] == 1.0 && Main.netMode != 1)
{
int num1 = -1;
float num2 = 2000f;
for (int index = 0; index < (int) byte.MaxValue; ++index)
{
if (Main.player[index].active && !Main.player[index].dead)
{
Vector2 center = Main.player[index].Center;
float num3 = Vector2.Distance(center, this.Center);
if (((double) num3 < (double) num2 || num1 == -1) && Collision.CanHit(this.Center, 1, 1, center, 1, 1))
{
num2 = num3;
num1 = index;
}
}
}
if ((double) num2 < 20.0)
{
this.Kill();
return;
}
if (num1 != -1)
{
this.ai[1] = 21f;
this.ai[0] = (float) num1;
this.netUpdate = true;
}
}
else if ((double) this.ai[1] > 20.0 && (double) this.ai[1] < 200.0)
{
++this.ai[1];
int index = (int) this.ai[0];
if (!Main.player[index].active || Main.player[index].dead)
{
this.ai[1] = 1f;
this.ai[0] = 0.0f;
this.netUpdate = true;
}
else
{
float rotation = this.velocity.ToRotation();
Vector2 v = Main.player[index].Center - this.Center;
if ((double) v.Length() < 20.0)
{
this.Kill();
return;
}
float targetAngle = v.ToRotation();
if (v == Vector2.Zero)
targetAngle = rotation;
float num = rotation.AngleLerp(targetAngle, 0.008f);
this.velocity = new Vector2(this.velocity.Length(), 0.0f).RotatedBy((double) num);
}
}
if ((double) this.ai[1] >= 1.0 && (double) this.ai[1] < 20.0)
{
++this.ai[1];
if ((double) this.ai[1] == 20.0)
this.ai[1] = 1f;
}
this.alpha -= 40;
if (this.alpha < 0)
this.alpha = 0;
this.spriteDirection = this.direction;
++this.frameCounter;
if (this.frameCounter >= 3)
{
++this.frame;
this.frameCounter = 0;
if (this.frame >= 4)
this.frame = 0;
}
Lighting.AddLight(this.Center, 1.1f, 0.9f, 0.4f);
++this.localAI[0];
if ((double) this.localAI[0] == 12.0)
{
this.localAI[0] = 0.0f;
for (int index4 = 0; index4 < 12; ++index4)
{
Vector2 vector2 = (Vector2.UnitX * (float) -this.width / 2f + -Vector2.UnitY.RotatedBy((double) index4 * 3.14159274101257 / 6.0) * new Vector2(8f, 16f)).RotatedBy((double) this.rotation - 1.57079637050629);
int index5 = Dust.NewDust(this.Center, 0, 0, 6, Alpha: 160);
Main.dust[index5].scale = 1.1f;
Main.dust[index5].noGravity = true;
Main.dust[index5].position = this.Center + vector2;
Main.dust[index5].velocity = this.velocity * 0.1f;
Main.dust[index5].velocity = Vector2.Normalize(this.Center - this.velocity * 3f - Main.dust[index5].position) * 1.25f;
}
}
if (Main.rand.Next(4) == 0)
{
for (int index6 = 0; index6 < 1; ++index6)
{
Vector2 vector2 = -Vector2.UnitX.RotatedByRandom(0.196349546313286).RotatedBy((double) this.velocity.ToRotation());
int index7 = Dust.NewDust(this.position, this.width, this.height, 31, Alpha: 100);
Main.dust[index7].velocity *= 0.1f;
Main.dust[index7].position = this.Center + vector2 * (float) this.width / 2f;
Main.dust[index7].fadeIn = 0.9f;
}
}
if (Main.rand.Next(32) == 0)
{
for (int index8 = 0; index8 < 1; ++index8)
{
Vector2 vector2 = -Vector2.UnitX.RotatedByRandom(0.392699092626572).RotatedBy((double) this.velocity.ToRotation());
int index9 = Dust.NewDust(this.position, this.width, this.height, 31, Alpha: 155, Scale: 0.8f);
Main.dust[index9].velocity *= 0.3f;
Main.dust[index9].position = this.Center + vector2 * (float) this.width / 2f;
if (Main.rand.Next(2) == 0)
Main.dust[index9].fadeIn = 1.4f;
}
}
if (Main.rand.Next(2) == 0)
{
for (int index10 = 0; index10 < 2; ++index10)
{
Vector2 vector2 = -Vector2.UnitX.RotatedByRandom(0.785398185253143).RotatedBy((double) this.velocity.ToRotation());
int index11 = Dust.NewDust(this.position, this.width, this.height, 6, Scale: 1.2f);
Main.dust[index11].velocity *= 0.3f;
Main.dust[index11].noGravity = true;
Main.dust[index11].position = this.Center + vector2 * (float) this.width / 2f;
if (Main.rand.Next(2) == 0)
Main.dust[index11].fadeIn = 1.4f;
}
}
}
if (this.type == 468)
{
if ((double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item34, this.position);
}
else if ((double) this.ai[1] == 1.0 && Main.netMode != 1)
{
int num4 = -1;
float num5 = 2000f;
for (int index = 0; index < (int) byte.MaxValue; ++index)
{
if (Main.player[index].active && !Main.player[index].dead)
{
Vector2 center = Main.player[index].Center;
float num6 = Vector2.Distance(center, this.Center);
if (((double) num6 < (double) num5 || num4 == -1) && Collision.CanHit(this.Center, 1, 1, center, 1, 1))
{
num5 = num6;
num4 = index;
}
}
}
if ((double) num5 < 20.0)
{
this.Kill();
return;
}
if (num4 != -1)
{
this.ai[1] = 21f;
this.ai[0] = (float) num4;
this.netUpdate = true;
}
}
else if ((double) this.ai[1] > 20.0 && (double) this.ai[1] < 200.0)
{
++this.ai[1];
int index = (int) this.ai[0];
if (!Main.player[index].active || Main.player[index].dead)
{
this.ai[1] = 1f;
this.ai[0] = 0.0f;
this.netUpdate = true;
}
else
{
float rotation = this.velocity.ToRotation();
Vector2 v = Main.player[index].Center - this.Center;
if ((double) v.Length() < 20.0)
{
this.Kill();
return;
}
float targetAngle = v.ToRotation();
if (v == Vector2.Zero)
targetAngle = rotation;
float num = rotation.AngleLerp(targetAngle, 0.01f);
this.velocity = new Vector2(this.velocity.Length(), 0.0f).RotatedBy((double) num);
}
}
if ((double) this.ai[1] >= 1.0 && (double) this.ai[1] < 20.0)
{
++this.ai[1];
if ((double) this.ai[1] == 20.0)
this.ai[1] = 1f;
}
this.alpha -= 40;
if (this.alpha < 0)
this.alpha = 0;
this.spriteDirection = this.direction;
++this.frameCounter;
if (this.frameCounter >= 3)
{
++this.frame;
this.frameCounter = 0;
if (this.frame >= 4)
this.frame = 0;
}
Lighting.AddLight(this.Center, 0.2f, 0.1f, 0.6f);
++this.localAI[0];
if ((double) this.localAI[0] == 12.0)
{
this.localAI[0] = 0.0f;
for (int index12 = 0; index12 < 12; ++index12)
{
Vector2 vector2 = (Vector2.UnitX * (float) -this.width / 2f + -Vector2.UnitY.RotatedBy((double) index12 * 3.14159274101257 / 6.0) * new Vector2(8f, 16f)).RotatedBy((double) this.rotation - 1.57079637050629);
int index13 = Dust.NewDust(this.Center, 0, 0, 27, Alpha: 160);
Main.dust[index13].scale = 1.1f;
Main.dust[index13].noGravity = true;
Main.dust[index13].position = this.Center + vector2;
Main.dust[index13].velocity = this.velocity * 0.1f;
Main.dust[index13].velocity = Vector2.Normalize(this.Center - this.velocity * 3f - Main.dust[index13].position) * 1.25f;
}
}
if (Main.rand.Next(4) == 0)
{
for (int index14 = 0; index14 < 1; ++index14)
{
Vector2 vector2 = -Vector2.UnitX.RotatedByRandom(0.196349546313286).RotatedBy((double) this.velocity.ToRotation());
int index15 = Dust.NewDust(this.position, this.width, this.height, 31, Alpha: 100);
Main.dust[index15].velocity *= 0.1f;
Main.dust[index15].position = this.Center + vector2 * (float) this.width / 2f;
Main.dust[index15].fadeIn = 0.9f;
}
}
if (Main.rand.Next(32) == 0)
{
for (int index16 = 0; index16 < 1; ++index16)
{
Vector2 vector2 = -Vector2.UnitX.RotatedByRandom(0.392699092626572).RotatedBy((double) this.velocity.ToRotation());
int index17 = Dust.NewDust(this.position, this.width, this.height, 31, Alpha: 155, Scale: 0.8f);
Main.dust[index17].velocity *= 0.3f;
Main.dust[index17].position = this.Center + vector2 * (float) this.width / 2f;
if (Main.rand.Next(2) == 0)
Main.dust[index17].fadeIn = 1.4f;
}
}
if (Main.rand.Next(2) == 0)
{
for (int index18 = 0; index18 < 2; ++index18)
{
Vector2 vector2 = -Vector2.UnitX.RotatedByRandom(0.785398185253143).RotatedBy((double) this.velocity.ToRotation());
int index19 = Dust.NewDust(this.position, this.width, this.height, 27, Scale: 1.2f);
Main.dust[index19].velocity *= 0.3f;
Main.dust[index19].noGravity = true;
Main.dust[index19].position = this.Center + vector2 * (float) this.width / 2f;
if (Main.rand.Next(2) == 0)
Main.dust[index19].fadeIn = 1.4f;
}
}
}
if (this.type == 634 || this.type == 635)
{
float num7 = 5f;
float num8 = 250f;
float num9 = 6f;
Vector2 vector2_1 = new Vector2(8f, 10f);
float num10 = 1.2f;
Vector3 rgb = new Vector3(0.7f, 0.1f, 0.5f);
int num11 = 4 * this.MaxUpdates;
int Type1 = Utils.SelectRandom<int>(Main.rand, 242, 73, 72, 71, (int) byte.MaxValue);
int Type2 = (int) byte.MaxValue;
if (this.type == 635)
{
vector2_1 = new Vector2(10f, 20f);
num10 = 1f;
num8 = 500f;
Type2 = 88;
num11 = 3 * this.MaxUpdates;
rgb = new Vector3(0.4f, 0.6f, 0.9f);
Type1 = Utils.SelectRandom<int>(Main.rand, 242, 59, 88);
}
if ((double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
this.localAI[0] = (float) -Main.rand.Next(48);
SoundEngine.PlaySound(SoundID.Item34, this.position);
}
else if ((double) this.ai[1] == 1.0 && this.owner == Main.myPlayer)
{
int num12 = -1;
float num13 = num8;
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].CanBeChasedBy((object) this))
{
Vector2 center = Main.npc[index].Center;
float num14 = Vector2.Distance(center, this.Center);
if ((double) num14 < (double) num13 && num12 == -1 && Collision.CanHitLine(this.Center, 1, 1, center, 1, 1))
{
num13 = num14;
num12 = index;
}
}
}
if ((double) num13 < 20.0)
{
this.Kill();
return;
}
if (num12 != -1)
{
this.ai[1] = num7 + 1f;
this.ai[0] = (float) num12;
this.netUpdate = true;
}
}
else if ((double) this.ai[1] > (double) num7)
{
++this.ai[1];
int index = (int) this.ai[0];
if (!Main.npc[index].active || !Main.npc[index].CanBeChasedBy((object) this))
{
this.ai[1] = 1f;
this.ai[0] = 0.0f;
this.netUpdate = true;
}
else
{
double rotation = (double) this.velocity.ToRotation();
Vector2 vector2_2 = Main.npc[index].Center - this.Center;
if ((double) vector2_2.Length() < 20.0)
{
this.Kill();
return;
}
if (vector2_2 != Vector2.Zero)
{
vector2_2.Normalize();
vector2_2 *= num9;
}
float num15 = 30f;
this.velocity = (this.velocity * (num15 - 1f) + vector2_2) / num15;
}
}
if ((double) this.ai[1] >= 1.0 && (double) this.ai[1] < (double) num7)
{
++this.ai[1];
if ((double) this.ai[1] == (double) num7)
this.ai[1] = 1f;
}
this.alpha -= 40;
if (this.alpha < 0)
this.alpha = 0;
this.spriteDirection = this.direction;
++this.frameCounter;
if (this.frameCounter >= num11)
{
++this.frame;
this.frameCounter = 0;
if (this.frame >= 4)
this.frame = 0;
}
Lighting.AddLight(this.Center, rgb);
this.rotation = this.velocity.ToRotation();
++this.localAI[0];
if ((double) this.localAI[0] == 48.0)
this.localAI[0] = 0.0f;
else if (this.alpha == 0)
{
for (int index20 = 0; index20 < 2; ++index20)
{
Vector2 vector2_3 = Vector2.UnitX * -30f;
Vector2 vector2_4 = -Vector2.UnitY.RotatedBy((double) this.localAI[0] * 0.130899697542191 + (double) index20 * 3.14159274101257) * vector2_1 - this.rotation.ToRotationVector2() * 10f;
int index21 = Dust.NewDust(this.Center, 0, 0, Type2, Alpha: 160);
Main.dust[index21].scale = num10;
Main.dust[index21].noGravity = true;
Main.dust[index21].position = this.Center + vector2_4 + this.velocity * 2f;
Main.dust[index21].velocity = Vector2.Normalize(this.Center + this.velocity * 2f * 8f - Main.dust[index21].position) * 2f + this.velocity * 2f;
}
}
if (Main.rand.Next(12) == 0)
{
for (int index22 = 0; index22 < 1; ++index22)
{
Vector2 vector2_5 = -Vector2.UnitX.RotatedByRandom(0.196349546313286).RotatedBy((double) this.velocity.ToRotation());
int index23 = Dust.NewDust(this.position, this.width, this.height, 31, Alpha: 100);
Main.dust[index23].velocity *= 0.1f;
Main.dust[index23].position = this.Center + vector2_5 * (float) this.width / 2f + this.velocity * 2f;
Main.dust[index23].fadeIn = 0.9f;
}
}
if (Main.rand.Next(64) == 0)
{
for (int index24 = 0; index24 < 1; ++index24)
{
Vector2 vector2_6 = -Vector2.UnitX.RotatedByRandom(0.392699092626572).RotatedBy((double) this.velocity.ToRotation());
int index25 = Dust.NewDust(this.position, this.width, this.height, 31, Alpha: 155, Scale: 0.8f);
Main.dust[index25].velocity *= 0.3f;
Main.dust[index25].position = this.Center + vector2_6 * (float) this.width / 2f;
if (Main.rand.Next(2) == 0)
Main.dust[index25].fadeIn = 1.4f;
}
}
if (Main.rand.Next(4) == 0)
{
for (int index26 = 0; index26 < 2; ++index26)
{
Vector2 vector2_7 = -Vector2.UnitX.RotatedByRandom(0.785398185253143).RotatedBy((double) this.velocity.ToRotation());
int index27 = Dust.NewDust(this.position, this.width, this.height, Type1, Scale: 1.2f);
Main.dust[index27].velocity *= 0.3f;
Main.dust[index27].noGravity = true;
Main.dust[index27].position = this.Center + vector2_7 * (float) this.width / 2f;
if (Main.rand.Next(2) == 0)
Main.dust[index27].fadeIn = 1.4f;
}
}
if (Main.rand.Next(12) == 0 && this.type == 634)
{
Vector2 vector2_8 = -Vector2.UnitX.RotatedByRandom(0.196349546313286).RotatedBy((double) this.velocity.ToRotation());
int index = Dust.NewDust(this.position, this.width, this.height, Type2, Alpha: 100);
Main.dust[index].velocity *= 0.3f;
Main.dust[index].position = this.Center + vector2_8 * (float) this.width / 2f;
Main.dust[index].fadeIn = 0.9f;
Main.dust[index].noGravity = true;
}
if (Main.rand.Next(3) == 0 && this.type == 635)
{
Vector2 vector2_9 = -Vector2.UnitX.RotatedByRandom(0.196349546313286).RotatedBy((double) this.velocity.ToRotation());
int index = Dust.NewDust(this.position, this.width, this.height, Type2, Alpha: 100);
Main.dust[index].velocity *= 0.3f;
Main.dust[index].position = this.Center + vector2_9 * (float) this.width / 2f;
Main.dust[index].fadeIn = 1.2f;
Main.dust[index].scale = 1.5f;
Main.dust[index].noGravity = true;
}
}
if (this.type == 459)
{
this.alpha -= 30;
if (this.alpha < 0)
this.alpha = 0;
this.spriteDirection = this.direction;
++this.frameCounter;
if (this.frameCounter >= 3)
{
++this.frame;
this.frameCounter = 0;
if (this.frame >= 3)
this.frame = 0;
}
this.position = this.Center;
this.scale = this.ai[1];
this.width = this.height = (int) (22.0 * (double) this.scale);
this.Center = this.position;
Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.4f, 0.85f, 0.9f);
int num;
if ((double) this.scale < 0.85)
{
num = Main.rand.Next(3) == 0 ? 1 : 0;
}
else
{
num = 1;
this.penetrate = -1;
this.maxPenetrate = -1;
}
for (int index28 = 0; index28 < num; ++index28)
{
int index29 = Dust.NewDust(this.position, this.width, this.height, 226, this.velocity.X);
Main.dust[index29].position -= Vector2.One * 3f;
Main.dust[index29].scale = 0.5f;
Main.dust[index29].noGravity = true;
Main.dust[index29].velocity = this.velocity / 3f;
Main.dust[index29].alpha = (int) byte.MaxValue - (int) ((double) byte.MaxValue * (double) this.scale);
}
}
if (this.type == 709)
{
this.alpha -= 30;
if (this.alpha < 0)
this.alpha = 0;
this.spriteDirection = this.direction;
++this.frameCounter;
if (this.frameCounter >= 3)
{
++this.frame;
this.frameCounter = 0;
if (this.frame >= 3)
this.frame = 0;
}
Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.4f, 0.85f, 0.9f);
if ((double) this.ai[1] == 0.0)
SoundEngine.PlayTrackedSound((SoundStyle) SoundID.DD2_SkyDragonsFuryShot, this.Center);
++this.ai[1];
if ((double) this.ai[1] >= 30.0)
{
this.Kill();
return;
}
}
if (this.type == 442)
{
this.frame = 0;
if (this.alpha != 0)
{
++this.localAI[0];
if ((double) this.localAI[0] >= 4.0)
{
this.alpha -= 90;
if (this.alpha < 0)
{
this.alpha = 0;
this.localAI[0] = 2f;
}
}
}
if ((double) Vector2.Distance(this.Center, new Vector2(this.ai[0], this.ai[1]) * 16f + Vector2.One * 8f) <= 16.0)
{
this.Kill();
return;
}
if (this.alpha == 0)
{
++this.localAI[1];
if ((double) this.localAI[1] >= 120.0)
{
this.Kill();
return;
}
Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.3f, 0.45f, 0.8f);
++this.localAI[0];
if ((double) this.localAI[0] == 3.0)
{
this.localAI[0] = 0.0f;
for (int index30 = 0; index30 < 8; ++index30)
{
Vector2 vector2 = (Vector2.UnitX * -8f + -Vector2.UnitY.RotatedBy((double) index30 * 3.14159274101257 / 4.0) * new Vector2(2f, 4f)).RotatedBy((double) this.rotation - 1.57079637050629);
int index31 = Dust.NewDust(this.Center, 0, 0, 135);
Main.dust[index31].scale = 1.5f;
Main.dust[index31].noGravity = true;
Main.dust[index31].position = this.Center + vector2;
Main.dust[index31].velocity = this.velocity * 0.66f;
}
}
}
}
if (this.type == 440 || this.type == 449 || this.type == 606)
{
if (this.alpha > 0)
this.alpha -= 25;
if (this.alpha < 0)
this.alpha = 0;
if (this.type == 440)
Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.25f, 0.4f, 0.7f);
if (this.type == 449)
Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.7f, 0.65f, 0.3f);
if (this.type == 606)
Lighting.AddLight(this.Center, 0.7f, 0.3f, 0.3f);
float num16 = 100f;
float num17 = 3f;
if (this.type == 606)
{
num16 = 150f;
num17 = 5f;
}
if ((double) this.ai[1] == 0.0)
{
this.localAI[0] += num17;
if ((double) this.localAI[0] == (double) num17 * 1.0 && this.type == 606)
{
for (int index32 = 0; index32 < 4; ++index32)
{
int index33 = Dust.NewDust(this.Center - this.velocity / 2f, 0, 0, 182, Alpha: 100, Scale: 1.4f);
Main.dust[index33].velocity *= 0.2f;
Main.dust[index33].velocity += this.velocity / 10f;
Main.dust[index33].noGravity = true;
}
}
if ((double) this.localAI[0] > (double) num16)
this.localAI[0] = num16;
}
else
{
this.localAI[0] -= num17;
if ((double) this.localAI[0] <= 0.0)
{
this.Kill();
return;
}
}
}
if (this.type == 438)
Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.4f, 0.1f, 0.2f);
if (this.type == 593)
{
Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.4f, 0.1f, 0.3f);
if (++this.frameCounter >= 12)
{
if (++this.frame >= Main.projFrames[this.type])
this.frame = 0;
this.frameCounter = 0;
}
if (Main.rand.Next(2) == 0)
{
Vector2 spinningpoint = Vector2.UnitY.RotatedByRandom(6.28318548202515);
Dust dust = Main.dust[Dust.NewDust(this.Center - spinningpoint * 8f, 0, 0, 240)];
dust.noGravity = true;
dust.position = this.Center - spinningpoint * 8f * this.scale;
dust.velocity = spinningpoint.RotatedBy(-1.57079637050629) * 2f;
dust.velocity = Vector2.Zero;
dust.scale = 0.5f + Main.rand.NextFloat();
dust.fadeIn = 0.5f;
}
}
if (this.type == 592)
Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.15f, 0.15f, 0.4f);
if (this.type == 462)
{
int index = Dust.NewDust(this.Center, 0, 0, 229, Alpha: 100);
Main.dust[index].noLight = true;
Main.dust[index].noGravity = true;
Main.dust[index].velocity = this.velocity;
Main.dust[index].position -= Vector2.One * 4f;
Main.dust[index].scale = 0.8f;
if (++this.frameCounter >= 9)
{
this.frameCounter = 0;
if (++this.frame >= 5)
this.frame = 0;
}
}
if (this.type == 437)
{
if ((double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item12, this.position);
}
if ((double) this.localAI[0] == 0.0)
{
this.localAI[0] = 1f;
for (int index34 = 0; index34 < 4; ++index34)
{
int index35 = Dust.NewDust(this.position, this.width, this.height, 226, this.velocity.X);
Main.dust[index35].position = Vector2.Lerp(Main.dust[index35].position, this.Center, 0.25f);
Main.dust[index35].scale = 0.5f;
Main.dust[index35].noGravity = true;
Main.dust[index35].velocity /= 2f;
Main.dust[index35].velocity += this.velocity * 0.66f;
}
}
if ((double) this.ai[0] < 16.0)
{
for (int index36 = 0; index36 < 2; ++index36)
{
int index37 = Dust.NewDust(this.position, this.width, this.height, 226, this.velocity.X);
Main.dust[index37].position = this.position + new Vector2((float) ((this.direction == 1 ? 1 : 0) * this.width), (float) (2 + (this.height - 4) * index36));
Main.dust[index37].scale = 0.3f;
Main.dust[index37].noGravity = true;
Main.dust[index37].velocity = Vector2.Zero;
}
}
}
if (this.type == 435)
{
if ((double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item12, this.position);
}
this.alpha -= 40;
if (this.alpha < 0)
this.alpha = 0;
this.spriteDirection = this.direction;
++this.frameCounter;
if (this.frameCounter >= 3)
{
++this.frame;
this.frameCounter = 0;
if (this.frame >= 4)
this.frame = 0;
}
Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.3f, 0.8f, 1.1f);
}
if (this.type == 682)
{
if ((double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.DD2_LightningBugZap, this.position);
for (int index = 0; index < 8; ++index)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 272);
dust.velocity *= 1f;
dust.velocity += this.velocity * 0.65f;
dust.scale = 0.6f;
dust.fadeIn = 0.8f;
dust.noGravity = true;
dust.noLight = true;
dust.position += dust.velocity * 3f;
}
}
this.alpha -= 40;
if (this.alpha < 0)
this.alpha = 0;
this.spriteDirection = this.direction;
++this.frameCounter;
if (this.frameCounter >= 3)
{
++this.frame;
this.frameCounter = 0;
if (this.frame >= 4)
this.frame = 0;
}
Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.5f, 0.2f, 1.1f);
}
if (this.type == 684)
{
this.alpha -= 40;
if (this.alpha < 0)
this.alpha = 0;
this.spriteDirection = this.direction;
++this.localAI[0];
for (int index = 0; index < 1; ++index)
{
Vector2 vector2 = (Utils.RandomVector2(Main.rand, -0.5f, 0.5f) * new Vector2(20f, 80f)).RotatedBy((double) this.velocity.ToRotation());
Dust dust = Dust.NewDustDirect(this.Center, 0, 0, 60);
dust.alpha = (int) sbyte.MaxValue;
dust.fadeIn = 1.5f;
dust.scale = 1.3f;
dust.velocity *= 0.3f;
dust.position = this.Center + vector2;
dust.noGravity = true;
dust.noLight = true;
dust.color = new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0);
}
Lighting.AddLight(this.Center, 1.1f, 0.3f, 0.4f);
}
if (this.type == 408)
{
this.alpha -= 40;
if (this.alpha < 0)
this.alpha = 0;
this.spriteDirection = this.direction;
}
if (this.type == 282)
{
int index = Dust.NewDust(this.position, this.width, this.height, 171, Alpha: 100);
Main.dust[index].scale = (float) Main.rand.Next(1, 10) * 0.1f;
Main.dust[index].noGravity = true;
Main.dust[index].fadeIn = 1.5f;
Main.dust[index].velocity *= 0.25f;
Main.dust[index].velocity += this.velocity * 0.25f;
}
if (this.type == 275 || this.type == 276)
{
++this.frameCounter;
if (this.frameCounter > 1)
{
this.frameCounter = 0;
++this.frame;
if (this.frame > 1)
this.frame = 0;
}
}
if (this.type == 225 && Main.rand.Next(2) == 0)
{
int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 40);
Main.dust[index].noGravity = true;
Main.dust[index].scale = 1.3f;
Main.dust[index].velocity *= 0.5f;
}
if (this.type == 174)
{
if (this.alpha == 0)
{
int index = Dust.NewDust(this.oldPosition - this.velocity * 3f, this.width, this.height, 76, Alpha: 50);
Main.dust[index].noGravity = true;
Main.dust[index].noLight = true;
Main.dust[index].velocity *= 0.5f;
}
this.alpha -= 50;
if (this.alpha < 0)
this.alpha = 0;
if ((double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item17, this.position);
}
}
else if (this.type == 605 || this.type == 920 || this.type == 921 || this.type == 926 || this.type == 937)
{
if (this.type == 920 && this.frameCounter == 0)
{
this.frameCounter = 1;
this.frame = Main.rand.Next(3);
}
if (this.alpha == 0 && Main.rand.Next(3) == 0)
{
int Type = 4;
Color newColor = new Color(78, 136, (int) byte.MaxValue, 150);
float Scale = 1.2f;
bool flag = true;
int num = 0;
if (this.type == 921)
{
Type = 243;
newColor = new Color();
}
if (this.type == 926)
{
Type = 4;
newColor = NPC.AI_121_QueenSlime_GetDustColor();
newColor.A = (byte) 150;
Scale = 1.2f;
num = 8;
flag = Main.rand.Next(2) == 0;
}
if (this.type == 937)
{
Type = 4;
newColor = NPC.AI_121_QueenSlime_GetDustColor();
newColor.A = (byte) 150;
}
int index = Dust.NewDust(this.position - new Vector2((float) num, (float) num) + this.velocity, this.width + num * 2, this.height + num * 2, Type, Alpha: 50, newColor: newColor, Scale: Scale);
Main.dust[index].velocity *= 0.3f;
Main.dust[index].velocity += this.velocity * 0.3f;
Main.dust[index].noGravity = flag;
}
this.alpha -= 50;
if (this.alpha < 0)
this.alpha = 0;
if (this.type != 937 && (double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
if (this.type == 926)
SoundEngine.PlaySound(SoundID.Item155, this.position);
else
SoundEngine.PlaySound(SoundID.Item154, this.position);
}
}
else if (this.type == 176)
{
if (this.alpha == 0)
{
int index = Dust.NewDust(this.oldPosition, this.width, this.height, 22, Alpha: 100, Scale: 0.5f);
Main.dust[index].noGravity = true;
Main.dust[index].noLight = true;
Main.dust[index].velocity *= 0.15f;
Main.dust[index].fadeIn = 0.8f;
}
this.alpha -= 50;
if (this.alpha < 0)
this.alpha = 0;
if ((double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item17, this.position);
}
}
if (this.type == 350)
{
this.alpha -= 100;
if (this.alpha < 0)
this.alpha = 0;
Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.9f, 0.6f, 0.2f);
if (this.alpha == 0)
{
int num = 2;
if (Main.rand.Next(3) != 0)
{
int index = Dust.NewDust(new Vector2(this.Center.X - (float) num, (float) ((double) this.Center.Y - (double) num - 2.0)) - this.velocity * 0.5f, num * 2, num * 2, 6, Alpha: 100);
Main.dust[index].scale *= (float) (1.29999995231628 + (double) Main.rand.Next(10) * 0.0500000007450581);
Main.dust[index].velocity *= 0.2f;
Main.dust[index].noGravity = true;
Main.dust[index].noLight = true;
Main.dust[index].velocity += this.velocity * 0.25f;
}
if (Main.rand.Next(4) == 0)
{
int index = Dust.NewDust(new Vector2(this.Center.X - (float) num, (float) ((double) this.Center.Y - (double) num - 2.0)) - this.velocity * 0.5f, num * 2, num * 2, 31, Alpha: 100, Scale: 0.5f);
Main.dust[index].fadeIn = (float) (0.600000023841858 + (double) Main.rand.Next(5) * 0.100000001490116);
Main.dust[index].velocity *= 0.05f;
Main.dust[index].velocity += this.velocity * 0.25f;
}
}
if ((double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item42, this.position);
}
}
if (this.type == 325)
{
this.alpha -= 100;
if (this.alpha < 0)
this.alpha = 0;
Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, 0.9f, 0.6f, 0.2f);
if (this.alpha == 0)
{
int num = 2;
if (Main.rand.Next(3) != 0)
{
int index = Dust.NewDust(new Vector2(this.Center.X - (float) num, (float) ((double) this.Center.Y - (double) num - 2.0)) - this.velocity * 0.5f, num * 2, num * 2, 6, Alpha: 100);
Main.dust[index].scale *= (float) (1.20000004768372 + (double) Main.rand.Next(10) * 0.0500000007450581);
Main.dust[index].velocity *= 0.2f;
Main.dust[index].noGravity = true;
Main.dust[index].noLight = true;
Main.dust[index].velocity += this.velocity * 0.25f;
}
if (Main.rand.Next(4) == 0)
{
int index = Dust.NewDust(new Vector2(this.Center.X - (float) num, (float) ((double) this.Center.Y - (double) num - 2.0)) - this.velocity * 0.5f, num * 2, num * 2, 31, Alpha: 100, Scale: 0.5f);
Main.dust[index].fadeIn = (float) (0.5 + (double) Main.rand.Next(5) * 0.0500000007450581);
Main.dust[index].velocity *= 0.05f;
}
}
if ((double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item42, this.position);
}
}
if (this.type == 469)
{
++this.localAI[1];
if ((double) this.localAI[1] > 2.0)
{
this.alpha -= 50;
if (this.alpha < 0)
this.alpha = 0;
}
}
else if (this.type == 83 && (double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item33, this.position);
}
else if (this.type == 408 && (double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
SoundEngine.PlaySound(4, (int) this.position.X, (int) this.position.Y, 19);
}
else if (this.type == 259 && (double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item33, this.position);
}
else if (this.type == 110 && (double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item11, this.position);
}
else if (this.type == 302 && (double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item11, this.position);
}
else if (this.type == 438 && (double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item12, this.position);
}
else if (this.type == 593 && (double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item11, this.position);
}
else if (this.type == 592 && (double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item12, this.position);
}
else if (this.type == 462 && (double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
if (Main.rand.Next(2) == 0)
SoundEngine.PlaySound(SoundID.Item124, this.position);
else
SoundEngine.PlaySound(SoundID.Item125, this.position);
Vector2 vector2 = Vector2.Normalize(this.velocity);
int num = Main.rand.Next(5, 10);
for (int index38 = 0; index38 < num; ++index38)
{
int index39 = Dust.NewDust(this.Center, 0, 0, 229, Alpha: 100);
--Main.dust[index39].velocity.Y;
Main.dust[index39].velocity += vector2 * 2f;
Main.dust[index39].position -= Vector2.One * 4f;
Main.dust[index39].noGravity = true;
}
}
else if (this.type == 84 && (double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item12, this.position);
}
else if (this.type == 389 && (double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item12, this.position);
}
else if (this.type == 257 && (double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item12, this.position);
}
else if (this.type == 100 && (double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item33, this.position);
}
else if (this.type == 98 && (double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item17, this.position);
}
else if (this.type == 184 && (double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item17, this.position);
}
else if (this.type == 195 && (double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item17, this.position);
}
else if (this.type == 275 && (double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item17, this.position);
}
else if (this.type == 276 && (double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item17, this.position);
}
else if ((this.type == 81 || this.type == 82) && (double) this.ai[1] == 0.0)
{
SoundEngine.PlaySound(SoundID.Item5, this.position);
this.ai[1] = 1f;
}
else if (this.type == 180 && (double) this.ai[1] == 0.0)
{
SoundEngine.PlaySound(SoundID.Item11, this.position);
this.ai[1] = 1f;
}
else if (this.type == 248 && (double) this.ai[1] == 0.0)
{
SoundEngine.PlaySound(SoundID.Item17, this.position);
this.ai[1] = 1f;
}
else if (this.type == 576 && (double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item12, this.position);
}
else if (this.type == 577 && (double) this.ai[1] == 0.0)
{
this.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item36, this.position);
}
else if (this.type == 710)
{
this.alpha -= 25;
if (this.alpha < 0)
this.alpha = 0;
if (Main.rand.Next(4) == 0)
{
if (Main.rand.Next(2) == 0)
{
int index = Dust.NewDust(this.position, this.width, this.height, 31, Alpha: 100, Scale: 1.6f);
Main.dust[index].noGravity = true;
}
int index40 = Dust.NewDust(this.position, this.width, this.height, 6, Alpha: 100, Scale: 1.2f);
Main.dust[index40].noGravity = true;
Main.dust[index40].velocity *= 2f;
Main.dust[index40].velocity += this.velocity;
Main.dust[index40].fadeIn = (double) this.ai[1] != -1.0 ? 1.22f : 1.5f;
if (this.wet)
this.Kill();
}
}
else if (this.type == 639)
{
if ((double) this.localAI[0] == 0.0 && (double) this.localAI[1] == 0.0)
{
this.localAI[0] = this.Center.X;
this.localAI[1] = this.Center.Y;
this.ai[0] = this.velocity.X;
this.ai[1] = this.velocity.Y;
}
this.alpha -= 25;
if (this.alpha < 0)
this.alpha = 0;
}
else if (this.type == 640)
{
this.alpha -= 25;
if (this.alpha < 0)
this.alpha = 0;
if (this.velocity == Vector2.Zero)
{
this.ai[0] = 0.0f;
bool flag = true;
for (int index = 1; index < this.oldPos.Length; ++index)
{
if (this.oldPos[index] != this.oldPos[0])
flag = false;
}
if (flag)
{
this.Kill();
return;
}
if (Main.rand.Next(this.extraUpdates) == 0 && (this.velocity != Vector2.Zero || Main.rand.Next((double) this.localAI[1] == 2.0 ? 2 : 6) == 0))
{
for (int index41 = 0; index41 < 2; ++index41)
{
float num18 = this.rotation + (float) ((Main.rand.Next(2) == 1 ? -1.0 : 1.0) * 1.57079637050629);
float num19 = (float) (Main.rand.NextDouble() * 0.800000011920929 + 1.0);
Vector2 vector2 = new Vector2((float) Math.Cos((double) num18) * num19, (float) Math.Sin((double) num18) * num19);
int index42 = Dust.NewDust(this.Center, 0, 0, 229, vector2.X, vector2.Y);
Main.dust[index42].noGravity = true;
Main.dust[index42].scale = 1.2f;
}
if (Main.rand.Next(10) == 0)
{
int index = Dust.NewDust(this.Center + this.velocity.RotatedBy(1.57079637050629) * ((float) Main.rand.NextDouble() - 0.5f) * (float) this.width - Vector2.One * 4f, 8, 8, 31, Alpha: 100, Scale: 1.5f);
Main.dust[index].velocity *= 0.5f;
Main.dust[index].velocity.Y = -Math.Abs(Main.dust[index].velocity.Y);
}
}
}
else if (this.numUpdates == 1)
{
float num20 = (float) ((double) this.rotation + 1.57079637050629 + (Main.rand.Next(2) == 1 ? -1.0 : 1.0) * 1.57079637050629);
float num21 = (float) (Main.rand.NextDouble() * 0.25 + 0.25);
Vector2 vector2 = new Vector2((float) Math.Cos((double) num20) * num21, (float) Math.Sin((double) num20) * num21);
int index = Dust.NewDust(this.position, 0, 0, 229, vector2.X, vector2.Y);
Main.dust[index].noGravity = true;
Main.dust[index].scale = 1.2f;
}
}
if (this.type == 41)
{
int index43 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, Alpha: 100, Scale: 1.6f);
Main.dust[index43].noGravity = true;
int index44 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 2f);
Main.dust[index44].noGravity = true;
}
else if (this.type == 55)
{
int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 18, Scale: 0.9f);
Main.dust[index].noGravity = true;
}
else if (this.type == 719)
{
if (Main.rand.Next(2) == 0)
Dust.NewDustDirect(this.position - this.velocity, this.width, this.height, 147, Scale: 0.9f).noGravity = true;
if ((double) this.localAI[0] == 0.0)
{
this.localAI[0] = 1f;
for (int index = 0; index < 20; ++index)
{
Dust dust = Dust.NewDustDirect(this.position - this.velocity, this.width, this.height, 147, Scale: 1.3f);
dust.noGravity = true;
dust.velocity += this.velocity * 0.75f;
}
for (int index = 0; index < 10; ++index)
{
Dust dust = Dust.NewDustDirect(this.position - this.velocity, this.width, this.height, 147, Scale: 1.3f);
dust.noGravity = true;
dust.velocity *= 2f;
}
}
}
else if (this.type == 763)
{
if ((double) this.localAI[0] == 0.0)
{
this.localAI[0] = 1f;
for (int index = 0; index < 5; ++index)
{
Dust dust = Dust.NewDustDirect(this.position - this.velocity, this.width, this.height, 40, Scale: 1.1f);
dust.noGravity = true;
dust.velocity *= 1.5f;
}
}
}
else if (this.type == 772)
{
if (Main.rand.Next(7) == 0)
{
for (int index = 0; index < 1; ++index)
{
Dust dust = Dust.NewDustDirect(this.position - this.velocity, this.width, this.height, Main.rand.NextFromList<int>(86, 87, 88, 89, 90, 91, 138), Scale: 0.7f);
dust.noGravity = true;
dust.velocity = this.velocity * 0.6f;
dust.fadeIn = 0.8f;
}
}
}
else if (this.type == 374)
{
if ((double) this.localAI[0] == 0.0)
{
SoundEngine.PlaySound(SoundID.Item17, this.position);
this.localAI[0] = 1f;
}
if (Main.rand.Next(2) == 0)
{
int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 18, Scale: 0.9f);
Main.dust[index].noGravity = true;
Main.dust[index].velocity *= 0.5f;
}
}
else if (this.type == 376)
{
if ((double) this.localAI[0] == 0.0)
SoundEngine.PlaySound(SoundID.Item20, this.position);
++this.localAI[0];
if ((double) this.localAI[0] > 3.0)
{
int num = 1;
if ((double) this.localAI[0] > 5.0)
num = 2;
for (int index45 = 0; index45 < num; ++index45)
{
int index46 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 2f), this.width, this.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, Scale: 2f);
Main.dust[index46].noGravity = true;
Main.dust[index46].velocity.X *= 0.3f;
Main.dust[index46].velocity.Y *= 0.3f;
Main.dust[index46].noLight = true;
}
if (this.wet && !this.lavaWet)
{
this.Kill();
return;
}
}
}
else if (this.type == 91 && Main.rand.Next(2) == 0)
{
int index = Dust.NewDust(this.position, this.width, this.height, Main.rand.Next(2) != 0 ? 58 : 15, this.velocity.X * 0.25f, this.velocity.Y * 0.25f, 150, Scale: 0.9f);
Main.dust[index].velocity *= 0.25f;
}
if (this.type == 163 || this.type == 310)
{
if (this.alpha > 0)
this.alpha -= 25;
if (this.alpha < 0)
this.alpha = 0;
}
switch (this.type)
{
case 14:
case 20:
case 36:
case 83:
case 84:
case 89:
case 100:
case 104:
case 110:
case 158:
case 159:
case 160:
case 161:
case 180:
case 279:
case 283:
case 284:
case 285:
case 286:
case 287:
case 389:
if (this.alpha > 0)
this.alpha -= 15;
if (this.alpha < 0)
{
this.alpha = 0;
break;
}
break;
case 576:
case 577:
++this.localAI[1];
if ((double) this.localAI[1] > 2.0)
{
if (this.alpha > 0)
this.alpha -= 15;
if (this.alpha < 0)
{
this.alpha = 0;
break;
}
break;
}
break;
}
if (this.type == 484)
{
int index = Dust.NewDust(this.position, this.width, this.height, 78);
Main.dust[index].noGravity = true;
Main.dust[index].velocity *= 0.1f;
Main.dust[index].scale = 0.75f;
Main.dust[index].position = (Main.dust[index].position + this.Center) / 2f;
Main.dust[index].position += this.velocity * (float) Main.rand.Next(0, 101) * 0.01f;
}
if (this.type == 242 || this.type == 302 || this.type == 438 || this.type == 462 || this.type == 592)
{
float num = (float) Math.Sqrt((double) this.velocity.X * (double) this.velocity.X + (double) this.velocity.Y * (double) this.velocity.Y);
if (this.alpha > 0)
this.alpha -= (int) (byte) ((double) num * 0.9);
if (this.alpha < 0)
this.alpha = 0;
}
if (this.type == 660)
{
DelegateMethods.v3_1 = new Vector3(0.6f, 1f, 1f) * 0.2f;
Utils.PlotTileLine(this.Center, this.Center + this.velocity * 10f, 8f, new Utils.TileActionAttempt(DelegateMethods.CastLightOpen));
if (this.alpha > 0)
{
SoundEngine.PlaySound(SoundID.Item9, this.Center);
this.alpha = 0;
this.scale = 1.1f;
this.frame = Main.rand.Next(14);
float num = 16f;
for (int index47 = 0; (double) index47 < (double) num; ++index47)
{
Vector2 v = (Vector2.UnitX * 0.0f + -Vector2.UnitY.RotatedBy((double) index47 * (6.28318548202515 / (double) num)) * new Vector2(1f, 4f)).RotatedBy((double) this.velocity.ToRotation());
int index48 = Dust.NewDust(this.Center, 0, 0, 180);
Main.dust[index48].scale = 1.5f;
Main.dust[index48].noGravity = true;
Main.dust[index48].position = this.Center + v;
Main.dust[index48].velocity = this.velocity * 0.0f + v.SafeNormalize(Vector2.UnitY) * 1f;
}
}
}
if (this.type == 712)
{
DelegateMethods.v3_1 = new Vector3(0.4f, 0.4f, 0.4f) * 0.7f;
Utils.PlotTileLine(this.Center, this.Center + this.velocity * 10f, 8f, new Utils.TileActionAttempt(DelegateMethods.CastLightOpen));
if (this.alpha == (int) byte.MaxValue)
this.frame = Main.rand.Next(2) * 4;
if (++this.frameCounter >= 4)
{
this.frameCounter = 0;
++this.frame;
if (this.frame == 4)
this.frame = 0;
if (this.frame >= 8)
this.frame = 4;
}
if (this.alpha > 0)
{
this.alpha = 0;
this.scale = 1.1f;
this.frame = Main.rand.Next(14);
float num = 4f;
for (int index49 = 0; (double) index49 < (double) num; ++index49)
{
Vector2 v = (Vector2.UnitX * 0.0f + -Vector2.UnitY.RotatedBy((double) index49 * (6.28318548202515 / (double) num)) * new Vector2(1f, 4f)).RotatedBy((double) this.velocity.ToRotation());
int index50 = Dust.NewDust(this.Center, 0, 0, 15);
Main.dust[index50].scale = 1.7f;
Main.dust[index50].noGravity = true;
Main.dust[index50].position = this.Center + v + this.velocity.SafeNormalize(Vector2.Zero) * 50f;
Main.dust[index50].velocity = Main.dust[index50].velocity * 2f + v.SafeNormalize(Vector2.UnitY) * 0.3f + this.velocity.SafeNormalize(Vector2.Zero) * 3f;
Main.dust[index50].velocity *= 0.7f;
Main.dust[index50].position += Main.dust[index50].velocity * 5f;
}
}
}
if (this.type == 661)
{
if (this.alpha <= 0)
{
for (int index51 = 0; index51 < 3; ++index51)
{
int index52 = Dust.NewDust(this.position, this.width, this.height, 240);
Main.dust[index52].noGravity = true;
Main.dust[index52].velocity *= 0.3f;
Main.dust[index52].noLight = true;
}
}
if (this.alpha > 0)
{
this.alpha -= 55;
this.scale = 1.3f;
if (this.alpha < 0)
{
this.alpha = 0;
float num = 16f;
for (int index53 = 0; (double) index53 < (double) num; ++index53)
{
Vector2 vector2 = (Vector2.UnitX * 0.0f + -Vector2.UnitY.RotatedBy((double) index53 * (6.28318548202515 / (double) num)) * new Vector2(1f, 4f)).RotatedBy((double) this.velocity.ToRotation());
int index54 = Dust.NewDust(this.Center, 0, 0, 62);
Main.dust[index54].scale = 1.5f;
Main.dust[index54].noLight = true;
Main.dust[index54].noGravity = true;
Main.dust[index54].position = this.Center + vector2;
Main.dust[index54].velocity = Main.dust[index54].velocity * 4f + this.velocity * 0.3f;
}
}
}
}
if (this.type == 706)
{
if (this.wet)
{
this.Kill();
return;
}
if ((double) this.localAI[1] == 0.0)
{
float[] localAi = this.localAI;
SlotId slotId = SoundEngine.PlayTrackedSound((SoundStyle) SoundID.DD2_PhantomPhoenixShot, this.Center);
double num = (double) ((SlotId) ref slotId).ToFloat();
localAi[0] = (float) num;
++this.localAI[1];
for (int index = 0; index < 15; ++index)
{
if (Main.rand.Next(4) != 0)
{
Dust dust = Dust.NewDustDirect(this.Center - this.Size / 4f, this.width / 2, this.height / 2, Utils.SelectRandom<int>(Main.rand, 6, 31, 31));
dust.noGravity = true;
dust.velocity *= 2.3f;
dust.fadeIn = 1.5f;
dust.noLight = true;
}
}
}
ActiveSound activeSound = SoundEngine.GetActiveSound(SlotId.FromFloat(this.localAI[0]));
if (activeSound != null)
{
activeSound.Position = this.Center;
}
else
{
float[] localAi = this.localAI;
SlotId invalid = (SlotId) SlotId.Invalid;
double num = (double) ((SlotId) ref invalid).ToFloat();
localAi[0] = (float) num;
}
if (this.alpha <= 0)
{
for (int index = 0; index < 2; ++index)
{
if (Main.rand.Next(4) != 0)
{
Dust dust = Dust.NewDustDirect(this.Center - this.Size / 4f, this.width / 2, this.height / 2, Utils.SelectRandom<int>(Main.rand, 6, 31, 31));
dust.noGravity = true;
dust.velocity *= 2.3f;
dust.fadeIn = 1.5f;
dust.noLight = true;
}
}
Vector2 vector2_10 = (new Vector2(0.0f, (float) Math.Cos((double) this.frameCounter * 6.28318548202515 / 40.0 - 1.57079637050629)) * 16f).RotatedBy((double) this.rotation);
Vector2 vector2_11 = this.velocity.SafeNormalize(Vector2.Zero);
for (int index = 0; index < 1; ++index)
{
Dust dust1 = Dust.NewDustDirect(this.Center - this.Size / 4f, this.width / 2, this.height / 2, 6);
dust1.noGravity = true;
dust1.position = this.Center + vector2_10;
dust1.velocity *= 0.0f;
dust1.fadeIn = 1.4f;
dust1.scale = 1.15f;
dust1.noLight = true;
dust1.position += this.velocity * 1.2f;
dust1.velocity += vector2_11 * 2f;
Dust dust2 = Dust.NewDustDirect(this.Center - this.Size / 4f, this.width / 2, this.height / 2, 6);
dust2.noGravity = true;
dust2.position = this.Center + vector2_10;
dust2.velocity *= 0.0f;
dust2.fadeIn = 1.4f;
dust2.scale = 1.15f;
dust2.noLight = true;
dust2.position += this.velocity * 0.5f;
dust2.position += this.velocity * 1.2f;
dust2.velocity += vector2_11 * 2f;
}
}
if (++this.frameCounter >= 40)
this.frameCounter = 0;
this.frame = this.frameCounter / 5;
if (this.alpha > 0)
{
this.alpha -= 55;
if (this.alpha < 0)
{
this.alpha = 0;
float num = 16f;
for (int index55 = 0; (double) index55 < (double) num; ++index55)
{
Vector2 vector2 = (Vector2.UnitX * 0.0f + -Vector2.UnitY.RotatedBy((double) index55 * (6.28318548202515 / (double) num)) * new Vector2(1f, 4f)).RotatedBy((double) this.velocity.ToRotation());
int index56 = Dust.NewDust(this.Center, 0, 0, 6);
Main.dust[index56].scale = 1.5f;
Main.dust[index56].noLight = true;
Main.dust[index56].noGravity = true;
Main.dust[index56].position = this.Center + vector2;
Main.dust[index56].velocity = Main.dust[index56].velocity * 4f + this.velocity * 0.3f;
}
}
}
DelegateMethods.v3_1 = new Vector3(1f, 0.6f, 0.2f);
Utils.PlotTileLine(this.Center, this.Center + this.velocity * 4f, 40f, new Utils.TileActionAttempt(DelegateMethods.CastLightOpen));
}
if (this.type == 638)
{
float num22 = this.velocity.Length();
if (this.alpha > 0)
this.alpha -= (int) (byte) ((double) num22 * 0.3);
if (this.alpha < 0)
this.alpha = 0;
Microsoft.Xna.Framework.Rectangle hitbox = this.Hitbox;
hitbox.Offset((int) this.velocity.X, (int) this.velocity.Y);
bool flag = false;
for (int index = 0; index < 200; ++index)
{
NPC npc = Main.npc[index];
if (npc.active && !npc.dontTakeDamage && npc.immune[this.owner] == 0 && this.localNPCImmunity[index] == 0 && npc.Hitbox.Intersects(hitbox) && !npc.friendly)
{
flag = true;
break;
}
}
if (flag)
{
int num23 = Main.rand.Next(15, 31);
for (int index57 = 0; index57 < num23; ++index57)
{
int index58 = Dust.NewDust(this.Center, 0, 0, 229, Alpha: 100, Scale: 0.8f);
Main.dust[index58].velocity *= 1.6f;
--Main.dust[index58].velocity.Y;
Main.dust[index58].velocity += this.velocity;
Main.dust[index58].noGravity = true;
}
}
}
if (this.type == 257 || this.type == 593)
{
if (this.alpha > 0)
this.alpha -= 10;
if (this.alpha < 0)
this.alpha = 0;
}
if (this.type == 876)
{
this.tileCollide = (double) this.ai[1] == 0.0;
if (this.alpha > 0)
this.alpha -= 10;
if (this.alpha < 0)
this.alpha = 0;
}
if (this.type == 88)
{
if (this.alpha > 0)
this.alpha -= 10;
if (this.alpha < 0)
this.alpha = 0;
}
if (this.type == 532)
++this.ai[0];
bool flag1 = true;
int type = this.type;
if (type <= 323)
{
if (type <= 161)
{
if (type <= 55)
{
if (type <= 20)
{
if (type != 5 && type != 14 && type != 20)
goto label_648;
}
else if (type != 36 && type != 38 && type != 55)
goto label_648;
}
else if (type <= 98)
{
if ((uint) (type - 83) > 1U && (uint) (type - 88) > 1U && type != 98)
goto label_648;
}
else if (type <= 104)
{
if (type != 100 && type != 104)
goto label_648;
}
else if (type != 110 && (uint) (type - 158) > 3U)
goto label_648;
}
else if (type <= 259)
{
if (type <= 242)
{
if (type != 180 && type != 184 && type != 242)
goto label_648;
}
else if (type != 248 && type != 257 && type != 259)
goto label_648;
}
else if (type <= 279)
{
if (type != 265 && type != 270 && type != 279)
goto label_648;
}
else if (type <= 299)
{
if ((uint) (type - 283) > 4U && type != 299)
goto label_648;
}
else if (type != 302 && type != 323)
goto label_648;
}
else if (type <= 485)
{
if (type <= 389)
{
if (type <= 355)
{
if (type != 325 && (uint) (type - 348) > 2U && type != 355)
goto label_648;
}
else if (type != 374 && type != 376 && type != 389)
goto label_648;
}
else if (type <= 459)
{
switch (type - 435)
{
case 0:
case 1:
case 3:
case 5:
case 7:
break;
case 2:
case 4:
case 6:
goto label_648;
default:
if (type == 449 || type == 459)
break;
goto label_648;
}
}
else if (type <= 469)
{
if (type != 462 && (uint) (type - 467) > 2U)
goto label_648;
}
else if (type != 472 && (uint) (type - 483) > 2U)
goto label_648;
}
else if (type <= 616)
{
if (type <= 585)
{
if (type != 498 && (uint) (type - 576) > 1U && type != 585)
goto label_648;
}
else if (type <= 601)
{
if ((uint) (type - 592) > 1U && type != 601)
goto label_648;
}
else if (type != 606 && type != 616)
goto label_648;
}
else if (type <= 661)
{
if ((uint) (type - 634) > 1U && (uint) (type - 638) > 1U && (uint) (type - 660) > 1U)
goto label_648;
}
else if (type <= 684)
{
if (type != 682 && type != 684)
goto label_648;
}
else
{
switch (type - 706)
{
case 0:
case 3:
case 4:
case 6:
break;
case 1:
case 2:
case 5:
goto label_648;
default:
if (type != 876)
goto label_648;
else
break;
}
}
flag1 = false;
label_648:
if (flag1)
++this.ai[0];
if (this.type == 270)
{
int closest = (int) Player.FindClosest(this.Center, 1, 1);
++this.ai[1];
if ((double) this.ai[1] < 110.0 && (double) this.ai[1] > 30.0)
{
float num = this.velocity.Length();
Vector2 vector2 = Main.player[closest].Center - this.Center;
vector2.Normalize();
this.velocity = (this.velocity * 24f + vector2 * num) / 25f;
this.velocity.Normalize();
this.velocity = this.velocity * num;
}
if ((double) this.velocity.Length() < 18.0)
this.velocity = this.velocity * 1.02f;
if ((double) this.localAI[0] == 0.0)
{
this.localAI[0] = 1f;
SoundEngine.PlaySound(SoundID.Item8, this.position);
for (int index59 = 0; index59 < 10; ++index59)
{
int index60 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 5, this.velocity.X, this.velocity.Y, Scale: 2f);
Main.dust[index60].noGravity = true;
Main.dust[index60].velocity = this.Center - Main.dust[index60].position;
Main.dust[index60].velocity.Normalize();
Main.dust[index60].velocity *= -5f;
Main.dust[index60].velocity += this.velocity / 2f;
}
}
}
if (this.type == 585)
{
if ((double) this.localAI[0] == 0.0)
{
this.localAI[0] = 1f;
SoundEngine.PlaySound(SoundID.Item8, this.position);
for (int index61 = 0; index61 < 3; ++index61)
{
int index62 = Dust.NewDust(this.position, this.width, this.height, 27, this.velocity.X, this.velocity.Y, Scale: 2f);
Main.dust[index62].noGravity = true;
Main.dust[index62].velocity = this.Center - Main.dust[index62].position;
Main.dust[index62].velocity.Normalize();
Main.dust[index62].velocity *= -5f;
Main.dust[index62].velocity += this.velocity / 2f;
Main.dust[index62].noLight = true;
}
}
if (this.alpha > 0)
this.alpha -= 50;
if (this.alpha < 0)
this.alpha = 0;
++this.frameCounter;
if (this.frameCounter >= 12)
this.frameCounter = 0;
this.frame = this.frameCounter / 2;
if (this.frame > 3)
this.frame = 6 - this.frame;
Vector3 vector3 = NPCID.Sets.MagicAuraColor[54].ToVector3();
Lighting.AddLight(this.Center, vector3.X, vector3.Y, vector3.Z);
if (Main.rand.Next(3) == 0)
{
int index = Dust.NewDust(new Vector2(this.position.X + 4f, this.position.Y + 4f), this.width - 8, this.height - 8, 27, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, Scale: 2f);
Main.dust[index].position -= this.velocity * 2f;
Main.dust[index].noLight = true;
Main.dust[index].noGravity = true;
Main.dust[index].velocity.X *= 0.3f;
Main.dust[index].velocity.Y *= 0.3f;
}
}
if (this.type == 594)
{
int num = (int) (43.0 - (double) this.ai[1]) / 13;
if (num < 1)
num = 1;
int Type = (double) this.ai[1] < 20.0 ? 6 : 31;
for (int index63 = 0; index63 < num; ++index63)
{
int index64 = Dust.NewDust(new Vector2(this.position.X + 4f, this.position.Y + 4f), this.width - 8, this.height - 8, Type, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, Scale: 2f);
Main.dust[index64].position -= this.velocity * 2f;
Main.dust[index64].noLight = true;
Main.dust[index64].noGravity = true;
Main.dust[index64].velocity.X *= 0.3f;
Main.dust[index64].velocity.Y *= 0.3f;
if (Type == 6)
Main.dust[index64].fadeIn = Main.rand.NextFloat() * 2f;
}
++this.ai[1];
if ((double) this.ai[1] > (double) (43 * this.MaxUpdates))
{
this.Kill();
return;
}
}
if (this.type == 622)
{
int Type = 229;
if (Main.rand.Next(3) != 0)
{
int index = Dust.NewDust(new Vector2(this.position.X + 4f, this.position.Y + 4f), this.width - 8, this.height - 8, Type, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, Scale: 1.2f);
Main.dust[index].position -= this.velocity * 2f;
Main.dust[index].noLight = true;
Main.dust[index].noGravity = true;
Main.dust[index].velocity.X *= 0.3f;
Main.dust[index].velocity.Y *= 0.3f;
}
++this.ai[1];
if ((double) this.ai[1] > (double) (23 * this.MaxUpdates))
{
this.Kill();
return;
}
}
if (this.type == 587)
{
Color rgb = Main.hslToRgb(this.ai[1], 1f, 0.5f);
rgb.A = (byte) 200;
++this.localAI[0];
if ((double) this.localAI[0] >= 2.0)
{
if ((double) this.localAI[0] == 2.0)
{
SoundEngine.PlaySound(SoundID.Item5, this.position);
for (int index65 = 0; index65 < 4; ++index65)
{
int index66 = Dust.NewDust(this.position, this.width, this.height, 76, this.velocity.X, this.velocity.Y, newColor: rgb, Scale: 1.1f);
Main.dust[index66].noGravity = true;
Main.dust[index66].velocity = this.Center - Main.dust[index66].position;
Main.dust[index66].velocity.Normalize();
Main.dust[index66].velocity *= -3f;
Main.dust[index66].velocity += this.velocity / 2f;
}
}
else
{
++this.frame;
if (this.frame > 2)
this.frame = 0;
for (int index67 = 0; index67 < 1; ++index67)
{
int index68 = Dust.NewDust(new Vector2(this.position.X + 4f, this.position.Y + 4f), this.width - 8, this.height - 8, 76, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, newColor: rgb, Scale: 0.9f);
Main.dust[index68].position = this.Center;
Main.dust[index68].noGravity = true;
Main.dust[index68].velocity = this.velocity * 0.5f;
}
}
}
}
if (this.type == 349)
{
this.frame = (int) this.ai[0];
this.velocity.Y += 0.2f;
if ((double) this.localAI[0] == 0.0 || (double) this.localAI[0] == 2.0)
{
this.scale += 0.01f;
this.alpha -= 50;
if (this.alpha <= 0)
{
this.localAI[0] = 1f;
this.alpha = 0;
}
}
else if ((double) this.localAI[0] == 1.0)
{
this.scale -= 0.01f;
this.alpha += 50;
if (this.alpha >= (int) byte.MaxValue)
{
this.localAI[0] = 2f;
this.alpha = (int) byte.MaxValue;
}
}
}
if (this.type == 348)
{
if ((double) this.localAI[1] == 0.0)
{
this.localAI[1] = 1f;
SoundEngine.PlaySound(SoundID.Item8, this.position);
}
if ((double) this.ai[0] == 0.0 || (double) this.ai[0] == 2.0)
{
this.scale += 0.01f;
this.alpha -= 50;
if (this.alpha <= 0)
{
this.ai[0] = 1f;
this.alpha = 0;
}
}
else if ((double) this.ai[0] == 1.0)
{
this.scale -= 0.01f;
this.alpha += 50;
if (this.alpha >= (int) byte.MaxValue)
{
this.ai[0] = 2f;
this.alpha = (int) byte.MaxValue;
}
}
}
if (this.type == 572)
{
if ((double) this.localAI[0] == 0.0)
{
this.localAI[0] = 1f;
SoundEngine.PlaySound(SoundID.Item17, this.position);
}
for (int index69 = 0; index69 < 2; ++index69)
{
int index70 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 40, this.velocity.X, this.velocity.Y, 100);
Main.dust[index70].velocity *= 0.5f;
Main.dust[index70].velocity += this.velocity;
Main.dust[index70].velocity *= 0.5f;
Main.dust[index70].noGravity = true;
Main.dust[index70].scale = 1.2f;
Main.dust[index70].position = (this.Center + this.position) / 2f;
}
}
if (this.type == 577)
Lighting.AddLight(this.Center, 0.1f, 0.3f, 0.4f);
else if (this.type == 576)
{
Lighting.AddLight(this.Center, 0.4f, 0.2f, 0.4f);
for (int index = 0; index < 5; ++index)
{
Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, 242, this.velocity.X, this.velocity.Y, 100)];
dust.velocity = Vector2.Zero;
dust.position -= this.velocity / 5f * (float) index;
dust.noGravity = true;
dust.scale = 0.8f;
dust.noLight = true;
}
}
else if (this.type == 581)
{
if ((double) this.localAI[0] == 0.0)
{
this.localAI[0] = 1f;
SoundEngine.PlaySound(SoundID.Item17, this.Center);
}
for (int index = 0; index < 2; ++index)
{
int Type = Utils.SelectRandom<int>(Main.rand, 229, 161, 161);
Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, Type, this.velocity.X, this.velocity.Y, 100)];
dust.velocity = dust.velocity / 4f + this.velocity / 2f;
dust.noGravity = true;
dust.scale = 1.2f;
dust.position = this.Center;
dust.noLight = true;
}
}
else if (this.type == 671)
{
if ((double) this.localAI[0] == 0.0)
{
this.localAI[0] = 1f;
for (int index = 0; index < 8; ++index)
{
int Type = Utils.SelectRandom<int>(Main.rand, 27, 62);
Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, Type, this.velocity.X, this.velocity.Y, 100)];
dust.velocity = (Main.rand.NextFloatDirection() * 3.141593f).ToRotationVector2() * 2f + this.velocity.SafeNormalize(Vector2.Zero) * 3f;
dust.noGravity = true;
dust.scale = 1.5f;
dust.fadeIn = 1.2f;
dust.position = this.Center;
dust.noLight = true;
}
}
this.alpha -= 20;
if (this.alpha < 0)
this.alpha = 0;
for (int index = 0; index < 2; ++index)
{
int Type = Utils.SelectRandom<int>(Main.rand, 27, 27, 62);
Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, Type, this.velocity.X, this.velocity.Y, 100)];
dust.velocity = dust.velocity / 4f + this.velocity / 2f;
dust.noGravity = true;
dust.scale = 1.2f;
dust.position = this.Center;
dust.noLight = true;
}
}
else if (this.type == 811)
{
if ((double) this.localAI[0] == 0.0)
{
SoundEngine.PlaySound(SoundID.Item17, this.Center);
this.localAI[0] = 1f;
for (int index = 0; index < 8; ++index)
{
Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, 5, this.velocity.X, this.velocity.Y, 100)];
dust.velocity = (Main.rand.NextFloatDirection() * 3.141593f).ToRotationVector2() * 2f + this.velocity.SafeNormalize(Vector2.Zero) * 3f;
dust.scale = 1.5f;
dust.fadeIn = 1.7f;
dust.position = this.Center;
}
}
this.alpha -= 20;
if (this.alpha < 0)
this.alpha = 0;
for (int index = 0; index < 2; ++index)
{
Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, 5, this.velocity.X, this.velocity.Y, 100)];
dust.velocity = dust.velocity / 4f + this.velocity / 2f;
dust.scale = 1.2f;
dust.position = this.Center + Main.rand.NextFloat() * this.velocity * 2f;
}
}
else if (this.type == 819)
{
if ((double) this.localAI[0] == 0.0)
{
this.localAI[0] = 1f;
for (int index = 0; index < 8; ++index)
{
Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, 5, this.velocity.X, this.velocity.Y, 100)];
dust.velocity = (Main.rand.NextFloatDirection() * 3.141593f).ToRotationVector2() * 2f + this.velocity.SafeNormalize(Vector2.Zero) * 2f;
dust.scale = 0.9f;
dust.fadeIn = 1.1f;
dust.position = this.Center;
}
}
this.alpha -= 20;
if (this.alpha < 0)
this.alpha = 0;
for (int index = 1; index < 3; ++index)
{
Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, 5, this.velocity.X, this.velocity.Y, 100)];
dust.velocity = this.velocity;
dust.velocity *= 0.75f;
dust.scale = 1f;
dust.position = this.Center + this.velocity * (float) index;
}
}
else if (this.type == 814)
{
if ((double) this.localAI[0] == 0.0)
{
SoundEngine.PlaySound(SoundID.Item171, this.Center);
this.localAI[0] = 1f;
for (int index = 0; index < 8; ++index)
{
Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, 5, this.velocity.X, this.velocity.Y, 100)];
dust.velocity = (Main.rand.NextFloatDirection() * 3.141593f).ToRotationVector2() * 2f + this.velocity.SafeNormalize(Vector2.Zero) * 2f;
dust.scale = 0.9f;
dust.fadeIn = 1.1f;
dust.position = this.Center;
}
}
this.alpha -= 20;
if (this.alpha < 0)
this.alpha = 0;
for (int index = 0; index < 2; ++index)
{
Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, 5, this.velocity.X, this.velocity.Y, 100)];
dust.velocity = dust.velocity / 4f + this.velocity / 2f;
dust.scale = 1.2f;
dust.position = this.Center + Main.rand.NextFloat() * this.velocity * 2f;
}
for (int index = 1; index < this.oldPos.Length && !(this.oldPos[index] == Vector2.Zero); ++index)
{
if (Main.rand.Next(3) == 0)
{
Dust dust = Main.dust[Dust.NewDust(this.oldPos[index], this.width, this.height, 5, this.velocity.X, this.velocity.Y, 100)];
dust.velocity = dust.velocity / 4f + this.velocity / 2f;
dust.scale = 1.2f;
dust.position = this.oldPos[index] + this.Size / 2f + Main.rand.NextFloat() * this.velocity * 2f;
}
}
}
else if (this.type == 675)
{
if ((double) this.localAI[0] == 0.0)
{
this.localAI[0] = 1f;
SoundEngine.PlayTrackedSound((SoundStyle) SoundID.DD2_DarkMageAttack, this.Center);
}
this.alpha -= 20;
if (this.alpha < 0)
this.alpha = 0;
}
else if (this.type == 676)
{
if ((double) this.localAI[0] == 0.0)
{
this.localAI[0] = 1f;
SoundEngine.PlaySound(SoundID.Item17, this.Center);
}
this.alpha -= 20;
if (this.alpha < 0)
this.alpha = 0;
for (int index = 0; index < 2; ++index)
{
if (Main.rand.Next(5) != 0)
{
int Type = Utils.SelectRandom<int>(Main.rand, 4, 256);
Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, Type, this.velocity.X, this.velocity.Y, 100)];
dust.velocity = dust.velocity / 4f + this.velocity / 2f;
dust.scale = (float) (0.800000011920929 + (double) Main.rand.NextFloat() * 0.400000005960464);
dust.position = this.Center;
dust.position += new Vector2((float) (this.width * 2), 0.0f).RotatedBy(6.28318548202515 * (double) Main.rand.NextFloat()) * Main.rand.NextFloat();
dust.noLight = true;
if (dust.type == 4)
dust.color = new Color(80, 170, 40, 120);
}
}
}
else if (this.type == 686)
{
if ((double) this.localAI[0] == 0.0)
{
this.localAI[0] = 1f;
SoundEngine.PlayTrackedSound((SoundStyle) SoundID.DD2_BetsyFireballShot, this.Center);
}
if ((double) this.ai[0] >= 2.0)
{
this.alpha -= 25;
if (this.alpha < 0)
this.alpha = 0;
}
if (Main.rand.Next(4) == 0)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 55, Alpha: 200);
dust.scale *= 0.7f;
dust.velocity += this.velocity * 1f;
}
if (Main.rand.Next(3) == 0 && this.oldPos[9] != Vector2.Zero)
{
Dust dust = Dust.NewDustDirect(this.oldPos[9], this.width, this.height, 55, Alpha: 50);
dust.scale *= 0.85f;
dust.velocity += this.velocity * 0.85f;
dust.color = Color.Purple;
}
}
else if (this.type == 711)
{
if ((double) this.localAI[0] == 0.0)
{
this.localAI[0] = 1f;
for (int index = 0; index < 10; ++index)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 55, Alpha: 200);
dust.scale *= 0.65f;
dust.velocity *= 1.5f;
dust.velocity += this.velocity * 0.3f;
dust.fadeIn = 0.7f;
}
}
if ((double) this.ai[0] >= 2.0)
{
this.alpha -= 25;
if (this.alpha < 0)
this.alpha = 0;
}
if (Main.rand.Next(4) == 0)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 55, Alpha: 200);
dust.scale *= 0.7f;
dust.velocity += this.velocity * 1f;
}
if (Main.rand.Next(3) == 0 && this.oldPos[9] != Vector2.Zero)
{
Dust dust = Dust.NewDustDirect(this.oldPos[9], this.width, this.height, 55, Alpha: 50);
dust.scale *= 0.85f;
dust.velocity += this.velocity * 0.85f;
dust.color = Color.Purple;
}
}
if (this.type == 299)
{
if ((double) this.localAI[0] == 6.0)
{
SoundEngine.PlaySound(SoundID.Item8, this.position);
for (int index71 = 0; index71 < 40; ++index71)
{
int index72 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 181, Alpha: 100);
Main.dust[index72].velocity *= 3f;
Main.dust[index72].velocity += this.velocity * 0.75f;
Main.dust[index72].scale *= 1.2f;
Main.dust[index72].noGravity = true;
}
}
++this.localAI[0];
if ((double) this.localAI[0] > 6.0)
{
for (int index73 = 0; index73 < 3; ++index73)
{
int index74 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 181, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100);
Main.dust[index74].velocity *= 0.6f;
Main.dust[index74].scale *= 1.4f;
Main.dust[index74].noGravity = true;
}
}
}
else if (this.type == 270 || this.type == 837)
{
if (this.type == 270)
this.alpha = 0;
if (this.alpha > 0)
this.alpha -= 50;
if (this.alpha < 0)
this.alpha = 0;
++this.frame;
if (this.frame > 2)
this.frame = 0;
if (this.type == 270)
{
for (int index75 = 0; index75 < 2; ++index75)
{
int index76 = Dust.NewDust(new Vector2(this.position.X + 4f, this.position.Y + 4f), this.width - 8, this.height - 8, 5, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, Scale: 1.5f);
Main.dust[index76].position -= this.velocity;
Main.dust[index76].noGravity = true;
Main.dust[index76].velocity.X *= 0.3f;
Main.dust[index76].velocity.Y *= 0.3f;
}
}
else
{
for (int index77 = 0; index77 < 2; ++index77)
{
int index78 = Dust.NewDust(new Vector2(this.position.X + 4f, this.position.Y + 4f), this.width - 8, this.height - 8, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, Scale: 2f);
Main.dust[index78].position -= this.velocity * 2f;
Main.dust[index78].noGravity = true;
Main.dust[index78].velocity.X *= 0.3f;
Main.dust[index78].velocity.Y *= 0.3f;
}
}
}
if (this.type == 259)
{
if (this.alpha > 0)
this.alpha -= 10;
if (this.alpha < 0)
this.alpha = 0;
}
if (this.type == 265)
{
if (this.alpha > 0)
this.alpha -= 50;
if (this.alpha < 0)
this.alpha = 0;
if (this.alpha == 0)
{
int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 163, this.velocity.X, this.velocity.Y, 100, Scale: 1.2f);
Main.dust[index].noGravity = true;
Main.dust[index].velocity *= 0.3f;
Main.dust[index].velocity -= this.velocity * 0.4f;
}
}
if (this.type == 355)
{
if (this.alpha > 0)
this.alpha -= 50;
if (this.alpha < 0)
this.alpha = 0;
if (this.alpha == 0)
{
int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 205, this.velocity.X, this.velocity.Y, 100, Scale: 1.2f);
Main.dust[index].noGravity = true;
Main.dust[index].velocity *= 0.3f;
Main.dust[index].velocity -= this.velocity * 0.4f;
}
}
if (this.type == 357)
{
if (this.alpha < 170)
{
for (int index79 = 0; index79 < 10; ++index79)
{
float x = this.position.X - this.velocity.X / 10f * (float) index79;
float y = this.position.Y - this.velocity.Y / 10f * (float) index79;
int index80 = Dust.NewDust(new Vector2(x, y), 1, 1, 206);
Main.dust[index80].alpha = this.alpha;
Main.dust[index80].position.X = x;
Main.dust[index80].position.Y = y;
Main.dust[index80].velocity *= 0.0f;
Main.dust[index80].noGravity = true;
}
}
if (this.alpha > 0)
this.alpha -= 25;
if (this.alpha < 0)
this.alpha = 0;
}
else if (this.type == 207 || this.type == 837)
{
if (this.type == 207 && this.alpha < 170)
{
for (int index81 = 0; index81 < 10; ++index81)
{
float x = this.position.X - this.velocity.X / 10f * (float) index81;
float y = this.position.Y - this.velocity.Y / 10f * (float) index81;
int index82 = Dust.NewDust(new Vector2(x, y), 1, 1, 75);
Main.dust[index82].alpha = this.alpha;
Main.dust[index82].position.X = x;
Main.dust[index82].position.Y = y;
Main.dust[index82].velocity *= 0.0f;
Main.dust[index82].noGravity = true;
}
}
float num24 = (float) Math.Sqrt((double) this.velocity.X * (double) this.velocity.X + (double) this.velocity.Y * (double) this.velocity.Y);
float num25 = this.localAI[0];
if ((double) num25 == 0.0)
{
this.localAI[0] = num24;
num25 = num24;
}
if (this.alpha > 0)
this.alpha -= 25;
if (this.alpha < 0)
this.alpha = 0;
float num26 = this.position.X;
float num27 = this.position.Y;
float num28 = 300f;
bool flag2 = false;
int num29 = 0;
if ((double) this.ai[1] == 0.0)
{
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].CanBeChasedBy((object) this) && ((double) this.ai[1] == 0.0 || (double) this.ai[1] == (double) (index + 1)))
{
float num30 = Main.npc[index].position.X + (float) (Main.npc[index].width / 2);
float num31 = Main.npc[index].position.Y + (float) (Main.npc[index].height / 2);
float num32 = Math.Abs(this.position.X + (float) (this.width / 2) - num30) + Math.Abs(this.position.Y + (float) (this.height / 2) - num31);
if ((double) num32 < (double) num28 && Collision.CanHit(new Vector2(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2)), 1, 1, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height))
{
num28 = num32;
num26 = num30;
num27 = num31;
flag2 = true;
num29 = index;
}
}
}
if (flag2)
this.ai[1] = (float) (num29 + 1);
flag2 = false;
}
if ((double) this.ai[1] > 0.0)
{
int index = (int) ((double) this.ai[1] - 1.0);
if (Main.npc[index].active && Main.npc[index].CanBeChasedBy((object) this, true) && !Main.npc[index].dontTakeDamage)
{
float num33 = Main.npc[index].position.X + (float) (Main.npc[index].width / 2);
float num34 = Main.npc[index].position.Y + (float) (Main.npc[index].height / 2);
if ((double) Math.Abs(this.position.X + (float) (this.width / 2) - num33) + (double) Math.Abs(this.position.Y + (float) (this.height / 2) - num34) < 1000.0)
{
flag2 = true;
num26 = Main.npc[index].position.X + (float) (Main.npc[index].width / 2);
num27 = Main.npc[index].position.Y + (float) (Main.npc[index].height / 2);
}
}
else
this.ai[1] = 0.0f;
}
if (!this.friendly)
flag2 = false;
if (flag2)
{
double num35 = (double) num25;
Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
float num36 = num26 - vector2.X;
float num37 = num27 - vector2.Y;
double num38 = Math.Sqrt((double) num36 * (double) num36 + (double) num37 * (double) num37);
float num39 = (float) (num35 / num38);
float num40 = num36 * num39;
float num41 = num37 * num39;
int num42 = 8;
if (this.type == 837)
num42 = 32;
this.velocity.X = (this.velocity.X * (float) (num42 - 1) + num40) / (float) num42;
this.velocity.Y = (this.velocity.Y * (float) (num42 - 1) + num41) / (float) num42;
}
}
else if (this.type == 81 || this.type == 91)
{
if ((double) this.ai[0] >= 20.0)
{
this.ai[0] = 20f;
this.velocity.Y += 0.07f;
}
}
else if (this.type == 174 || this.type == 605 || this.type == 920 || this.type == 921 || this.type == 926 || this.type == 937)
{
if ((double) this.ai[0] >= 5.0)
{
this.ai[0] = 5f;
this.velocity.Y += 0.15f;
}
}
else if (this.type == 337)
{
if ((double) this.position.Y > (double) Main.player[this.owner].position.Y - 300.0)
this.tileCollide = true;
if ((double) this.position.Y < Main.worldSurface * 16.0)
this.tileCollide = true;
this.frame = (int) this.ai[1];
if (Main.rand.Next(2) == 0)
{
int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 197);
Main.dust[index].velocity *= 0.5f;
Main.dust[index].noGravity = true;
}
}
else if (this.type == 645)
{
if ((double) this.ai[1] != -1.0 && (double) this.position.Y > (double) this.ai[1])
this.tileCollide = true;
if (this.position.HasNaNs())
{
this.Kill();
return;
}
int num43 = WorldGen.SolidTile(Framing.GetTileSafely((int) this.position.X / 16, (int) this.position.Y / 16)) ? 1 : 0;
Dust dust = Main.dust[Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 229)];
dust.position = this.Center;
dust.velocity = Vector2.Zero;
dust.noGravity = true;
if (num43 != 0)
dust.noLight = true;
if ((double) this.ai[1] == -1.0)
{
++this.ai[0];
this.velocity = Vector2.Zero;
this.tileCollide = false;
this.penetrate = -1;
this.position = this.Center;
this.width = this.height = 140;
this.Center = this.position;
this.alpha -= 10;
if (this.alpha < 0)
this.alpha = 0;
if (++this.frameCounter >= this.MaxUpdates * 3)
{
this.frameCounter = 0;
++this.frame;
}
if ((double) this.ai[0] < (double) (Main.projFrames[this.type] * this.MaxUpdates * 3))
return;
this.Kill();
return;
}
this.alpha = (int) byte.MaxValue;
if (this.numUpdates == 0)
{
int num44 = -1;
float num45 = 60f;
for (int index = 0; index < 200; ++index)
{
NPC npc = Main.npc[index];
if (npc.CanBeChasedBy((object) this))
{
float num46 = this.Distance(npc.Center);
if ((double) num46 < (double) num45 && Collision.CanHitLine(this.Center, 0, 0, npc.Center, 0, 0))
{
num45 = num46;
num44 = index;
}
}
}
if (num44 != -1)
{
this.ai[0] = 0.0f;
this.ai[1] = -1f;
this.netUpdate = true;
return;
}
}
}
else if (this.type >= 424 && this.type <= 426)
{
if ((double) this.position.Y > (double) Main.player[this.owner].position.Y - 300.0)
this.tileCollide = true;
if ((double) this.position.Y < Main.worldSurface * 16.0)
this.tileCollide = true;
this.scale = this.ai[1];
this.rotation += this.velocity.X * 2f;
Vector2 vector2 = this.Center + Vector2.Normalize(this.velocity) * 10f;
Dust dust3 = Main.dust[Dust.NewDust(this.position, this.width, this.height, 6)];
dust3.position = vector2;
dust3.velocity = this.velocity.RotatedBy(1.57079637050629) * 0.33f + this.velocity / 4f;
dust3.position += this.velocity.RotatedBy(1.57079637050629);
dust3.fadeIn = 0.5f;
dust3.noGravity = true;
Dust dust4 = Main.dust[Dust.NewDust(this.position, this.width, this.height, 6)];
dust4.position = vector2;
dust4.velocity = this.velocity.RotatedBy(-1.57079637050629) * 0.33f + this.velocity / 4f;
dust4.position += this.velocity.RotatedBy(-1.57079637050629);
dust4.fadeIn = 0.5f;
dust4.noGravity = true;
for (int index83 = 0; index83 < 1; ++index83)
{
int index84 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6);
Main.dust[index84].velocity *= 0.5f;
Main.dust[index84].scale *= 1.3f;
Main.dust[index84].fadeIn = 1f;
Main.dust[index84].noGravity = true;
}
}
else if (this.type == 344)
{
if (WorldGen.SolidTile((int) this.position.X / 16, (int) ((double) this.position.Y + (double) this.velocity.Y) / 16 + 1) || WorldGen.SolidTile((int) ((double) this.position.X + (double) this.width) / 16, (int) ((double) this.position.Y + (double) this.velocity.Y) / 16 + 1))
{
this.Kill();
return;
}
++this.localAI[1];
if ((double) this.localAI[1] > 5.0)
{
this.alpha -= 50;
if (this.alpha < 0)
this.alpha = 0;
}
this.frame = (int) this.ai[1];
if ((double) this.localAI[1] > 20.0)
{
this.localAI[1] = 20f;
this.velocity.Y += 0.15f;
}
this.rotation += Main.windSpeedCurrent * 0.2f;
this.velocity.X += Main.windSpeedCurrent * 0.1f;
}
else if (this.type == 336 || this.type == 345)
{
if (this.type == 345 && (double) this.localAI[0] == 0.0)
{
this.localAI[0] = 1f;
SoundEngine.PlaySound(SoundID.Item1, this.position);
}
if ((double) this.ai[0] >= 50.0)
{
this.ai[0] = 50f;
this.velocity.Y += 0.5f;
}
}
else if (this.type == 246)
{
this.alpha -= 20;
if (this.alpha < 0)
this.alpha = 0;
if ((double) this.ai[0] >= 60.0)
{
this.ai[0] = 60f;
this.velocity.Y += 0.15f;
}
}
else if (this.type == 311)
{
if (this.alpha > 0)
this.alpha -= 50;
if (this.alpha < 0)
this.alpha = 0;
if ((double) this.ai[0] >= 30.0)
{
this.ai[0] = 30f;
if ((double) this.ai[1] == 0.0)
this.ai[1] = 1f;
this.velocity.Y += 0.5f;
}
}
else if (this.type == 312)
{
if ((double) this.ai[0] >= 5.0)
this.alpha = 0;
if ((double) this.ai[0] >= 20.0)
{
this.ai[0] = 30f;
this.velocity.Y += 0.5f;
}
Lighting.AddLight(this.Center, 0.6f, 0.4f, 0.3f);
}
else if (this.type != 239 && this.type != 264)
{
if (this.type == 176)
{
if ((double) this.ai[0] >= 15.0)
{
this.ai[0] = 15f;
this.velocity.Y += 0.05f;
}
}
else if (this.type == 275 || this.type == 276)
{
if (this.alpha > 0)
this.alpha -= 30;
if (this.alpha < 0)
this.alpha = 0;
if ((double) this.ai[0] >= 35.0)
{
this.ai[0] = 35f;
this.velocity.Y += 0.025f;
}
if (Main.expertMode)
{
float num47 = 18f;
int closest = (int) Player.FindClosest(this.Center, 1, 1);
Vector2 vector2 = Main.player[closest].Center - this.Center;
vector2.Normalize();
vector2 *= num47;
int num48 = 70;
this.velocity = (this.velocity * (float) (num48 - 1) + vector2) / (float) num48;
if ((double) this.velocity.Length() < 14.0)
{
this.velocity.Normalize();
this.velocity = this.velocity * 14f;
}
this.tileCollide = false;
if (this.timeLeft > 180)
this.timeLeft = 180;
}
}
else if (this.type == 172)
{
if ((double) this.ai[0] >= 17.0)
{
this.ai[0] = 17f;
this.velocity.Y += 0.085f;
}
}
else if (this.type == 117)
{
if ((double) this.ai[0] >= 35.0)
{
this.ai[0] = 35f;
this.velocity.Y += 0.06f;
}
}
else if (this.type == 120)
{
int index = Dust.NewDust(new Vector2(this.position.X - this.velocity.X, this.position.Y - this.velocity.Y), this.width, this.height, 67, this.velocity.X, this.velocity.Y, 100, Scale: 1.2f);
Main.dust[index].noGravity = true;
Main.dust[index].velocity *= 0.3f;
if ((double) this.ai[0] >= 30.0)
{
this.ai[0] = 30f;
this.velocity.Y += 0.05f;
}
}
else if (this.type == 195)
{
if ((double) this.ai[0] >= 20.0)
{
this.ai[0] = 20f;
this.velocity.Y += 0.075f;
this.tileCollide = true;
}
else
this.tileCollide = false;
}
else if (this.type == 267 || this.type == 477 || this.type == 478 || this.type == 479)
{
++this.localAI[0];
if ((double) this.localAI[0] > 3.0)
this.alpha = 0;
if ((double) this.ai[0] >= 20.0)
{
this.ai[0] = 20f;
if (this.type != 477)
this.velocity.Y += 0.075f;
}
if (this.type == 479 && Main.myPlayer == this.owner)
{
if ((double) this.ai[1] >= 0.0)
this.penetrate = -1;
else if (this.penetrate < 0)
this.penetrate = 1;
if ((double) this.ai[1] >= 0.0)
++this.ai[1];
if ((double) this.ai[1] > (double) Main.rand.Next(5, 30))
{
this.ai[1] = -1000f;
float num49 = this.velocity.Length();
Vector2 velocity = this.velocity;
velocity.Normalize();
int num50 = Main.rand.Next(2, 4);
if (Main.rand.Next(4) == 0)
++num50;
for (int index = 0; index < num50; ++index)
{
Vector2 vector2_12 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101));
vector2_12.Normalize();
Vector2 vector2_13 = vector2_12 + velocity * 2f;
vector2_13.Normalize();
vector2_12 = vector2_13 * num49;
Projectile.NewProjectile(this.Center.X, this.Center.Y, vector2_12.X, vector2_12.Y, this.type, this.damage, this.knockBack, this.owner, ai1: -1000f);
}
}
}
if (this.type == 478 && Main.myPlayer == this.owner)
{
++this.ai[1];
if ((double) this.ai[1] > (double) Main.rand.Next(5, 20))
{
if (this.timeLeft > 40)
this.timeLeft -= 20;
this.ai[1] = 0.0f;
Projectile.NewProjectile(this.Center.X, this.Center.Y, 0.0f, 0.0f, 480, (int) ((double) this.damage * 0.8), this.knockBack * 0.5f, this.owner);
}
}
}
else if (this.type == 408)
{
if ((double) this.ai[0] >= 45.0)
{
this.ai[0] = 45f;
this.velocity.Y += 0.05f;
}
}
else if (this.type == 616)
{
if (this.alpha < 170)
{
float num = 3f;
for (int index85 = 0; (double) index85 < (double) num; ++index85)
{
int index86 = Dust.NewDust(this.position, 1, 1, 229);
Main.dust[index86].position = this.Center - this.velocity / num * (float) index85;
Main.dust[index86].velocity *= 0.0f;
Main.dust[index86].noGravity = true;
Main.dust[index86].alpha = 200;
Main.dust[index86].scale = 0.5f;
}
}
float num51 = (float) Math.Sqrt((double) this.velocity.X * (double) this.velocity.X + (double) this.velocity.Y * (double) this.velocity.Y);
float num52 = this.localAI[0];
if ((double) num52 == 0.0)
{
this.localAI[0] = num51;
num52 = num51;
}
if (this.alpha > 0)
this.alpha -= 25;
if (this.alpha < 0)
this.alpha = 0;
float num53 = this.position.X;
float num54 = this.position.Y;
float num55 = 800f;
bool flag3 = false;
int num56 = 0;
++this.ai[0];
if ((double) this.ai[0] > 20.0)
{
--this.ai[0];
if ((double) this.ai[1] == 0.0)
{
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].CanBeChasedBy((object) this) && ((double) this.ai[1] == 0.0 || (double) this.ai[1] == (double) (index + 1)))
{
float num57 = Main.npc[index].position.X + (float) (Main.npc[index].width / 2);
float num58 = Main.npc[index].position.Y + (float) (Main.npc[index].height / 2);
float num59 = Math.Abs(this.position.X + (float) (this.width / 2) - num57) + Math.Abs(this.position.Y + (float) (this.height / 2) - num58);
if ((double) num59 < (double) num55 && Collision.CanHit(new Vector2(this.position.X + (float) (this.width / 2), this.position.Y + (float) (this.height / 2)), 1, 1, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height))
{
num55 = num59;
num53 = num57;
num54 = num58;
flag3 = true;
num56 = index;
}
}
}
if (flag3)
this.ai[1] = (float) (num56 + 1);
flag3 = false;
}
if ((double) this.ai[1] != 0.0)
{
int index = (int) ((double) this.ai[1] - 1.0);
if (Main.npc[index].active && Main.npc[index].CanBeChasedBy((object) this, true))
{
float num60 = Main.npc[index].position.X + (float) (Main.npc[index].width / 2);
float num61 = Main.npc[index].position.Y + (float) (Main.npc[index].height / 2);
if ((double) Math.Abs(this.position.X + (float) (this.width / 2) - num60) + (double) Math.Abs(this.position.Y + (float) (this.height / 2) - num61) < 1000.0)
{
flag3 = true;
num53 = Main.npc[index].position.X + (float) (Main.npc[index].width / 2);
num54 = Main.npc[index].position.Y + (float) (Main.npc[index].height / 2);
}
}
}
if (!this.friendly)
flag3 = false;
if (flag3)
{
double num62 = (double) num52;
Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
float num63 = num53 - vector2.X;
float num64 = num54 - vector2.Y;
double num65 = Math.Sqrt((double) num63 * (double) num63 + (double) num64 * (double) num64);
float num66 = (float) (num62 / num65);
float num67 = num63 * num66;
float num68 = num64 * num66;
int num69 = 8;
this.velocity.X = (this.velocity.X * (float) (num69 - 1) + num67) / (float) num69;
this.velocity.Y = (this.velocity.Y * (float) (num69 - 1) + num68) / (float) num69;
}
}
}
else if (this.type == 507 || this.type == 508 || this.type == 662 || this.type == 680 || this.type == 685)
{
if ((double) this.ai[0] > 45.0)
{
this.velocity.X *= 0.98f;
this.velocity.Y += 0.3f;
}
}
else if (this.type == 495)
{
int index = Dust.NewDust(new Vector2(this.position.X - this.velocity.X, this.position.Y - this.velocity.Y), this.width, this.height, 27, this.velocity.X, this.velocity.Y, 100, Scale: 1.2f);
Main.dust[index].noGravity = true;
Main.dust[index].velocity *= 0.3f;
if ((double) this.ai[0] >= 30.0)
{
this.ai[0] = 30f;
this.velocity.Y += 0.04f;
}
}
else if (this.type == 498)
{
if ((double) this.localAI[0] == 0.0)
{
++this.localAI[0];
SoundEngine.PlaySound(SoundID.Item17, this.position);
}
++this.ai[0];
if ((double) this.ai[0] >= 50.0)
{
this.velocity.X *= 0.98f;
this.velocity.Y += 0.15f;
this.rotation += (float) this.direction * 0.5f;
}
else
this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57f;
}
else if (this.type == 437)
{
if ((double) this.ai[0] >= 12.0)
{
if ((double) this.ai[0] >= 20.0)
this.Kill();
this.alpha += 30;
}
}
else if (this.type != 442 && this.type != 634 && this.type != 635 && this.type != 675)
{
if (this.type == 686 || this.type == 711)
{
if ((double) this.ai[0] >= 10.0)
this.velocity.Y += 0.1f;
if ((double) this.ai[0] >= 20.0)
this.velocity.Y += 0.1f;
if ((double) this.ai[0] > 20.0)
this.ai[0] = 20f;
this.velocity.X *= 0.99f;
if ((double) this.velocity.Y > 32.0)
this.velocity.Y = 32f;
}
else if (this.type == 639)
{
if (this.timeLeft <= this.MaxUpdates * 45 - 14)
this.velocity.Y += 0.1f;
}
else if (this.type == 710)
{
if ((double) this.ai[0] >= 0.0)
{
++this.ai[0];
if ((double) this.ai[0] >= 20.0)
{
this.velocity.Y += 0.2f;
if ((double) this.velocity.Y > 0.0)
this.velocity.X *= 0.98f;
if ((double) this.velocity.Y > 12.0)
this.velocity.Y = 12f;
}
}
}
else if ((double) this.ai[0] >= 15.0)
{
this.ai[0] = 15f;
this.velocity.Y += 0.1f;
}
}
}
if (this.type == 921 || this.type == 926 || this.type == 937)
this.rotation += (float) (((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y)) * 0.0500000007450581);
else if (this.type == 248)
{
if ((double) this.velocity.X < 0.0)
this.rotation -= (float) (((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y)) * 0.0500000007450581);
else
this.rotation += (float) (((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y)) * 0.0500000007450581);
}
else if (this.type == 270 || this.type == 585 || this.type == 601 || this.type == 706 || this.type == 837)
{
this.spriteDirection = this.direction;
this.rotation = this.direction >= 0 ? (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) : (float) Math.Atan2(-(double) this.velocity.Y, -(double) this.velocity.X);
}
else if (this.type == 311)
{
if ((double) this.ai[1] != 0.0)
this.rotation += (float) ((double) this.velocity.X * 0.100000001490116 + (double) Main.rand.Next(-10, 11) * 0.025000000372529);
else
this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57f;
}
else if (this.type == 312)
this.rotation += this.velocity.X * 0.02f;
else if (this.type == 675)
this.rotation += this.velocity.X * 0.03f;
else if (this.type != 676)
{
if (this.type == 408)
{
this.rotation = this.velocity.ToRotation();
if (this.direction == -1)
this.rotation += 3.141593f;
}
else if (this.type == 435 || this.type == 459 || this.type == 682 || this.type == 709)
{
this.rotation = this.velocity.ToRotation();
if (this.direction == -1)
this.rotation += 3.141593f;
}
else if (this.type == 660)
this.rotation = this.velocity.ToRotation() + 0.7853982f;
else if (this.type == 662 || this.type == 685)
this.rotation = (float) ((double) this.velocity.ToRotation() - 3.14159274101257 - 0.785398185253143);
else if (this.type == 680 || this.type == 684 || this.type == 686 || this.type == 711 || this.type == 712)
this.rotation = this.velocity.ToRotation() + 1.570796f;
else if (this.type == 436)
{
this.rotation = this.velocity.ToRotation();
this.rotation += 3.141593f;
if (this.direction == -1)
this.rotation += 3.141593f;
}
else if (this.type == 469)
{
if ((double) this.velocity.X > 0.0)
{
this.spriteDirection = -1;
this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57f;
}
else
{
this.spriteDirection = 1;
this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57f;
}
}
else if (this.type == 477)
{
if ((double) this.localAI[1] < 5.0)
{
this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57f;
++this.localAI[1];
}
else
this.rotation = (float) (((double) this.rotation * 2.0 + Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57000005245209) / 3.0);
}
else if (this.type == 532)
this.rotation += (float) (0.200000002980232 + (double) Math.Abs(this.velocity.X) * 0.100000001490116);
else if (this.type == 483)
this.rotation += this.velocity.X * 0.05f;
else if (this.type == 772)
this.rotation += (float) ((double) Math.Sign(this.velocity.X) * ((double) Math.Abs(this.velocity.X) + (double) Math.Abs(this.velocity.Y)) * 0.0500000007450581);
else if (this.type == 485)
{
this.velocity = (this.velocity * 39f + new Vector2(this.ai[0], this.ai[1])) / 40f;
int index = Dust.NewDust(this.position, this.width, this.height, 6);
Main.dust[index].noGravity = true;
Main.dust[index].velocity *= 0.2f;
Main.dust[index].position = (Main.dust[index].position + this.Center) / 2f;
++this.frameCounter;
if (this.frameCounter >= 2)
{
this.frameCounter = 0;
++this.frame;
if (this.frame >= 5)
this.frame = 0;
}
if ((double) this.velocity.X < 0.0)
{
this.spriteDirection = -1;
this.rotation = (float) Math.Atan2(-(double) this.velocity.Y, -(double) this.velocity.X);
}
else
{
this.spriteDirection = 1;
this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X);
}
}
else if (this.type == 640)
{
if (this.velocity != Vector2.Zero)
this.rotation = this.velocity.ToRotation() + 1.570796f;
}
else if (this.type == 325)
this.rotation = this.velocity.ToRotation() - 1.570796f;
else if (this.type != 344 && this.type != 498)
this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X) + 1.57f;
}
if ((double) this.velocity.Y <= 16.0)
return;
this.velocity.Y = 16f;
}
private void AI_010()
{
if (this.type == 31 && (double) this.ai[0] != 2.0)
{
if (Main.rand.Next(2) == 0)
{
int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 32, SpeedY: (this.velocity.Y / 2f));
Main.dust[index].velocity.X *= 0.4f;
}
}
else if (this.type == 39)
{
if (Main.rand.Next(2) == 0)
{
int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 38, SpeedY: (this.velocity.Y / 2f));
Main.dust[index].velocity.X *= 0.4f;
}
}
else if (this.type >= 411 && this.type <= 414)
{
if (Main.rand.Next(3) == 0)
{
int Type = 9;
if (this.type == 412 || this.type == 414)
Type = 11;
if (this.type == 413)
Type = 19;
int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, Type, SpeedY: (this.velocity.Y / 2f));
Main.dust[index].noGravity = true;
Main.dust[index].velocity -= this.velocity * 0.5f;
}
}
else if (this.type == 40)
{
if (Main.rand.Next(2) == 0)
{
int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 36, SpeedY: (this.velocity.Y / 2f));
Main.dust[index].velocity *= 0.4f;
}
}
else if (this.type == 42 || this.type == 31)
{
if (Main.rand.Next(2) == 0)
{
int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 32);
Main.dust[index].velocity.X *= 0.4f;
}
}
else if (this.type == 56 || this.type == 65)
{
if (Main.rand.Next(2) == 0)
{
int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 14);
Main.dust[index].velocity.X *= 0.4f;
}
}
else if (this.type == 67 || this.type == 68)
{
if (Main.rand.Next(2) == 0)
{
int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 51);
Main.dust[index].velocity.X *= 0.4f;
}
}
else if (this.type == 71)
{
if (Main.rand.Next(2) == 0)
{
int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 53);
Main.dust[index].velocity.X *= 0.4f;
}
}
else if (this.type == 179)
{
if (Main.rand.Next(2) == 0)
{
int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 149);
Main.dust[index].velocity.X *= 0.4f;
}
}
else if (this.type == 241 || this.type == 354)
{
if (Main.rand.Next(2) == 0)
{
int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 36);
Main.dust[index].velocity.X *= 0.4f;
}
}
else if (this.type >= 736 && this.type <= 738)
{
if (Main.rand.Next(40) == 0)
{
int index = Dust.NewDust(this.position, this.width, this.height, this.type - 736 + 275);
if (index >= 0)
Main.dust[index].velocity = Main.dust[index].velocity * 0.5f + this.velocity * 0.5f;
}
}
else if (this.type != 109 && Main.rand.Next(20) == 0)
Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 0);
if (this.type >= 736 && this.type <= 738)
{
if ((double) this.localAI[0] == 0.0)
{
this.frame = Main.rand.Next(3);
this.scale = (float) (1.0 - (double) Main.rand.Next(30) * 0.00999999977648258);
}
++this.localAI[0];
}
this.tileCollide = true;
this.localAI[1] = 0.0f;
if (Main.myPlayer == this.owner && (double) this.ai[0] == 0.0)
{
this.tileCollide = false;
if (Main.player[this.owner].channel && (this.type < 736 || this.type > 738) && this.type != 40)
{
this.localAI[1] = -1f;
float num1 = 12f;
Vector2 vector2 = new Vector2(this.position.X + (float) this.width * 0.5f, this.position.Y + (float) this.height * 0.5f);
float num2 = (float) Main.mouseX + Main.screenPosition.X - vector2.X;
float num3 = (float) Main.mouseY + Main.screenPosition.Y - vector2.Y;
if ((double) Main.player[this.owner].gravDir == -1.0)
num3 = Main.screenPosition.Y + (float) Main.screenHeight - (float) Main.mouseY - vector2.Y;
float num4 = (float) Math.Sqrt((double) num2 * (double) num2 + (double) num3 * (double) num3);
float num5 = (float) Math.Sqrt((double) num2 * (double) num2 + (double) num3 * (double) num3);
if ((double) num5 > (double) num1)
{
float num6 = num1 / num5;
float num7 = num2 * num6;
float num8 = num3 * num6;
if ((double) num7 != (double) this.velocity.X || (double) num8 != (double) this.velocity.Y)
this.netUpdate = true;
this.velocity.X = num7;
this.velocity.Y = num8;
}
else
{
if ((double) num2 != (double) this.velocity.X || (double) num3 != (double) this.velocity.Y)
this.netUpdate = true;
this.velocity.X = num2;
this.velocity.Y = num3;
}
}
else
{
this.ai[0] = 1f;
this.netUpdate = true;
}
}
if ((double) this.ai[0] == 1.0 && this.type != 109)
{
if (this.type == 42 || this.type == 65 || this.type == 68 || this.type == 354)
{
++this.ai[1];
if ((double) this.ai[1] >= 60.0)
{
this.ai[1] = 60f;
this.velocity.Y += 0.2f;
}
}
else
this.velocity.Y += 0.41f;
}
else if ((double) this.ai[0] == 2.0 && this.type != 109)
{
this.velocity.Y += 0.2f;
if ((double) this.velocity.X < -0.04)
this.velocity.X += 0.04f;
else if ((double) this.velocity.X > 0.04)
this.velocity.X -= 0.04f;
else
this.velocity.X = 0.0f;
}
if (this.owner == Main.myPlayer)
{
for (int index1 = (int) ((double) this.position.X / 16.0); index1 <= (int) (((double) this.position.X + (double) this.width) / 16.0); ++index1)
{
for (int index2 = (int) ((double) this.position.Y / 16.0); index2 <= (int) (((double) this.position.Y + (double) this.height) / 16.0); ++index2)
{
if (WorldGen.InWorld(index1, index2) && Main.tile[index1, index2].active())
{
if (Main.tile[index1, index2].type >= (ushort) 185 && Main.tile[index1, index2].type <= (ushort) 187 || Main.tile[index1, index2].type == (ushort) 165 || Main.tile[index1, index2].type == (ushort) 12 || Main.tile[index1, index2].type == (ushort) 105 || Main.tile[index1, index2].type == (ushort) 178)
WorldGen.KillTile(index1, index2);
else if (Main.tile[index1, index2].topSlope())
Main.tile[index1, index2].slope((byte) 0);
}
}
}
}
if (this.type >= 736 && this.type <= 738)
{
if (this.frame == 0)
this.rotation -= 0.1f;
else if (this.frame == 1)
this.rotation += 0.1f;
else
this.rotation += 0.15f;
if ((double) this.velocity.Y <= 10.0)
return;
this.velocity.Y = 10f;
}
else
{
this.rotation += 0.1f;
if ((double) this.velocity.Y <= 10.0)
return;
this.velocity.Y = 10f;
}
}
private void AI_026()
{
// ISSUE: unable to decompile the method.
}
private void AI_062()
{
if (this.type == 373)
{
if (Main.player[this.owner].dead)
Main.player[this.owner].hornetMinion = false;
if (Main.player[this.owner].hornetMinion)
this.timeLeft = 2;
}
if (this.type == 375)
{
if (Main.player[this.owner].dead)
Main.player[this.owner].impMinion = false;
if (Main.player[this.owner].impMinion)
this.timeLeft = 2;
}
if (this.type == 407)
{
if (Main.player[this.owner].dead)
Main.player[this.owner].sharknadoMinion = false;
if (Main.player[this.owner].sharknadoMinion)
this.timeLeft = 2;
}
if (this.type == 423)
{
if (Main.player[this.owner].dead)
Main.player[this.owner].UFOMinion = false;
if (Main.player[this.owner].UFOMinion)
this.timeLeft = 2;
}
if (this.type == 613)
{
if (Main.player[this.owner].dead)
Main.player[this.owner].stardustMinion = false;
if (Main.player[this.owner].stardustMinion)
this.timeLeft = 2;
Lighting.AddLight(this.Center, 0.2f, 0.6f, 0.7f);
if ((double) this.localAI[1] > 0.0)
--this.localAI[1];
}
if (this.type == 423)
{
if ((double) this.ai[0] == 2.0)
{
--this.ai[1];
this.tileCollide = false;
if ((double) this.ai[1] > 3.0)
{
int index = Dust.NewDust(this.Center, 0, 0, 220 + Main.rand.Next(2), this.velocity.X, this.velocity.Y, 100);
Main.dust[index].scale = (float) (0.5 + Main.rand.NextDouble() * 0.300000011920929);
Main.dust[index].velocity /= 2.5f;
Main.dust[index].noGravity = true;
Main.dust[index].noLight = true;
Main.dust[index].frame.Y = 80;
}
if ((double) this.ai[1] != 0.0)
return;
this.ai[1] = 30f;
this.ai[0] = 0.0f;
this.velocity = this.velocity / 5f;
this.velocity.Y = 0.0f;
this.extraUpdates = 0;
this.numUpdates = 0;
this.netUpdate = true;
this.extraUpdates = 0;
this.numUpdates = 0;
}
if (this.extraUpdates > 1)
this.extraUpdates = 0;
if (this.numUpdates > 1)
this.numUpdates = 0;
}
if (this.type == 613)
{
if ((double) this.ai[0] == 2.0)
{
--this.ai[1];
this.tileCollide = false;
if ((double) this.ai[1] > 3.0)
{
if (this.numUpdates < 20)
{
for (int index = 0; index < 3; ++index)
{
Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, 229)];
dust.noGravity = true;
dust.position = this.Center;
dust.velocity *= 3f;
dust.velocity += this.velocity * 3f;
dust.fadeIn = 1f;
}
}
float num1 = (float) (2.0 - (double) this.numUpdates / 30.0);
if ((double) this.scale > 0.0)
{
float num2 = 2f;
for (int index = 0; (double) index < (double) num2; ++index)
{
Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, 229)];
dust.noGravity = true;
dust.position = this.Center + Vector2.UnitY.RotatedBy((double) this.numUpdates * 0.104719758033752 + (double) this.whoAmI * 0.785398185253143 + 1.57079637050629) * (float) (this.height / 2) - this.velocity * ((float) index / num2);
dust.velocity = this.velocity / 3f;
dust.fadeIn = num1 / 2f;
dust.scale = num1;
}
}
}
if ((double) this.ai[1] != 0.0)
return;
this.ai[1] = 30f;
this.ai[0] = 0.0f;
this.velocity = this.velocity / 5f;
this.velocity.Y = 0.0f;
this.extraUpdates = 0;
this.numUpdates = 0;
this.netUpdate = true;
float num = 15f;
for (int index = 0; (double) index < (double) num; ++index)
{
Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, 229)];
dust.noGravity = true;
dust.position = this.Center - this.velocity * 5f;
dust.velocity *= 3f;
dust.velocity += this.velocity * 3f;
dust.fadeIn = 1f;
if (Main.rand.Next(3) != 0)
{
dust.fadeIn = 2f;
dust.scale = 2f;
dust.velocity /= 8f;
}
}
for (int index = 0; (double) index < (double) num; ++index)
{
Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, 229)];
dust.noGravity = true;
dust.position = this.Center;
dust.velocity *= 3f;
dust.velocity += this.velocity * 3f;
dust.fadeIn = 1f;
if (Main.rand.Next(3) != 0)
{
dust.fadeIn = 2f;
dust.scale = 2f;
dust.velocity /= 8f;
}
}
this.extraUpdates = 0;
this.numUpdates = 0;
}
if (this.extraUpdates > 1)
this.extraUpdates = 0;
if (this.numUpdates > 1)
this.numUpdates = 0;
}
if (this.type == 423 && (double) this.localAI[0] > 0.0)
--this.localAI[0];
if (this.type == 613 && (double) this.localAI[0] > 0.0)
--this.localAI[0];
float num3 = 0.05f;
float width = (float) this.width;
if (this.type == 407)
{
num3 = 0.1f;
width *= 2f;
}
for (int index = 0; index < 1000; ++index)
{
if (index != this.whoAmI && Main.projectile[index].active && Main.projectile[index].owner == this.owner && Main.projectile[index].type == this.type && (double) Math.Abs(this.position.X - Main.projectile[index].position.X) + (double) Math.Abs(this.position.Y - Main.projectile[index].position.Y) < (double) width)
{
if ((double) this.position.X < (double) Main.projectile[index].position.X)
this.velocity.X -= num3;
else
this.velocity.X += num3;
if ((double) this.position.Y < (double) Main.projectile[index].position.Y)
this.velocity.Y -= num3;
else
this.velocity.Y += num3;
}
}
Vector2 vector2_1 = this.position;
float num4 = 400f;
if (this.type == 423)
num4 = 300f;
if (this.type == 613)
num4 = 300f;
bool flag = false;
int num5 = -1;
this.tileCollide = true;
if (this.type == 407)
{
this.tileCollide = false;
if (Collision.SolidCollision(this.position, this.width, this.height))
{
this.alpha += 20;
if (this.alpha > 150)
this.alpha = 150;
}
else
{
this.alpha -= 50;
if (this.alpha < 60)
this.alpha = 60;
}
}
if (this.type == 407 || this.type == 613 || this.type == 423)
{
Vector2 center = Main.player[this.owner].Center;
Vector2 vector2_2 = new Vector2(0.5f);
if (this.type == 423)
vector2_2.Y = 0.0f;
NPC minionAttackTargetNpc = this.OwnerMinionAttackTargetNPC;
if (minionAttackTargetNpc != null && minionAttackTargetNpc.CanBeChasedBy((object) this))
{
Vector2 vector2_3 = minionAttackTargetNpc.position + minionAttackTargetNpc.Size * vector2_2;
float num6 = Vector2.Distance(vector2_3, center);
if (((double) Vector2.Distance(center, vector2_1) > (double) num6 && (double) num6 < (double) num4 || !flag) && Collision.CanHitLine(this.position, this.width, this.height, minionAttackTargetNpc.position, minionAttackTargetNpc.width, minionAttackTargetNpc.height))
{
num4 = num6;
vector2_1 = vector2_3;
flag = true;
num5 = minionAttackTargetNpc.whoAmI;
}
}
if (!flag)
{
for (int index = 0; index < 200; ++index)
{
NPC npc = Main.npc[index];
if (npc.CanBeChasedBy((object) this))
{
Vector2 vector2_4 = npc.position + npc.Size * vector2_2;
float num7 = Vector2.Distance(vector2_4, center);
if (((double) Vector2.Distance(center, vector2_1) > (double) num7 && (double) num7 < (double) num4 || !flag) && Collision.CanHitLine(this.position, this.width, this.height, npc.position, npc.width, npc.height))
{
num4 = num7;
vector2_1 = vector2_4;
flag = true;
num5 = index;
}
}
}
}
}
else
{
NPC minionAttackTargetNpc = this.OwnerMinionAttackTargetNPC;
if (minionAttackTargetNpc != null && minionAttackTargetNpc.CanBeChasedBy((object) this))
{
float num8 = Vector2.Distance(minionAttackTargetNpc.Center, this.Center);
if (((double) Vector2.Distance(this.Center, vector2_1) > (double) num8 && (double) num8 < (double) num4 || !flag) && Collision.CanHitLine(this.position, this.width, this.height, minionAttackTargetNpc.position, minionAttackTargetNpc.width, minionAttackTargetNpc.height))
{
num4 = num8;
vector2_1 = minionAttackTargetNpc.Center;
flag = true;
num5 = minionAttackTargetNpc.whoAmI;
}
}
if (!flag)
{
for (int index = 0; index < 200; ++index)
{
NPC npc = Main.npc[index];
if (npc.CanBeChasedBy((object) this))
{
float num9 = Vector2.Distance(npc.Center, this.Center);
if (((double) Vector2.Distance(this.Center, vector2_1) > (double) num9 && (double) num9 < (double) num4 || !flag) && Collision.CanHitLine(this.position, this.width, this.height, npc.position, npc.width, npc.height))
{
num4 = num9;
vector2_1 = npc.Center;
flag = true;
num5 = index;
}
}
}
}
}
int num10 = 500;
if (flag)
num10 = 1000;
if (flag && this.type == 423)
num10 = 1200;
if (flag && this.type == 613)
num10 = 1350;
Player player = Main.player[this.owner];
if ((double) Vector2.Distance(player.Center, this.Center) > (double) num10)
{
this.ai[0] = 1f;
this.netUpdate = true;
}
if ((double) this.ai[0] == 1.0)
this.tileCollide = false;
if (flag && (double) this.ai[0] == 0.0)
{
Vector2 vector2_5 = vector2_1 - this.Center;
float num11 = vector2_5.Length();
vector2_5.Normalize();
if (this.type == 423)
{
Vector2 vector2_6 = vector2_1 - Vector2.UnitY * 80f;
int index = (int) vector2_6.Y / 16;
if (index < 0)
index = 0;
Tile tile1 = Main.tile[(int) vector2_6.X / 16, index];
if (tile1 != null && tile1.active() && Main.tileSolid[(int) tile1.type] && !Main.tileSolidTop[(int) tile1.type])
{
vector2_6 += Vector2.UnitY * 16f;
Tile tile2 = Main.tile[(int) vector2_6.X / 16, (int) vector2_6.Y / 16];
if (tile2 != null && tile2.active() && Main.tileSolid[(int) tile2.type] && !Main.tileSolidTop[(int) tile2.type])
vector2_6 += Vector2.UnitY * 16f;
}
vector2_5 = vector2_6 - this.Center;
num11 = vector2_5.Length();
vector2_5.Normalize();
if ((double) num11 > 300.0 && (double) num11 <= 800.0 && (double) this.localAI[0] == 0.0)
{
this.ai[0] = 2f;
this.ai[1] = (float) (int) ((double) num11 / 10.0);
this.extraUpdates = (int) this.ai[1];
this.velocity = vector2_5 * 10f;
this.localAI[0] = 60f;
return;
}
}
if (this.type == 613)
{
Vector2 vector2_7 = vector2_1;
Vector2 vector2_8 = this.Center - vector2_7;
if (vector2_8 == Vector2.Zero)
vector2_8 = -Vector2.UnitY;
vector2_8.Normalize();
Vector2 vector2_9 = vector2_7 + vector2_8 * 60f;
int index = (int) vector2_9.Y / 16;
if (index < 0)
index = 0;
Tile tile3 = Main.tile[(int) vector2_9.X / 16, index];
if (tile3 != null && tile3.active() && Main.tileSolid[(int) tile3.type] && !Main.tileSolidTop[(int) tile3.type])
{
vector2_9 += Vector2.UnitY * 16f;
Tile tile4 = Main.tile[(int) vector2_9.X / 16, (int) vector2_9.Y / 16];
if (tile4 != null && tile4.active() && Main.tileSolid[(int) tile4.type] && !Main.tileSolidTop[(int) tile4.type])
vector2_9 += Vector2.UnitY * 16f;
}
vector2_5 = vector2_9 - this.Center;
num11 = vector2_5.Length();
vector2_5.Normalize();
if ((double) num11 > 400.0 && (double) num11 <= 800.0 && (double) this.localAI[0] == 0.0)
{
this.ai[0] = 2f;
this.ai[1] = (float) (int) ((double) num11 / 10.0);
this.extraUpdates = (int) this.ai[1];
this.velocity = vector2_5 * 10f;
this.localAI[0] = 60f;
return;
}
}
if (this.type == 407)
{
if ((double) num11 > 400.0)
{
float num12 = 2f;
vector2_5 *= num12;
this.velocity = (this.velocity * 20f + vector2_5) / 21f;
}
else
this.velocity = this.velocity * 0.96f;
}
if ((double) num11 > 200.0)
{
float num13 = 6f;
Vector2 vector2_10 = vector2_5 * num13;
this.velocity.X = (float) (((double) this.velocity.X * 40.0 + (double) vector2_10.X) / 41.0);
this.velocity.Y = (float) (((double) this.velocity.Y * 40.0 + (double) vector2_10.Y) / 41.0);
}
else if (this.type == 423 || this.type == 613)
{
if ((double) num11 > 70.0 && (double) num11 < 130.0)
{
float num14 = 7f;
if ((double) num11 < 100.0)
num14 = -3f;
Vector2 vector2_11 = vector2_5 * num14;
this.velocity = (this.velocity * 20f + vector2_11) / 21f;
if ((double) Math.Abs(vector2_11.X) > (double) Math.Abs(vector2_11.Y))
this.velocity.X = (float) (((double) this.velocity.X * 10.0 + (double) vector2_11.X) / 11.0);
}
else
this.velocity = this.velocity * 0.97f;
}
else if (this.type == 375)
{
if ((double) num11 < 150.0)
{
float num15 = 4f;
Vector2 vector2_12 = vector2_5 * -num15;
this.velocity.X = (float) (((double) this.velocity.X * 40.0 + (double) vector2_12.X) / 41.0);
this.velocity.Y = (float) (((double) this.velocity.Y * 40.0 + (double) vector2_12.Y) / 41.0);
}
else
this.velocity = this.velocity * 0.97f;
}
else if ((double) this.velocity.Y > -1.0)
this.velocity.Y -= 0.1f;
}
else
{
if (!Collision.CanHitLine(this.Center, 1, 1, Main.player[this.owner].Center, 1, 1))
this.ai[0] = 1f;
float num16 = 6f;
if ((double) this.ai[0] == 1.0)
num16 = 15f;
if (this.type == 407)
num16 = 9f;
Vector2 center = this.Center;
Vector2 vector2_13 = player.Center - center + new Vector2(0.0f, -60f);
if (this.type == 407)
vector2_13 += new Vector2(0.0f, 40f);
if (this.type == 375)
{
this.ai[1] = 3600f;
this.netUpdate = true;
vector2_13 = player.Center - center;
int num17 = 1;
for (int index = 0; index < this.whoAmI; ++index)
{
if (Main.projectile[index].active && Main.projectile[index].owner == this.owner && Main.projectile[index].type == this.type)
++num17;
}
vector2_13.X -= (float) (10 * Main.player[this.owner].direction);
vector2_13.X -= (float) (num17 * 40 * Main.player[this.owner].direction);
vector2_13.Y -= 10f;
}
float num18 = vector2_13.Length();
if ((double) num18 > 200.0 && (double) num16 < 9.0)
num16 = 9f;
if (this.type == 375)
num16 = (float) (int) ((double) num16 * 0.75);
if ((double) num18 < 100.0 && (double) this.ai[0] == 1.0 && !Collision.SolidCollision(this.position, this.width, this.height))
{
this.ai[0] = 0.0f;
this.netUpdate = true;
}
if ((double) num18 > 2000.0)
{
this.position.X = Main.player[this.owner].Center.X - (float) (this.width / 2);
this.position.Y = Main.player[this.owner].Center.Y - (float) (this.width / 2);
}
if (this.type == 375)
{
if ((double) num18 > 10.0)
{
vector2_13.Normalize();
if ((double) num18 < 50.0)
num16 /= 2f;
this.velocity = (this.velocity * 20f + vector2_13 * num16) / 21f;
}
else
{
this.direction = Main.player[this.owner].direction;
this.velocity = this.velocity * 0.9f;
}
}
else if (this.type == 407)
{
if ((double) Math.Abs(vector2_13.X) > 40.0 || (double) Math.Abs(vector2_13.Y) > 10.0)
{
vector2_13.Normalize();
this.velocity = (this.velocity * 20f + vector2_13 * num16 * new Vector2(1.25f, 0.65f)) / 21f;
}
else
{
if ((double) this.velocity.X == 0.0 && (double) this.velocity.Y == 0.0)
{
this.velocity.X = -0.15f;
this.velocity.Y = -0.05f;
}
this.velocity = this.velocity * 1.01f;
}
}
else if ((double) num18 > 70.0)
{
vector2_13.Normalize();
this.velocity = (this.velocity * 20f + vector2_13 * num16) / 21f;
}
else
{
if ((double) this.velocity.X == 0.0 && (double) this.velocity.Y == 0.0)
{
this.velocity.X = -0.15f;
this.velocity.Y = -0.05f;
}
this.velocity = this.velocity * 1.01f;
}
}
this.rotation = this.velocity.X * 0.05f;
++this.frameCounter;
if (this.type == 373)
{
if (this.frameCounter > 1)
{
++this.frame;
this.frameCounter = 0;
}
if (this.frame > 2)
this.frame = 0;
}
if (this.type == 375)
{
if (this.frameCounter >= 16)
this.frameCounter = 0;
this.frame = this.frameCounter / 4;
if ((double) this.ai[1] > 0.0 && (double) this.ai[1] < 16.0)
this.frame += 4;
if (Main.rand.Next(6) == 0)
{
int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, Alpha: 100, Scale: 2f);
Main.dust[index].velocity *= 0.3f;
Main.dust[index].noGravity = true;
Main.dust[index].noLight = true;
}
}
if (this.type == 407)
{
int num19 = 2;
if (this.frameCounter >= 6 * num19)
this.frameCounter = 0;
this.frame = this.frameCounter / num19;
if (Main.rand.Next(5) == 0)
{
int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 217, Alpha: 100, Scale: 2f);
Main.dust[index].velocity *= 0.3f;
Main.dust[index].noGravity = true;
Main.dust[index].noLight = true;
}
}
if (this.type == 423 || this.type == 613)
{
int num20 = 3;
if (this.frameCounter >= 4 * num20)
this.frameCounter = 0;
this.frame = this.frameCounter / num20;
}
if ((double) this.velocity.X > 0.0)
this.spriteDirection = this.direction = -1;
else if ((double) this.velocity.X < 0.0)
this.spriteDirection = this.direction = 1;
if (this.type == 373)
{
if ((double) this.ai[1] > 0.0)
this.ai[1] += (float) Main.rand.Next(1, 4);
if ((double) this.ai[1] > 90.0)
{
this.ai[1] = 0.0f;
this.netUpdate = true;
}
}
else if (this.type == 375)
{
if ((double) this.ai[1] > 0.0)
{
++this.ai[1];
if (Main.rand.Next(3) == 0)
++this.ai[1];
}
if ((double) this.ai[1] > 90.0)
{
this.ai[1] = 0.0f;
this.netUpdate = true;
}
}
else if (this.type == 407)
{
if ((double) this.ai[1] > 0.0)
{
++this.ai[1];
if (Main.rand.Next(3) != 0)
++this.ai[1];
}
if ((double) this.ai[1] > 60.0)
{
this.ai[1] = 0.0f;
this.netUpdate = true;
}
}
else if (this.type == 423)
{
if ((double) this.ai[1] > 0.0)
{
++this.ai[1];
if (Main.rand.Next(3) != 0)
++this.ai[1];
}
if ((double) this.ai[1] > 30.0)
{
this.ai[1] = 0.0f;
this.netUpdate = true;
}
}
else if (this.type == 613)
{
if ((double) this.ai[1] > 0.0)
{
++this.ai[1];
if (Main.rand.Next(3) != 0)
++this.ai[1];
}
if ((double) this.ai[1] > 60.0)
{
this.ai[1] = 0.0f;
this.netUpdate = true;
}
}
if ((double) this.ai[0] != 0.0)
return;
float num21 = 0.0f;
int Type = 0;
if (this.type == 373)
{
num21 = 10f;
Type = 374;
}
else if (this.type == 375)
{
num21 = 11f;
Type = 376;
}
else if (this.type == 407)
{
num21 = 14f;
Type = 408;
}
else if (this.type == 423)
{
num21 = 4f;
Type = 433;
}
else if (this.type == 613)
{
num21 = 14f;
Type = 614;
}
if (!flag)
return;
if (this.type == 375)
{
if ((double) (vector2_1 - this.Center).X > 0.0)
this.spriteDirection = this.direction = -1;
else if ((double) (vector2_1 - this.Center).X < 0.0)
this.spriteDirection = this.direction = 1;
}
if (this.type == 407 && Collision.SolidCollision(this.position, this.width, this.height))
return;
if (this.type == 423)
{
if ((double) Math.Abs((vector2_1 - this.Center).ToRotation() - 1.570796f) > 0.785398185253143)
{
this.velocity = this.velocity + Vector2.Normalize(vector2_1 - this.Center - Vector2.UnitY * 80f);
}
else
{
if ((double) (vector2_1 - this.Center).Length() > 400.0 || (double) this.ai[1] != 0.0)
return;
++this.ai[1];
if (Main.myPlayer != this.owner)
return;
Vector2 vector2_14 = vector2_1 - this.Center;
vector2_14.Normalize();
Vector2 vector2_15 = vector2_14 * num21;
Projectile.NewProjectile(this.Center.X, this.Center.Y, vector2_15.X, vector2_15.Y, Type, this.damage, 0.0f, Main.myPlayer);
this.netUpdate = true;
}
}
else if ((double) this.ai[1] == 0.0 && this.type == 613)
{
if ((double) (vector2_1 - this.Center).Length() > 500.0 || (double) this.ai[1] != 0.0)
return;
++this.ai[1];
if (Main.myPlayer == this.owner)
{
Vector2 vector2_16 = vector2_1 - this.Center;
vector2_16.Normalize();
Vector2 vector2_17 = vector2_16 * num21;
int index = Projectile.NewProjectile(this.Center.X, this.Center.Y, vector2_17.X, vector2_17.Y, Type, this.damage, 0.0f, Main.myPlayer, ai1: ((float) num5));
Main.projectile[index].timeLeft = 300;
Main.projectile[index].netUpdate = true;
this.velocity = this.velocity - vector2_17 / 3f;
this.netUpdate = true;
}
for (int index1 = 0; index1 < 5; ++index1)
{
int num22 = this.width / 4;
Vector2 vector2_18 = ((float) Main.rand.NextDouble() * 6.283185f).ToRotationVector2() * (float) Main.rand.Next(24, 41) / 8f;
int index2 = Dust.NewDust(this.Center - Vector2.One * (float) num22, num22 * 2, num22 * 2, 88);
Dust dust = Main.dust[index2];
Vector2 vector2_19 = Vector2.Normalize(dust.position - this.Center);
dust.position = this.Center + vector2_19 * (float) num22 * this.scale - new Vector2(4f);
dust.velocity = index1 >= 30 ? 2f * vector2_19 * (float) Main.rand.Next(45, 91) / 10f : vector2_19 * dust.velocity.Length() * 2f;
dust.noGravity = true;
dust.scale = 0.7f + Main.rand.NextFloat();
}
}
else
{
if ((double) this.ai[1] != 0.0)
return;
Vector2 vector2_20 = vector2_1 - this.Center;
++this.ai[1];
if (Main.myPlayer != this.owner)
return;
vector2_20.Normalize();
Vector2 vector2_21 = vector2_20 * num21;
int index = Projectile.NewProjectile(this.Center.X, this.Center.Y, vector2_21.X, vector2_21.Y, Type, this.damage, 0.0f, Main.myPlayer);
Main.projectile[index].timeLeft = 300;
Main.projectile[index].netUpdate = true;
this.netUpdate = true;
}
}
private void AI_075()
{
Player player = Main.player[this.owner];
float num1 = 1.570796f;
Vector2 vector2_1 = player.RotatedRelativePoint(player.MountedCenter);
int frames = 2;
float num2 = 0.0f;
if (this.type == 439)
{
++this.ai[0];
int num3 = 0;
if ((double) this.ai[0] >= 40.0)
++num3;
if ((double) this.ai[0] >= 80.0)
++num3;
if ((double) this.ai[0] >= 120.0)
++num3;
int num4 = 24;
int num5 = 6;
++this.ai[1];
bool flag = false;
if ((double) this.ai[1] >= (double) (num4 - num5 * num3))
{
this.ai[1] = 0.0f;
flag = true;
}
this.frameCounter += 1 + num3;
if (this.frameCounter >= 4)
{
this.frameCounter = 0;
++this.frame;
if (this.frame >= 6)
this.frame = 0;
}
if (this.soundDelay <= 0)
{
this.soundDelay = num4 - num5 * num3;
if ((double) this.ai[0] != 1.0)
SoundEngine.PlaySound(SoundID.Item91, this.position);
}
if ((double) this.ai[1] == 1.0 && (double) this.ai[0] != 1.0)
{
Vector2 vector2_2 = this.Center + (Vector2.UnitX * 24f).RotatedBy((double) this.rotation - 1.57079637050629);
for (int index1 = 0; index1 < 2; ++index1)
{
int index2 = Dust.NewDust(vector2_2 - Vector2.One * 8f, 16, 16, 135, this.velocity.X / 2f, this.velocity.Y / 2f, 100);
Main.dust[index2].velocity *= 0.66f;
Main.dust[index2].noGravity = true;
Main.dust[index2].scale = 1.4f;
}
}
if (flag && Main.myPlayer == this.owner)
{
if ((!player.channel || !player.CheckMana(player.inventory[player.selectedItem].mana, true) || player.noItems ? 0 : (!player.CCed ? 1 : 0)) != 0)
{
float num6 = player.inventory[player.selectedItem].shootSpeed * this.scale;
Vector2 vector2_3 = vector2_1;
Vector2 vector2_4 = Main.screenPosition + new Vector2((float) Main.mouseX, (float) Main.mouseY) - vector2_3;
if ((double) player.gravDir == -1.0)
vector2_4.Y = (float) (Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector2_3.Y;
Vector2 vector2_5 = Vector2.Normalize(vector2_4);
if (float.IsNaN(vector2_5.X) || float.IsNaN(vector2_5.Y))
vector2_5 = -Vector2.UnitY;
Vector2 vector2_6 = vector2_5 * num6;
if ((double) vector2_6.X != (double) this.velocity.X || (double) vector2_6.Y != (double) this.velocity.Y)
this.netUpdate = true;
this.velocity = vector2_6;
int Type = 440;
float num7 = 14f;
int num8 = 7;
for (int index = 0; index < 2; ++index)
{
Vector2 vector2_7 = this.Center + new Vector2((float) Main.rand.Next(-num8, num8 + 1), (float) Main.rand.Next(-num8, num8 + 1));
Vector2 vector2_8 = (Vector2.Normalize(this.velocity) * num7).RotatedBy(Main.rand.NextDouble() * 0.196349546313286 - 0.0981747731566429);
if (float.IsNaN(vector2_8.X) || float.IsNaN(vector2_8.Y))
vector2_8 = -Vector2.UnitY;
Projectile.NewProjectile(vector2_7.X, vector2_7.Y, vector2_8.X, vector2_8.Y, Type, this.damage, this.knockBack, this.owner);
}
}
else
this.Kill();
}
}
if (this.type == 445)
{
if (this.soundDelay <= 0)
{
SoundEngine.PlaySound(SoundID.Item132, this.position);
this.soundDelay = 23;
}
++this.localAI[0];
if ((double) this.localAI[0] >= 60.0)
this.localAI[0] = 0.0f;
if ((double) Vector2.Distance(vector2_1, this.Center) >= 5.0)
{
float num9 = this.localAI[0] / 60f;
if ((double) num9 > 0.5)
num9 = 1f - num9;
Vector3 vector3 = Vector3.Lerp(new Vector3(0.0f, 1f, 0.7f), new Vector3(0.0f, 0.7f, 1f), (float) (1.0 - (double) num9 * 2.0)) * 0.5f;
if ((double) Vector2.Distance(vector2_1, this.Center) >= 30.0)
{
Vector2 vector2_9 = this.Center - vector2_1;
vector2_9.Normalize();
Vector2 vector2_10 = vector2_9 * (Vector2.Distance(vector2_1, this.Center) - 30f);
DelegateMethods.v3_1 = vector3 * 0.8f;
Utils.PlotTileLine(this.Center - vector2_10, this.Center, 8f, new Utils.TileActionAttempt(DelegateMethods.CastLightOpen));
}
Lighting.AddLight((int) this.Center.X / 16, (int) this.Center.Y / 16, vector3.X, vector3.Y, vector3.Z);
}
if (Main.myPlayer == this.owner)
{
if ((double) this.localAI[1] > 0.0)
--this.localAI[1];
if (!player.channel || player.noItems || player.CCed)
this.Kill();
else if ((double) this.localAI[1] == 0.0)
{
Vector2 vector2_11 = vector2_1;
Vector2 vector2_12 = Main.screenPosition + new Vector2((float) Main.mouseX, (float) Main.mouseY) - vector2_11;
if ((double) player.gravDir == -1.0)
vector2_12.Y = (float) (Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector2_11.Y;
if (Main.tile[Player.tileTargetX, Player.tileTargetY].active())
{
vector2_12 = new Vector2((float) Player.tileTargetX, (float) Player.tileTargetY) * 16f + Vector2.One * 8f - vector2_11;
this.localAI[1] = 2f;
}
Vector2 vector2_13 = Vector2.Lerp(vector2_12, this.velocity, 0.7f);
if (float.IsNaN(vector2_13.X) || float.IsNaN(vector2_13.Y))
vector2_13 = -Vector2.UnitY;
float num10 = 30f;
if ((double) vector2_13.Length() < (double) num10)
vector2_13 = Vector2.Normalize(vector2_13) * num10;
int tileBoost = player.inventory[player.selectedItem].tileBoost;
int num11 = -Player.tileRangeX - tileBoost + 1;
int num12 = Player.tileRangeX + tileBoost - 1;
int num13 = -Player.tileRangeY - tileBoost;
int num14 = Player.tileRangeY + tileBoost - 1;
int num15 = 12;
bool flag = false;
if ((double) vector2_13.X < (double) (num11 * 16 - num15))
flag = true;
if ((double) vector2_13.Y < (double) (num13 * 16 - num15))
flag = true;
if ((double) vector2_13.X > (double) (num12 * 16 + num15))
flag = true;
if ((double) vector2_13.Y > (double) (num14 * 16 + num15))
flag = true;
if (flag)
{
Vector2 vector2_14 = Vector2.Normalize(vector2_13);
float num16 = -1f;
if ((double) vector2_14.X < 0.0 && ((double) (num11 * 16 - num15) / (double) vector2_14.X < (double) num16 || (double) num16 == -1.0))
num16 = (float) (num11 * 16 - num15) / vector2_14.X;
if ((double) vector2_14.X > 0.0 && ((double) (num12 * 16 + num15) / (double) vector2_14.X < (double) num16 || (double) num16 == -1.0))
num16 = (float) (num12 * 16 + num15) / vector2_14.X;
if ((double) vector2_14.Y < 0.0 && ((double) (num13 * 16 - num15) / (double) vector2_14.Y < (double) num16 || (double) num16 == -1.0))
num16 = (float) (num13 * 16 - num15) / vector2_14.Y;
if ((double) vector2_14.Y > 0.0 && ((double) (num14 * 16 + num15) / (double) vector2_14.Y < (double) num16 || (double) num16 == -1.0))
num16 = (float) (num14 * 16 + num15) / vector2_14.Y;
vector2_13 = vector2_14 * num16;
}
if ((double) vector2_13.X != (double) this.velocity.X || (double) vector2_13.Y != (double) this.velocity.Y)
this.netUpdate = true;
this.velocity = vector2_13;
}
}
}
if (this.type == 460)
{
++this.ai[0];
int num17 = 0;
if ((double) this.ai[0] >= 80.0)
++num17;
if ((double) this.ai[0] >= 180.0)
++num17;
bool flag1 = false;
double num18 = (double) this.ai[0];
if ((double) this.ai[0] == 80.0 || (double) this.ai[0] == 180.0 || (double) this.ai[0] > 180.0 && (double) this.ai[0] % 20.0 == 0.0)
flag1 = true;
bool flag2 = (double) this.ai[0] >= 180.0;
int num19 = 5;
if (!flag2)
++this.ai[1];
bool flag3 = false;
if ((double) this.ai[0] == 1.0)
flag3 = true;
if (flag2 && (double) this.ai[0] % 20.0 == 0.0)
flag3 = true;
if ((double) this.ai[1] >= (double) num19 && !flag2)
{
this.ai[1] = 0.0f;
flag3 = true;
if (!flag2)
{
float num20 = player.inventory[player.selectedItem].shootSpeed * this.scale;
Vector2 vector2_15 = vector2_1;
Vector2 vector2_16 = Main.screenPosition + new Vector2((float) Main.mouseX, (float) Main.mouseY) - vector2_15;
if ((double) player.gravDir == -1.0)
vector2_16.Y = (float) (Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector2_15.Y;
Vector2 vector2_17 = Vector2.Normalize(vector2_16);
if (float.IsNaN(vector2_17.X) || float.IsNaN(vector2_17.Y))
vector2_17 = -Vector2.UnitY;
Vector2 vector2_18 = vector2_17 * num20;
if ((double) vector2_18.X != (double) this.velocity.X || (double) vector2_18.Y != (double) this.velocity.Y)
this.netUpdate = true;
this.velocity = vector2_18;
}
}
if (this.soundDelay <= 0 && !flag2)
{
this.soundDelay = num19 - num17;
this.soundDelay *= 2;
if ((double) this.ai[0] != 1.0)
SoundEngine.PlaySound(SoundID.Item15, this.position);
}
if ((double) this.ai[0] > 10.0 && !flag2)
{
Vector2 vector2_19 = this.Center + (Vector2.UnitX * 18f).RotatedBy((double) this.rotation - 1.57079637050629);
for (int index3 = 0; index3 < num17 + 1; ++index3)
{
int Type = 226;
float num21 = 0.4f;
if (index3 % 2 == 1)
{
Type = 226;
num21 = 0.65f;
}
Vector2 vector2_20 = vector2_19 + ((float) Main.rand.NextDouble() * 6.283185f).ToRotationVector2() * (12f - (float) (num17 * 2));
int index4 = Dust.NewDust(vector2_20 - Vector2.One * 8f, 16, 16, Type, this.velocity.X / 2f, this.velocity.Y / 2f);
Main.dust[index4].velocity = Vector2.Normalize(vector2_19 - vector2_20) * 1.5f * (float) (10.0 - (double) num17 * 2.0) / 10f;
Main.dust[index4].noGravity = true;
Main.dust[index4].scale = num21;
Main.dust[index4].customData = (object) player;
}
}
if (flag2)
{
Vector2 vector2_21 = this.Center + (Vector2.UnitX * 14f).RotatedBy((double) this.rotation - 1.57079637050629);
for (int index5 = 0; index5 < 2; ++index5)
{
int Type = 226;
float num22 = 0.35f;
if (index5 % 2 == 1)
{
Type = 226;
num22 = 0.45f;
}
float num23 = Main.rand.NextFloatDirection();
Vector2 vector2_22 = vector2_21 + ((float) ((double) this.rotation + (double) num23 * 0.785398185253143 * 0.800000011920929 - 1.57079637050629)).ToRotationVector2() * 6f;
int num24 = 24;
int index6 = Dust.NewDust(vector2_22 - Vector2.One * (float) (num24 / 2), num24, num24, Type, this.velocity.X / 2f, this.velocity.Y / 2f);
Main.dust[index6].velocity = (vector2_22 - vector2_21).SafeNormalize(Vector2.Zero) * MathHelper.Lerp(1.5f, 9f, Utils.GetLerpValue(1f, 0.0f, Math.Abs(num23), true));
Main.dust[index6].noGravity = true;
Main.dust[index6].scale = num22;
Main.dust[index6].customData = (object) player;
Main.dust[index6].fadeIn = 0.5f;
}
}
if (flag3 && Main.myPlayer == this.owner)
{
bool flag4 = !flag1 || player.CheckMana(player.inventory[player.selectedItem].mana, true);
if ((!(player.channel & flag4) || player.noItems ? 0 : (!player.CCed ? 1 : 0)) != 0)
{
if ((double) this.ai[0] == 180.0)
{
Vector2 center = this.Center;
Vector2 vector2_23 = Vector2.Normalize(this.velocity);
if (float.IsNaN(vector2_23.X) || float.IsNaN(vector2_23.Y))
vector2_23 = -Vector2.UnitY;
int Damage = (int) ((double) this.damage * 1.5);
this.ai[1] = (float) Projectile.NewProjectile(center.X, center.Y, vector2_23.X, vector2_23.Y, 461, Damage, this.knockBack, this.owner, ai1: ((float) this.whoAmI));
this.netUpdate = true;
}
else if (flag2)
{
Projectile projectile = Main.projectile[(int) this.ai[1]];
if (!projectile.active || projectile.type != 461)
{
this.Kill();
return;
}
}
else
{
bool flag5 = false;
if ((double) this.ai[0] == 1.0)
flag5 = true;
if ((double) this.ai[0] <= 50.0 && (double) this.ai[0] % 10.0 == 0.0)
flag5 = true;
if ((double) this.ai[0] >= 80.0 && (double) this.ai[0] < 180.0 && (double) this.ai[0] % 30.0 == 0.0)
flag5 = true;
if (flag5)
{
int Type = 459;
float num25 = 10f;
Vector2 center = this.Center;
Vector2 vector2_24 = Vector2.Normalize(this.velocity) * num25;
if (float.IsNaN(vector2_24.X) || float.IsNaN(vector2_24.Y))
vector2_24 = -Vector2.UnitY;
float ai1 = (float) (0.699999988079071 + (double) num17 * 0.300000011920929);
int Damage = (double) ai1 < 1.0 ? this.damage : (int) ((double) this.damage * 2.5);
Projectile.NewProjectile(center.X, center.Y, vector2_24.X, vector2_24.Y, Type, Damage, this.knockBack, this.owner, ai1: ai1);
}
}
}
else
this.Kill();
}
}
if (this.type == 633)
{
float num26 = 30f;
if ((double) this.ai[0] > 90.0)
num26 = 15f;
if ((double) this.ai[0] > 120.0)
num26 = 5f;
this.damage = (int) ((double) player.inventory[player.selectedItem].damage * (double) player.magicDamage);
++this.ai[0];
++this.ai[1];
bool flag6 = false;
if ((double) this.ai[0] % (double) num26 == 0.0)
flag6 = true;
int num27 = 10;
bool flag7 = false;
if ((double) this.ai[0] % (double) num26 == 0.0)
flag7 = true;
if ((double) this.ai[1] >= 1.0)
{
this.ai[1] = 0.0f;
flag7 = true;
if (Main.myPlayer == this.owner)
{
float num28 = player.inventory[player.selectedItem].shootSpeed * this.scale;
Vector2 vector2_25 = vector2_1;
Vector2 vector2_26 = Main.screenPosition + new Vector2((float) Main.mouseX, (float) Main.mouseY) - vector2_25;
if ((double) player.gravDir == -1.0)
vector2_26.Y = (float) (Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector2_25.Y;
Vector2 vector2_27 = Vector2.Normalize(vector2_26);
if (float.IsNaN(vector2_27.X) || float.IsNaN(vector2_27.Y))
vector2_27 = -Vector2.UnitY;
Vector2 vector2_28 = Vector2.Normalize(Vector2.Lerp(vector2_27, Vector2.Normalize(this.velocity), 0.92f)) * num28;
if ((double) vector2_28.X != (double) this.velocity.X || (double) vector2_28.Y != (double) this.velocity.Y)
this.netUpdate = true;
this.velocity = vector2_28;
}
}
++this.frameCounter;
if (this.frameCounter >= ((double) this.ai[0] < 120.0 ? 4 : 1))
{
this.frameCounter = 0;
if (++this.frame >= 5)
this.frame = 0;
}
if (this.soundDelay <= 0)
{
this.soundDelay = num27;
this.soundDelay *= 2;
if ((double) this.ai[0] != 1.0)
SoundEngine.PlaySound(SoundID.Item15, this.position);
}
if (flag7 && Main.myPlayer == this.owner)
{
bool flag8 = !flag6 || player.CheckMana(player.inventory[player.selectedItem].mana, true);
if ((!(player.channel & flag8) || player.noItems ? 0 : (!player.CCed ? 1 : 0)) != 0)
{
if ((double) this.ai[0] == 1.0)
{
Vector2 center = this.Center;
Vector2 vector2_29 = Vector2.Normalize(this.velocity);
if (float.IsNaN(vector2_29.X) || float.IsNaN(vector2_29.Y))
vector2_29 = -Vector2.UnitY;
int damage = this.damage;
for (int index = 0; index < 6; ++index)
Projectile.NewProjectile(center.X, center.Y, vector2_29.X, vector2_29.Y, 632, damage, this.knockBack, this.owner, (float) index, (float) this.whoAmI);
this.netUpdate = true;
}
}
else
this.Kill();
}
}
if (this.type == 595)
{
num1 = 0.0f;
if (this.spriteDirection == -1)
num1 = 3.141593f;
if (++this.frame >= Main.projFrames[this.type])
this.frame = 0;
--this.soundDelay;
if (this.soundDelay <= 0)
{
SoundEngine.PlaySound(SoundID.Item1, this.Center);
this.soundDelay = 12;
}
if (Main.myPlayer == this.owner)
{
if (player.channel && !player.noItems && !player.CCed)
{
float num29 = 1f;
if (player.inventory[player.selectedItem].shoot == this.type)
num29 = player.inventory[player.selectedItem].shootSpeed * this.scale;
Vector2 vec = Main.MouseWorld - vector2_1;
vec.Normalize();
if (vec.HasNaNs())
vec = Vector2.UnitX * (float) player.direction;
vec *= num29;
if ((double) vec.X != (double) this.velocity.X || (double) vec.Y != (double) this.velocity.Y)
this.netUpdate = true;
this.velocity = vec;
}
else
this.Kill();
}
Vector2 position = this.Center + this.velocity * 3f;
Lighting.AddLight(position, 0.8f, 0.8f, 0.8f);
if (Main.rand.Next(3) == 0)
{
int index = Dust.NewDust(position - this.Size / 2f, this.width, this.height, 63, this.velocity.X, this.velocity.Y, 100, Scale: 2f);
Main.dust[index].noGravity = true;
Main.dust[index].position -= this.velocity;
}
}
if (this.type == 735)
{
num1 = 0.0f;
if (this.spriteDirection == -1)
num1 = 3.141593f;
if (++this.frame >= Main.projFrames[this.type])
this.frame = 0;
--this.soundDelay;
if (this.soundDelay <= 0)
{
SoundEngine.PlaySound(SoundID.Item1, this.Center);
this.soundDelay = 12;
}
if (Main.myPlayer == this.owner)
{
if (player.channel && !player.noItems && !player.CCed)
{
float num30 = 1f;
if (player.inventory[player.selectedItem].shoot == this.type)
num30 = player.inventory[player.selectedItem].shootSpeed * this.scale;
Vector2 vec = Main.MouseWorld - vector2_1;
vec.Normalize();
if (vec.HasNaNs())
vec = Vector2.UnitX * (float) player.direction;
vec *= num30;
if ((double) vec.X != (double) this.velocity.X || (double) vec.Y != (double) this.velocity.Y)
this.netUpdate = true;
this.velocity = vec;
}
else
this.Kill();
}
Vector2 position = this.Center + this.velocity * 3f;
Lighting.AddLight(position, 0.8f, 0.8f, 0.8f);
if (Main.rand.Next(3) == 0)
{
int index = Dust.NewDust(position - this.Size / 2f, this.width, this.height, 302, this.velocity.X, this.velocity.Y, 100, Scale: 2f);
Main.dust[index].noGravity = true;
Main.dust[index].position -= this.velocity;
}
}
if (this.type == 927)
{
num1 = 0.0f;
++this.ai[0];
if ((double) this.ai[0] >= 8.0)
this.ai[0] = 0.0f;
frames = 9;
num2 = (float) ((double) Main.rand.NextFloatDirection() * 6.28318548202515 * 0.0500000007450581);
--this.soundDelay;
if (this.soundDelay <= 0)
{
SoundEngine.PlaySound(SoundID.Item1, this.Center);
this.soundDelay = 6;
}
if (Main.myPlayer == this.owner)
{
if (player.channel && !player.noItems && !player.CCed)
{
float num31 = 1f;
if (player.inventory[player.selectedItem].shoot == this.type)
num31 = player.inventory[player.selectedItem].shootSpeed * this.scale;
Vector2 vec = Main.MouseWorld - vector2_1;
vec.Normalize();
if (vec.HasNaNs())
vec = Vector2.UnitX * (float) player.direction;
vec *= num31;
if ((double) vec.X != (double) this.velocity.X || (double) vec.Y != (double) this.velocity.Y)
this.netUpdate = true;
this.velocity = vec;
}
else
this.Kill();
}
DelegateMethods.v3_1 = new Vector3(0.5f, 0.5f, 0.5f);
Utils.PlotTileLine(this.Center - this.velocity, this.Center + this.velocity.SafeNormalize(Vector2.Zero) * 80f, 16f, new Utils.TileActionAttempt(DelegateMethods.CastLightOpen));
}
if (this.type == 600)
{
double num32 = (double) this.ai[0];
++this.ai[0];
if (Main.myPlayer == this.owner && (double) this.ai[0] == 1.0)
{
float num33 = player.inventory[player.selectedItem].shootSpeed * this.scale;
Vector2 vector2_30 = vector2_1;
Vector2 vector2_31 = Main.screenPosition + new Vector2((float) Main.mouseX, (float) Main.mouseY) - vector2_30;
if ((double) player.gravDir == -1.0)
vector2_31.Y = (float) (Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector2_30.Y;
Vector2 vector2_32 = Vector2.Normalize(vector2_31);
if (float.IsNaN(vector2_32.X) || float.IsNaN(vector2_32.Y))
vector2_32 = -Vector2.UnitY;
Vector2 vector2_33 = vector2_32 * num33;
if ((double) vector2_33.X != (double) this.velocity.X || (double) vector2_33.Y != (double) this.velocity.Y)
this.netUpdate = true;
this.velocity = vector2_33;
int Type = 601;
float num34 = 3f;
Vector2 center = this.Center;
Vector2 vector2_34 = Vector2.Normalize(this.velocity) * num34;
if (float.IsNaN(vector2_34.X) || float.IsNaN(vector2_34.Y))
vector2_34 = -Vector2.UnitY;
Projectile.NewProjectile(center.X, center.Y, vector2_34.X, vector2_34.Y, Type, this.damage, this.knockBack, this.owner, this.ai[1]);
}
if ((double) this.ai[0] >= 30.0)
this.Kill();
}
if (this.type == 611)
{
if (Main.netMode != 2 && (double) this.localAI[0] == 0.0)
SoundEngine.PlaySound(SoundID.Item116, this.Center);
if ((double) this.localAI[1] > 0.0)
--this.localAI[1];
this.alpha -= 42;
if (this.alpha < 0)
this.alpha = 0;
if ((double) this.localAI[0] == 0.0)
this.localAI[0] = this.velocity.ToRotation();
float num35 = (double) this.localAI[0].ToRotationVector2().X >= 0.0 ? 1f : -1f;
if ((double) this.ai[1] <= 0.0)
num35 *= -1f;
Vector2 rotationVector2 = (num35 * (float) ((double) this.ai[0] / 30.0 * 6.28318548202515 - 1.57079637050629)).ToRotationVector2();
rotationVector2.Y *= (float) Math.Sin((double) this.ai[1]);
if ((double) this.ai[1] <= 0.0)
rotationVector2.Y *= -1f;
Vector2 vector2_35 = rotationVector2.RotatedBy((double) this.localAI[0]);
++this.ai[0];
if ((double) this.ai[0] < 30.0)
this.velocity = this.velocity + 48f * vector2_35;
else
this.Kill();
}
if (this.type == 615)
{
num1 = 0.0f;
if (this.spriteDirection == -1)
num1 = 3.141593f;
++this.ai[0];
int num36 = 0;
if ((double) this.ai[0] >= 40.0)
++num36;
if ((double) this.ai[0] >= 80.0)
++num36;
if ((double) this.ai[0] >= 120.0)
++num36;
int num37 = 5;
int num38 = 0;
--this.ai[1];
bool flag = false;
int num39 = -1;
if ((double) this.ai[1] <= 0.0)
{
this.ai[1] = (float) (num37 - num38 * num36);
flag = true;
if ((int) this.ai[0] / (num37 - num38 * num36) % 7 == 0)
num39 = 0;
}
this.frameCounter += 1 + num36;
if (this.frameCounter >= 4)
{
this.frameCounter = 0;
++this.frame;
if (this.frame >= Main.projFrames[this.type])
this.frame = 0;
}
if (this.soundDelay <= 0)
{
this.soundDelay = num37 - num38 * num36;
if ((double) this.ai[0] != 1.0)
SoundEngine.PlaySound(SoundID.Item36, this.position);
}
if (flag && Main.myPlayer == this.owner)
{
bool canShoot = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed;
int projToShoot = 14;
float speed = 14f;
int weaponDamage = player.GetWeaponDamage(player.inventory[player.selectedItem]);
float knockBack = player.inventory[player.selectedItem].knockBack;
if (canShoot)
{
player.PickAmmo(player.inventory[player.selectedItem], ref projToShoot, ref speed, ref canShoot, ref weaponDamage, ref knockBack);
float weaponKnockback = player.GetWeaponKnockback(player.inventory[player.selectedItem], knockBack);
float num40 = player.inventory[player.selectedItem].shootSpeed * this.scale;
Vector2 vector2_36 = vector2_1;
Vector2 vector2_37 = Main.screenPosition + new Vector2((float) Main.mouseX, (float) Main.mouseY) - vector2_36;
if ((double) player.gravDir == -1.0)
vector2_37.Y = (float) (Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector2_36.Y;
Vector2 vector2_38 = Vector2.Normalize(vector2_37);
if (float.IsNaN(vector2_38.X) || float.IsNaN(vector2_38.Y))
vector2_38 = -Vector2.UnitY;
Vector2 vector2_39 = (vector2_38 * num40).RotatedBy(Main.rand.NextDouble() * 0.130899697542191 - 0.0654498487710953);
if ((double) vector2_39.X != (double) this.velocity.X || (double) vector2_39.Y != (double) this.velocity.Y)
this.netUpdate = true;
this.velocity = vector2_39;
for (int index = 0; index < 1; ++index)
{
Vector2 vector2_40 = (Vector2.Normalize(this.velocity) * speed).RotatedBy(Main.rand.NextDouble() * 0.196349546313286 - 0.0981747731566429);
if (float.IsNaN(vector2_40.X) || float.IsNaN(vector2_40.Y))
vector2_40 = -Vector2.UnitY;
Projectile.NewProjectile(vector2_36.X, vector2_36.Y, vector2_40.X, vector2_40.Y, projToShoot, weaponDamage, weaponKnockback, this.owner);
}
if (num39 == 0)
{
projToShoot = 616;
float num41 = 8f;
for (int index = 0; index < 1; ++index)
{
Vector2 vector2_41 = (Vector2.Normalize(this.velocity) * num41).RotatedBy(Main.rand.NextDouble() * 0.392699092626572 - 0.196349546313286);
if (float.IsNaN(vector2_41.X) || float.IsNaN(vector2_41.Y))
vector2_41 = -Vector2.UnitY;
Projectile.NewProjectile(vector2_36.X, vector2_36.Y, vector2_41.X, vector2_41.Y, projToShoot, weaponDamage + 20, weaponKnockback * 1.25f, this.owner);
}
}
}
else
this.Kill();
}
}
if (this.type == 714)
{
num1 = 0.0f;
if (this.spriteDirection == -1)
num1 = 3.141593f;
++this.ai[0];
int num42 = 0;
int num43 = 8;
int num44 = 0;
--this.ai[1];
bool flag = false;
int num45 = -1;
if ((double) this.ai[1] <= 0.0)
{
this.ai[1] = (float) (num43 - num44 * num42);
flag = true;
int num46 = (int) this.ai[0] / (num43 - num44 * num42);
if (num46 % 7 == 0)
;
num45 = num46 % 7;
}
double rotation = (double) this.rotation;
Vector2 center = this.Center;
int direction = this.direction;
Vector2 velocity = this.velocity;
this.frameCounter += 1 + num42;
if (this.frameCounter >= 4)
{
this.frameCounter = 0;
++this.frame;
if (this.frame >= Main.projFrames[this.type])
this.frame = 0;
}
if (this.soundDelay <= 0 && Main.player[this.owner].controlUseItem)
{
this.soundDelay = num43 - num44 * num42;
if ((double) this.ai[0] != 1.0)
SoundEngine.PlaySound(SoundID.Item156, this.position);
}
if (flag && Main.myPlayer == this.owner)
{
bool canShoot = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed;
int projToShoot = 134;
float speed = 8f;
int weaponDamage = player.GetWeaponDamage(player.inventory[player.selectedItem]);
float knockBack = player.inventory[player.selectedItem].knockBack;
if (num45 == 3)
++speed;
if (canShoot)
{
player.PickAmmo(player.inventory[player.selectedItem], ref projToShoot, ref speed, ref canShoot, ref weaponDamage, ref knockBack);
float weaponKnockback = player.GetWeaponKnockback(player.inventory[player.selectedItem], knockBack);
float num47 = player.inventory[player.selectedItem].shootSpeed * this.scale;
Vector2 vector2_42 = vector2_1;
Vector2 vector2_43 = Main.screenPosition + new Vector2((float) Main.mouseX, (float) Main.mouseY) - vector2_42;
if ((double) player.gravDir == -1.0)
vector2_43.Y = (float) (Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector2_42.Y;
Vector2 vector2_44 = Vector2.Normalize(vector2_43);
if (float.IsNaN(vector2_44.X) || float.IsNaN(vector2_44.Y))
vector2_44 = -Vector2.UnitY;
Vector2 vector2_45 = (vector2_44 * num47).RotatedBy((Main.rand.NextDouble() * 0.130899697542191 - 0.0654498487710953) * 0.5);
if ((double) vector2_45.X != (double) this.velocity.X || (double) vector2_45.Y != (double) this.velocity.Y)
this.netUpdate = true;
this.velocity = vector2_45;
for (int index = 0; index < 1; ++index)
{
Vector2 spinningpoint = (Vector2.Normalize(this.velocity) * speed).RotatedBy(Main.rand.NextDouble() * 0.196349546313286 - 0.0981747731566429);
if (float.IsNaN(spinningpoint.X) || float.IsNaN(spinningpoint.Y))
spinningpoint = -Vector2.UnitY;
Projectile.NewProjectile(vector2_42.X, vector2_42.Y, spinningpoint.X, spinningpoint.Y, projToShoot, weaponDamage, weaponKnockback, this.owner, (float) num45);
if (num45 == 5)
{
for (float num48 = -1f; (double) num48 <= 1.0; num48 += 2f)
{
Vector2 vector2_46 = spinningpoint.RotatedBy(6.28318548202515 * (double) num48 * 1.0 / 80.0);
if (float.IsNaN(spinningpoint.X) || float.IsNaN(spinningpoint.Y))
vector2_46 = -Vector2.UnitY;
Projectile.NewProjectile(vector2_42.X, vector2_42.Y, vector2_46.X, vector2_46.Y, projToShoot, weaponDamage, weaponKnockback, this.owner, (float) num45);
}
}
if (num45 == 4)
Projectile.NewProjectile(vector2_42.X, vector2_42.Y, spinningpoint.X, spinningpoint.Y, projToShoot, weaponDamage, weaponKnockback, this.owner, (float) num45, 1f);
}
}
else
this.Kill();
}
Vector2 Position = this.Center + this.velocity.ToRotation().ToRotationVector2() * 40f;
Vector2 vector2_47 = center + velocity.ToRotation().ToRotationVector2() * 40f;
Color rgb = Main.hslToRgb((float) ((double) this.ai[0] / 90.0 % 1.0), 1f, 0.5f);
rgb.A = (byte) 120;
int Type = 267;
Dust dust1 = Dust.NewDustPerfect(Position, Type, new Vector2?(Vector2.Zero));
dust1.color = rgb;
dust1.scale = 0.6f;
dust1.fadeIn = 0.9f;
dust1.noGravity = true;
Dust dust2 = Dust.NewDustPerfect(Position, Type, new Vector2?(Vector2.Zero));
dust2.color = rgb;
dust2.scale = 0.6f;
dust2.fadeIn = 0.7f;
dust2.noGravity = true;
dust2.velocity = -this.velocity.RotatedBy(2.09439516067505) / 10f;
Dust dust3 = Dust.NewDustPerfect(Position, Type, new Vector2?(Vector2.Zero));
dust3.color = rgb;
dust3.scale = 0.6f;
dust3.fadeIn = 0.7f;
dust3.noGravity = true;
dust3.velocity = -this.velocity.RotatedBy(-2.09439516067505) / 10f;
if (Position != vector2_47)
{
float num49 = -1f;
Dust dust4 = Dust.NewDustPerfect(Vector2.Lerp(Position, vector2_47, 0.8f), Type, new Vector2?(Vector2.Zero));
dust4.velocity = (Position - vector2_47).SafeNormalize(Vector2.Zero) * 2f;
dust4.color = rgb;
dust4.scale = 0.6f;
dust4.fadeIn = 0.9f;
dust4.velocity *= num49;
dust4.noGravity = true;
Dust dust5 = Dust.NewDustPerfect(Vector2.Lerp(Position, vector2_47, 0.5f), Type, new Vector2?(Vector2.Zero));
dust5.velocity = (Position - vector2_47).SafeNormalize(Vector2.Zero) * 2f;
dust5.color = rgb;
dust5.scale = 0.6f;
dust5.fadeIn = 0.9f;
dust5.velocity *= num49;
dust5.noGravity = true;
Dust dust6 = Dust.NewDustPerfect(Vector2.Lerp(Position, vector2_47, 0.2f), Type, new Vector2?(Vector2.Zero));
dust6.velocity = (Position - vector2_47).SafeNormalize(Vector2.Zero) * 2f;
dust6.color = rgb;
dust6.scale = 0.6f;
dust6.fadeIn = 0.9f;
dust6.velocity *= num49;
dust6.noGravity = true;
}
}
if (this.type == 630)
{
num1 = 0.0f;
if (this.spriteDirection == -1)
num1 = 3.141593f;
++this.ai[0];
int num50 = 0;
if ((double) this.ai[0] >= 40.0)
++num50;
if ((double) this.ai[0] >= 80.0)
++num50;
if ((double) this.ai[0] >= 120.0)
++num50;
int num51 = 24;
int num52 = 2;
--this.ai[1];
bool flag = false;
if ((double) this.ai[1] <= 0.0)
{
this.ai[1] = (float) (num51 - num52 * num50);
flag = true;
int num53 = (int) this.ai[0] / (num51 - num52 * num50);
}
bool canShoot = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed;
if ((double) this.localAI[0] > 0.0)
--this.localAI[0];
if (this.soundDelay <= 0 & canShoot)
{
this.soundDelay = num51 - num52 * num50;
if ((double) this.ai[0] != 1.0)
SoundEngine.PlaySound(SoundID.Item5, this.position);
this.localAI[0] = 12f;
}
player.phantasmTime = 2;
if (flag && Main.myPlayer == this.owner)
{
int projToShoot = 14;
float speed = 14f;
int weaponDamage = player.GetWeaponDamage(player.inventory[player.selectedItem]);
float knockBack = player.inventory[player.selectedItem].knockBack;
if (canShoot)
{
player.PickAmmo(player.inventory[player.selectedItem], ref projToShoot, ref speed, ref canShoot, ref weaponDamage, ref knockBack);
float weaponKnockback = player.GetWeaponKnockback(player.inventory[player.selectedItem], knockBack);
float num54 = player.inventory[player.selectedItem].shootSpeed * this.scale;
Vector2 vector2_48 = vector2_1;
Vector2 vector2_49 = Main.screenPosition + new Vector2((float) Main.mouseX, (float) Main.mouseY) - vector2_48;
if ((double) player.gravDir == -1.0)
vector2_49.Y = (float) (Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector2_48.Y;
Vector2 vector2_50 = Vector2.Normalize(vector2_49);
if (float.IsNaN(vector2_50.X) || float.IsNaN(vector2_50.Y))
vector2_50 = -Vector2.UnitY;
Vector2 vector2_51 = vector2_50 * num54;
if ((double) vector2_51.X != (double) this.velocity.X || (double) vector2_51.Y != (double) this.velocity.Y)
this.netUpdate = true;
this.velocity = vector2_51 * 0.55f;
for (int index7 = 0; index7 < 4; ++index7)
{
Vector2 vector2_52 = Vector2.Normalize(this.velocity) * speed * (float) (0.600000023841858 + (double) Main.rand.NextFloat() * 0.800000011920929);
if (float.IsNaN(vector2_52.X) || float.IsNaN(vector2_52.Y))
vector2_52 = -Vector2.UnitY;
Vector2 vector2_53 = vector2_48 + Utils.RandomVector2(Main.rand, -15f, 15f);
int index8 = Projectile.NewProjectile(vector2_53.X, vector2_53.Y, vector2_52.X, vector2_52.Y, projToShoot, weaponDamage, weaponKnockback, this.owner);
Main.projectile[index8].noDropItem = true;
}
}
else
this.Kill();
}
}
if (this.type == 705)
{
num1 = 0.0f;
if (this.spriteDirection == -1)
num1 = 3.141593f;
++this.ai[0];
int itemAnimationMax = player.itemAnimationMax;
--this.ai[1];
bool flag = false;
if ((double) this.ai[1] <= 0.0)
{
this.ai[1] = (float) itemAnimationMax;
flag = true;
}
bool canShoot = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed;
if ((double) this.localAI[0] > 0.0)
--this.localAI[0];
if (this.soundDelay <= 0 & canShoot)
{
this.soundDelay = itemAnimationMax;
if ((double) this.ai[0] != 1.0)
SoundEngine.PlaySound(SoundID.Item5, this.position);
this.localAI[0] = 12f;
}
if (flag && Main.myPlayer == this.owner)
{
int projToShoot = 14;
float speed = 12f;
int weaponDamage = player.GetWeaponDamage(player.inventory[player.selectedItem]);
float knockBack = player.inventory[player.selectedItem].knockBack;
int num55 = 2;
float max = 1.5f;
if (canShoot)
{
player.PickAmmo(player.inventory[player.selectedItem], ref projToShoot, ref speed, ref canShoot, ref weaponDamage, ref knockBack);
float weaponKnockback = player.GetWeaponKnockback(player.inventory[player.selectedItem], knockBack);
if (projToShoot == 1)
projToShoot = 2;
if (++player.phantomPhoneixCounter >= 3)
{
player.phantomPhoneixCounter = 0;
num55 = 1;
weaponDamage *= 2;
max = 0.0f;
this.ai[1] *= 1.5f;
projToShoot = 706;
speed = 16f;
}
float num56 = player.inventory[player.selectedItem].shootSpeed * this.scale;
Vector2 vector2_54 = vector2_1;
Vector2 vector2_55 = Main.screenPosition + new Vector2((float) Main.mouseX, (float) Main.mouseY) - vector2_54;
if ((double) player.gravDir == -1.0)
vector2_55.Y = (float) (Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector2_54.Y;
Vector2 vector2_56 = Vector2.Normalize(vector2_55);
if (float.IsNaN(vector2_56.X) || float.IsNaN(vector2_56.Y))
vector2_56 = -Vector2.UnitY;
Vector2 vector2_57 = vector2_56 * num56;
if ((double) vector2_57.X != (double) this.velocity.X || (double) vector2_57.Y != (double) this.velocity.Y)
this.netUpdate = true;
this.velocity = vector2_57 * 0.55f;
for (int index9 = 0; index9 < num55; ++index9)
{
Vector2 vector2_58 = Vector2.Normalize(this.velocity) * speed + Main.rand.NextVector2Square(-max, max);
if (float.IsNaN(vector2_58.X) || float.IsNaN(vector2_58.Y))
vector2_58 = -Vector2.UnitY;
Vector2 vector2_59 = vector2_54;
int index10 = Projectile.NewProjectile(vector2_59.X, vector2_59.Y, vector2_58.X, vector2_58.Y, projToShoot, weaponDamage, weaponKnockback, this.owner);
Main.projectile[index10].noDropItem = true;
}
}
else
this.Kill();
}
}
this.position = player.RotatedRelativePoint(player.MountedCenter, addGfxOffY: false) - this.Size / 2f;
this.rotation = this.velocity.ToRotation() + num1;
this.spriteDirection = this.direction;
this.timeLeft = 2;
player.ChangeDir(this.direction);
player.heldProj = this.whoAmI;
player.SetDummyItemTime(frames);
player.itemRotation = MathHelper.WrapAngle((float) Math.Atan2((double) this.velocity.Y * (double) this.direction, (double) this.velocity.X * (double) this.direction) + num2);
if (this.type == 460 || this.type == 611)
{
Vector2 vector2_60 = Main.OffsetsPlayerOnhand[player.bodyFrame.Y / 56] * 2f;
if (player.direction != 1)
vector2_60.X = (float) player.bodyFrame.Width - vector2_60.X;
if ((double) player.gravDir != 1.0)
vector2_60.Y = (float) player.bodyFrame.Height - vector2_60.Y;
Vector2 vector2_61 = vector2_60 - new Vector2((float) (player.bodyFrame.Width - player.width), (float) (player.bodyFrame.Height - 42)) / 2f;
this.Center = player.RotatedRelativePoint(player.MountedCenter - new Vector2(20f, 42f) / 2f + vector2_61, addGfxOffY: false) - this.velocity;
}
if (this.type == 615)
this.position.Y += player.gravDir * 2f;
if (this.type == 714)
this.position.Y += player.gravDir * 2f;
if (this.type == 611 && this.alpha == 0)
{
for (int index = 0; index < 2; ++index)
{
Dust dust = Main.dust[Dust.NewDust(this.position + this.velocity * 2f, this.width, this.height, 6, Alpha: 100, newColor: Color.Transparent, Scale: 2f)];
dust.noGravity = true;
dust.velocity *= 2f;
dust.velocity += this.localAI[0].ToRotationVector2();
dust.fadeIn = 1.5f;
}
float num57 = 18f;
for (int index = 0; (double) index < (double) num57; ++index)
{
if (Main.rand.Next(4) == 0)
{
Vector2 Position = this.position + this.velocity + this.velocity * ((float) index / num57);
Dust dust = Main.dust[Dust.NewDust(Position, this.width, this.height, 6, Alpha: 100, newColor: Color.Transparent)];
dust.noGravity = true;
dust.fadeIn = 0.5f;
dust.velocity += this.localAI[0].ToRotationVector2();
dust.noLight = true;
}
}
}
if (this.type != 927)
return;
player.itemAnimation = frames - (int) this.ai[0];
}
private void AI_099_1()
{
this.timeLeft = 6;
bool flag1 = true;
float num1 = 250f;
float num2 = 0.1f;
float num3 = 15f;
float num4 = 12f;
float num5 = num1 * 0.5f;
float num6 = num3 * 0.8f;
float num7 = num4 * 1.5f;
if (this.owner == Main.myPlayer)
{
bool flag2 = false;
for (int index = 0; index < 1000; ++index)
{
if (Main.projectile[index].active && Main.projectile[index].owner == this.owner && Main.projectile[index].aiStyle == 99 && (Main.projectile[index].type < 556 || Main.projectile[index].type > 561))
flag2 = true;
}
if (!flag2)
{
this.ai[0] = -1f;
this.netUpdate = true;
}
}
if (Main.player[this.owner].yoyoString)
num5 += (float) ((double) num5 * 0.25 + 10.0);
this.rotation += 0.5f;
if (Main.player[this.owner].dead)
{
this.Kill();
}
else
{
if (!flag1)
{
Main.player[this.owner].heldProj = this.whoAmI;
Main.player[this.owner].SetDummyItemTime(2);
if ((double) this.position.X + (double) (this.width / 2) > (double) Main.player[this.owner].position.X + (double) (Main.player[this.owner].width / 2))
{
Main.player[this.owner].ChangeDir(1);
this.direction = 1;
}
else
{
Main.player[this.owner].ChangeDir(-1);
this.direction = -1;
}
}
if ((double) this.ai[0] == 0.0 || (double) this.ai[0] == 1.0)
{
if ((double) this.ai[0] == 1.0)
num5 *= 0.75f;
float num8 = num7 * 0.5f;
bool flag3 = false;
Vector2 vector2_1 = Main.player[this.owner].Center - this.Center;
if ((double) vector2_1.Length() > (double) num5 * 0.9)
flag3 = true;
if ((double) vector2_1.Length() > (double) num5)
{
float num9 = vector2_1.Length() - num5;
Vector2 vector2_2;
vector2_2.X = vector2_1.Y;
vector2_2.Y = vector2_1.X;
vector2_1.Normalize();
Vector2 vector2_3 = vector2_1 * num5;
this.position = Main.player[this.owner].Center - vector2_3;
this.position.X -= (float) (this.width / 2);
this.position.Y -= (float) (this.height / 2);
float num10 = this.velocity.Length();
this.velocity.Normalize();
if ((double) num9 > (double) num10 - 1.0)
num9 = num10 - 1f;
this.velocity = this.velocity * (num10 - num9);
this.velocity.Length();
Vector2 vector2_4 = new Vector2(this.Center.X, this.Center.Y);
Vector2 vector2_5 = new Vector2(Main.player[this.owner].Center.X, Main.player[this.owner].Center.Y);
if ((double) vector2_4.Y < (double) vector2_5.Y)
vector2_2.Y = Math.Abs(vector2_2.Y);
else if ((double) vector2_4.Y > (double) vector2_5.Y)
vector2_2.Y = -Math.Abs(vector2_2.Y);
if ((double) vector2_4.X < (double) vector2_5.X)
vector2_2.X = Math.Abs(vector2_2.X);
else if ((double) vector2_4.X > (double) vector2_5.X)
vector2_2.X = -Math.Abs(vector2_2.X);
vector2_2.Normalize();
Vector2 vector2_6 = vector2_2 * this.velocity.Length();
Vector2 vector2_7 = new Vector2(vector2_6.X, vector2_6.Y);
if ((double) Math.Abs(this.velocity.X) > (double) Math.Abs(this.velocity.Y))
{
Vector2 velocity = this.velocity;
velocity.Y += vector2_6.Y;
velocity.Normalize();
Vector2 vector2_8 = velocity * this.velocity.Length();
if ((double) Math.Abs(vector2_6.X) < 0.1 || (double) Math.Abs(vector2_6.Y) < 0.1)
this.velocity = vector2_8;
else
this.velocity = (vector2_8 + this.velocity * 2f) / 3f;
}
else
{
Vector2 velocity = this.velocity;
velocity.X += vector2_6.X;
velocity.Normalize();
Vector2 vector2_9 = velocity * this.velocity.Length();
if ((double) Math.Abs(vector2_6.X) < 0.2 || (double) Math.Abs(vector2_6.Y) < 0.2)
this.velocity = vector2_9;
else
this.velocity = (vector2_9 + this.velocity * 2f) / 3f;
}
}
if (Main.myPlayer == this.owner)
{
if (Main.player[this.owner].channel)
{
Vector2 vector2_10 = new Vector2((float) (Main.mouseX - Main.lastMouseX), (float) (Main.mouseY - Main.lastMouseY));
if ((double) this.velocity.X != 0.0 || (double) this.velocity.Y != 0.0)
{
if (flag1)
vector2_10 *= -1f;
if (flag3)
{
if ((double) this.Center.X < (double) Main.player[this.owner].Center.X && (double) vector2_10.X < 0.0)
vector2_10.X = 0.0f;
if ((double) this.Center.X > (double) Main.player[this.owner].Center.X && (double) vector2_10.X > 0.0)
vector2_10.X = 0.0f;
if ((double) this.Center.Y < (double) Main.player[this.owner].Center.Y && (double) vector2_10.Y < 0.0)
vector2_10.Y = 0.0f;
if ((double) this.Center.Y > (double) Main.player[this.owner].Center.Y && (double) vector2_10.Y > 0.0)
vector2_10.Y = 0.0f;
}
this.velocity = this.velocity + vector2_10 * num2;
this.netUpdate = true;
}
}
else
{
this.ai[0] = 10f;
this.netUpdate = true;
}
}
if (flag1 || this.type == 562 || this.type == 547 || this.type == 555 || this.type == 564 || this.type == 552 || this.type == 563 || this.type == 549 || this.type == 550 || this.type == 554 || this.type == 553 || this.type == 603)
{
float num11 = 800f;
Vector2 vector2_11 = new Vector2();
bool flag4 = false;
if (this.type == 549)
num11 = 200f;
if (this.type == 554)
num11 = 400f;
if (this.type == 553)
num11 = 250f;
if (this.type == 603)
num11 = 320f;
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].CanBeChasedBy((object) this))
{
float num12 = Main.npc[index].position.X + (float) (Main.npc[index].width / 2);
float num13 = Main.npc[index].position.Y + (float) (Main.npc[index].height / 2);
float num14 = Math.Abs(this.position.X + (float) (this.width / 2) - num12) + Math.Abs(this.position.Y + (float) (this.height / 2) - num13);
if ((double) num14 < (double) num11 && (this.type != 563 || (double) num14 >= 200.0) && Collision.CanHit(this.position, this.width, this.height, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height) && (double) (Main.npc[index].Center - Main.player[this.owner].Center).Length() < (double) num5 * 0.9)
{
num11 = num14;
vector2_11.X = num12;
vector2_11.Y = num13;
flag4 = true;
}
}
}
if (flag4)
{
vector2_11 -= this.Center;
vector2_11.Normalize();
if (this.type == 563)
{
vector2_11 *= 4f;
this.velocity = (this.velocity * 14f + vector2_11) / 15f;
}
else if (this.type == 553)
{
vector2_11 *= 5f;
this.velocity = (this.velocity * 12f + vector2_11) / 13f;
}
else if (this.type == 603)
{
vector2_11 *= 16f;
this.velocity = (this.velocity * 9f + vector2_11) / 10f;
}
else if (this.type == 554)
{
vector2_11 *= 8f;
this.velocity = (this.velocity * 6f + vector2_11) / 7f;
}
else
{
vector2_11 *= 6f;
this.velocity = (this.velocity * 7f + vector2_11) / 8f;
}
}
}
if ((double) this.velocity.Length() > (double) num6)
{
this.velocity.Normalize();
this.velocity = this.velocity * num6;
}
if ((double) this.velocity.Length() >= (double) num8)
return;
this.velocity.Normalize();
this.velocity = this.velocity * num8;
}
else
{
this.tileCollide = false;
Vector2 vec = Main.player[this.owner].Center - this.Center;
float num15 = vec.Length();
if ((double) num15 < 40.0 || vec.HasNaNs() || (double) num15 > 2000.0)
{
this.Kill();
}
else
{
float num16 = num6 * 1.5f;
if (this.type == 546)
num16 *= 1.5f;
if (this.type == 554)
num16 *= 1.25f;
if (this.type == 555)
num16 *= 1.35f;
if (this.type == 562)
num16 *= 1.25f;
float num17 = 12f;
vec.Normalize();
vec *= num16;
this.velocity = (this.velocity * (num17 - 1f) + vec) / num17;
}
}
}
}
private void AI_099_2()
{
bool flag1 = false;
for (int index = 0; index < this.whoAmI; ++index)
{
if (Main.projectile[index].active && Main.projectile[index].owner == this.owner && Main.projectile[index].type == this.type)
flag1 = true;
}
if (this.owner == Main.myPlayer)
{
++this.localAI[0];
if (flag1)
this.localAI[0] += (float) Main.rand.Next(10, 31) * 0.1f;
float num1 = this.localAI[0] / 60f / (float) ((1.0 + (double) Main.player[this.owner].meleeSpeed) / 2.0);
float num2 = ProjectileID.Sets.YoyosLifeTimeMultiplier[this.type];
if ((double) num2 != -1.0 && (double) num1 > (double) num2)
this.ai[0] = -1f;
}
if (this.type == 603 && this.owner == Main.myPlayer)
{
++this.localAI[1];
if ((double) this.localAI[1] >= 6.0)
{
float num3 = 400f;
Vector2 velocity = this.velocity;
Vector2 vector2_1 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101));
vector2_1.Normalize();
Vector2 vector2_2 = vector2_1 * ((float) Main.rand.Next(10, 41) * 0.1f);
if (Main.rand.Next(3) == 0)
vector2_2 *= 2f;
Vector2 vector2_3 = velocity * 0.25f + vector2_2;
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].CanBeChasedBy((object) this))
{
float num4 = Main.npc[index].position.X + (float) (Main.npc[index].width / 2);
float num5 = Main.npc[index].position.Y + (float) (Main.npc[index].height / 2);
float num6 = Math.Abs(this.position.X + (float) (this.width / 2) - num4) + Math.Abs(this.position.Y + (float) (this.height / 2) - num5);
if ((double) num6 < (double) num3 && Collision.CanHit(this.position, this.width, this.height, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height))
{
num3 = num6;
vector2_3.X = num4;
vector2_3.Y = num5;
Vector2 vector2_4 = vector2_3 - this.Center;
vector2_4.Normalize();
vector2_3 = vector2_4 * 8f;
}
}
}
Vector2 vector2_5 = vector2_3 * 0.8f;
Projectile.NewProjectile(this.Center.X - vector2_5.X, this.Center.Y - vector2_5.Y, vector2_5.X, vector2_5.Y, 604, this.damage, this.knockBack, this.owner);
this.localAI[1] = 0.0f;
}
}
bool flag2 = false;
if (this.type >= 556 && this.type <= 561)
flag2 = true;
if (Main.player[this.owner].dead)
{
this.Kill();
}
else
{
if (!flag2 && !flag1)
{
Main.player[this.owner].heldProj = this.whoAmI;
Main.player[this.owner].SetDummyItemTime(2);
if ((double) this.position.X + (double) (this.width / 2) > (double) Main.player[this.owner].position.X + (double) (Main.player[this.owner].width / 2))
{
Main.player[this.owner].ChangeDir(1);
this.direction = 1;
}
else
{
Main.player[this.owner].ChangeDir(-1);
this.direction = -1;
}
}
if (this.velocity.HasNaNs())
this.Kill();
this.timeLeft = 6;
float num7 = ProjectileID.Sets.YoyosMaximumRange[this.type];
float num8 = ProjectileID.Sets.YoyosTopSpeed[this.type];
if (this.type == 545)
{
if (Main.rand.Next(6) == 0)
{
int index = Dust.NewDust(this.position, this.width, this.height, 6);
Main.dust[index].noGravity = true;
}
}
else if (this.type == 553 && Main.rand.Next(2) == 0)
{
int index = Dust.NewDust(this.position, this.width, this.height, 6);
Main.dust[index].noGravity = true;
Main.dust[index].scale = 1.6f;
}
if (Main.player[this.owner].yoyoString)
num7 = (float) ((double) num7 * 1.25 + 30.0);
float num9 = num7 / (float) ((1.0 + (double) Main.player[this.owner].meleeSpeed * 3.0) / 4.0);
float val2 = num8 / (float) ((1.0 + (double) Main.player[this.owner].meleeSpeed * 3.0) / 4.0);
float num10 = (float) (14.0 - (double) val2 / 2.0);
if ((double) num10 < 1.0)
num10 = 1f;
float num11 = (float) (5.0 + (double) val2 / 2.0);
if (flag1)
num11 += 20f;
if ((double) this.ai[0] >= 0.0)
{
if ((double) this.velocity.Length() > (double) val2)
this.velocity = this.velocity * 0.98f;
bool flag3 = false;
bool flag4 = false;
Vector2 vector2_6 = Main.player[this.owner].Center - this.Center;
if ((double) vector2_6.Length() > (double) num9)
{
flag3 = true;
if ((double) vector2_6.Length() > (double) num9 * 1.3)
flag4 = true;
}
if (this.owner == Main.myPlayer)
{
if (!Main.player[this.owner].channel || Main.player[this.owner].stoned || Main.player[this.owner].frozen)
{
this.ai[0] = -1f;
this.ai[1] = 0.0f;
this.netUpdate = true;
}
else
{
Vector2 vector2_7 = Main.ReverseGravitySupport(Main.MouseScreen) + Main.screenPosition;
float x = vector2_7.X;
float y = vector2_7.Y;
Vector2 vector2_8 = new Vector2(x, y) - Main.player[this.owner].Center;
if ((double) vector2_8.Length() > (double) num9)
{
vector2_8.Normalize();
Vector2 vector2_9 = vector2_8 * num9;
Vector2 vector2_10 = Main.player[this.owner].Center + vector2_9;
x = vector2_10.X;
y = vector2_10.Y;
}
if ((double) this.ai[0] != (double) x || (double) this.ai[1] != (double) y)
{
Vector2 vector2_11 = new Vector2(x, y) - Main.player[this.owner].Center;
if ((double) vector2_11.Length() > (double) num9 - 1.0)
{
vector2_11.Normalize();
vector2_11 *= num9 - 1f;
Vector2 vector2_12 = Main.player[this.owner].Center + vector2_11;
x = vector2_12.X;
y = vector2_12.Y;
}
this.ai[0] = x;
this.ai[1] = y;
this.netUpdate = true;
}
}
}
if (flag4 && this.owner == Main.myPlayer)
{
this.ai[0] = -1f;
this.netUpdate = true;
}
if ((double) this.ai[0] >= 0.0)
{
if (flag3)
{
num10 /= 2f;
val2 *= 2f;
if ((double) this.Center.X > (double) Main.player[this.owner].Center.X && (double) this.velocity.X > 0.0)
this.velocity.X *= 0.5f;
if ((double) this.Center.Y > (double) Main.player[this.owner].Center.Y && (double) this.velocity.Y > 0.0)
this.velocity.Y *= 0.5f;
if ((double) this.Center.X < (double) Main.player[this.owner].Center.X && (double) this.velocity.X < 0.0)
this.velocity.X *= 0.5f;
if ((double) this.Center.Y < (double) Main.player[this.owner].Center.Y && (double) this.velocity.Y < 0.0)
this.velocity.Y *= 0.5f;
}
Vector2 vector2_13 = new Vector2(this.ai[0], this.ai[1]) - this.Center;
if (flag3)
num10 = 1f;
double num12 = (double) this.velocity.Length();
float num13 = vector2_13.Length();
if ((double) num13 > (double) num11)
{
vector2_13.Normalize();
float val1 = Math.Min(num13 / 2f, val2);
if (flag3)
val1 = Math.Min(val1, val2 / 2f);
vector2_13 *= val1;
this.velocity = (this.velocity * (num10 - 1f) + vector2_13) / num10;
}
else if (flag1)
{
if ((double) this.velocity.Length() < (double) val2 * 0.6)
{
vector2_13 = this.velocity;
vector2_13.Normalize();
vector2_13 *= val2 * 0.6f;
this.velocity = (this.velocity * (num10 - 1f) + vector2_13) / num10;
}
}
else
this.velocity = this.velocity * 0.8f;
if (flag1 && !flag3 && (double) this.velocity.Length() < (double) val2 * 0.6)
{
this.velocity.Normalize();
this.velocity = this.velocity * (val2 * 0.6f);
}
}
}
else
{
float num14 = (float) (int) ((double) num10 * 0.8);
float num15 = val2 * 1.5f;
this.tileCollide = false;
Vector2 vector2 = Main.player[this.owner].Center - this.Center;
float num16 = vector2.Length();
if ((double) num16 < (double) num15 + 10.0 || (double) num16 == 0.0 || (double) num16 > 2000.0)
{
this.Kill();
}
else
{
vector2.Normalize();
vector2 *= num15;
this.velocity = (this.velocity * (num14 - 1f) + vector2) / num14;
}
}
this.rotation += 0.45f;
}
}
private void AI_130_FlameBurstTower()
{
float shot_range = 900f;
float angleRatioMax = 1f;
Vector2 vector2_1 = this.Center;
int Type = 664;
int num1 = 12;
float num2 = 12f;
int num3 = 1;
int num4 = 6;
int num5 = 4;
int num6 = 80;
switch (this.type)
{
case 663:
Lighting.AddLight(this.Center, new Vector3(0.4f, 0.2f, 0.1f));
Lighting.AddLight(this.Bottom + new Vector2(0.0f, -10f), new Vector3(0.4f, 0.2f, 0.1f));
vector2_1 = this.Bottom + new Vector2((float) (this.direction * 6), -40f);
if ((double) ++this.localAI[0] >= 300.0)
this.localAI[0] = 0.0f;
Microsoft.Xna.Framework.Rectangle r1 = new Microsoft.Xna.Framework.Rectangle((int) this.position.X + this.width / 4, (int) this.position.Y + this.height - 16, this.width / 4 * 3, 6);
if (this.direction == 1)
r1.X -= this.width / 4;
for (int index = 0; index < 1; ++index)
{
if (Main.rand.Next(2) == 0)
{
Dust dust = Dust.NewDustDirect(r1.TopLeft() + new Vector2(-2f, -2f), r1.Width + 4, r1.Height + 4, 270, (float) (-this.direction * 2), -2f, 200, new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0));
dust.fadeIn = (float) (0.600000023841858 + (double) Main.rand.NextFloat() * 0.600000023841858);
dust.scale = 0.4f;
dust.noGravity = true;
dust.noLight = true;
dust.velocity = Vector2.Zero;
dust.velocity.X = (float) -this.direction * Main.rand.NextFloat() * dust.fadeIn;
}
}
r1 = new Microsoft.Xna.Framework.Rectangle((int) this.Center.X, (int) this.Bottom.Y, this.width / 4, 10);
if (this.direction == -1)
r1.X -= r1.Width;
r1.X += this.direction * 4;
r1.Y -= this.height - 10;
for (int index = 0; index < 1; ++index)
{
if (Main.rand.Next(5) == 0)
{
Dust dust = Dust.NewDustDirect(r1.TopLeft(), r1.Width, r1.Height, 6);
dust.fadeIn = 1f;
dust.scale = 1f;
dust.noGravity = true;
dust.noLight = true;
dust.velocity *= 2f;
}
}
break;
case 665:
Lighting.AddLight(this.Center, new Vector3(0.4f, 0.2f, 0.1f) * 1.2f);
Lighting.AddLight(this.Bottom + new Vector2(0.0f, -10f), new Vector3(0.4f, 0.2f, 0.1f) * 1.2f);
num6 = 70;
num2 += 3f;
num4 = 8;
Type = 666;
vector2_1 = this.Bottom + new Vector2((float) (this.direction * 6), -44f);
if ((double) ++this.localAI[0] >= 300.0)
this.localAI[0] = 0.0f;
Microsoft.Xna.Framework.Rectangle r2 = new Microsoft.Xna.Framework.Rectangle((int) this.position.X + this.width / 4, (int) this.position.Y + this.height - 16, this.width / 4 * 2, 6);
if (this.direction == 1)
r2.X -= this.width / 4;
for (int index = 0; index < 1; ++index)
{
if (Main.rand.Next(2) == 0)
{
Dust dust = Dust.NewDustDirect(r2.TopLeft() + new Vector2(-2f, -2f), r2.Width + 4, r2.Height + 4, 270, (float) (-this.direction * 2), -2f, 200, new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0));
dust.fadeIn = (float) (0.600000023841858 + (double) Main.rand.NextFloat() * 0.600000023841858);
dust.scale = 0.4f;
dust.noGravity = true;
dust.noLight = true;
dust.velocity = Vector2.Zero;
dust.velocity.X = (float) -this.direction * Main.rand.NextFloat() * dust.fadeIn;
}
}
r2 = new Microsoft.Xna.Framework.Rectangle((int) this.Center.X, (int) this.Bottom.Y, this.width / 4, 10);
if (this.direction == -1)
r2.X -= r2.Width;
r2.X += this.direction * 4;
r2.Y -= this.height - 10;
for (int index = 0; index < 2; ++index)
{
if (Main.rand.Next(5) == 0)
{
Dust dust = Dust.NewDustDirect(r2.TopLeft(), r2.Width, r2.Height, 6);
dust.fadeIn = 1f;
dust.scale = 1f;
dust.noGravity = true;
dust.noLight = true;
dust.velocity *= 2f;
}
}
break;
case 667:
Lighting.AddLight(this.Center, new Vector3(0.4f, 0.2f, 0.1f) * 1.5f);
Lighting.AddLight(this.Bottom + new Vector2(0.0f, -10f), new Vector3(0.4f, 0.2f, 0.1f) * 1.5f);
num6 = 60;
num2 += 6f;
num4 = 8;
Type = 668;
vector2_1 = this.Bottom + new Vector2((float) (this.direction * 6), -46f);
if ((double) ++this.localAI[0] >= 300.0)
this.localAI[0] = 0.0f;
Microsoft.Xna.Framework.Rectangle r3 = new Microsoft.Xna.Framework.Rectangle((int) this.position.X + this.width / 4, (int) this.position.Y + this.height - 16, this.width / 4 * 2, 6);
if (this.direction == 1)
r3.X -= this.width / 4;
for (int index = 0; index < 1; ++index)
{
if (Main.rand.Next(2) == 0)
{
Dust dust = Dust.NewDustDirect(r3.TopLeft() + new Vector2(-2f, -2f), r3.Width + 4, r3.Height + 4, 270, (float) (-this.direction * 2), -2f, 200, new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0));
dust.fadeIn = (float) (0.600000023841858 + (double) Main.rand.NextFloat() * 0.600000023841858);
dust.scale = 0.4f;
dust.noGravity = true;
dust.noLight = true;
dust.velocity = Vector2.Zero;
dust.velocity.X = (float) -this.direction * Main.rand.NextFloat() * dust.fadeIn;
}
}
r3 = new Microsoft.Xna.Framework.Rectangle((int) this.Center.X, (int) this.Bottom.Y, this.width / 4, 10);
if (this.direction == -1)
r3.X -= r3.Width;
r3.X += this.direction * 4;
r3.Y -= this.height - 10;
for (int index = 0; index < 3; ++index)
{
if (Main.rand.Next(5) == 0)
{
Dust dust = Dust.NewDustDirect(r3.TopLeft(), r3.Width, r3.Height, 6);
dust.fadeIn = 1.1f;
dust.scale = 1f;
dust.noGravity = true;
dust.noLight = true;
dust.velocity *= 2.4f;
}
}
break;
}
if (Main.player[this.owner].setApprenticeT2)
{
angleRatioMax = 0.1f;
shot_range *= 1.5f;
num2 *= 1.4f;
}
if ((double) this.ai[0] == 0.0)
{
this.direction = this.spriteDirection = Main.player[this.owner].direction;
this.ai[0] = 1f;
this.ai[1] = 0.0f;
this.netUpdate = true;
}
if ((double) this.ai[0] == 1.0)
{
this.frame = 0;
bool flag = false;
if ((double) this.ai[1] > 0.0)
--this.ai[1];
else
flag = true;
if (flag && this.owner == Main.myPlayer)
{
int target = this.AI_130_FlameBurstTower_FindTarget(shot_range, angleRatioMax, vector2_1);
if (target != -1)
{
this.direction = Math.Sign(this.DirectionTo(Main.npc[target].Center).X);
this.ai[0] = 2f;
this.ai[1] = 0.0f;
this.netUpdate = true;
}
}
}
else if ((double) this.ai[0] == 2.0)
{
this.frame = num3 + (int) ((double) this.ai[1] / (double) num5);
if ((double) this.ai[1] == (double) num1)
{
Vector2 vector2_2 = new Vector2((float) this.direction, 0.0f);
int target = this.AI_130_FlameBurstTower_FindTarget(shot_range, angleRatioMax, vector2_1, false);
if (target != -1)
vector2_2 = (Main.npc[target].Center - vector2_1).SafeNormalize(Vector2.UnitX * (float) this.direction);
Vector2 velocity = vector2_2 * num2;
if (this.owner == Main.myPlayer)
Projectile.NewProjectile(vector2_1, velocity, Type, this.damage, this.knockBack, this.owner);
}
if ((double) ++this.ai[1] >= (double) (num4 * num5))
{
this.ai[0] = 1f;
this.ai[1] = (float) num6;
}
}
this.spriteDirection = this.direction;
this.tileCollide = true;
this.velocity.Y += 0.2f;
}
private int AI_130_FlameBurstTower_FindTarget(
float shot_range,
float angleRatioMax,
Vector2 shootingSpot,
bool canChangeDirection = true)
{
int index1 = -1;
NPC minionAttackTargetNpc = this.OwnerMinionAttackTargetNPC;
if (minionAttackTargetNpc != null && minionAttackTargetNpc.CanBeChasedBy((object) this))
{
for (int index2 = 0; index2 < 1; ++index2)
{
if (minionAttackTargetNpc.CanBeChasedBy((object) this))
{
float num = Vector2.Distance(shootingSpot, minionAttackTargetNpc.Center);
if ((double) num <= (double) shot_range)
{
Vector2 vector2 = (minionAttackTargetNpc.Center - shootingSpot).SafeNormalize(Vector2.UnitY);
if ((double) Math.Abs(vector2.X) >= (double) Math.Abs(vector2.Y) * (double) angleRatioMax && (canChangeDirection || (double) this.direction * (double) vector2.X >= 0.0) && (index1 == -1 || (double) num < (double) Vector2.Distance(shootingSpot, Main.npc[index1].Center)) && Collision.CanHitLine(shootingSpot, 0, 0, minionAttackTargetNpc.Center, 0, 0))
index1 = minionAttackTargetNpc.whoAmI;
}
}
}
if (index1 != -1)
return index1;
}
for (int index3 = 0; index3 < 200; ++index3)
{
NPC npc = Main.npc[index3];
if (npc.CanBeChasedBy((object) this))
{
float num = Vector2.Distance(shootingSpot, npc.Center);
if ((double) num <= (double) shot_range)
{
Vector2 vector2 = (npc.Center - shootingSpot).SafeNormalize(Vector2.UnitY);
if ((double) Math.Abs(vector2.X) >= (double) Math.Abs(vector2.Y) * (double) angleRatioMax && (canChangeDirection || (double) this.direction * (double) vector2.X >= 0.0) && (index1 == -1 || (double) num < (double) Vector2.Distance(shootingSpot, Main.npc[index1].Center)) && Collision.CanHitLine(shootingSpot, 0, 0, npc.Center, 0, 0))
index1 = index3;
}
}
}
return index1;
}
private int AI_134_Ballista_FindTarget(
float shot_range,
float deadBottomAngle,
Vector2 shootingSpot)
{
int index1 = -1;
NPC minionAttackTargetNpc = this.OwnerMinionAttackTargetNPC;
if (minionAttackTargetNpc != null && minionAttackTargetNpc.CanBeChasedBy((object) this))
{
for (int index2 = 0; index2 < 1; ++index2)
{
if (minionAttackTargetNpc.CanBeChasedBy((object) this))
{
float num = Vector2.Distance(shootingSpot, minionAttackTargetNpc.Center);
if ((double) num <= (double) shot_range)
{
Vector2 vector2 = (minionAttackTargetNpc.Center - shootingSpot).SafeNormalize(Vector2.UnitY);
if (((double) Math.Abs(vector2.X) >= (double) Math.Abs(vector2.Y) * (double) deadBottomAngle || (double) vector2.Y <= 0.0) && (index1 == -1 || (double) num < (double) Vector2.Distance(shootingSpot, Main.npc[index1].Center)) && Collision.CanHitLine(shootingSpot, 0, 0, minionAttackTargetNpc.Center, 0, 0))
index1 = minionAttackTargetNpc.whoAmI;
}
}
}
if (index1 != -1)
return index1;
}
for (int index3 = 0; index3 < 200; ++index3)
{
NPC npc = Main.npc[index3];
if (npc.CanBeChasedBy((object) this))
{
float num = Vector2.Distance(shootingSpot, npc.Center);
if ((double) num <= (double) shot_range)
{
Vector2 vector2 = (npc.Center - shootingSpot).SafeNormalize(Vector2.UnitY);
if (((double) Math.Abs(vector2.X) >= (double) Math.Abs(vector2.Y) * (double) deadBottomAngle || (double) vector2.Y <= 0.0) && (index1 == -1 || (double) num < (double) Vector2.Distance(shootingSpot, Main.npc[index1].Center)) && Collision.CanHitLine(shootingSpot, 0, 0, npc.Center, 0, 0))
index1 = index3;
}
}
}
return index1;
}
private void AI_131_FlameBurstShot()
{
if (this.type != 664 && this.type != 666 && this.type != 668)
return;
if ((double) this.localAI[0] == 0.0)
{
this.localAI[0] = 1f;
SoundEngine.PlayTrackedSound((SoundStyle) SoundID.DD2_FlameburstTowerShot, this.Center);
}
if (this.alpha > 0)
{
this.alpha -= 25;
if (this.alpha < 0)
this.alpha = 0;
}
int num = 1;
if (this.type == 666)
num = 2;
if (this.type == 668)
num = 3;
for (int index = 0; index < num; ++index)
{
if (Main.rand.Next(2) != 0)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, Scale: 2f);
dust.noGravity = true;
dust.velocity *= 0.3f;
if (Main.rand.Next(1) == 0)
{
dust.velocity.Y += (float) Math.Sign(dust.velocity.Y) * 1.2f;
dust.fadeIn += 0.5f;
}
}
}
this.rotation = this.velocity.ToRotation() + 1.570796f;
}
private void AI_134_Ballista()
{
float shot_range = 900f;
float deadBottomAngle = 0.75f;
Vector2 center = this.Center;
int Type = 680;
float num1 = 16f;
int num2 = 1;
int num3 = 5;
int num4 = 5;
int num5 = 180;
if (Main.player[this.owner].setSquireT2)
num1 = 21f;
if (Main.player[this.owner].setSquireT3)
num5 = 100;
if (Main.player[this.owner].ballistaPanic)
num5 = 60;
if (Main.player[this.owner].ballistaPanic && Main.player[this.owner].setSquireT3)
num5 = 30;
int num6 = num4;
if (this.type == 677)
center.Y -= 4f;
if ((double) this.ai[0] == 0.0)
{
this.direction = this.spriteDirection = Main.player[this.owner].direction;
this.ai[0] = 1f;
this.ai[1] = 0.0f;
this.netUpdate = true;
if (this.direction == -1)
this.rotation = 3.141593f;
}
if ((double) this.ai[0] == 1.0)
{
this.frame = 0;
bool flag = false;
if (Main.player[this.owner].ballistaPanic && (double) this.ai[1] > 60.0)
this.ai[1] = 60f;
if (Main.player[this.owner].ballistaPanic && Main.player[this.owner].setSquireT3 && (double) this.ai[1] > 30.0)
this.ai[1] = 30f;
if ((double) this.ai[1] > 0.0)
--this.ai[1];
else
flag = true;
int target = this.AI_134_Ballista_FindTarget(shot_range, deadBottomAngle, center);
if (target != -1)
{
Vector2 v = (Main.npc[target].Center - center).SafeNormalize(Vector2.UnitY);
this.rotation = this.rotation.AngleLerp(v.ToRotation(), 0.08f);
if ((double) this.rotation > 1.57079637050629 || (double) this.rotation < -1.57079637050629)
this.direction = -1;
else
this.direction = 1;
if (flag && this.owner == Main.myPlayer)
{
this.direction = Math.Sign(v.X);
this.ai[0] = 2f;
this.ai[1] = 0.0f;
this.netUpdate = true;
}
}
else
{
float targetAngle = 0.0f;
if (this.direction == -1)
targetAngle = 3.141593f;
this.rotation = this.rotation.AngleLerp(targetAngle, 0.05f);
}
}
else if ((double) this.ai[0] == 2.0)
{
this.frame = num2 + (int) ((double) this.ai[1] / (double) num4);
if ((double) this.ai[1] == (double) num6)
{
SoundEngine.PlayTrackedSound((SoundStyle) SoundID.DD2_BallistaTowerShot, this.Center);
Vector2 v = new Vector2((float) this.direction, 0.0f);
int target = this.AI_134_Ballista_FindTarget(shot_range, deadBottomAngle, center);
if (target != -1)
v = (Main.npc[target].Center - center).SafeNormalize(Vector2.UnitX * (float) this.direction);
this.rotation = v.ToRotation();
if ((double) this.rotation > 1.57079637050629 || (double) this.rotation < -1.57079637050629)
this.direction = -1;
else
this.direction = 1;
Vector2 velocity = v * num1;
if (this.owner == Main.myPlayer)
Projectile.NewProjectile(center, velocity, Type, this.damage, this.knockBack, this.owner);
}
if ((double) ++this.ai[1] >= (double) (num3 * num4))
{
this.ai[0] = 1f;
this.ai[1] = (float) num5;
}
}
this.spriteDirection = this.direction;
this.tileCollide = true;
this.velocity.Y += 0.2f;
}
private void AI_135_OgreStomp()
{
float num1 = 40f;
if (this.type == 922)
num1 = 30f;
++this.ai[0];
if ((double) this.ai[0] > 9.0)
{
this.Kill();
}
else
{
this.velocity = Vector2.Zero;
this.position = this.Center;
this.Size = new Vector2(16f, 16f) * MathHelper.Lerp(5f, num1, Utils.GetLerpValue(0.0f, 9f, this.ai[0], false));
this.Center = this.position;
Point tileCoordinates1 = this.TopLeft.ToTileCoordinates();
Point tileCoordinates2 = this.BottomRight.ToTileCoordinates();
int num2 = tileCoordinates1.X / 2 + tileCoordinates2.X / 2;
int num3 = this.width / 2;
if ((int) this.ai[0] % 3 != 0)
return;
int num4 = (int) this.ai[0] / 3;
for (int x = tileCoordinates1.X; x <= tileCoordinates2.X; ++x)
{
for (int y = tileCoordinates1.Y; y <= tileCoordinates2.Y; ++y)
{
if ((double) Vector2.Distance(this.Center, new Vector2((float) (x * 16), (float) (y * 16))) <= (double) num3)
{
Tile tileSafely1 = Framing.GetTileSafely(x, y);
if (tileSafely1.active() && Main.tileSolid[(int) tileSafely1.type] && !Main.tileSolidTop[(int) tileSafely1.type] && !Main.tileFrameImportant[(int) tileSafely1.type])
{
Tile tileSafely2 = Framing.GetTileSafely(x, y - 1);
if (!tileSafely2.active() || !Main.tileSolid[(int) tileSafely2.type] || Main.tileSolidTop[(int) tileSafely2.type])
{
int tileDustAmount = WorldGen.KillTile_GetTileDustAmount(true, tileSafely1);
for (int index = 0; index < tileDustAmount; ++index)
{
Dust dust = Main.dust[WorldGen.KillTile_MakeTileDust(x, y, tileSafely1)];
dust.velocity.Y -= (float) (3.0 + (double) num4 * 1.5);
dust.velocity.Y *= Main.rand.NextFloat();
dust.velocity.Y *= 0.75f;
dust.scale += (float) num4 * 0.03f;
}
if (num4 >= 2)
{
if (this.type == 922)
{
Color dustColor = NPC.AI_121_QueenSlime_GetDustColor();
dustColor.A = (byte) 150;
for (int index1 = 0; index1 < tileDustAmount - 1; ++index1)
{
int index2 = Dust.NewDust(this.position, 12, 12, 4, Alpha: 50, newColor: dustColor, Scale: 1.5f);
Main.dust[index2].velocity.Y -= (float) (0.100000001490116 + (double) num4 * 0.5);
Main.dust[index2].velocity.Y *= Main.rand.NextFloat();
Main.dust[index2].velocity.X *= Main.rand.NextFloatDirection() * 3f;
Main.dust[index2].position = new Vector2((float) (x * 16 + Main.rand.Next(16)), (float) (y * 16 + Main.rand.Next(16)));
if (Main.rand.Next(3) != 0)
{
Main.dust[index2].velocity *= 0.5f;
Main.dust[index2].noGravity = true;
}
}
}
else
{
for (int index = 0; index < tileDustAmount - 1; ++index)
{
Dust dust = Main.dust[WorldGen.KillTile_MakeTileDust(x, y, tileSafely1)];
dust.velocity.Y -= 1f + (float) num4;
dust.velocity.Y *= Main.rand.NextFloat();
dust.velocity.Y *= 0.75f;
}
}
}
if (tileDustAmount > 0 && Main.rand.Next(3) != 0)
{
float num5 = (float) Math.Abs(num2 - x) / (num1 / 2f);
if (this.type == 922)
{
Color dustColor = NPC.AI_121_QueenSlime_GetDustColor();
dustColor.A = (byte) 150;
for (int index3 = 0; index3 < 3; ++index3)
{
int index4 = Dust.NewDust(this.position, this.width, this.height, 31, Alpha: 50, newColor: dustColor, Scale: ((float) (2.0 - (double) num4 * 0.150000005960464 + (double) num5 * 0.5)));
Main.dust[index4].velocity.Y -= (float) (0.100000001490116 + (double) num4 * 0.5 + (double) num5 * (double) num4 * 1.0);
Main.dust[index4].velocity.Y *= Main.rand.NextFloat();
Main.dust[index4].velocity.X *= Main.rand.NextFloatDirection() * 3f;
Main.dust[index4].position = new Vector2((float) (x * 16 + 20), (float) (y * 16 + 20));
if (Main.rand.Next(3) != 0)
{
Main.dust[index4].velocity *= 0.5f;
Main.dust[index4].noGravity = true;
}
}
}
else
{
Gore gore = Gore.NewGoreDirect(this.position, Vector2.Zero, 61 + Main.rand.Next(3), (float) (1.0 - (double) num4 * 0.150000005960464 + (double) num5 * 0.5));
gore.velocity.Y -= (float) (0.100000001490116 + (double) num4 * 0.5 + (double) num5 * (double) num4 * 1.0);
gore.velocity.Y *= Main.rand.NextFloat();
gore.position = new Vector2((float) (x * 16 + 20), (float) (y * 16 + 20));
}
}
}
}
}
}
}
}
}
private void AI_136_BetsyBreath()
{
if ((double) this.ai[1] < 0.0 || (double) this.ai[1] > 200.0)
{
this.Kill();
}
else
{
NPC npc = Main.npc[(int) this.ai[1]];
float num1 = -8f;
this.Center = npc.Center + new Vector2((110f + num1) * (float) npc.spriteDirection, 30f).RotatedBy((double) npc.rotation);
this.rotation = npc.DirectionTo(this.Center).ToRotation();
DelegateMethods.v3_1 = new Vector3(1.2f, 1f, 0.3f);
float num2 = this.ai[0] / 40f;
if ((double) num2 > 1.0)
num2 = 1f;
float num3 = (float) (((double) this.ai[0] - 38.0) / 40.0);
if ((double) num3 < 0.0)
num3 = 0.0f;
Utils.PlotTileLine(this.Center + this.rotation.ToRotationVector2() * 400f * num3, this.Center + this.rotation.ToRotationVector2() * 400f * num2, 16f, new Utils.TileActionAttempt(DelegateMethods.CastLight));
Utils.PlotTileLine(this.Center + this.rotation.ToRotationVector2().RotatedBy(0.196349546313286) * 400f * num3, this.Center + this.rotation.ToRotationVector2().RotatedBy(0.196349546313286) * 400f * num2, 16f, new Utils.TileActionAttempt(DelegateMethods.CastLight));
Utils.PlotTileLine(this.Center + this.rotation.ToRotationVector2().RotatedBy(-0.196349546313286) * 400f * num3, this.Center + this.rotation.ToRotationVector2().RotatedBy(-0.196349546313286) * 400f * num2, 16f, new Utils.TileActionAttempt(DelegateMethods.CastLight));
if ((double) num3 == 0.0 && (double) num2 > 0.100000001490116)
{
for (int index = 0; index < 3; ++index)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 6);
dust.fadeIn = 1.5f;
dust.velocity = this.rotation.ToRotationVector2().RotatedBy((double) Main.rand.NextFloatDirection() * 0.261799395084381) * (float) (0.5 + (double) Main.rand.NextFloat() * 2.5) * 15f;
dust.velocity += npc.velocity * 2f;
dust.noLight = true;
dust.noGravity = true;
dust.alpha = 200;
}
}
if (Main.rand.Next(5) == 0 && (double) this.ai[0] >= 15.0)
{
Gore gore = Gore.NewGoreDirect(this.Center + this.rotation.ToRotationVector2() * 300f - Utils.RandomVector2(Main.rand, -20f, 20f), Vector2.Zero, 61 + Main.rand.Next(3), 0.5f);
gore.velocity *= 0.3f;
gore.velocity += this.rotation.ToRotationVector2() * 4f;
}
for (int index = 0; index < 1; ++index)
{
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 31);
dust.fadeIn = 1.5f;
dust.scale = 0.4f;
dust.velocity = this.rotation.ToRotationVector2().RotatedBy((double) Main.rand.NextFloatDirection() * 0.261799395084381) * (float) (0.5 + (double) Main.rand.NextFloat() * 2.5) * 15f;
dust.velocity += npc.velocity * 2f;
dust.velocity *= 0.3f;
dust.noLight = true;
dust.noGravity = true;
float amount = Main.rand.NextFloat();
dust.position = Vector2.Lerp(this.Center + this.rotation.ToRotationVector2() * 400f * num3, this.Center + this.rotation.ToRotationVector2() * 400f * num2, amount);
dust.position += this.rotation.ToRotationVector2().RotatedBy(1.57079637050629) * (float) (20.0 + 100.0 * ((double) amount - 0.5));
}
++this.frameCounter;
++this.ai[0];
if ((double) this.ai[0] < 78.0)
return;
this.Kill();
}
}
private void AI_137_LightningAura()
{
int maxDistance = 10;
int num1 = 999;
int num2 = 30;
int num3 = 40;
int num4 = 4;
this.knockBack = 0.0f;
if (Main.player[this.owner].setMonkT2)
num2 -= 5;
if (Main.player[this.owner].setMonkT3)
{
maxDistance = 14;
num4 = 8;
}
++this.ai[0];
if ((double) this.ai[0] >= (double) num2)
this.ai[0] = 0.0f;
if ((double) this.ai[0] == 0.0)
{
bool flag = false;
for (int index = 0; index < 200; ++index)
{
NPC npc = Main.npc[index];
if (npc.CanBeChasedBy((object) this) && (double) npc.Hitbox.Distance(this.Center) < (double) (this.width / 2) && this.Colliding(this.Hitbox, npc.Hitbox))
{
flag = true;
break;
}
}
if (flag)
SoundEngine.PlayTrackedSound((SoundStyle) SoundID.DD2_LightningAuraZap, this.Center);
}
if ((double) this.localAI[0] == 0.0)
{
this.localAI[0] = 1f;
this.velocity = Vector2.Zero;
Point tileCoordinates = this.Center.ToTileCoordinates();
bool flag = true;
Point result1;
if (!WorldUtils.Find(tileCoordinates, Searches.Chain((GenSearch) new Searches.Down(500), (GenCondition) Projectile._cachedConditions_notNull, (GenCondition) Projectile._cachedConditions_solid), out result1))
{
this.position.Y += 16f;
return;
}
Point result2;
if (!WorldUtils.Find(new Point(result1.X, result1.Y - 1), Searches.Chain((GenSearch) new Searches.Up(maxDistance), (GenCondition) Projectile._cachedConditions_notNull, (GenCondition) Projectile._cachedConditions_solid), out result2))
result2 = new Point(tileCoordinates.X, tileCoordinates.Y - maxDistance - 1);
int num5 = 0;
if (flag && Main.tile[result1.X, result1.Y] != null && Main.tile[result1.X, result1.Y].blockType() == 1)
num5 += 8;
Vector2 worldCoordinates1 = result1.ToWorldCoordinates(autoAddY: ((float) num5));
Vector2 worldCoordinates2 = result2.ToWorldCoordinates(autoAddY: 0.0f);
this.Size = new Vector2(1f, worldCoordinates1.Y - worldCoordinates2.Y);
if (this.height > maxDistance * 16)
this.height = maxDistance * 16;
if (this.height < num4 * 16)
this.height = num4 * 16;
this.height *= 2;
this.width = (int) ((double) this.height * 1.0);
if (this.width > num1)
this.width = num1;
this.Center = worldCoordinates1;
}
if (++this.frameCounter >= 8)
{
this.frameCounter = 0;
if (++this.frame >= Main.projFrames[this.type])
this.frame = 0;
}
DelegateMethods.v3_1 = new Vector3(0.2f, 0.7f, 1f);
Utils.PlotTileLine(this.Center + Vector2.UnitX * -40f, this.Center + Vector2.UnitX * 40f, 80f, new Utils.TileActionAttempt(DelegateMethods.CastLightOpen));
Vector2 vector2_1 = new Vector2(this.Top.X, this.position.Y + (float) num3);
for (int index = 0; index < 4; ++index)
{
if (Main.rand.Next(6) == 0)
{
Vector2 vector2_2 = Main.rand.NextVector2Unit();
if ((double) Math.Abs(vector2_2.X) >= 0.119999997317791)
{
Vector2 vector2_3 = this.Center + vector2_2 * new Vector2((float) ((this.height - num3) / 2));
if (!WorldGen.SolidTile((int) vector2_3.X / 16, (int) vector2_3.Y / 16) && this.AI_137_CanHit(vector2_3))
{
Dust dust = Dust.NewDustDirect(vector2_3, 0, 0, 226, Alpha: 100);
dust.position = vector2_3;
dust.velocity = (vector2_1 - dust.position).SafeNormalize(Vector2.Zero);
dust.scale = 0.7f;
dust.fadeIn = 1f;
dust.noGravity = true;
dust.noLight = true;
}
}
}
}
for (int index = 0; index < 0; ++index)
{
if (Main.rand.Next(10) == 0)
{
Vector2 vector2_4 = Main.rand.NextVector2Unit();
if ((double) Math.Abs(vector2_4.X) >= 0.119999997317791)
{
Vector2 vector2_5 = this.Center + vector2_4 * new Vector2((float) ((this.height - num3) / 2)) * Main.rand.NextFloat();
if (!WorldGen.SolidTile((int) vector2_5.X / 16, (int) vector2_5.Y / 16) && this.AI_137_CanHit(vector2_5))
{
Dust dust = Dust.NewDustDirect(vector2_5, 0, 0, 226, Alpha: 100);
dust.velocity *= 0.6f;
dust.velocity += Vector2.UnitY * -2f;
dust.noGravity = true;
dust.noLight = true;
}
}
}
}
for (int index = 0; index < 4; ++index)
{
if (Main.rand.Next(10) == 0)
{
Dust dust = Dust.NewDustDirect(vector2_1 - new Vector2(8f, 0.0f), 16, this.height / 2 - 40, 226, Alpha: 100);
dust.velocity *= 0.6f;
dust.velocity += Vector2.UnitY * -2f;
dust.scale = 0.7f;
dust.noGravity = true;
dust.noLight = true;
}
}
this.tileCollide = true;
this.velocity.Y += 0.2f;
}
private void AI_138_ExplosiveTrap()
{
this.spriteDirection = this.direction = 1;
int num1 = 110;
int Type = 694;
int num2 = 48;
if (Main.player[this.owner].setHuntressT2)
num1 = 74;
if (Main.player[this.owner].setHuntressT3)
num1 = 40;
switch (this.type)
{
case 692:
Type = 695;
break;
case 693:
Type = 696;
break;
}
Lighting.AddLight(this.Center, 0.6f, 0.5f, 0.3f);
if (++this.frameCounter >= 12)
{
this.frameCounter = 0;
if (++this.frame >= Main.projFrames[this.type])
this.frame = 0;
}
if ((double) this.localAI[0] > 0.0)
--this.localAI[0];
if ((double) this.localAI[0] <= 0.0 && this.owner == Main.myPlayer)
{
this.localAI[0] = 3f;
bool flag = false;
Microsoft.Xna.Framework.Rectangle rectangle = Utils.CenteredRectangle(this.Center + new Vector2(0.0f, (float) -num2), new Vector2((float) (num2 * 2)));
for (int index = 0; index < 200; ++index)
{
NPC npc = Main.npc[index];
if (npc.CanBeChasedBy((object) this) && rectangle.Intersects(npc.Hitbox))
{
flag = true;
break;
}
}
if (flag)
{
SoundEngine.PlayTrackedSound((SoundStyle) SoundID.DD2_ExplosiveTrapExplode);
this.localAI[0] = (float) num1;
Projectile.NewProjectile(this.Center + new Vector2(0.0f, (float) -num2), Vector2.Zero, Type, this.damage, this.knockBack, this.owner);
}
}
this.tileCollide = true;
this.velocity.Y += 0.2f;
}
private void AI_139_ExplosiveTrapExplosion()
{
int projFrame = Main.projFrames[this.type];
int num = 3;
this.alpha -= 25;
if (this.alpha < 0)
this.alpha = 0;
if ((double) this.localAI[0] == 0.0)
this.localAI[0] = 1f;
if (++this.frameCounter >= num)
{
this.frameCounter = 0;
if (++this.frame >= projFrame)
{
this.Kill();
return;
}
}
DelegateMethods.v3_1 = new Vector3(1.3f, 0.9f, 0.2f);
Utils.PlotTileLine(this.Top, this.Bottom, 2f, new Utils.TileActionAttempt(DelegateMethods.CastLightOpen));
}
private void AI_140_MonkStaffT1()
{
float num1 = 50f;
float num2 = 2f;
float num3 = 20f;
Player player = Main.player[this.owner];
float num4 = -0.7853982f;
Vector2 vector2_1 = player.RotatedRelativePoint(player.MountedCenter);
Vector2 vector2_2 = Vector2.Zero;
if (player.dead)
{
this.Kill();
}
else
{
if (this.type == 697)
{
int Damage = this.damage * 3;
int num5 = Math.Sign(this.velocity.X);
this.velocity = new Vector2((float) num5, 0.0f);
if ((double) this.ai[0] == 0.0)
{
this.rotation = (float) ((double) new Vector2((float) num5, -player.gravDir).ToRotation() + (double) num4 + 3.14159274101257);
if ((double) this.velocity.X < 0.0)
this.rotation -= 1.570796f;
}
this.alpha -= 128;
if (this.alpha < 0)
this.alpha = 0;
double num6 = (double) this.ai[0] / (double) num1;
++this.ai[0];
this.rotation += 6.283185f * num2 / num1 * (float) num5;
bool flag = (double) this.ai[0] == (double) (int) ((double) num1 / 2.0);
if ((double) this.ai[0] >= (double) num1 || flag && !player.controlUseItem)
{
this.Kill();
player.reuseDelay = 10;
}
else if (flag)
{
Vector2 mouseWorld = Main.MouseWorld;
int dir = (double) player.DirectionTo(mouseWorld).X > 0.0 ? 1 : -1;
if ((double) dir != (double) this.velocity.X)
{
player.ChangeDir(dir);
this.velocity = new Vector2((float) dir, 0.0f);
this.netUpdate = true;
this.rotation -= 3.141593f;
}
}
float num7 = this.rotation - 0.7853982f * (float) num5;
vector2_2 = (num7 + (num5 == -1 ? 3.141593f : 0.0f)).ToRotationVector2() * (this.ai[0] / num1) * num3;
Vector2 vec = this.Center + (num7 + (num5 == -1 ? 3.141593f : 0.0f)).ToRotationVector2() * 30f;
if (Main.rand.Next(2) == 0)
{
Dust dust = Dust.NewDustDirect(vec - new Vector2(5f), 10, 10, 31, player.velocity.X, player.velocity.Y, 150);
dust.velocity = this.DirectionTo(dust.position) * 0.1f + dust.velocity * 0.1f;
}
if (num6 >= 0.75)
{
Dust dust = Dust.NewDustDirect(vec - new Vector2(5f), 10, 10, 55, player.velocity.X, player.velocity.Y, 50);
dust.velocity = this.DirectionTo(dust.position) * 0.1f + dust.velocity * 0.1f;
dust.noGravity = true;
dust.color = new Color(20, (int) byte.MaxValue, 100, 160);
}
if ((double) this.ai[0] >= (double) num1 - 8.0 && (double) this.ai[0] < (double) num1 - 2.0)
{
for (int index = 0; index < 5; ++index)
{
Dust dust = Dust.NewDustDirect(vec - new Vector2(5f), 10, 10, 55, player.velocity.X, player.velocity.Y, 50);
dust.velocity *= 1.2f;
dust.noGravity = true;
dust.scale += 0.1f;
dust.color = new Color(20, (int) byte.MaxValue, 100, 160);
}
}
if ((double) this.ai[0] == (double) num1 - 3.0 && this.owner == Main.myPlayer)
{
if ((double) this.localAI[1] != 1.0)
{
if (!WorldUtils.Find(vec.ToTileCoordinates(), Searches.Chain((GenSearch) new Searches.Down(4), (GenCondition) Projectile._cachedConditions_notNull, (GenCondition) Projectile._cachedConditions_solid), out Point _))
{
SoundEngine.PlayTrackedSound((SoundStyle) SoundID.DD2_MonkStaffGroundMiss, this.Center);
goto label_26;
}
}
Projectile.NewProjectile(vec + new Vector2((float) (num5 * 20), -60f), Vector2.Zero, 698, Damage, 0.0f, this.owner);
SoundEngine.PlayTrackedSound((SoundStyle) SoundID.DD2_MonkStaffGroundImpact, this.Center);
}
}
label_26:
if (this.type == 707)
{
Lighting.AddLight(player.Center, 0.75f, 0.9f, 1.15f);
int num8 = Math.Sign(this.velocity.X);
this.velocity = new Vector2((float) num8, 0.0f);
if ((double) this.ai[0] == 0.0)
{
this.rotation = (float) ((double) new Vector2((float) num8, -player.gravDir).ToRotation() + (double) num4 + 3.14159274101257);
if ((double) this.velocity.X < 0.0)
this.rotation -= 1.570796f;
}
this.alpha -= 128;
if (this.alpha < 0)
this.alpha = 0;
double num9 = (double) this.ai[0] / (double) num1;
float num10 = 1f;
this.ai[0] += num10;
this.rotation += 6.283185f * num2 / num1 * (float) num8;
bool flag = (double) this.ai[0] == (double) (int) ((double) num1 / 2.0);
if ((double) this.ai[0] >= (double) num1 || flag && !player.controlUseItem)
{
this.Kill();
player.reuseDelay = 2;
}
else if (flag)
{
Vector2 mouseWorld = Main.MouseWorld;
int dir = (double) player.DirectionTo(mouseWorld).X > 0.0 ? 1 : -1;
if ((double) dir != (double) this.velocity.X)
{
player.ChangeDir(dir);
this.velocity = new Vector2((float) dir, 0.0f);
this.netUpdate = true;
this.rotation -= 3.141593f;
}
}
if (((double) this.ai[0] == (double) num10 || (double) this.ai[0] == (double) (int) ((double) num1 / 2.0) && this.active) && this.owner == Main.myPlayer)
{
Vector2 mouseWorld = Main.MouseWorld;
Vector2 vector2_3 = player.DirectionTo(mouseWorld) * 0.0f;
}
float f = this.rotation - 0.7853982f * (float) num8;
vector2_2 = (f + (num8 == -1 ? 3.141593f : 0.0f)).ToRotationVector2() * (this.ai[0] / num1) * num3;
Vector2 vector2_4 = this.Center + (f + (num8 == -1 ? 3.141593f : 0.0f)).ToRotationVector2() * 30f;
Vector2 rotationVector2 = f.ToRotationVector2();
Vector2 vector2_5 = rotationVector2.RotatedBy(1.57079637050629 * (double) this.spriteDirection);
if (Main.rand.Next(2) == 0)
{
Dust dust = Dust.NewDustDirect(vector2_4 - new Vector2(5f), 10, 10, 31, player.velocity.X, player.velocity.Y, 150);
dust.velocity = this.DirectionTo(dust.position) * 0.1f + dust.velocity * 0.1f;
}
for (int index = 0; index < 4; ++index)
{
float num11 = 1f;
float num12 = 1f;
switch (index - 1)
{
case 0:
num12 = -1f;
break;
case 1:
num12 = 1.25f;
num11 = 0.5f;
break;
case 2:
num12 = -1.25f;
num11 = 0.5f;
break;
}
if (Main.rand.Next(6) != 0)
{
Dust dust = Dust.NewDustDirect(this.position, 0, 0, 226, Alpha: 100);
dust.position = this.Center + rotationVector2 * (float) (60.0 + (double) Main.rand.NextFloat() * 20.0) * num12;
dust.velocity = vector2_5 * (float) (4.0 + 4.0 * (double) Main.rand.NextFloat()) * num12 * num11;
dust.noGravity = true;
dust.noLight = true;
dust.scale = 0.5f;
dust.customData = (object) this;
if (Main.rand.Next(4) == 0)
dust.noGravity = false;
}
}
}
this.position = vector2_1 - this.Size / 2f;
this.position = this.position + vector2_2;
this.spriteDirection = this.direction;
this.timeLeft = 2;
player.ChangeDir(this.direction);
player.heldProj = this.whoAmI;
player.SetDummyItemTime(2);
player.itemRotation = MathHelper.WrapAngle(this.rotation);
}
}
private void AI_141_MonkStaffT1Explosion()
{
Point tileCoordinates1 = this.TopLeft.ToTileCoordinates();
Point tileCoordinates2 = this.BottomRight.ToTileCoordinates();
int num1 = tileCoordinates1.X / 2;
int num2 = tileCoordinates2.X / 2;
int width = this.width;
++this.ai[0];
if ((double) this.ai[0] > 20.0)
{
this.Kill();
}
else
{
if ((double) this.ai[0] != 1.0)
return;
bool causedShockwaves;
this.CreateImpactExplosion(6, this.Bottom, ref tileCoordinates1, ref tileCoordinates2, width, out causedShockwaves);
this.CreateImpactExplosion2_SleepyOctopod(this.Bottom, causedShockwaves);
}
}
private void CreateImpactExplosion(
int dustAmountMultiplier,
Vector2 explosionOrigin,
ref Point scanAreaStart,
ref Point scanAreaEnd,
int explosionRange,
out bool causedShockwaves)
{
causedShockwaves = false;
int num1 = 4;
for (int x = scanAreaStart.X; x <= scanAreaEnd.X; ++x)
{
for (int y = scanAreaStart.Y; y <= scanAreaEnd.Y; ++y)
{
if ((double) Vector2.Distance(explosionOrigin, new Vector2((float) (x * 16), (float) (y * 16))) <= (double) explosionRange)
{
Tile tileSafely1 = Framing.GetTileSafely(x, y);
if (tileSafely1.active() && Main.tileSolid[(int) tileSafely1.type] && !Main.tileSolidTop[(int) tileSafely1.type] && !Main.tileFrameImportant[(int) tileSafely1.type])
{
Tile tileSafely2 = Framing.GetTileSafely(x, y - 1);
if (!tileSafely2.active() || !Main.tileSolid[(int) tileSafely2.type] || Main.tileSolidTop[(int) tileSafely2.type])
{
int num2 = WorldGen.KillTile_GetTileDustAmount(true, tileSafely1) * dustAmountMultiplier;
for (int index = 0; index < num2; ++index)
{
Dust dust = Main.dust[WorldGen.KillTile_MakeTileDust(x, y, tileSafely1)];
dust.velocity.Y -= (float) (3.0 + (double) num1 * 1.5);
dust.velocity.Y *= Main.rand.NextFloat();
dust.scale += (float) num1 * 0.03f;
}
if (num1 >= 2)
{
for (int index = 0; index < num2 - 1; ++index)
{
Dust dust = Main.dust[WorldGen.KillTile_MakeTileDust(x, y, tileSafely1)];
dust.velocity.Y -= 1f + (float) num1;
dust.velocity.Y *= Main.rand.NextFloat();
}
}
if (num2 > 0)
causedShockwaves = true;
}
}
}
}
}
}
private void CreateImpactExplosion2_SleepyOctopod(
Vector2 explosionOrigin,
bool causedShockwaves)
{
Vector2 vector2_1 = explosionOrigin;
Vector2 spinningpoint = new Vector2(7f, 0.0f);
Vector2 vector2_2 = new Vector2(1f, 0.7f);
Color color = new Color(20, (int) byte.MaxValue, 100, 200);
for (float num = 0.0f; (double) num < 25.0; ++num)
{
Vector2 vector2_3 = spinningpoint.RotatedBy((double) num * 6.28318548202515 / 25.0) * vector2_2;
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 55);
dust.alpha = 0;
if (!causedShockwaves)
dust.alpha = 50;
dust.color = color;
dust.position = vector2_1 + vector2_3;
dust.velocity.Y -= 3f;
dust.velocity.X *= 0.5f;
dust.fadeIn = (float) (0.5 + (double) Main.rand.NextFloat() * 0.5);
dust.noLight = true;
}
if (causedShockwaves)
return;
for (float num = 0.0f; (double) num < 25.0; ++num)
{
Vector2 vector2_4 = spinningpoint.RotatedBy((double) num * 6.28318548202515 / 25.0) * vector2_2;
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 55);
dust.alpha = 100;
dust.color = color;
dust.position = vector2_1 + vector2_4;
dust.velocity.Y -= 5f;
dust.velocity.X *= 0.8f;
dust.fadeIn = (float) (0.5 + (double) Main.rand.NextFloat() * 0.5);
dust.noLight = true;
}
}
private void CreateImpactExplosion2_FlailTileCollision(
Vector2 explosionOrigin,
bool causedShockwaves,
Vector2 velocityBeforeCollision)
{
Vector2 vector2_1 = explosionOrigin;
Vector2 spinningpoint = new Vector2(7f, 0.0f);
Vector2 vector2_2 = new Vector2(1f, 0.7f);
Color color = Color.White * 0.5f;
Vector2 vector2_3 = velocityBeforeCollision.SafeNormalize(Vector2.Zero);
for (float num = 0.0f; (double) num < 8.0; ++num)
{
Vector2 vector2_4 = spinningpoint.RotatedBy((double) num * 6.28318548202515 / 8.0) * vector2_2;
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 31);
dust.alpha = 0;
if (!causedShockwaves)
dust.alpha = 50;
dust.color = color;
dust.position = vector2_1 + vector2_4;
dust.velocity.Y -= 0.8f;
dust.velocity.X *= 0.8f;
dust.fadeIn = (float) (0.300000011920929 + (double) Main.rand.NextFloat() * 0.400000005960464);
dust.scale = 0.4f;
dust.noLight = true;
dust.velocity += vector2_3 * 2f;
}
if (causedShockwaves)
return;
for (float num = 0.0f; (double) num < 8.0; ++num)
{
Vector2 vector2_5 = spinningpoint.RotatedBy((double) num * 6.28318548202515 / 8.0) * vector2_2;
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 31);
dust.alpha = 100;
dust.color = color;
dust.position = vector2_1 + vector2_5;
--dust.velocity.Y;
dust.velocity.X *= 0.4f;
dust.fadeIn = (float) (0.300000011920929 + (double) Main.rand.NextFloat() * 0.400000005960464);
dust.scale = 0.4f;
dust.noLight = true;
dust.velocity += vector2_3 * 1.5f;
}
}
private void AI_142_MonkStaffT2And3()
{
Player player = Main.player[this.owner];
Vector2 vector2_1 = player.RotatedRelativePoint(player.MountedCenter);
this.direction = player.direction;
player.heldProj = this.whoAmI;
this.Center = vector2_1;
if (player.dead)
{
this.Kill();
}
else
{
if (!player.frozen)
{
if (this.type == 699)
{
this.spriteDirection = this.direction = player.direction;
Vector2 Origin = vector2_1;
this.alpha -= (int) sbyte.MaxValue;
if (this.alpha < 0)
this.alpha = 0;
if ((double) this.localAI[0] > 0.0)
--this.localAI[0];
float num1 = 1f - (float) player.itemAnimation / (float) player.itemAnimationMax;
float rotation = this.velocity.ToRotation();
float x = this.velocity.Length();
float num2 = 22f;
Vector2 spinningpoint1 = new Vector2(1f, 0.0f).RotatedBy(3.14159274101257 + (double) num1 * 6.28318548202515) * new Vector2(x, this.ai[0]);
this.position = this.position + (spinningpoint1.RotatedBy((double) rotation) + new Vector2(x + num2, 0.0f).RotatedBy((double) rotation));
Vector2 Target = Origin + spinningpoint1.RotatedBy((double) rotation) + new Vector2((float) ((double) x + (double) num2 + 40.0), 0.0f).RotatedBy((double) rotation);
this.rotation = Origin.AngleTo(Target) + 0.7853982f * (float) player.direction;
if (this.spriteDirection == -1)
this.rotation += 3.141593f;
Origin.DirectionTo(this.Center);
Vector2 vector2_2 = Origin.DirectionTo(Target);
Vector2 spinningpoint2 = this.velocity.SafeNormalize(Vector2.UnitY);
float num3 = 2f;
for (int index = 0; (double) index < (double) num3; ++index)
{
Dust dust = Dust.NewDustDirect(this.Center, 14, 14, 228, Alpha: 110);
dust.velocity = Origin.DirectionTo(dust.position) * 2f;
dust.position = this.Center + spinningpoint2.RotatedBy((double) num1 * 6.28318548202515 * 2.0 + (double) index / (double) num3 * 6.28318548202515) * 10f;
dust.scale = (float) (1.0 + 0.600000023841858 * (double) Main.rand.NextFloat());
dust.velocity += spinningpoint2 * 3f;
dust.noGravity = true;
}
for (int index = 0; index < 1; ++index)
{
if (Main.rand.Next(3) == 0)
{
Dust dust = Dust.NewDustDirect(this.Center, 20, 20, 228, Alpha: 110);
dust.velocity = Origin.DirectionTo(dust.position) * 2f;
dust.position = this.Center + vector2_2 * -110f;
dust.scale = (float) (0.449999988079071 + 0.400000005960464 * (double) Main.rand.NextFloat());
dust.fadeIn = (float) (0.699999988079071 + 0.400000005960464 * (double) Main.rand.NextFloat());
dust.noGravity = true;
dust.noLight = true;
}
}
}
else if (this.type == 708)
{
Lighting.AddLight(player.Center, 0.75f, 0.9f, 1.15f);
this.spriteDirection = this.direction = player.direction;
this.alpha -= (int) sbyte.MaxValue;
if (this.alpha < 0)
this.alpha = 0;
float num4 = 1f - (float) player.itemAnimation / (float) player.itemAnimationMax;
float rotation = this.velocity.ToRotation();
float x = this.velocity.Length();
float num5 = 22f;
Vector2 spinningpoint3 = new Vector2(1f, 0.0f).RotatedBy(3.14159274101257 + (double) num4 * 6.28318548202515) * new Vector2(x, this.ai[0]);
this.position = this.position + (spinningpoint3.RotatedBy((double) rotation) + new Vector2(x + num5, 0.0f).RotatedBy((double) rotation));
Vector2 vector2_3 = vector2_1 + spinningpoint3.RotatedBy((double) rotation) + new Vector2((float) ((double) x + (double) num5 + 40.0), 0.0f).RotatedBy((double) rotation);
this.rotation = (vector2_3 - vector2_1).SafeNormalize(Vector2.UnitX).ToRotation() + 0.7853982f * (float) player.direction;
if (this.spriteDirection == -1)
this.rotation += 3.141593f;
(this.Center - vector2_1).SafeNormalize(Vector2.Zero);
(vector2_3 - vector2_1).SafeNormalize(Vector2.Zero);
Vector2 spinningpoint4 = this.velocity.SafeNormalize(Vector2.UnitY);
if ((player.itemAnimation == 2 || player.itemAnimation == 6 || player.itemAnimation == 10) && this.owner == Main.myPlayer)
{
Vector2 vector2_4 = (spinningpoint4 + Main.rand.NextVector2Square(-0.2f, 0.2f)) * 12f;
switch (player.itemAnimation)
{
case 2:
vector2_4 = spinningpoint4.RotatedBy(0.383972465991974);
break;
case 6:
vector2_4 = spinningpoint4.RotatedBy(-0.383972465991974);
break;
case 10:
vector2_4 = spinningpoint4.RotatedBy(0.0);
break;
}
Projectile.NewProjectile(this.Center, vector2_4 * (10f + (float) Main.rand.Next(4)), 709, this.damage, 0.0f, this.owner);
}
for (int index = 0; index < 3; index += 2)
{
float num6 = 1f;
float num7 = 1f;
switch (index - 1)
{
case 0:
num7 = -1f;
break;
case 1:
num7 = 1.25f;
num6 = 0.5f;
break;
case 2:
num7 = -1.25f;
num6 = 0.5f;
break;
}
if (Main.rand.Next(6) != 0)
{
float num8 = num7 * 1.2f;
Dust dust = Dust.NewDustDirect(this.position, this.width, this.height, 226, Alpha: 100);
dust.velocity = spinningpoint4 * (float) (4.0 + 4.0 * (double) Main.rand.NextFloat()) * num8 * num6;
dust.noGravity = true;
dust.noLight = true;
dust.scale = 0.75f;
dust.fadeIn = 0.8f;
dust.customData = (object) this;
if (Main.rand.Next(3) == 0)
{
dust.noGravity = false;
dust.fadeIn = 0.0f;
}
}
}
}
}
if (player.itemAnimation != 2)
return;
this.Kill();
player.reuseDelay = 2;
}
}
private void AI_143_MonkStaffT2Ghast()
{
SlotId slotId;
if ((double) this.ai[0] == 0.0)
{
float[] localAi = this.localAI;
slotId = SoundEngine.PlayTrackedSound((SoundStyle) SoundID.DD2_GhastlyGlaiveImpactGhost, this.Center);
double num = (double) ((SlotId) ref slotId).ToFloat();
localAi[1] = (float) num;
}
ActiveSound activeSound = SoundEngine.GetActiveSound(SlotId.FromFloat(this.localAI[1]));
if (activeSound == null)
{
float[] localAi = this.localAI;
slotId = (SlotId) SlotId.Invalid;
double num = (double) ((SlotId) ref slotId).ToFloat();
localAi[1] = (float) num;
}
else
activeSound.Position = this.Center;
++this.ai[0];
if ((double) this.ai[0] > 50.0)
{
this.alpha += 25;
if (this.alpha > (int) byte.MaxValue)
this.alpha = (int) byte.MaxValue;
}
else
{
this.alpha -= 25;
if (this.alpha < 100)
this.alpha = 100;
}
this.velocity = this.velocity * 0.98f;
if (++this.frameCounter >= 5)
{
this.frameCounter = 0;
if (++this.frame >= 4)
this.frame = 0;
}
if ((double) this.ai[0] >= 60.0)
this.Kill();
this.direction = this.spriteDirection = (double) this.velocity.X > 0.0 ? 1 : -1;
this.rotation = this.velocity.ToRotation();
if (this.spriteDirection == -1)
this.rotation += 3.141593f;
if ((double) this.ai[0] < 10.0 || (double) this.ai[0] >= 34.0)
return;
Vector2 spinningpoint = this.velocity.SafeNormalize(Vector2.UnitY);
float num1 = this.ai[0] / 60f;
float num2 = 2f;
for (int index = 0; (double) index < (double) num2; ++index)
{
Dust dust = Dust.NewDustDirect(this.Center, 14, 14, 228, Alpha: 110);
dust.velocity = spinningpoint * 2f;
dust.position = this.Center + spinningpoint.RotatedBy((double) num1 * 6.28318548202515 * 2.0 + (double) index / (double) num2 * 6.28318548202515) * 7f;
dust.scale = (float) (1.0 + 0.600000023841858 * (double) Main.rand.NextFloat());
dust.velocity += spinningpoint * 3f;
dust.noGravity = true;
}
}
private void AI_144_DD2Pet()
{
Player player = Main.player[this.owner];
float num1 = 4f;
int num2 = 6;
int num3 = 4;
int num4 = Main.projFrames[this.type];
int num5 = 0;
float num6 = 0.08f;
bool flag1 = false;
float num7 = 0.1f;
Vector2 vector2_1 = new Vector2((float) (player.direction * 30), -20f);
if (player.dead)
{
this.Kill();
}
else
{
bool flag2 = true;
switch (this.type)
{
case 701:
if (player.petFlagDD2Dragon)
{
this.timeLeft = 2;
break;
}
break;
case 702:
if (player.petFlagDD2Ghost)
this.timeLeft = 2;
vector2_1.Y += (float) Math.Cos((double) this.localAI[0] * 0.0523598790168762) * 2f;
num3 = 4;
num2 = 10;
flag2 = false;
num1 = 6f;
Vector2 vector2_2 = new Vector2(this.spriteDirection == -1 ? -6f : -2f, -26f).RotatedBy((double) this.rotation);
if (Main.rand.Next(24) == 0)
{
Dust dust = Dust.NewDustDirect(this.Center + vector2_2, 4, 4, 135, Alpha: 100);
if (Main.rand.Next(3) != 0)
{
dust.noGravity = true;
dust.velocity.Y -= 3f;
dust.noLight = true;
}
else if (Main.rand.Next(2) != 0)
dust.noLight = true;
dust.velocity *= 0.5f;
dust.velocity.Y -= 0.9f;
dust.scale += (float) (0.100000001490116 + (double) Main.rand.NextFloat() * 0.600000023841858);
}
DelegateMethods.v3_1 = new Vector3(0.3f, 0.5f, 1f);
Utils.PlotTileLine(this.Center, this.Center + this.velocity * 6f, 20f, new Utils.TileActionAttempt(DelegateMethods.CastLightOpen));
Utils.PlotTileLine(this.Left, this.Right, 20f, new Utils.TileActionAttempt(DelegateMethods.CastLightOpen));
Utils.PlotTileLine(player.Center, player.Center + player.velocity * 6f, 40f, new Utils.TileActionAttempt(DelegateMethods.CastLightOpen));
Utils.PlotTileLine(player.Left, player.Right, 40f, new Utils.TileActionAttempt(DelegateMethods.CastLightOpen));
break;
case 703:
if (player.petFlagDD2Gato)
this.timeLeft = 2;
vector2_1.Y += (float) Math.Cos((double) this.localAI[0] * 0.104719758033752) * 2f;
num2 = 4;
num3 = 2;
num1 = 3f;
num4 = 4;
break;
case 764:
num7 = 0.025f;
num6 = 0.04f;
flag1 = true;
++this.localAI[0];
if ((double) this.localAI[0] > 120.0)
this.localAI[0] = 0.0f;
this.localAI[1] += this.velocity.X * 0.01f;
this.localAI[1] += 0.008333334f;
if ((double) this.localAI[1] < -6.28318548202515)
this.localAI[1] += 6.283185f;
if ((double) this.localAI[1] > 6.28318548202515)
this.localAI[1] -= 6.283185f;
if ((double) this.velocity.Length() < 4.0)
{
this.localAI[1] *= 0.9f;
if ((double) this.velocity.Length() > 0.100000001490116 && Main.rand.Next(30) == 0)
{
Dust dust = Dust.NewDustDirect(this.position - this.velocity, this.width, this.height, 292, this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 150);
dust.velocity *= 0.3f;
dust.noLightEmittence = true;
}
}
else
{
Vector2 vector2_3 = new Vector2((float) Main.screenWidth, (float) Main.screenHeight);
this.Hitbox.Intersects(Utils.CenteredRectangle(Main.screenPosition + vector2_3 / 2f, vector2_3 + new Vector2(400f)));
if (Main.rand.Next(15) == 0)
Dust.NewDustDirect(this.position - this.velocity, this.width, this.height, 292, this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 150, Scale: 0.9f).noLightEmittence = true;
}
float amount = (float) ((double) this.localAI[0] / 120.0 * 2.0);
if ((double) amount > 1.0)
amount = 2f - amount;
this.Opacity = MathHelper.Lerp(0.4f, 0.75f, amount);
vector2_1.Y += (float) Math.Cos((double) this.localAI[0] / 120.0 * 6.28318548202515) * 2f;
if (player.petFlagUpbeatStar)
{
this.timeLeft = 2;
break;
}
break;
}
if (flag2 && (player.suspiciouslookingTentacle || player.petFlagDD2Ghost))
vector2_1.X += (float) (-player.direction * 64);
this.direction = this.spriteDirection = player.direction;
Vector2 vector2_4 = player.MountedCenter + vector2_1;
double num8 = (double) Vector2.Distance(this.Center, vector2_4);
if (num8 > 1000.0)
this.Center = player.Center + vector2_1;
Vector2 vector2_5 = vector2_4 - this.Center;
if (num8 < (double) num1)
this.velocity = this.velocity * 0.25f;
if (vector2_5 != Vector2.Zero)
{
if ((double) vector2_5.Length() < (double) num1 * 0.5)
this.velocity = vector2_5;
else
this.velocity = vector2_5 * num7;
}
if ((double) this.velocity.Length() > 6.0)
{
float num9 = (float) ((double) this.velocity.X * (double) num6 + (double) this.velocity.Y * (double) this.spriteDirection * 0.0199999995529652);
if ((double) Math.Abs(this.rotation - num9) >= 3.14159274101257)
{
if ((double) num9 < (double) this.rotation)
this.rotation -= 6.283185f;
else
this.rotation += 6.283185f;
}
float num10 = 12f;
this.rotation = (this.rotation * (num10 - 1f) + num9) / num10;
if (++this.frameCounter >= num3)
{
this.frameCounter = 0;
if (++this.frame >= num4)
this.frame = num5;
}
}
else
{
if ((double) this.rotation > 3.14159274101257)
this.rotation -= 6.283185f;
if ((double) this.rotation > -0.00499999988824129 && (double) this.rotation < 0.00499999988824129)
this.rotation = 0.0f;
else
this.rotation *= 0.96f;
if (++this.frameCounter >= num2)
{
this.frameCounter = 0;
if (++this.frame >= num4)
this.frame = num5;
}
}
if (flag1)
return;
++this.localAI[0];
if ((double) this.localAI[0] <= 120.0)
return;
this.localAI[0] = 0.0f;
}
}
private void AI_145_BookStaffStorm()
{
float num1 = 300f;
SlotId slotId;
if (this.soundDelay == 0)
{
this.soundDelay = -1;
float[] localAi = this.localAI;
slotId = SoundEngine.PlayTrackedSound((SoundStyle) SoundID.DD2_BookStaffTwisterLoop, this.Center);
double num2 = (double) ((SlotId) ref slotId).ToFloat();
localAi[1] = (float) num2;
}
ActiveSound activeSound = SoundEngine.GetActiveSound(SlotId.FromFloat(this.localAI[1]));
if (activeSound != null)
{
activeSound.Position = this.Center;
activeSound.Volume = (float) (1.0 - (double) Math.Max(this.ai[0] - (num1 - 15f), 0.0f) / 15.0);
}
else
{
float[] localAi = this.localAI;
slotId = (SlotId) SlotId.Invalid;
double num3 = (double) ((SlotId) ref slotId).ToFloat();
localAi[1] = (float) num3;
}
if ((double) this.localAI[0] >= 16.0 && (double) this.ai[0] < (double) num1 - 15.0)
this.ai[0] = num1 - 15f;
++this.ai[0];
if ((double) this.ai[0] >= (double) num1)
this.Kill();
Vector2 top = this.Top;
Vector2 bottom = this.Bottom;
Vector2 vector2_1 = Vector2.Lerp(top, bottom, 0.5f);
Vector2 vector2_2 = new Vector2(0.0f, bottom.Y - top.Y);
vector2_2.X = vector2_2.Y * 0.2f;
int Width = 16;
int Height = 160;
for (int index = 0; index < 1; ++index)
{
Vector2 Position = new Vector2(this.Center.X - (float) (Width / 2), this.position.Y + (float) this.height - (float) Height);
if (Collision.SolidCollision(Position, Width, Height) || Collision.WetCollision(Position, Width, Height))
{
if ((double) this.velocity.Y > 0.0)
this.velocity.Y = 0.0f;
if ((double) this.velocity.Y > -4.0)
{
this.velocity.Y -= 2f;
}
else
{
this.velocity.Y -= 4f;
this.localAI[0] += 2f;
}
if ((double) this.velocity.Y < -16.0)
this.velocity.Y = -16f;
}
else
{
--this.localAI[0];
if ((double) this.localAI[0] < 0.0)
this.localAI[0] = 0.0f;
if ((double) this.velocity.Y < 0.0)
this.velocity.Y = 0.0f;
if ((double) this.velocity.Y < 4.0)
this.velocity.Y += 2f;
else
this.velocity.Y += 4f;
if ((double) this.velocity.Y > 16.0)
this.velocity.Y = 16f;
}
}
if ((double) this.ai[0] < (double) num1 - 30.0)
{
for (int index = 0; index < 1; ++index)
{
float num4 = -1f;
float num5 = 0.9f;
float amount = Main.rand.NextFloat();
Vector2 vector2_3 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(num4, num5, amount));
vector2_3.X *= MathHelper.Lerp(2.2f, 0.6f, amount);
vector2_3.X *= -1f;
Vector2 vector2_4 = new Vector2(6f, 10f);
Vector2 Position = vector2_1 + vector2_2 * vector2_3 * 0.5f + vector2_4;
Dust dust = Main.dust[Dust.NewDust(Position, 0, 0, 274)];
dust.position = Position;
dust.fadeIn = 1.3f;
dust.scale = 0.87f;
dust.alpha = 211;
if ((double) vector2_3.X > -1.20000004768372)
dust.velocity.X = 1f + Main.rand.NextFloat();
dust.noGravity = true;
dust.velocity.Y = (float) ((double) Main.rand.NextFloat() * -0.5 - 1.29999995231628);
dust.velocity.X += this.velocity.X * 2.1f;
dust.noLight = true;
}
}
Vector2 Position1 = this.Bottom + new Vector2(-25f, -25f);
for (int index = 0; index < 4; ++index)
{
Dust dust = Dust.NewDustDirect(Position1, 50, 25, 31, this.velocity.X, -2f, 100);
dust.fadeIn = 1.1f;
dust.noGravity = true;
}
for (int index = 0; index < 1; ++index)
{
if (Main.rand.Next(5) == 0)
{
Gore gore = Gore.NewGoreDirect(this.TopLeft + Main.rand.NextVector2Square(0.0f, 1f) * this.Size, new Vector2(this.velocity.X * 1.5f, (float) (-(double) Main.rand.NextFloat() * 16.0)), Utils.SelectRandom<int>(Main.rand, 1007, 1008, 1008));
gore.timeLeft = 60;
gore.alpha = 50;
gore.velocity.X += this.velocity.X;
}
}
for (int index = 0; index < 1; ++index)
{
if (Main.rand.Next(7) == 0)
{
Gore gore = Gore.NewGoreDirect(this.TopLeft + Main.rand.NextVector2Square(0.0f, 1f) * this.Size, new Vector2(this.velocity.X * 1.5f, (float) (-(double) Main.rand.NextFloat() * 16.0)), Utils.SelectRandom<int>(Main.rand, 1007, 1008, 1008));
gore.timeLeft = 0;
gore.alpha = 80;
}
}
for (int index = 0; index < 1; ++index)
{
if (Main.rand.Next(7) == 0)
{
Gore gore = Gore.NewGoreDirect(this.TopLeft + Main.rand.NextVector2Square(0.0f, 1f) * this.Size, new Vector2(this.velocity.X * 1.5f, (float) (-(double) Main.rand.NextFloat() * 16.0)), Utils.SelectRandom<int>(Main.rand, 1007, 1008, 1008));
gore.timeLeft = 0;
gore.alpha = 80;
}
}
}
public bool AI_137_CanHit(Vector2 targetPosition)
{
if (WorldGen.SolidTile((int) targetPosition.X / 16, (int) targetPosition.Y / 16))
return false;
Vector2 Position1 = this.Top + Vector2.UnitY * 20f;
bool flag = Collision.CanHitLine(Position1, 0, 0, targetPosition, 0, 0);
if (!flag)
{
Vector2 v = targetPosition - Position1;
Vector2 spinningpoint = v.SafeNormalize(Vector2.UnitY);
Vector2 vector2_1 = Vector2.Lerp(Position1, targetPosition, 0.5f);
Vector2 vector2_2 = vector2_1 + spinningpoint.RotatedBy(1.57079637050629) * v.Length() * 0.2f;
if (Collision.CanHitLine(Position1, 0, 0, vector2_2, 0, 0) && Collision.CanHitLine(vector2_2, 0, 0, targetPosition, 0, 0))
flag = true;
if (!flag)
{
Vector2 vector2_3 = vector2_1 + spinningpoint.RotatedBy(-1.57079637050629) * v.Length() * 0.2f;
if (Collision.CanHitLine(Position1, 0, 0, vector2_3, 0, 0) && Collision.CanHitLine(vector2_3, 0, 0, targetPosition, 0, 0))
flag = true;
}
}
return flag;
}
private Point GetScarabBombDigDirectionSnap8()
{
Vector2 vector2 = this.DirectionTo(Main.player[this.owner].Center);
Point point = new Point((double) vector2.X > 0.0 ? -1 : 1, (double) vector2.Y > 0.0 ? -1 : 1);
if ((double) Math.Abs(vector2.X) > (double) Math.Abs(vector2.Y) * 2.0)
point.Y = 0;
else if ((double) Math.Abs(vector2.Y) > (double) Math.Abs(vector2.X) * 2.0)
point.X = 0;
return point;
}
public Color GetFirstFractalColor() => Main.hslToRgb(this.ai[1], 1f, 0.5f);
public void Kill_DirtAndFluidProjectiles_RunDelegateMethodPushUpForHalfBricks(
Point pt,
float size,
Utils.TileActionAttempt plot)
{
Tile tile = Main.tile[pt.X, pt.Y];
if (tile != null && tile.active() && tile.halfBrick())
{
int index = pt.Y - 1;
if (index >= 0 && !WorldGen.SolidOrSlopedTile(Main.tile[pt.X, index]))
--pt.Y;
}
DelegateMethods.v2_1 = pt.ToVector2();
DelegateMethods.f_1 = size;
Utils.PlotTileArea(pt.X, pt.Y, plot);
}
public void Kill()
{
// ISSUE: The method is too long to display (51354 instructions)
}
private void DoRainbowCrystalStaffExplosion()
{
Vector2 spinningpoint = new Vector2(0.0f, -3f).RotatedByRandom(3.14159274101257);
float num1 = (float) Main.rand.Next(7, 13);
Vector2 vector2 = new Vector2(2.1f, 2f);
Color rgb = Main.hslToRgb(this.ai[0], 1f, 0.5f);
rgb.A = byte.MaxValue;
for (float num2 = 0.0f; (double) num2 < (double) num1; ++num2)
{
int dustIndex = Dust.NewDust(this.Center, 0, 0, 267, newColor: rgb);
Main.dust[dustIndex].position = this.Center;
Main.dust[dustIndex].velocity = spinningpoint.RotatedBy(6.28318548202515 * (double) num2 / (double) num1) * vector2 * (float) (0.800000011920929 + (double) Main.rand.NextFloat() * 0.400000005960464);
Main.dust[dustIndex].noGravity = true;
Main.dust[dustIndex].scale = 2f;
Main.dust[dustIndex].fadeIn = Main.rand.NextFloat() * 2f;
if (dustIndex != 6000)
{
Dust dust = Dust.CloneDust(dustIndex);
dust.scale /= 2f;
dust.fadeIn /= 2f;
dust.color = new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue);
}
}
for (float num3 = 0.0f; (double) num3 < (double) num1; ++num3)
{
int dustIndex = Dust.NewDust(this.Center, 0, 0, 267, newColor: rgb);
Main.dust[dustIndex].position = this.Center;
Main.dust[dustIndex].velocity = spinningpoint.RotatedBy(6.28318548202515 * (double) num3 / (double) num1) * vector2 * (float) (0.800000011920929 + (double) Main.rand.NextFloat() * 0.400000005960464);
Main.dust[dustIndex].velocity *= Main.rand.NextFloat() * 0.8f;
Main.dust[dustIndex].noGravity = true;
Main.dust[dustIndex].scale = Main.rand.NextFloat() * 1f;
Main.dust[dustIndex].fadeIn = Main.rand.NextFloat() * 2f;
if (dustIndex != 6000)
{
Dust dust = Dust.CloneDust(dustIndex);
dust.scale /= 2f;
dust.fadeIn /= 2f;
dust.color = new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue);
}
}
}
private bool ShouldWallExplode(
Vector2 compareSpot,
int radius,
int minI,
int maxI,
int minJ,
int maxJ)
{
bool flag = false;
for (int index1 = minI; index1 <= maxI; ++index1)
{
for (int index2 = minJ; index2 <= maxJ; ++index2)
{
double num1 = (double) Math.Abs((float) index1 - compareSpot.X / 16f);
float num2 = Math.Abs((float) index2 - compareSpot.Y / 16f);
if (Math.Sqrt(num1 * num1 + (double) num2 * (double) num2) < (double) radius && Main.tile[index1, index2] != null && Main.tile[index1, index2].wall == (ushort) 0)
{
flag = true;
break;
}
}
}
return flag;
}
public Color GetFloatingDaggerMinionGlowColor() => Main.hslToRgb((float) (0.660000026226044 + 0.330000013113022 * (double) ((float) (this.whoAmI % 6) / 6f)), 0.7f, 0.6f) * 0.7f;
private bool CanExplodeTile(int x, int y)
{
if (Main.tileDungeon[(int) Main.tile[x, y].type] || TileID.Sets.BasicChest[(int) Main.tile[x, y].type])
return false;
switch (Main.tile[x, y].type)
{
case 26:
case 37:
case 88:
case 107:
case 108:
case 111:
case 211:
case 221:
case 222:
case 223:
case 226:
case 237:
return false;
case 58:
if (!Main.hardMode)
return false;
break;
case 77:
if (!Main.hardMode && y >= Main.UnderworldLayer)
return false;
break;
case 137:
if (!NPC.downedGolemBoss)
{
switch ((int) Main.tile[x, y].frameY / 18)
{
case 1:
case 2:
case 3:
case 4:
return false;
}
}
else
break;
break;
}
return true;
}
private void ExplodeTiles(
Vector2 compareSpot,
int radius,
int minI,
int maxI,
int minJ,
int maxJ,
bool wallSplode)
{
AchievementsHelper.CurrentlyMining = true;
for (int index1 = minI; index1 <= maxI; ++index1)
{
for (int index2 = minJ; index2 <= maxJ; ++index2)
{
double num1 = (double) Math.Abs((float) index1 - compareSpot.X / 16f);
float num2 = Math.Abs((float) index2 - compareSpot.Y / 16f);
if (Math.Sqrt(num1 * num1 + (double) num2 * (double) num2) < (double) radius)
{
bool flag = true;
if (Main.tile[index1, index2] != null && Main.tile[index1, index2].active())
{
flag = this.CanExplodeTile(index1, index2);
if (flag)
{
WorldGen.KillTile(index1, index2);
if (!Main.tile[index1, index2].active() && Main.netMode != 0)
NetMessage.SendData(17, number2: ((float) index1), number3: ((float) index2));
}
}
if (flag)
{
for (int i = index1 - 1; i <= index1 + 1; ++i)
{
for (int j = index2 - 1; j <= index2 + 1; ++j)
{
if (Main.tile[i, j] != null && Main.tile[i, j].wall > (ushort) 0 && wallSplode)
{
WorldGen.KillWall(i, j);
if (Main.tile[i, j].wall == (ushort) 0 && Main.netMode != 0)
NetMessage.SendData(17, number: 2, number2: ((float) i), number3: ((float) j));
}
}
}
}
}
}
}
AchievementsHelper.CurrentlyMining = false;
}
private void ExplodeCrackedTiles(
Vector2 compareSpot,
int radius,
int minI,
int maxI,
int minJ,
int maxJ)
{
AchievementsHelper.CurrentlyMining = true;
for (int i = minI; i <= maxI; ++i)
{
for (int j = minJ; j <= maxJ; ++j)
{
double num1 = (double) Math.Abs((float) i - compareSpot.X / 16f);
float num2 = Math.Abs((float) j - compareSpot.Y / 16f);
if (Math.Sqrt(num1 * num1 + (double) num2 * (double) num2) < (double) radius)
{
bool flag = false;
if (Main.tile[i, j] != null && Main.tile[i, j].active())
{
if (Main.tile[i, j].type >= (ushort) 481 && Main.tile[i, j].type <= (ushort) 483)
flag = true;
if (flag)
{
WorldGen.KillTile(i, j);
if (!Main.tile[i, j].active() && Main.netMode != 0)
NetMessage.SendData(17, number2: ((float) i), number3: ((float) j));
}
}
}
}
}
AchievementsHelper.CurrentlyMining = false;
}
public bool TryGetContainerIndex(out int containerIndex)
{
containerIndex = -1;
if (this.type == 525)
{
containerIndex = -2;
return true;
}
if (this.type != 734)
return false;
containerIndex = -5;
return true;
}
public bool IsInteractible()
{
switch (this.type)
{
case 525:
case 734:
return true;
default:
return false;
}
}
public Color GetAlpha(Color newColor)
{
if (this.type == 937)
newColor.A = (byte) ((double) newColor.A * 0.75);
if (this.type == 880 || this.type == 929)
newColor.A /= (byte) 2;
if (this.type == 855)
newColor = Color.Lerp(newColor, new Color((int) byte.MaxValue, 200, 60), 0.5f);
if (this.type == 933)
newColor = Color.White * this.Opacity;
if (this.type == 270)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) Utils.WrappedLerp(0.0f, (float) byte.MaxValue, (float) (this.timeLeft % 40) / 40f));
if (this.type == 837)
return this.alpha > 0 ? Color.Transparent : new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 200);
if (this.type == 180 || this.type == 345 || this.type == 586)
return Color.Lerp(newColor, Color.White, 0.75f);
if (this.type == 764 || this.type == 856 || this.type == 857 || this.type == 864)
return Color.White;
if (this.type == 873 || this.type == 872 || this.type == 931 || this.type == 913 || this.type == 34)
return Color.White * this.Opacity;
if (this.type == 756)
return Color.Lerp(newColor, Color.Black, 0.25f);
if (this.type == 895)
return Color.White * this.Opacity;
if (this.type == 893 || this.type == 907)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 150);
if (this.type == 833 || this.type == 834 || this.type == 835 || this.type == 912)
return Color.Lerp(newColor, Color.White, 0.25f);
if (this.type == 351 || this.type == 350)
{
Point tileCoordinates = this.Center.ToTileCoordinates();
return WorldGen.InWorld(tileCoordinates.X, tileCoordinates.Y) && !WorldGen.SolidTile(tileCoordinates.X, tileCoordinates.Y) ? Color.Lerp(newColor, Color.White, 0.15f) : Color.Lerp(newColor, Color.White, 0.05f);
}
if (this.type == 346 || this.type == 347 || this.type == 325 || this.type == 755)
return Color.Lerp(newColor, Color.White, 0.75f);
int num1;
int num2;
int num3;
if (this.type == 650)
{
int num4 = (int) ((double) newColor.R * 1.5);
int num5 = (int) ((double) newColor.G * 1.5);
int num6 = (int) ((double) newColor.B * 1.5);
if (num4 > (int) byte.MaxValue)
num1 = (int) byte.MaxValue;
if (num5 > (int) byte.MaxValue)
num2 = (int) byte.MaxValue;
if (num6 > (int) byte.MaxValue)
num3 = (int) byte.MaxValue;
}
else
{
if (this.type == 948)
return Color.White;
if (this.type == 604 || this.type == 631)
return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, 0);
if (this.type == 636)
return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, 64 - this.alpha / 4);
if (this.type == 673 || this.type == 706)
return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, 180 - this.alpha / 2 - this.alpha / 4);
if (this.type == 603 || this.type == 633)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 200);
if (this.type == 623 || this.type >= 625 && this.type <= 628 || this.type == 710)
return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha);
if (this.type == 645 || this.type == 643)
return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) sbyte.MaxValue - this.alpha / 2);
if (this.type == 611)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 200);
if (this.type == 640 || this.type == 644 || this.type == 658)
return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, 0);
if (this.type == 612)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue);
if (this.aiStyle == 105)
return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha);
if (this.type == 554)
return new Color(200, 200, 200, 200);
if (this.type == 601)
return PortalHelper.GetPortalColor(this.owner, (int) this.ai[0]);
if (this.type == 602)
{
Color portalColor = PortalHelper.GetPortalColor(this.owner, (int) this.ai[1]);
portalColor.A = (byte) 227;
return portalColor;
}
if (this.type == 585)
{
byte a = newColor.A;
newColor = Color.Lerp(newColor, Color.White, 0.5f);
newColor.A = a;
return newColor;
}
if (this.type == 714)
{
byte a = newColor.A;
newColor = Color.Lerp(newColor, Color.White, 0.8f);
newColor.A = a;
newColor *= (float) a / (float) byte.MaxValue;
return newColor;
}
if (this.type == 573 || this.type == 578 || this.type == 579 || this.type == 617 || this.type == 641 || this.type == 707 || this.type == 813)
return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha);
if (this.type == 9 || this.type == 490)
return Color.White;
if (this.type == 575 || this.type == 596 || this.type == 659)
{
if (this.timeLeft < 30)
this.alpha = (int) ((double) byte.MaxValue - (double) byte.MaxValue * (double) ((float) this.timeLeft / 30f));
return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, 128 - this.alpha / 2);
}
if (this.type == 546)
return new Color((int) byte.MaxValue, 200, (int) byte.MaxValue, 200);
if (this.type == 553)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, 200, 200);
if (this.type == 540)
return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, 0);
if (this.type == 498)
return new Color((int) byte.MaxValue, 100, 20, 200);
if (this.type == 538)
return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha);
if (this.type == 518)
{
float num7 = (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
return new Color((int) (200.0 * (double) num7), (int) (200.0 * (double) num7), (int) (200.0 * (double) num7), (int) (100.0 * (double) num7));
}
if (this.type == 518 || this.type == 595 || this.type == 735)
{
Color color = Color.Lerp(newColor, Color.White, 0.85f);
color.A = (byte) 128;
return color * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
}
if (this.type == 536 || this.type == 607)
return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, 63 - this.alpha / 4);
if (this.type == 591)
return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, 63 - this.alpha / 4);
if (this.type == 493 || this.type == 494)
return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha);
if (this.type == 492)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue);
if (this.type == 491)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue);
if (this.type == 485 || this.type == 502)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 200);
if (this.type == 488)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue);
if (this.type == 477 || this.type == 478 || this.type == 479)
return this.alpha == 0 ? new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 200) : new Color(0, 0, 0, 0);
if (this.type == 473)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue);
if (this.type == 50 || this.type == 53 || this.type == 515 || this.type == 870)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0);
if (this.type == 723 || this.type == 724 || this.type == 725 || this.type == 726 || this.type == 728)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0) * this.Opacity;
if (this.type == 92)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0);
if (this.type == 91)
return new Color(200, 200, 200, 0);
if (this.type == 34 || this.type == 15 || this.type == 93 || this.type == 94 || this.type == 95 || this.type == 96 || this.type == 253 || this.type == 258 || this.type == 102 && this.alpha < (int) byte.MaxValue)
return new Color(200, 200, 200, 25);
if (this.type == 465)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0) * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
if (this.type == 503)
{
Color color1 = Color.Lerp(newColor, Color.White, 0.5f) * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
Color color2 = Color.Lerp(Color.Purple, Color.White, 0.33f);
float num8 = (float) (0.25 + Math.Cos((double) this.localAI[0]) * 0.25);
Color color3 = color2;
double num9 = (double) num8;
return Color.Lerp(color1, color3, (float) num9);
}
if (this.type == 467)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue) * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
if (this.type == 694 || this.type == 695 || this.type == 696)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue) * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
if (this.type == 634 || this.type == 635)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue) * this.Opacity;
if (this.type == 671)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue) * this.Opacity;
if (this.type == 664 || this.type == 666 || this.type == 668)
{
newColor = Color.Lerp(newColor, Color.White, 0.5f);
return new Color((int) newColor.R, (int) newColor.G, (int) newColor.B, 200) * this.Opacity;
}
if (this.type == 451)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 200) * (float) (((double) byte.MaxValue - (double) this.alpha) / (double) byte.MaxValue);
if (this.type == 684)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 200) * (float) (((double) byte.MaxValue - (double) this.alpha) / (double) byte.MaxValue);
if (this.type == 454 || this.type == 452)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue) * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
if (this.type == 464)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue) * (float) (((double) byte.MaxValue - (double) this.alpha) / (double) byte.MaxValue);
if (this.type == 450)
return new Color(200, 200, 200, (int) byte.MaxValue - this.alpha);
if (this.type == 459 || this.type == 709)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 200);
if (this.type == 447)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 200);
if (this.type == 446)
return Color.Lerp(newColor, Color.White, 0.8f) * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
if (this.type == 691 || this.type == 692 || this.type == 693)
return Color.Lerp(newColor, Color.White, 0.4f) * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
if (this.type >= 646 && this.type <= 649)
return Color.Lerp(newColor, Color.White, 0.8f) * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
if (this.type == 445)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 128) * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
if (this.type == 440 || this.type == 449 || this.type == 606)
{
num1 = (int) byte.MaxValue - this.alpha;
num2 = (int) byte.MaxValue - this.alpha;
num3 = (int) byte.MaxValue - this.alpha;
}
else
{
if (this.type == 444)
return newColor * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
if (this.type == 443 || this.type == 675 || this.type == 686 || this.type == 711)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 128) * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
if (this.type == 676)
return newColor * this.Opacity;
if (this.type == 438)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 128) * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
if (this.type == 592)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 128) * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
if (this.type == 437 || this.type == 700)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0) * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
if (this.type == 462)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 128) * (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
if (this.type == 352)
{
Color color = Color.Lerp(newColor, Color.White, 0.5f);
color.A = (byte) ((double) color.A * ((double) this.alpha / (double) byte.MaxValue));
return new Color((int) color.R, (int) color.G, (int) color.B, (int) color.A);
}
if (this.type == 435 || this.type == 732 || this.type == 731)
{
newColor = Color.Lerp(newColor, Color.White, 0.8f);
return new Color((int) newColor.R, (int) newColor.G, (int) newColor.B, 25);
}
if (this.type == 682)
{
newColor = Color.Lerp(newColor, Color.White, 0.8f);
return new Color((int) newColor.R, (int) newColor.G, (int) newColor.B, (int) sbyte.MaxValue);
}
if (this.type == 436)
{
newColor = Color.Lerp(newColor, Color.White, 0.8f);
return new Color((int) newColor.R, (int) newColor.G, (int) newColor.B, 25);
}
if (this.type == 409)
return new Color(250, 250, 250, 200);
if (this.type == 348 || this.type == 349)
return new Color(200, 200, 200, this.alpha);
if (this.type == 337)
return new Color(250, 250, 250, 150);
if (this.type >= 424 && this.type <= 426)
{
byte num10 = 150;
if ((int) newColor.R < (int) num10)
newColor.R = num10;
if ((int) newColor.G < (int) num10)
newColor.G = num10;
if ((int) newColor.B < (int) num10)
newColor.B = num10;
return new Color((int) newColor.R, (int) newColor.G, (int) newColor.B, (int) byte.MaxValue);
}
if (this.type == 431 || this.type == 432)
return new Color(250, 250, 250, (int) byte.MaxValue - this.alpha);
if (this.type == 343 || this.type == 344)
{
float num11 = (float) (1.0 - (double) this.alpha / (double) byte.MaxValue);
return new Color((int) (250.0 * (double) num11), (int) (250.0 * (double) num11), (int) (250.0 * (double) num11), (int) (100.0 * (double) num11));
}
if (this.type == 332)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue);
if (this.type == 329)
return new Color(200, 200, 200, 50);
if (this.type >= 326 && this.type <= 328 || this.type >= 400 && this.type <= 402)
return Color.Transparent;
if (this.type == 324 && this.frame >= 6 && this.frame <= 9)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue);
if (this.type == 16)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0);
if (this.type == 321)
return new Color(200, 200, 200, 0);
if (this.type == 76 || this.type == 77 || this.type == 78)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0);
if (this.type == 308)
return new Color(200, 200, (int) byte.MaxValue, 125);
if (this.type == 263)
return this.timeLeft < (int) byte.MaxValue ? new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) (byte) this.timeLeft) : new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue);
if (this.type == 274)
{
if (this.timeLeft >= 85)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 100);
byte num12 = (byte) (this.timeLeft * 3);
byte num13 = (byte) (100.0 * ((double) num12 / (double) byte.MaxValue));
return new Color((int) num12, (int) num12, (int) num12, (int) num13);
}
if (this.type == 5)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0);
if (this.type == 300 || this.type == 301)
return new Color(250, 250, 250, 50);
if (this.type == 712)
return Color.Lerp(newColor, Color.White, 0.4f) * this.Opacity;
if (this.type == 304)
return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) (byte) ((double) ((int) byte.MaxValue - this.alpha) / 3.0));
if (this.type == 116 || this.type == 132 || this.type == 156 || this.type == 157 || this.type == 157 || this.type == 173)
{
if ((double) this.localAI[1] >= 15.0)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, this.alpha);
if ((double) this.localAI[1] < 5.0)
return Color.Transparent;
int num14 = (int) (((double) this.localAI[1] - 5.0) / 10.0 * (double) byte.MaxValue);
return new Color(num14, num14, num14, num14);
}
if (this.type == 254)
{
if (this.timeLeft < 30)
this.alpha = (int) ((double) byte.MaxValue - (double) byte.MaxValue * (double) ((float) this.timeLeft / 30f));
return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, 0);
}
if (this.type == 265 || this.type == 355)
return this.alpha > 0 ? Color.Transparent : new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0);
if (this.type == 257)
return this.alpha > 200 ? Color.Transparent : new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, 0);
if (this.type == 259)
return this.alpha > 200 ? Color.Transparent : new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, 0);
if (this.type >= 150 && this.type <= 152)
return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha);
if (this.type == 250)
return Color.Transparent;
if (this.type == 251)
return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, 0);
if (this.type == 131)
return new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, 0);
if (this.type == 211)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0);
if (this.type == 229)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 50);
if (this.type == 221 || this.type == 729)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 200);
if (this.type == 20)
return this.alpha <= 150 ? new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0) : new Color(0, 0, 0, 0);
if (this.type == 207)
{
num1 = (int) byte.MaxValue - this.alpha;
num2 = (int) byte.MaxValue - this.alpha;
num3 = (int) byte.MaxValue - this.alpha;
}
else
{
if (this.type == 242)
return this.alpha < 140 ? new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 100) : Color.Transparent;
if (this.type == 638)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 100) * this.Opacity;
if (this.type == 660)
return new Color(150, (int) byte.MaxValue, (int) byte.MaxValue, 0) * this.Opacity;
if (this.type == 209)
{
num1 = (int) newColor.R - this.alpha;
num2 = (int) newColor.G - this.alpha;
num3 = (int) newColor.B - this.alpha / 2;
}
else
{
if (this.type == 130)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 175);
if (this.type == 182)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 200);
if (this.type == 226)
{
int maxValue1 = (int) byte.MaxValue;
int maxValue2 = (int) byte.MaxValue;
int maxValue3 = (int) byte.MaxValue;
float num15 = (float) ((double) Main.mouseTextColor / 200.0 - 0.300000011920929);
int num16 = (int) ((double) maxValue1 * (double) num15);
int num17 = (int) ((double) maxValue2 * (double) num15);
int num18 = (int) ((double) maxValue3 * (double) num15);
int r = num16 + 50;
if (r > (int) byte.MaxValue)
r = (int) byte.MaxValue;
int g = num17 + 50;
if (g > (int) byte.MaxValue)
g = (int) byte.MaxValue;
int b = num18 + 50;
if (b > (int) byte.MaxValue)
b = (int) byte.MaxValue;
return new Color(r, g, b, 200);
}
if (this.type == 227)
{
int maxValue;
int num19 = maxValue = (int) byte.MaxValue;
int num20 = maxValue;
int num21 = maxValue;
float num22 = (float) ((double) Main.mouseTextColor / 100.0 - 1.60000002384186);
int num23 = (int) ((double) num21 * (double) num22);
int num24 = (int) ((double) num20 * (double) num22);
int num25 = (int) ((double) num19 * (double) num22);
int a = (int) (100.0 * (double) num22);
int r = num23 + 50;
if (r > (int) byte.MaxValue)
r = (int) byte.MaxValue;
int g = num24 + 50;
if (g > (int) byte.MaxValue)
g = (int) byte.MaxValue;
int b = num25 + 50;
if (b > (int) byte.MaxValue)
b = (int) byte.MaxValue;
return new Color(r, g, b, a);
}
if (this.type == 114 || this.type == 115)
{
if ((double) this.localAI[1] >= 15.0)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, this.alpha);
if ((double) this.localAI[1] < 5.0)
return Color.Transparent;
int num26 = (int) (((double) this.localAI[1] - 5.0) / 10.0 * (double) byte.MaxValue);
return new Color(num26, num26, num26, num26);
}
if (this.type == 83 || this.type == 88 || this.type == 89 || this.type == 90 || this.type == 100 || this.type == 104 || this.type == 279 || this.type >= 283 && this.type <= 287 || this.type == 876)
return this.alpha < 200 ? new Color((int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, (int) byte.MaxValue - this.alpha, 0) : Color.Transparent;
if (this.type == 34 || this.type == 35 || this.type == 15 || this.type == 19 || this.type == 44 || this.type == 45)
return Color.White;
if (this.type == 79)
{
num1 = Main.DiscoR;
num2 = Main.DiscoG;
num3 = Main.DiscoB;
return new Color();
}
if (this.type == 9 || this.type == 15 || this.type == 34 || this.type == 50 || this.type == 53 || this.type == 76 || this.type == 77 || this.type == 78 || this.type == 92 || this.type == 91)
{
num1 = (int) newColor.R - this.alpha / 3;
num2 = (int) newColor.G - this.alpha / 3;
num3 = (int) newColor.B - this.alpha / 3;
}
else
{
if (this.type == 18)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 50);
if (this.type == 16 || this.type == 44 || this.type == 45)
{
num1 = (int) newColor.R;
num2 = (int) newColor.G;
num3 = (int) newColor.B;
}
else if (this.type == 12 || this.type == 72 || this.type == 86 || this.type == 87)
return new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) newColor.A - this.alpha);
}
}
}
}
}
float num27 = (float) ((int) byte.MaxValue - this.alpha) / (float) byte.MaxValue;
int r1 = (int) ((double) newColor.R * (double) num27);
int g1 = (int) ((double) newColor.G * (double) num27);
int b1 = (int) ((double) newColor.B * (double) num27);
int a1 = (int) newColor.A - this.alpha;
if (a1 < 0)
a1 = 0;
if (a1 > (int) byte.MaxValue)
a1 = (int) byte.MaxValue;
return new Color(r1, g1, b1, a1);
}
public override string ToString() => "type:" + (object) this.type + "name:" + this.Name + ", active:" + this.active.ToString() + ", whoAmI:" + (object) this.whoAmI + ", identity:" + (object) this.identity + ", ai0:" + (object) this.ai[0] + " , uuid:" + (object) this.projUUID;
private class NPCDistanceByIndexComparator : IComparer<Tuple<int, float>>
{
public int Compare(Tuple<int, float> npcIndex1, Tuple<int, float> npcIndex2) => npcIndex1.Item2.CompareTo(npcIndex2.Item2);
}
public struct HallowBossPelletStormInfo
{
public float StartAngle;
public float AnglePerBullet;
public int BulletsInStorm;
public float BulletsProgressInStormStartNormalized;
public float BulletsProgressInStormBonusByIndexNormalized;
public float StormTotalRange;
public Vector2 BulletSize;
public float GetBulletProgress(int bulletIndex) => this.BulletsProgressInStormStartNormalized + this.BulletsProgressInStormBonusByIndexNormalized * (float) bulletIndex;
public bool IsValid(int bulletIndex)
{
float bulletProgress = this.GetBulletProgress(bulletIndex);
return (double) bulletProgress >= 0.0 && (double) bulletProgress <= 1.0;
}
public Vector2 GetBulletPosition(int bulletIndex, Vector2 centerPoint) => centerPoint + Vector2.UnitX.RotatedBy((double) this.StartAngle + (double) this.AnglePerBullet * (double) bulletIndex) * this.StormTotalRange * this.GetBulletProgress(bulletIndex);
public Microsoft.Xna.Framework.Rectangle GetBulletHitbox(
int bulletIndex,
Vector2 centerPoint)
{
return Utils.CenteredRectangle(this.GetBulletPosition(bulletIndex, centerPoint), this.BulletSize);
}
}
}
}