public override bool Perform(Point origin, GenAction action) { Vector2 vector = new Vector2((float)this._offset.X, (float)this._offset.Y); float num = vector.Length(); int num2 = (int)(num / 6f); if (this._endPoints != null) { this._endPoints.Add(new Point(origin.X + this._offset.X, origin.Y + this._offset.Y)); } if (!this.PerformSegment(origin, action, origin, new Point(origin.X + this._offset.X, origin.Y + this._offset.Y), num2)) { return false; } int num3 = (int)(num / 8f); for (int i = 0; i < num3; i++) { float num4 = ((float)i + 1f) / ((float)num3 + 1f); Point point = new Point((int)(num4 * (float)this._offset.X), (int)(num4 * (float)this._offset.Y)); Vector2 spinningpoint = new Vector2((float)(this._offset.X - point.X), (float)(this._offset.Y - point.Y)); spinningpoint = spinningpoint.RotatedBy((double)(((float)GenBase._random.NextDouble() * 0.5f + 1f) * (float)((GenBase._random.Next(2) == 0) ? -1 : 1)), default(Vector2)) * 0.75f; Point point2 = new Point((int)spinningpoint.X + point.X, (int)spinningpoint.Y + point.Y); if (this._endPoints != null) { this._endPoints.Add(new Point(point2.X + origin.X, point2.Y + origin.Y)); } if (!this.PerformSegment(origin, action, new Point(point.X + origin.X, point.Y + origin.Y), new Point(point2.X + origin.X, point2.Y + origin.Y), num2 - 1)) { return false; } } return true; }
public override void Apply(Entity entity, DrawData? drawData) { if (entity == null) { this._shader.Parameters["uLightSource"].SetValue(Vector3.Zero); } else { float num = 0f; if (drawData.HasValue) { num = drawData.Value.rotation; } Vector2 value = entity.position; float num2 = (float)entity.width; float num3 = (float)entity.height; value += new Vector2(num2, num3) * 0.1f; num2 *= 0.8f; num3 *= 0.8f; Vector3 subLight = Lighting.GetSubLight(value + new Vector2(num2 * 0.5f, 0f)); Vector3 subLight2 = Lighting.GetSubLight(value + new Vector2(0f, num3 * 0.5f)); Vector3 subLight3 = Lighting.GetSubLight(value + new Vector2(num2, num3 * 0.5f)); Vector3 subLight4 = Lighting.GetSubLight(value + new Vector2(num2 * 0.5f, num3)); float num4 = subLight.X + subLight.Y + subLight.Z; float num5 = subLight2.X + subLight2.Y + subLight2.Z; float num6 = subLight3.X + subLight3.Y + subLight3.Z; float num7 = subLight4.X + subLight4.Y + subLight4.Z; Vector2 vector = new Vector2(num6 - num5, num7 - num4); float num8 = vector.Length(); if (num8 > 1f) { num8 = 1f; vector /= num8; } if (entity.direction == -1) { vector.X *= -1f; } vector = vector.RotatedBy((double)(-(double)num), default(Vector2)); Vector3 value2 = new Vector3(vector, 1f - (vector.X * vector.X + vector.Y * vector.Y)); value2.X *= 2f; value2.Y -= 0.15f; value2.Y *= 2f; value2.Normalize(); value2.Z *= 0.6f; this._shader.Parameters["uLightSource"].SetValue(value2); } base.Apply(entity, drawData); }
public override void AI() { projectile.velocity.Y = 5; //CONFIG INFO int range = 50; //How many tiles away the projectile targets NPCs int animSpeed = 2; //how many game frames per frame :P note: firing anims are twice as fast currently int targetingMax = 15; //how many frames allowed to target nearest instead of shooting float shootVelocity = 6f; //magnitude of the shoot vector (speed of arrows shot) //TARGET NEAREST NPC WITHIN RANGE float lowestDist = float.MaxValue; foreach (NPC npc in Main.npc) { //if npc is a valid target (active, not friendly, and not a critter) if (npc.active && !npc.friendly && npc.catchItem == 0) { //if npc is within 50 blocks float dist = projectile.Distance(npc.Center); if (dist / 16 < range) { //if npc is closer than closest found npc if (dist < lowestDist) { lowestDist = dist; //target this npc projectile.ai[1] = npc.whoAmI; } } } } NPC target = (Main.npc[(int)projectile.ai[1]] ?? new NPC()); //our target if (projectile.frame < 5) { //do nuffin... until target in range if (target.active && projectile.Distance(target.Center) / 16 < range) { projectile.frameCounter++; //proceed if rotated in the right direction if (projectile.rotation == projectile.DirectionTo(target.position).ToRotation() && projectile.frameCounter % 2 == 1) { projectile.frame++; projectile.frameCounter = 0; } //proceed if still haven't locked on (targets change too quickly, etc) else if (projectile.frameCounter >= targetingMax) { projectile.frame++; projectile.frameCounter = 0; } } else { projectile.frameCounter = 0; } } //firing else if (projectile.frame == 5) { projectile.frameCounter++; //fire!! if (projectile.frameCounter % animSpeed == 0) { //spawn the arrow centered on the bow (this code aligns the centers :3) Vector2 vel = projectile.DirectionTo(target.Center); Vector2 vel7 = new Vector2(-1, 0); vel7 *= shootVelocity; vel7 = vel7.RotatedBy(System.Math.PI / 13); for (int K = 0; K < 18; K++) { vel7 = vel7.RotatedBy(System.Math.PI / 13); int proj2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vel7.X, vel7.Y, 538, projectile.damage, 0, projectile.owner); Projectile newProj2 = Main.projectile[proj2]; newProj2.friendly = true; newProj2.hostile = false; projectile.frame = 1; } Main.PlaySound(2, projectile.Center, 5); //make bow shooty sound projectile.frame++; } } //finish firing anim, revert back to 0 if (projectile.frame == 6) { projectile.frame = 1; projectile.frameCounter = 0; } }
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { spikeCooldown += 1; Vector2 muzzleOffset = Vector2.Normalize(new Vector2(speedX, speedY)) * 40f; if (Collision.CanHit(position, 0, 0, position + muzzleOffset, 0, 0)) { position += muzzleOffset; } if (spikeCooldown == 1) { Main.PlaySound(SoundID.Item92); Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType <WaveMichi>(), damage, knockBack, player.whoAmI); } if (spikeCooldown == 2) { Main.PlaySound(SoundID.Item92); Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType <WaveMichi>(), damage, knockBack, player.whoAmI); } if (spikeCooldown == 3) { Main.PlaySound(SoundID.Item92); Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType <WaveMichi>(), damage, knockBack, player.whoAmI); } float numberProjectiles = 3; // 3, 4, or 5 shots float rotation = MathHelper.ToRadians(5); position += Vector2.Normalize(new Vector2(speedX, speedY)) * 45f; if (spikeCooldown == 4) { Main.PlaySound(SoundID.Item73); for (int i = 0; i < numberProjectiles; i++) { Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numberProjectiles - 1))) * .2f; // Watch out for dividing by 0 if there is only 1 projectile. Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType <SmallSpike>(), damage * 12, knockBack, player.whoAmI); } } if (spikeCooldown == 5) { Main.PlaySound(SoundID.Item73); for (int i = 0; i < numberProjectiles; i++) { Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numberProjectiles - 1))) * .2f; // Watch out for dividing by 0 if there is only 1 projectile. Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType <SmallSpike>(), damage * 12, knockBack, player.whoAmI); } } if (spikeCooldown == 6) { Main.PlaySound(SoundID.Item73); for (int i = 0; i < numberProjectiles; i++) { Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numberProjectiles - 1))) * .2f; // Watch out for dividing by 0 if there is only 1 projectile. Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType <SmallSpike>(), damage * 12, knockBack, player.whoAmI); } } if (type == ProjectileID.Bullet) { type = ModContent.ProjectileType <MichiBolt>(); } int projectileCount = 1; float startRadius = 35f; float spread = (float)Math.PI / 18f; Vector2 direction = Vector2.Normalize(new Vector2(speedX, speedY)); direction *= startRadius; if (spikeCooldown == 7) { for (int i = 0; i < projectileCount; i++) { Main.PlaySound(SoundID.Item72); float angleStep = (float)(i - (projectileCount - 1)) / 2f; Vector2 firePosition = direction.RotatedBy(angleStep * spread - 40); Projectile.NewProjectile(position.X + firePosition.X, position.Y + firePosition.Y, speedX, speedY, ModContent.ProjectileType <Spike>(), damage * 8, knockBack, player.whoAmI); } for (int i = 0; i < projectileCount; i++) { float angleStep = (float)(i - (projectileCount - 1)) / 2f; Vector2 firePosition = direction.RotatedBy(angleStep * spread + 40); Projectile.NewProjectile(position.X + firePosition.X, position.Y + firePosition.Y, speedX, speedY, ModContent.ProjectileType <Spike>(), damage * 8, knockBack, player.whoAmI); } for (int i = 0; i < projectileCount; i++) { float angleStep = (float)(i - (projectileCount - 1)) / 2f; Vector2 firePosition = direction.RotatedBy(angleStep * spread); Projectile.NewProjectile(position.X + firePosition.X, position.Y + firePosition.Y, speedX, speedY, ModContent.ProjectileType <Spike>(), damage * 8, knockBack, player.whoAmI); } } if (spikeCooldown == 8) { Main.PlaySound(SoundID.Item72); for (int i = 0; i < projectileCount; i++) { float angleStep = (float)(i - (projectileCount - 1)) / 2f; Vector2 firePosition = direction.RotatedBy(angleStep * spread - 40); Projectile.NewProjectile(position.X + firePosition.X, position.Y + firePosition.Y, speedX, speedY, ModContent.ProjectileType <Spike>(), damage * 8, knockBack, player.whoAmI); } for (int i = 0; i < projectileCount; i++) { float angleStep = (float)(i - (projectileCount - 1)) / 2f; Vector2 firePosition = direction.RotatedBy(angleStep * spread + 40); Projectile.NewProjectile(position.X + firePosition.X, position.Y + firePosition.Y, speedX, speedY, ModContent.ProjectileType <Spike>(), damage * 8, knockBack, player.whoAmI); } for (int i = 0; i < projectileCount; i++) { float angleStep = (float)(i - (projectileCount - 1)) / 2f; Vector2 firePosition = direction.RotatedBy(angleStep * spread); Projectile.NewProjectile(position.X + firePosition.X, position.Y + firePosition.Y, speedX, speedY, ModContent.ProjectileType <Spike>(), damage * 8, knockBack, player.whoAmI); } } if (spikeCooldown == 9) { Main.PlaySound(SoundID.Item72); for (int i = 0; i < projectileCount; i++) { float angleStep = (float)(i - (projectileCount - 1)) / 2f; Vector2 firePosition = direction.RotatedBy(angleStep * spread - 40); Projectile.NewProjectile(position.X + firePosition.X, position.Y + firePosition.Y, speedX, speedY, ModContent.ProjectileType <Spike>(), damage * 8, knockBack, player.whoAmI); } for (int i = 0; i < projectileCount; i++) { float angleStep = (float)(i - (projectileCount - 1)) / 2f; Vector2 firePosition = direction.RotatedBy(angleStep * spread + 40); Projectile.NewProjectile(position.X + firePosition.X, position.Y + firePosition.Y, speedX, speedY, ModContent.ProjectileType <Spike>(), damage * 8, knockBack, player.whoAmI); } for (int i = 0; i < projectileCount; i++) { float angleStep = (float)(i - (projectileCount - 1)) / 2f; Vector2 firePosition = direction.RotatedBy(angleStep * spread); Projectile.NewProjectile(position.X + firePosition.X, position.Y + firePosition.Y, speedX, speedY, ModContent.ProjectileType <Spike>(), damage * 8, knockBack, player.whoAmI); } spikeCooldown = 0; } return(true); }
public override bool PreAI() { Player player = Main.player[projectile.owner]; Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); bool channeling = (player.controlUseItem || player.controlUseTile) && player.inventory[player.selectedItem].shoot == projectile.type && !player.dead && !player.noItems && !player.CCed; if (channeling) { if (Main.myPlayer == projectile.owner) { Vector2 vector13 = Main.MouseWorld - vector; vector13.Normalize(); if (vector13.HasNaNs()) { vector13 = Vector2.UnitX * (float)player.direction; } if (vector13.X != projectile.velocity.X || vector13.Y != projectile.velocity.Y) { projectile.netUpdate = true; } projectile.velocity = vector13; } } else { projectile.Kill(); } projectile.velocity.Normalize(); projectile.rotation = projectile.velocity.ToRotation() + (projectile.direction == -1 ? 3.14f : 0); projectile.position = (vector - projectile.Size / 2f); projectile.spriteDirection = projectile.direction; projectile.timeLeft = 2; if (Main.myPlayer == projectile.owner && Main.mouseRight && Main.mouseRightRelease) { projectile.ai[1] = (projectile.ai[1] + 1) % 3; Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 23, 1, projectile.ai[1] * 0.2f); } if (Main.myPlayer == projectile.owner && Main.mouseLeft) { int rate = Math.Max(8 - ((int)projectile.localAI[0] / 20), 2); projectile.localNPCHitCooldown = rate * 2; if (projectile.localAI[0] < 40 + (projectile.ai[1] * 40)) { projectile.localAI[0] += 0.7f - (projectile.ai[1] * 0.25f); } else if (projectile.localAI[0] >= 41 + (projectile.ai[1] * 40)) { projectile.localAI[0]--; } projectile.localAI[1] = (projectile.localAI[1] + 45f / rate) % 360; projectile.ai[0]--; if (projectile.ai[0] <= 0) { projectile.ai[0] = rate; float shootSpeed = player.inventory[player.selectedItem].shootSpeed; int type = 0; Item item = new Item(); bool canShoot = false; bool flag = false; for (int i = 54; i < 58; i++) { if (player.inventory[i].ammo == AmmoID.Bullet && player.inventory[i].stack > 0) { item = player.inventory[i]; canShoot = true; flag = true; break; } } if (!flag) { for (int j = 0; j < 54; j++) { if (player.inventory[j].ammo == AmmoID.Bullet && player.inventory[j].stack > 0) { item = player.inventory[j]; canShoot = true; break; } } } if (canShoot) { Vector2 offSet = new Vector2(46, -6 * projectile.direction); offSet = offSet.RotatedBy(projectile.rotation + (projectile.direction == -1 ? 3.14f : 0)); shootSpeed += item.shootSpeed; Vector2 shootDir = projectile.velocity * shootSpeed; float spread = Math.Max(1, projectile.localAI[0] - 40) * 0.4f + Math.Max(1, projectile.localAI[0] - 80) * 1.2f; shootDir = shootDir.RotatedByRandom(MathHelper.ToRadians(spread)); type = item.shoot; if (projectile.localAI[0] > 1 && item.consumable && ItemLoader.ConsumeAmmo(player.HeldItem, item, player)) { player.ConsumeItem(item.type); } int damage = (int)((projectile.damage + item.damage) * player.bulletDamage); if (ProjectileID.Sets.Homing[type]) { damage = (int)(damage * 0.6f); } float knockBack = projectile.knockBack + item.knockBack; Projectile.NewProjectile(projectile.Center + offSet, shootDir, type, damage, knockBack, projectile.owner); Main.PlaySound(2, projectile.Center, 41); } else { Main.PlaySound(SoundLoader.customSoundType, projectile.Center, mod.GetSoundSlot(SoundType.Custom, "Sounds/Custom/MissileClick")); } } } projectile.direction = projectile.velocity.X < 0 ? -1 : 1; projectile.frame = (int)(projectile.localAI[1] / 15) % 6; player.ChangeDir(projectile.direction); player.heldProj = projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); return(false); }
public void Kill() { if (!this.active) { return; } Main.projectileIdentity[this.owner, this.identity] = -1; int num = this.timeLeft; this.timeLeft = 0; UlterrariaProjectiles.ProjectileKilled(this); if (this.type == 634 || this.type == 635) { int num2 = Utils.SelectRandom<int>(Main.rand, new int[] { 242, 73, 72, 71, 255 }); int num3 = 255; int num4 = 255; int height = 50; float num5 = 1.7f; float num6 = 0.8f; float num7 = 2f; Vector2 value = (this.rotation - 1.57079637f).ToRotationVector2(); Vector2 value2 = value * this.velocity.Length() * (float)this.MaxUpdates; if (this.type == 635) { num3 = 88; num4 = 88; num2 = Utils.SelectRandom<int>(Main.rand, new int[] { 242, 59, 88 }); num5 = 3.7f; num6 = 1.5f; num7 = 2.2f; value2 *= 0.5f; } Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); this.position = base.Center; this.width = (this.height = height); base.Center = this.position; this.maxPenetrate = -1; this.penetrate = -1; this.Damage(); for (int i = 0; i < 40; i++) { num2 = Utils.SelectRandom<int>(Main.rand, new int[] { 242, 73, 72, 71, 255 }); if (this.type == 635) { num2 = Utils.SelectRandom<int>(Main.rand, new int[] { 242, 59, 88 }); } int num8 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, num2, 0f, 0f, 200, default(Color), num5); Main.dust[num8].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)this.width / 2f; Main.dust[num8].noGravity = true; Main.dust[num8].velocity *= 3f; Main.dust[num8].velocity += value2 * Main.rand.NextFloat(); num8 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, num3, 0f, 0f, 100, default(Color), num6); Main.dust[num8].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)this.width / 2f; Main.dust[num8].velocity *= 2f; Main.dust[num8].noGravity = true; Main.dust[num8].fadeIn = 1f; Main.dust[num8].color = Color.Crimson * 0.5f; Main.dust[num8].velocity += value2 * Main.rand.NextFloat(); } for (int j = 0; j < 20; j++) { int num9 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, num4, 0f, 0f, 0, default(Color), num7); Main.dust[num9].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)this.velocity.ToRotation(), default(Vector2)) * (float)this.width / 3f; Main.dust[num9].noGravity = true; Main.dust[num9].velocity *= 0.5f; Main.dust[num9].velocity += value2 * (0.6f + 0.6f * Main.rand.NextFloat()); } } else if (this.type == 641) { if (this.owner == Main.myPlayer) { for (int k = 0; k < 1000; k++) { if (Main.projectile[k].active && Main.projectile[k].owner == this.owner && Main.projectile[k].type == 642) { Main.projectile[k].Kill(); } } } } else if (this.type == 643) { if (this.owner == Main.myPlayer) { for (int l = 0; l < 1000; l++) { if (Main.projectile[l].active && Main.projectile[l].owner == this.owner && Main.projectile[l].type == 644) { Main.projectile[l].Kill(); } } } } else if (this.type == 645) { bool flag = WorldGen.SolidTile(Framing.GetTileSafely((int)this.position.X / 16, (int)this.position.Y / 16)); for (int m = 0; m < 4; m++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f); } for (int n = 0; n < 4; n++) { int num10 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 229, 0f, 0f, 0, default(Color), 2.5f); Main.dust[num10].noGravity = true; Main.dust[num10].velocity *= 3f; if (flag) { Main.dust[num10].noLight = true; } num10 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 229, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num10].velocity *= 2f; Main.dust[num10].noGravity = true; if (flag) { Main.dust[num10].noLight = true; } } for (int num11 = 0; num11 < 1; num11++) { int num12 = 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, default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num12].velocity *= 0.3f; Gore expr_900_cp_0 = Main.gore[num12]; expr_900_cp_0.velocity.X = expr_900_cp_0.velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; Gore expr_92E_cp_0 = Main.gore[num12]; expr_92E_cp_0.velocity.Y = expr_92E_cp_0.velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; } } else if (this.type == 636) { Rectangle hitbox = base.Hitbox; for (int num13 = 0; num13 < 6; num13 += 3) { hitbox.X = (int)this.oldPos[num13].X; hitbox.Y = (int)this.oldPos[num13].Y; for (int num14 = 0; num14 < 5; num14++) { int num15 = Utils.SelectRandom<int>(Main.rand, new int[] { 6, 259, 158 }); int num16 = Dust.NewDust(hitbox.TopLeft(), this.width, this.height, num15, 2.5f * (float)this.direction, -2.5f, 0, default(Color), 1f); Main.dust[num16].alpha = 200; Main.dust[num16].velocity *= 2.4f; Main.dust[num16].scale += Main.rand.NextFloat(); } } } else if (this.type == 614) { for (int num17 = 0; num17 < 10; num17++) { Dust dust = Main.dust[Dust.NewDust(this.position, this.width, this.height, 229, 0f, 0f, 0, default(Color), 1f)]; dust.noGravity = true; dust.velocity *= 3f; } } if (this.type == 644) { Vector2 spinningpoint = new Vector2(0f, -3f).RotatedByRandom(3.1415927410125732); float num18 = (float)Main.rand.Next(7, 13); Vector2 value3 = new Vector2(2.1f, 2f); Color newColor = Main.hslToRgb(this.ai[0], 1f, 0.5f); newColor.A = 255; for (float num19 = 0f; num19 < num18; num19 += 1f) { int num20 = Dust.NewDust(base.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); Main.dust[num20].position = base.Center; Main.dust[num20].velocity = spinningpoint.RotatedBy((double)(6.28318548f * num19 / num18), default(Vector2)) * value3 * (0.8f + Main.rand.NextFloat() * 0.4f); Main.dust[num20].noGravity = true; Main.dust[num20].scale = 2f; Main.dust[num20].fadeIn = Main.rand.NextFloat() * 2f; Dust dust2 = Dust.CloneDust(num20); dust2.scale /= 2f; dust2.fadeIn /= 2f; dust2.color = new Color(255, 255, 255, 255); } for (float num21 = 0f; num21 < num18; num21 += 1f) { int num22 = Dust.NewDust(base.Center, 0, 0, 267, 0f, 0f, 0, newColor, 1f); Main.dust[num22].position = base.Center; Main.dust[num22].velocity = spinningpoint.RotatedBy((double)(6.28318548f * num21 / num18), default(Vector2)) * value3 * (0.8f + Main.rand.NextFloat() * 0.4f); Main.dust[num22].velocity *= Main.rand.NextFloat() * 0.8f; Main.dust[num22].noGravity = true; Main.dust[num22].scale = Main.rand.NextFloat() * 1f; Main.dust[num22].fadeIn = Main.rand.NextFloat() * 2f; Dust dust3 = Dust.CloneDust(num22); dust3.scale /= 2f; dust3.fadeIn /= 2f; dust3.color = new Color(255, 255, 255, 255); } if (Main.myPlayer == this.owner) { this.friendly = true; int width = this.width; int height2 = this.height; int num23 = this.penetrate; this.position = base.Center; this.width = (this.height = 60); base.Center = this.position; this.penetrate = -1; this.maxPenetrate = -1; this.Damage(); this.penetrate = num23; this.position = base.Center; this.width = width; this.height = height2; base.Center = this.position; } } if (this.type == 608) { this.maxPenetrate = -1; this.penetrate = -1; this.Damage(); Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); for (int num24 = 0; num24 < 4; num24++) { int num25 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num25].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)this.width / 2f; } for (int num26 = 0; num26 < 30; num26++) { int num27 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 200, default(Color), 3.7f); Main.dust[num27].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)this.width / 2f; Main.dust[num27].noGravity = true; Main.dust[num27].velocity *= 3f; Main.dust[num27].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].ArmorSetDye(), Main.player[this.owner]); num27 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num27].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)this.width / 2f; Main.dust[num27].velocity *= 2f; Main.dust[num27].noGravity = true; Main.dust[num27].fadeIn = 2.5f; Main.dust[num27].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].ArmorSetDye(), Main.player[this.owner]); } for (int num28 = 0; num28 < 10; num28++) { int num29 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 0, default(Color), 2.7f); Main.dust[num29].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)this.velocity.ToRotation(), default(Vector2)) * (float)this.width / 2f; Main.dust[num29].noGravity = true; Main.dust[num29].velocity *= 3f; Main.dust[num29].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].ArmorSetDye(), Main.player[this.owner]); } for (int num30 = 0; num30 < 10; num30++) { int num31 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 0, default(Color), 1.5f); Main.dust[num31].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)this.velocity.ToRotation(), default(Vector2)) * (float)this.width / 2f; Main.dust[num31].noGravity = true; Main.dust[num31].velocity *= 3f; } for (int num32 = 0; num32 < 2; num32++) { int num33 = 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, default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num33].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)this.width / 2f; Main.gore[num33].velocity *= 0.3f; Gore expr_150B_cp_0 = Main.gore[num33]; expr_150B_cp_0.velocity.X = expr_150B_cp_0.velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; Gore expr_1539_cp_0 = Main.gore[num33]; expr_1539_cp_0.velocity.Y = expr_1539_cp_0.velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; } } else if (this.type == 617) { this.position = base.Center; this.width = (this.height = 176); base.Center = this.position; this.maxPenetrate = -1; this.penetrate = -1; this.Damage(); Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); for (int num34 = 0; num34 < 4; num34++) { int num35 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 240, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num35].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)this.width / 2f; } for (int num36 = 0; num36 < 30; num36++) { int num37 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 62, 0f, 0f, 200, default(Color), 3.7f); Main.dust[num37].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)this.width / 2f; Main.dust[num37].noGravity = true; Main.dust[num37].velocity *= 3f; num37 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 90, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num37].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)this.width / 2f; Main.dust[num37].velocity *= 2f; Main.dust[num37].noGravity = true; Main.dust[num37].fadeIn = 1f; Main.dust[num37].color = Color.Crimson * 0.5f; } for (int num38 = 0; num38 < 10; num38++) { int num39 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 62, 0f, 0f, 0, default(Color), 2.7f); Main.dust[num39].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)this.velocity.ToRotation(), default(Vector2)) * (float)this.width / 2f; Main.dust[num39].noGravity = true; Main.dust[num39].velocity *= 3f; } for (int num40 = 0; num40 < 10; num40++) { int num41 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 240, 0f, 0f, 0, default(Color), 1.5f); Main.dust[num41].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)this.velocity.ToRotation(), default(Vector2)) * (float)this.width / 2f; Main.dust[num41].noGravity = true; Main.dust[num41].velocity *= 3f; } for (int num42 = 0; num42 < 2; num42++) { int num43 = 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, default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num43].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)this.width / 2f; Main.gore[num43].velocity *= 0.3f; Gore expr_1B60_cp_0 = Main.gore[num43]; expr_1B60_cp_0.velocity.X = expr_1B60_cp_0.velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; Gore expr_1B8E_cp_0 = Main.gore[num43]; expr_1B8E_cp_0.velocity.Y = expr_1B8E_cp_0.velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; } if (Main.myPlayer == this.owner) { for (int num44 = 0; num44 < 1000; num44++) { if (Main.projectile[num44].active && Main.projectile[num44].type == 618 && Main.projectile[num44].ai[1] == (float)this.whoAmI) { Main.projectile[num44].Kill(); } } int num45 = Main.rand.Next(5, 9); int num46 = Main.rand.Next(5, 9); int num47 = Utils.SelectRandom<int>(Main.rand, new int[] { 86, 90 }); int num48 = (num47 == 86) ? 90 : 86; for (int num49 = 0; num49 < num45; num49++) { Vector2 vector = base.Center + Utils.RandomVector2(Main.rand, -30f, 30f); Vector2 value4 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); while (value4.X == 0f && value4.Y == 0f) { value4 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); } value4.Normalize(); if (value4.Y > 0.2f) { value4.Y *= -1f; } value4 *= (float)Main.rand.Next(70, 101) * 0.1f; Projectile.NewProjectile(vector.X, vector.Y, value4.X, value4.Y, 620, (int)((double)this.damage * 0.65), this.knockBack * 0.8f, this.owner, (float)num47, 0f); } for (int num50 = 0; num50 < num46; num50++) { Vector2 vector2 = base.Center + Utils.RandomVector2(Main.rand, -30f, 30f); Vector2 value5 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); while (value5.X == 0f && value5.Y == 0f) { value5 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); } value5.Normalize(); if (value5.Y > 0.4f) { value5.Y *= -1f; } value5 *= (float)Main.rand.Next(40, 81) * 0.1f; Projectile.NewProjectile(vector2.X, vector2.Y, value5.X, value5.Y, 620, (int)((double)this.damage * 0.65), this.knockBack * 0.8f, this.owner, (float)num48, 0f); } } } if (this.type == 653 && this.ai[1] == 0f) { float r = 0f; for (int i = 0; i < 16; i++) { if (r < 1) { int speedX = Main.rand.Next(-8, 9); Projectile.NewProjectile(this.position.X, this.position.Y, speedX, -8, this.type, 21, 0.5f, Main.myPlayer, 0f, 1f); } else if (r < 2) { int speedX = Main.rand.Next(-8, 9); Projectile.NewProjectile(this.position.X, this.position.Y, speedX, 8, this.type, 21, 0.5f, Main.myPlayer, 0f, 1f); } else if (r < 3) { int speedY = Main.rand.Next(-8, 9); Projectile.NewProjectile(this.position.X, this.position.Y, -8, speedY, this.type, 21, 0.5f, Main.myPlayer, 0f, 1f); } else if (r < 4) { int speedY = Main.rand.Next(-8, 9); Projectile.NewProjectile(this.position.X, this.position.Y, 8, speedY, this.type, 21, 0.5f, Main.myPlayer, 0f, 1f); } r += 0.25f; } } else if (this.type == 620 || this.type == 618) { if (this.type == 618) { this.ai[0] = 86f; } for (int num51 = 0; num51 < 10; num51++) { int num52 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, (int)this.ai[0], this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 0, default(Color), 0.5f); if (Main.rand.Next(3) == 0) { Main.dust[num52].fadeIn = 0.75f + (float)Main.rand.Next(-10, 11) * 0.01f; Main.dust[num52].scale = 0.25f + (float)Main.rand.Next(-10, 11) * 0.005f; Main.dust[num52].type++; } else { Main.dust[num52].scale = 1f + (float)Main.rand.Next(-10, 11) * 0.01f; } Main.dust[num52].noGravity = true; Main.dust[num52].velocity *= 1.25f; Main.dust[num52].velocity -= this.oldVelocity / 10f; } } else if (this.type == 619) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 50); for (int num53 = 0; num53 < 20; num53++) { int num54 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, (int)this.ai[0], this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 0, default(Color), 0.5f); if (Main.rand.Next(3) == 0) { Main.dust[num54].fadeIn = 1.1f + (float)Main.rand.Next(-10, 11) * 0.01f; Main.dust[num54].scale = 0.35f + (float)Main.rand.Next(-10, 11) * 0.01f; Main.dust[num54].type++; } else { Main.dust[num54].scale = 1.2f + (float)Main.rand.Next(-10, 11) * 0.01f; } Main.dust[num54].noGravity = true; Main.dust[num54].velocity *= 2.5f; Main.dust[num54].velocity -= this.oldVelocity / 10f; } if (Main.myPlayer == this.owner) { int num55 = Main.rand.Next(3, 6); for (int num56 = 0; num56 < num55; num56++) { Vector2 value6 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); while (value6.X == 0f && value6.Y == 0f) { value6 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); } value6.Normalize(); value6 *= (float)Main.rand.Next(70, 101) * 0.1f; Projectile.NewProjectile(this.oldPosition.X + (float)(this.width / 2), this.oldPosition.Y + (float)(this.height / 2), value6.X, value6.Y, 620, (int)((double)this.damage * 0.8), this.knockBack * 0.8f, this.owner, this.ai[0], 0f); } } } if (this.type == 601) { Color portalColor = PortalHelper.GetPortalColor(this.owner, (int)this.ai[0]); Color color = portalColor; color.A = 255; for (int num57 = 0; num57 < 6; num57++) { Vector2 value7 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * (3f * Main.rand.NextFloat()); Dust dust4 = Main.dust[Dust.NewDust(base.Center, 0, 0, 263, 0f, 0f, 0, default(Color), 1f)]; dust4.position = base.Center; dust4.velocity = value7 + this.velocity / 5f; dust4.color = color; dust4.scale = 2f; dust4.noLight = true; dust4.noGravity = true; } } if (this.type == 596) { this.position = base.Center; this.width = (this.height = 60); base.Center = this.position; int num58 = 40; if (Main.expertMode) { num58 = 30; } this.damage = num58; this.Damage(); Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); for (int num59 = 0; num59 < 4; num59++) { int num60 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num60].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)this.width / 2f; } for (int num61 = 0; num61 < 20; num61++) { int num62 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 27, 0f, 0f, 0, default(Color), 2.5f); Main.dust[num62].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)this.width / 2f; Main.dust[num62].noGravity = true; Main.dust[num62].velocity *= 2f; } for (int num63 = 0; num63 < 10; num63++) { int num64 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 0, default(Color), 1.5f); Main.dust[num64].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)this.velocity.ToRotation(), default(Vector2)) * (float)this.width / 2f; Main.dust[num64].noGravity = true; Main.dust[num64].velocity *= 2f; } } else if (this.type >= 625 && this.type <= 628) { for (int num65 = 0; num65 < 6; num65++) { int num66 = Dust.NewDust(this.position, this.width, this.height, 135, 0f, 0f, 100, default(Color), 2f); Main.dust[num66].noGravity = true; Main.dust[num66].noLight = true; } } if (this.type == 631) { int num67 = Main.rand.Next(5, 10); for (int num68 = 0; num68 < num67; num68++) { int num69 = Dust.NewDust(base.Center, 0, 0, 229, 0f, 0f, 100, default(Color), 1f); Main.dust[num69].velocity *= 1.6f; Dust expr_288B_cp_0 = Main.dust[num69]; expr_288B_cp_0.velocity.Y = expr_288B_cp_0.velocity.Y - 1f; Main.dust[num69].position -= Vector2.One * 4f; Main.dust[num69].position = Vector2.Lerp(Main.dust[num69].position, base.Center, 0.5f); Main.dust[num69].noGravity = true; } } if (this.type == 539) { this.position = base.Center; this.width = (this.height = 80); base.Center = this.position; this.Damage(); Main.PlaySound(4, (int)this.position.X, (int)this.position.Y, 7); for (int num70 = 0; num70 < 4; num70++) { int num71 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num71].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)this.width / 2f; } for (int num72 = 0; num72 < 20; num72++) { int num73 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 176, 0f, 0f, 200, default(Color), 3.7f); Main.dust[num73].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)this.width / 2f; Main.dust[num73].noGravity = true; Main.dust[num73].velocity *= 3f; } for (int num74 = 0; num74 < 20; num74++) { int num75 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 180, 0f, 0f, 0, default(Color), 2.7f); Main.dust[num75].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)this.velocity.ToRotation(), default(Vector2)) * (float)this.width / 2f; Main.dust[num75].noGravity = true; Main.dust[num75].velocity *= 3f; } for (int num76 = 0; num76 < 10; num76++) { int num77 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 0, default(Color), 1.5f); Main.dust[num77].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)this.velocity.ToRotation(), default(Vector2)) * (float)this.width / 2f; Main.dust[num77].noGravity = true; Main.dust[num77].velocity *= 3f; } } else if (this.type == 585) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 27); for (int num78 = 0; num78 < 20; num78++) { int num79 = Dust.NewDust(this.position, this.width, this.height, 26, 0f, 0f, 100, default(Color), 1f); Main.dust[num79].noGravity = true; Main.dust[num79].velocity *= 1.2f; Main.dust[num79].scale = 1.3f; Main.dust[num79].velocity -= this.oldVelocity * 0.3f; num79 = Dust.NewDust(new Vector2(this.position.X + 4f, this.position.Y + 4f), this.width - 8, this.height - 8, 27, 0f, 0f, 100, default(Color), 2f); Main.dust[num79].noGravity = true; Main.dust[num79].velocity *= 3f; } } else if (this.type == 590) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 27); for (int num80 = 0; num80 < 10; num80++) { int num81 = Dust.NewDust(this.position, this.width, this.height, 165, 0f, 0f, 50, default(Color), 1.5f); Main.dust[num81].velocity *= 2f; Main.dust[num81].noGravity = true; } float num82 = 0.6f + Main.rand.NextFloat() * 0.4f; int num83 = Gore.NewGore(this.position, Vector2.Zero, 375, num82); Main.gore[num83].velocity *= 0.3f; num83 = Gore.NewGore(this.position, Vector2.Zero, 376, num82); Main.gore[num83].velocity *= 0.3f; num83 = Gore.NewGore(this.position, Vector2.Zero, 377, num82); Main.gore[num83].velocity *= 0.3f; } else if (this.type == 587) { Color newColor2 = Main.hslToRgb(this.ai[1], 1f, 0.5f); newColor2.A = 200; Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num84 = 0; num84 < 10; num84++) { int num85 = Dust.NewDust(this.position, this.width, this.height, 76, 0f, 0f, 0, newColor2, 1f); Main.dust[num85].noGravity = true; Main.dust[num85].velocity *= 1.2f; Main.dust[num85].scale = 0.9f; Main.dust[num85].velocity -= this.oldVelocity * 0.3f; num85 = Dust.NewDust(new Vector2(this.position.X + 4f, this.position.Y + 4f), this.width - 8, this.height - 8, 76, 0f, 0f, 0, newColor2, 1.1f); Main.dust[num85].noGravity = true; Main.dust[num85].velocity *= 2f; } } else if (this.type == 572) { for (int num86 = 0; num86 < 15; num86++) { int num87 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 40, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 100, default(Color), 1f); Main.dust[num87].velocity *= 3f; Main.dust[num87].noGravity = true; Main.dust[num87].scale = 1.25f; Main.dust[num87].position = (base.Center + this.position) / 2f; } } else if (this.type == 581) { for (int num88 = 0; num88 < 30; num88++) { int num89 = Utils.SelectRandom<int>(Main.rand, new int[] { 229, 229, 161 }); Dust dust5 = Main.dust[Dust.NewDust(this.position, this.width, this.height, num89, 0f, 0f, 0, default(Color), 1f)]; dust5.noGravity = true; dust5.scale = 1.25f + Main.rand.NextFloat(); dust5.fadeIn = 0.25f; dust5.velocity *= 2f; dust5.noLight = true; } } if (this.type == 405) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 54); Vector2 arg_3369_0 = base.Center; for (int num90 = 0; num90 < 20; num90++) { int num91 = 10; int num92 = Dust.NewDust(base.Center - Vector2.One * (float)num91, num91 * 2, num91 * 2, 212, 0f, 0f, 0, default(Color), 1f); Dust dust6 = Main.dust[num92]; Vector2 value8 = Vector2.Normalize(dust6.position - base.Center); dust6.position = base.Center + value8 * (float)num91 * this.scale; if (num90 < 30) { dust6.velocity = value8 * dust6.velocity.Length(); } else { dust6.velocity = value8 * (float)Main.rand.Next(45, 91) / 10f; } dust6.color = Main.hslToRgb((float)(0.40000000596046448 + Main.rand.NextDouble() * 0.20000000298023224), 0.9f, 0.5f); dust6.color = Color.Lerp(dust6.color, Color.White, 0.3f); dust6.noGravity = true; dust6.scale = 0.7f; } } if (this.type == 501) { Main.PlaySound(13, (int)this.position.X, (int)this.position.Y, 1); int num93 = 20; this.position.X = this.position.X - (float)num93; this.position.Y = this.position.Y - (float)num93; this.width += num93 * 2; this.height += num93 * 2; num93 += 20; for (int num94 = 0; num94 < 20; num94++) { int num95 = Dust.NewDust(this.position, this.width, this.height, 188, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num95].velocity *= 0.5f; } for (int num96 = 0; num96 < 5; num96++) { int num97 = Gore.NewGore(new Vector2(this.position.X + (float)Main.rand.Next(this.width), this.position.Y + (float)Main.rand.Next(this.height)), default(Vector2), Main.rand.Next(435, 438), 1f); Main.gore[num97].velocity *= 0.5f; if (num96 == 0) { Gore expr_365D_cp_0 = Main.gore[num97]; expr_365D_cp_0.velocity.X = expr_365D_cp_0.velocity.X + 1f; Gore expr_367B_cp_0 = Main.gore[num97]; expr_367B_cp_0.velocity.Y = expr_367B_cp_0.velocity.Y + 1f; } else if (num96 == 1) { Gore expr_36A3_cp_0 = Main.gore[num97]; expr_36A3_cp_0.velocity.X = expr_36A3_cp_0.velocity.X - 1f; Gore expr_36C1_cp_0 = Main.gore[num97]; expr_36C1_cp_0.velocity.Y = expr_36C1_cp_0.velocity.Y + 1f; } else if (num96 == 2) { Gore expr_36E6_cp_0 = Main.gore[num97]; expr_36E6_cp_0.velocity.X = expr_36E6_cp_0.velocity.X + 1f; Gore expr_3704_cp_0 = Main.gore[num97]; expr_3704_cp_0.velocity.Y = expr_3704_cp_0.velocity.Y - 1f; } else { Gore expr_3724_cp_0 = Main.gore[num97]; expr_3724_cp_0.velocity.X = expr_3724_cp_0.velocity.X - 1f; Gore expr_3742_cp_0 = Main.gore[num97]; expr_3742_cp_0.velocity.Y = expr_3742_cp_0.velocity.Y - 1f; } Main.gore[num97].velocity *= 0.5f; } this.position.X = this.position.X - (float)num93; this.position.Y = this.position.Y - (float)num93; this.width += num93 * 2; this.height += num93 * 2; this.Damage(); } if (this.type == 410) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 54); Vector2 arg_3806_0 = base.Center; for (int num98 = 0; num98 < 10; num98++) { int num99 = (int)(10f * this.ai[1]); int num100 = Dust.NewDust(base.Center - Vector2.One * (float)num99, num99 * 2, num99 * 2, 212, 0f, 0f, 0, default(Color), 1f); Dust dust7 = Main.dust[num100]; Vector2 value9 = Vector2.Normalize(dust7.position - base.Center); dust7.position = base.Center + value9 * (float)num99 * this.scale; if (num98 < 30) { dust7.velocity = value9 * dust7.velocity.Length(); } else { dust7.velocity = value9 * (float)Main.rand.Next(45, 91) / 10f; } dust7.color = Main.hslToRgb((float)(0.40000000596046448 + Main.rand.NextDouble() * 0.20000000298023224), 0.9f, 0.5f); dust7.color = Color.Lerp(dust7.color, Color.White, 0.3f); dust7.noGravity = true; dust7.scale = 0.7f; } } if (this.type == 629 && Main.netMode != 1) { int num101 = Main.npc[(int)this.ai[0]].type; if (num101 <= 493) { if (num101 != 422) { if (num101 == 493) { if (NPC.ShieldStrengthTowerStardust != 0) { Main.npc[(int)this.ai[0]].ai[3] = 1f; } NPC.ShieldStrengthTowerStardust = (int)MathHelper.Clamp((float)(NPC.ShieldStrengthTowerStardust - 1), 0f, (float)NPC.ShieldStrengthTowerMax); } } else { if (NPC.ShieldStrengthTowerVortex != 0) { Main.npc[(int)this.ai[0]].ai[3] = 1f; } NPC.ShieldStrengthTowerVortex = (int)MathHelper.Clamp((float)(NPC.ShieldStrengthTowerVortex - 1), 0f, (float)NPC.ShieldStrengthTowerMax); } } else if (num101 != 507) { if (num101 == 517) { if (NPC.ShieldStrengthTowerSolar != 0) { Main.npc[(int)this.ai[0]].ai[3] = 1f; } NPC.ShieldStrengthTowerSolar = (int)MathHelper.Clamp((float)(NPC.ShieldStrengthTowerSolar - 1), 0f, (float)NPC.ShieldStrengthTowerMax); } } else { if (NPC.ShieldStrengthTowerNebula != 0) { Main.npc[(int)this.ai[0]].ai[3] = 1f; } NPC.ShieldStrengthTowerNebula = (int)MathHelper.Clamp((float)(NPC.ShieldStrengthTowerNebula - 1), 0f, (float)NPC.ShieldStrengthTowerMax); } Main.npc[(int)this.ai[0]].netUpdate = true; NetMessage.SendData(101, -1, -1, "", 0, 0f, 0f, 0f, 0, 0, 0); } if (this.aiStyle == 105 && this.owner == Main.myPlayer && this.ai[1] == 0f) { Vector2 value10 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); value10.Normalize(); value10 *= 0.3f; Projectile.NewProjectile(base.Center.X, base.Center.Y, value10.X, value10.Y, Main.rand.Next(569, 572), this.damage, 0f, this.owner, 0f, 0f); } if (this.type == 452) { Main.PlaySound(29, (int)this.position.X, (int)this.position.Y, 103); this.position = base.Center; this.width = (this.height = 144); this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); for (int num102 = 0; num102 < 4; num102++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f); } for (int num103 = 0; num103 < 40; num103++) { int num104 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 229, 0f, 0f, 0, default(Color), 2.5f); Main.dust[num104].noGravity = true; Main.dust[num104].velocity *= 3f; num104 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 229, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num104].velocity *= 2f; Main.dust[num104].noGravity = true; } for (int num105 = 0; num105 < 1; num105++) { int num106 = 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, default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num106].velocity *= 0.3f; Gore expr_3E9B_cp_0 = Main.gore[num106]; expr_3E9B_cp_0.velocity.X = expr_3E9B_cp_0.velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; Gore expr_3EC9_cp_0 = Main.gore[num106]; expr_3EC9_cp_0.velocity.Y = expr_3EC9_cp_0.velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; } this.Damage(); } if (this.type == 454) { Main.PlaySound(4, (int)this.position.X, (int)this.position.Y, 6); this.position = base.Center; this.width = (this.height = 208); this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); for (int num107 = 0; num107 < 7; num107++) { int num108 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num108].position = new Vector2((float)(this.width / 2), 0f).RotatedBy(6.2831854820251465 * Main.rand.NextDouble(), default(Vector2)) * (float)Main.rand.NextDouble() + base.Center; } for (int num109 = 0; num109 < 60; num109++) { int num110 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 229, 0f, 0f, 0, default(Color), 2.5f); Main.dust[num110].position = new Vector2((float)(this.width / 2), 0f).RotatedBy(6.2831854820251465 * Main.rand.NextDouble(), default(Vector2)) * (float)Main.rand.NextDouble() + base.Center; Main.dust[num110].noGravity = true; Main.dust[num110].velocity *= 1f; num110 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 229, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num110].position = new Vector2((float)(this.width / 2), 0f).RotatedBy(6.2831854820251465 * Main.rand.NextDouble(), default(Vector2)) * (float)Main.rand.NextDouble() + base.Center; Main.dust[num110].velocity *= 1f; Main.dust[num110].noGravity = true; } for (int num111 = 0; num111 < 3; num111++) { int num112 = 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, default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num112].velocity *= 0.3f; Gore expr_42D6_cp_0 = Main.gore[num112]; expr_42D6_cp_0.velocity.X = expr_42D6_cp_0.velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; Gore expr_4304_cp_0 = Main.gore[num112]; expr_4304_cp_0.velocity.Y = expr_4304_cp_0.velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; } this.Damage(); } if (this.type == 467) { this.position = base.Center; this.width = (this.height = 176); base.Center = this.position; this.Damage(); Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); for (int num113 = 0; num113 < 4; num113++) { int num114 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num114].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)this.width / 2f; } for (int num115 = 0; num115 < 30; num115++) { int num116 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 200, default(Color), 3.7f); Main.dust[num116].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)this.width / 2f; Main.dust[num116].noGravity = true; Main.dust[num116].velocity *= 3f; num116 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num116].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)this.width / 2f; Main.dust[num116].velocity *= 2f; Main.dust[num116].noGravity = true; Main.dust[num116].fadeIn = 2.5f; } for (int num117 = 0; num117 < 10; num117++) { int num118 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 0, default(Color), 2.7f); Main.dust[num118].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)this.velocity.ToRotation(), default(Vector2)) * (float)this.width / 2f; Main.dust[num118].noGravity = true; Main.dust[num118].velocity *= 3f; } for (int num119 = 0; num119 < 10; num119++) { int num120 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 0, default(Color), 1.5f); Main.dust[num120].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)this.velocity.ToRotation(), default(Vector2)) * (float)this.width / 2f; Main.dust[num120].noGravity = true; Main.dust[num120].velocity *= 3f; } for (int num121 = 0; num121 < 2; num121++) { int num122 = 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, default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num122].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)this.width / 2f; Main.gore[num122].velocity *= 0.3f; Gore expr_48F9_cp_0 = Main.gore[num122]; expr_48F9_cp_0.velocity.X = expr_48F9_cp_0.velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; Gore expr_4927_cp_0 = Main.gore[num122]; expr_4927_cp_0.velocity.Y = expr_4927_cp_0.velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; } } if (this.type == 468) { this.position = base.Center; this.width = (this.height = 176); base.Center = this.position; this.Damage(); Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); for (int num123 = 0; num123 < 4; num123++) { int num124 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num124].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)this.width / 2f; } for (int num125 = 0; num125 < 20; num125++) { int num126 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 27, 0f, 0f, 200, default(Color), 3.7f); Main.dust[num126].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)this.width / 2f; Main.dust[num126].noGravity = true; Main.dust[num126].velocity *= 3f; num126 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 27, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num126].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)this.width / 2f; Main.dust[num126].velocity *= 2f; Main.dust[num126].noGravity = true; Main.dust[num126].fadeIn = 2.5f; } for (int num127 = 0; num127 < 10; num127++) { int num128 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 27, 0f, 0f, 0, default(Color), 2.7f); Main.dust[num128].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)this.velocity.ToRotation(), default(Vector2)) * (float)this.width / 2f; Main.dust[num128].noGravity = true; Main.dust[num128].velocity *= 3f; } for (int num129 = 0; num129 < 10; num129++) { int num130 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 0, default(Color), 1.5f); Main.dust[num130].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)this.velocity.ToRotation(), default(Vector2)) * (float)this.width / 2f; Main.dust[num130].noGravity = true; Main.dust[num130].velocity *= 3f; } for (int num131 = 0; num131 < 2; num131++) { int num132 = 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, default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num132].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)this.width / 2f; Main.gore[num132].velocity *= 0.3f; Gore expr_4F19_cp_0 = Main.gore[num132]; expr_4F19_cp_0.velocity.X = expr_4F19_cp_0.velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; Gore expr_4F47_cp_0 = Main.gore[num132]; expr_4F47_cp_0.velocity.Y = expr_4F47_cp_0.velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; } } if (this.type == 485) { for (int num133 = 0; num133 < 15; num133++) { int num134 = Dust.NewDust(this.position, this.width, this.height, 6, 0f, 0f, 0, default(Color), 1f); Main.dust[num134].noGravity = true; Main.dust[num134].velocity -= this.oldVelocity * (float)Main.rand.Next(20, 60) * 0.01f; } } else if (this.type == 484) { for (int num135 = 0; num135 < 5; num135++) { int num136 = Dust.NewDust(this.position, this.width, this.height, 78, 0f, 0f, 0, default(Color), 1f); Main.dust[num136].noGravity = true; Main.dust[num136].velocity -= this.oldVelocity / 5f; Main.dust[num136].scale = 0.85f; } } else if (this.type == 483) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); if (this.owner == Main.myPlayer) { int num137 = Main.rand.Next(4, 8); int[] array = new int[num137]; int num138 = 0; for (int num139 = 0; num139 < 200; num139++) { if (Main.npc[num139].CanBeChasedBy(this, true) && Collision.CanHitLine(this.position, this.width, this.height, Main.npc[num139].position, Main.npc[num139].width, Main.npc[num139].height)) { array[num138] = num139; num138++; if (num138 == num137) { break; } } } if (num138 > 1) { for (int num140 = 0; num140 < 100; num140++) { int num141 = Main.rand.Next(num138); int num142; for (num142 = num141; num142 == num141; num142 = Main.rand.Next(num138)) { } int num143 = array[num141]; array[num141] = array[num142]; array[num142] = num143; } } Vector2 vector3 = new Vector2(-1f, -1f); for (int num144 = 0; num144 < num138; num144++) { Vector2 value11 = Main.npc[array[num144]].Center - base.Center; value11.Normalize(); vector3 += value11; } vector3.Normalize(); for (int num145 = 0; num145 < num137; num145++) { float scaleFactor = (float)Main.rand.Next(8, 15); Vector2 vector4 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); vector4.Normalize(); if (num138 > 0) { vector4 += vector3; vector4.Normalize(); } vector4 *= scaleFactor; if (num138 > 0) { num138--; vector4 = Main.npc[array[num138]].Center - base.Center; vector4.Normalize(); vector4 *= scaleFactor; } Projectile.NewProjectile(base.Center.X, base.Center.Y, vector4.X, vector4.Y, 484, (int)((double)this.damage * 0.7), this.knockBack * 0.7f, this.owner, 0f, 0f); } } for (int num146 = 0; num146 < 20; num146++) { int num147 = Dust.NewDust(this.position, this.width, this.height, 78, 0f, 0f, 0, default(Color), 1f); Main.dust[num147].noGravity = true; Main.dust[num147].velocity *= 4f; } for (int num148 = 0; num148 < 7; num148++) { int num149 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num149].velocity *= 0.9f; Main.dust[num149].scale = 0.9f; } for (int num150 = 0; num150 < 3; num150++) { int num151 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 2.5f); Main.dust[num151].noGravity = true; Main.dust[num151].velocity *= 3f; num151 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num151].velocity *= 2f; } int num152 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num152].velocity *= 0.3f; Gore expr_55CC_cp_0 = Main.gore[num152]; expr_55CC_cp_0.velocity.X = expr_55CC_cp_0.velocity.X + (float)Main.rand.Next(-1, 2); Gore expr_55F2_cp_0 = Main.gore[num152]; expr_55F2_cp_0.velocity.Y = expr_55F2_cp_0.velocity.Y + (float)Main.rand.Next(-1, 2); if (this.owner == Main.myPlayer) { int num153 = 100; this.position.X = this.position.X - (float)(num153 / 2); this.position.Y = this.position.Y - (float)(num153 / 2); this.width += num153; this.height++; this.penetrate = -1; this.Damage(); } } if (this.type == 523) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 54); for (int num154 = 0; num154 < 25; num154++) { int num155 = Dust.NewDust(this.position, this.width, this.height, 256, 0f, 0f, 0, default(Color), 1f); Main.dust[num155].noGravity = true; Main.dust[num155].position = (Main.dust[num155].position + this.position) / 2f; Main.dust[num155].velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); Main.dust[num155].velocity.Normalize(); Main.dust[num155].velocity *= (float)Main.rand.Next(1, 30) * 0.1f; Main.dust[num155].alpha = this.alpha; } } else if (this.type == 522) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 118); for (int num156 = 0; num156 < 10; num156++) { int num157 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 254, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 0, default(Color), 0.5f); if (Main.rand.Next(3) == 0) { Main.dust[num157].fadeIn = 0.75f + (float)Main.rand.Next(-10, 11) * 0.01f; Main.dust[num157].scale = 0.25f + (float)Main.rand.Next(-10, 11) * 0.005f; Main.dust[num157].type++; } else { Main.dust[num157].scale = 1f + (float)Main.rand.Next(-10, 11) * 0.01f; } Main.dust[num157].noGravity = true; Main.dust[num157].velocity *= 1.25f; Main.dust[num157].velocity -= this.oldVelocity / 10f; } } else if (this.type == 521) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 110); for (int num158 = 0; num158 < 20; num158++) { int num159 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 254, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 0, default(Color), 0.5f); if (Main.rand.Next(3) == 0) { Main.dust[num159].fadeIn = 1.1f + (float)Main.rand.Next(-10, 11) * 0.01f; Main.dust[num159].scale = 0.35f + (float)Main.rand.Next(-10, 11) * 0.01f; Main.dust[num159].type++; } else { Main.dust[num159].scale = 1.2f + (float)Main.rand.Next(-10, 11) * 0.01f; } Main.dust[num159].noGravity = true; Main.dust[num159].velocity *= 2.5f; Main.dust[num159].velocity -= this.oldVelocity / 10f; } if (Main.myPlayer == this.owner) { int num160 = Main.rand.Next(3, 6); for (int num161 = 0; num161 < num160; num161++) { Vector2 value12 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); while (value12.X == 0f && value12.Y == 0f) { value12 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); } value12.Normalize(); value12 *= (float)Main.rand.Next(70, 101) * 0.1f; Projectile.NewProjectile(this.oldPosition.X + (float)(this.width / 2), this.oldPosition.Y + (float)(this.height / 2), value12.X, value12.Y, 522, (int)((double)this.damage * 0.8), this.knockBack * 0.8f, this.owner, 0f, 0f); } } } if (this.type == 520) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 50); for (int num162 = 0; num162 < 10; num162++) { int num163 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 252, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 0, default(Color), 0.75f); Main.dust[num163].noGravity = true; Main.dust[num163].velocity -= this.oldVelocity / 3f; } } if (this.type == 459) { int num164 = 3; int num165 = 10; int num166 = 0; if (this.scale >= 1f) { this.position = base.Center; this.width = (this.height = 144); base.Center = this.position; num164 = 7; num165 = 30; num166 = 2; this.Damage(); } for (int num167 = 0; num167 < num164; num167++) { int num168 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num168].position = new Vector2((float)(this.width / 2), 0f).RotatedBy(6.2831854820251465 * Main.rand.NextDouble(), default(Vector2)) * (float)Main.rand.NextDouble() + base.Center; } for (int num169 = 0; num169 < num165; num169++) { int num170 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 226, 0f, 0f, 0, default(Color), 1.5f); Main.dust[num170].position = new Vector2((float)(this.width / 2), 0f).RotatedBy(6.2831854820251465 * Main.rand.NextDouble(), default(Vector2)) * (float)Main.rand.NextDouble() + base.Center; Main.dust[num170].noGravity = true; Main.dust[num170].velocity *= 1f; } for (int num171 = 0; num171 < num166; num171++) { int num172 = 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, default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num172].velocity *= 0.3f; Gore expr_5FEE_cp_0 = Main.gore[num172]; expr_5FEE_cp_0.velocity.X = expr_5FEE_cp_0.velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; Gore expr_601C_cp_0 = Main.gore[num172]; expr_601C_cp_0.velocity.Y = expr_601C_cp_0.velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; } } if (this.owner != Main.myPlayer && this.type == 453 && Main.player[this.owner].mount.AbilityActive) { Main.player[this.owner].mount.UseAbility(Main.player[this.owner], this.position, false); } if (this.type == 441) { Main.player[this.owner].mount.StopAbilityCharge(); } if (this.type == 444) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 96); int num173 = Main.rand.Next(5, 9); for (int num174 = 0; num174 < num173; num174++) { int num175 = Dust.NewDust(base.Center, 0, 0, 171, 0f, 0f, 100, default(Color), 1.4f); Main.dust[num175].velocity *= 0.8f; Main.dust[num175].position = Vector2.Lerp(Main.dust[num175].position, base.Center, 0.5f); Main.dust[num175].noGravity = true; } if (this.owner == Main.myPlayer) { Vector2 value13 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY); if (Main.player[this.owner].gravDir == -1f) { value13.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y; } Vector2 value14 = Vector2.Normalize(value13 - base.Center); value14 *= this.localAI[1]; Projectile.NewProjectile(base.Center.X, base.Center.Y, value14.X, value14.Y, (int)this.localAI[0], this.damage, this.knockBack, this.owner, 0f, 0f); } } if (this.type == 472) { for (int num176 = 0; num176 < 20; num176++) { int num177 = Dust.NewDust(this.position, this.width, this.height, 30, 0f, 0f, 0, default(Color), 1f); Main.dust[num177].noGravity = true; Main.dust[num177].velocity *= 0.45f; Main.dust[num177].velocity += this.velocity * 0.9f; } } if (this.type == 639 || this.type == 640) { int num178 = Main.rand.Next(5, 10); for (int num179 = 0; num179 < num178; num179++) { int num180 = Dust.NewDust(base.Center, 0, 0, 220, 0f, 0f, 100, default(Color), 0.5f); Main.dust[num180].velocity *= 1.6f; Dust expr_63C3_cp_0 = Main.dust[num180]; expr_63C3_cp_0.velocity.Y = expr_63C3_cp_0.velocity.Y - 1f; Main.dust[num180].position = Vector2.Lerp(Main.dust[num180].position, base.Center, 0.5f); Main.dust[num180].noGravity = true; } if (this.owner == Main.myPlayer && this.type == 639) { int num181 = num + 1; int nextSlot = Projectile.GetNextSlot(); if (Main.ProjectileUpdateLoopIndex < nextSlot && Main.ProjectileUpdateLoopIndex != -1) { num181++; } Vector2 vector5 = new Vector2(this.ai[0], this.ai[1]); Projectile.NewProjectile(this.localAI[0], this.localAI[1], vector5.X, vector5.Y, 640, this.damage, this.knockBack, this.owner, 0f, (float)num181); } } if (this.type == 435) { int num182 = Main.rand.Next(5, 10); for (int num183 = 0; num183 < num182; num183++) { int num184 = Dust.NewDust(base.Center, 0, 0, 226, 0f, 0f, 100, default(Color), 0.5f); Main.dust[num184].velocity *= 1.6f; Dust expr_6539_cp_0 = Main.dust[num184]; expr_6539_cp_0.velocity.Y = expr_6539_cp_0.velocity.Y - 1f; Main.dust[num184].position = Vector2.Lerp(Main.dust[num184].position, base.Center, 0.5f); Main.dust[num184].noGravity = true; } } if (this.type == 436) { int num185 = Main.rand.Next(5, 10); for (int num186 = 0; num186 < num185; num186++) { int num187 = Dust.NewDust(base.Center, 0, 0, 220, 0f, 0f, 100, default(Color), 0.5f); Main.dust[num187].velocity *= 1.6f; Dust expr_6615_cp_0 = Main.dust[num187]; expr_6615_cp_0.velocity.Y = expr_6615_cp_0.velocity.Y - 1f; Main.dust[num187].position = Vector2.Lerp(Main.dust[num187].position, base.Center, 0.5f); Main.dust[num187].noGravity = true; } } if (this.type == 462) { int num188 = Main.rand.Next(5, 10); for (int num189 = 0; num189 < num188; num189++) { int num190 = Dust.NewDust(base.Center, 0, 0, 229, 0f, 0f, 100, default(Color), 0.5f); Main.dust[num190].velocity *= 1.6f; Dust expr_66F1_cp_0 = Main.dust[num190]; expr_66F1_cp_0.velocity.Y = expr_66F1_cp_0.velocity.Y - 1f; Main.dust[num190].position -= Vector2.One * 4f; Main.dust[num190].position = Vector2.Lerp(Main.dust[num190].position, base.Center, 0.5f); Main.dust[num190].noGravity = true; } } if (this.type == 442) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 94); int num191 = Main.rand.Next(3, 7); for (int num192 = 0; num192 < num191; num192++) { int num193 = Dust.NewDust(this.position, this.width, this.height, 135, 0f, 0f, 100, default(Color), 2.1f); Main.dust[num193].velocity *= 2f; Main.dust[num193].noGravity = true; } if (Main.myPlayer == this.owner) { Rectangle value15 = new Rectangle((int)base.Center.X - 40, (int)base.Center.Y - 40, 80, 80); for (int num194 = 0; num194 < 1000; num194++) { if (num194 != this.whoAmI && Main.projectile[num194].active && Main.projectile[num194].owner == this.owner && Main.projectile[num194].type == 443 && Main.projectile[num194].getRect().Intersects(value15)) { Main.projectile[num194].ai[1] = 1f; Main.projectile[num194].velocity = (base.Center - Main.projectile[num194].Center) / 5f; Main.projectile[num194].netUpdate = true; } } Projectile.NewProjectile(base.Center.X, base.Center.Y, 0f, 0f, 443, this.damage, 0f, this.owner, 0f, 0f); } } if (this.type == 440) { int num195 = Main.rand.Next(3, 7); for (int num196 = 0; num196 < num195; num196++) { int num197 = Dust.NewDust(base.Center - this.velocity / 2f, 0, 0, 135, 0f, 0f, 100, default(Color), 2.1f); Main.dust[num197].velocity *= 2f; Main.dust[num197].noGravity = true; } } if (this.type == 606) { int num198 = Main.rand.Next(3, 7); for (int num199 = 0; num199 < num198; num199++) { int num200 = Dust.NewDust(base.Center - this.velocity / 2f, 0, 0, 182, 0f, 0f, 100, default(Color), 1.6f); Main.dust[num200].velocity *= 1.5f; Main.dust[num200].noGravity = true; } } if (this.type == 658) { int randomNum = Main.rand.Next(3, 7); for (int num1111 = 0; num1111 < randomNum; num1111++) { int num2222 = Dust.NewDust(base.Center - this.velocity / 2f, 0, 0, 182, 0f, 0f, 100, default(Color), 1.6f); Main.dust[num2222].velocity *= 1.5f; Main.dust[num2222].noGravity = true; } } if (this.type == 449) { int num201 = Main.rand.Next(3, 7); for (int num202 = 0; num202 < num201; num202++) { int num203 = Dust.NewDust(base.Center - this.velocity / 2f, 0, 0, 228, 0f, 0f, 100, default(Color), 2.1f); Main.dust[num203].velocity *= 2f; Main.dust[num203].noGravity = true; } } if (this.type == 495) { for (int num204 = 0; num204 < 15; num204++) { int num205 = Dust.NewDust(base.Center, 10, 10, 27, 0f, 0f, 0, default(Color), 1f); Main.dust[num205].noGravity = true; Main.dust[num205].velocity -= this.oldVelocity * 0.3f; } } if (this.type == 497) { for (int num206 = 0; num206 < 15; num206++) { int num207 = Dust.NewDust(base.Center, 10, 10, 27, 0f, 0f, 0, default(Color), 1f); Main.dust[num207].noGravity = true; Main.dust[num207].velocity *= 2f; Main.dust[num207].velocity -= this.oldVelocity * 0.3f; Main.dust[num207].scale += (float)Main.rand.Next(150) * 0.001f; } } if (this.type == 448) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); this.position = base.Center; this.width = (this.height = 112); this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); for (int num208 = 0; num208 < 4; num208++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f); } for (int num209 = 0; num209 < 40; num209++) { int num210 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 228, 0f, 0f, 0, default(Color), 2.5f); Main.dust[num210].noGravity = true; Main.dust[num210].velocity *= 3f; num210 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 228, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num210].velocity *= 2f; Main.dust[num210].noGravity = true; } for (int num211 = 0; num211 < 1; num211++) { int num212 = 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, default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num212].velocity *= 0.3f; Gore expr_6F69_cp_0 = Main.gore[num212]; expr_6F69_cp_0.velocity.X = expr_6F69_cp_0.velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; Gore expr_6F99_cp_0 = Main.gore[num212]; expr_6F99_cp_0.velocity.Y = expr_6F99_cp_0.velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; } this.Damage(); } if (this.type == 616) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); this.position = base.Center; this.width = (this.height = 80); this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); for (int num213 = 0; num213 < 4; num213++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f); } for (int num214 = 0; num214 < 40; num214++) { int num215 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 229, 0f, 0f, 200, default(Color), 2.5f); Main.dust[num215].noGravity = true; Main.dust[num215].velocity *= 2f; num215 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 229, 0f, 0f, 200, default(Color), 1.5f); Main.dust[num215].velocity *= 1.2f; Main.dust[num215].noGravity = true; } for (int num216 = 0; num216 < 1; num216++) { int num217 = 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, default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num217].velocity *= 0.3f; Gore expr_72A2_cp_0 = Main.gore[num217]; expr_72A2_cp_0.velocity.X = expr_72A2_cp_0.velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; Gore expr_72D2_cp_0 = Main.gore[num217]; expr_72D2_cp_0.velocity.Y = expr_72D2_cp_0.velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; } this.Damage(); } if (this.type == 502) { Vector2 value16 = new Vector2((float)this.width, (float)this.height) / 2f; for (int num218 = 0; num218 < this.oldPos.Length; num218++) { if (!(this.oldPos[num218] == Vector2.Zero)) { int num219 = Dust.NewDust(this.oldPos[num218] + value16, 0, 0, 66, 0f, 0f, 150, Color.Transparent, 0.7f); Main.dust[num219].color = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.5f); Main.dust[num219].noGravity = true; } } } if (this.type == 510) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 107); Gore.NewGore(base.Center, -this.oldVelocity * 0.2f, 704, 1f); Gore.NewGore(base.Center, -this.oldVelocity * 0.2f, 705, 1f); if (this.owner == Main.myPlayer) { int num220 = Main.rand.Next(20, 31); for (int num221 = 0; num221 < num220; num221++) { Vector2 value17 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); value17.Normalize(); value17 *= (float)Main.rand.Next(10, 201) * 0.01f; Projectile.NewProjectile(base.Center.X, base.Center.Y, value17.X, value17.Y, 511 + Main.rand.Next(3), this.damage, 1f, this.owner, 0f, (float)Main.rand.Next(-45, 1)); } } } if (this.type == 408) { for (int num222 = 0; num222 < 15; num222++) { int num223 = Dust.NewDust(base.Center - Vector2.One * 10f, 50, 50, 5, 0f, -2f, 0, default(Color), 1f); Main.dust[num223].velocity /= 2f; } int num224 = 10; int num225 = Gore.NewGore(base.Center, this.velocity * 0.8f, 584, 1f); Main.gore[num225].timeLeft /= num224; num225 = Gore.NewGore(base.Center, this.velocity * 0.9f, 585, 1f); Main.gore[num225].timeLeft /= num224; num225 = Gore.NewGore(base.Center, this.velocity * 1f, 586, 1f); Main.gore[num225].timeLeft /= num224; } if (this.type == 385) { Main.PlaySound(4, (int)base.Center.X, (int)base.Center.Y, 19); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { Vector2 vector6 = Vector2.Normalize(this.velocity) * new Vector2((float)this.width / 2f, (float)this.height) * 0.75f; vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default(Vector2)) + base.Center; Vector2 vector7 = vector6 - base.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 172, vector7.X * 2f, vector7.Y * 2f, 100, default(Color), 1.4f); Main.dust[num228].noGravity = true; Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; } if (this.owner == Main.myPlayer) { if (this.ai[1] < 1f) { int num229 = Main.expertMode ? 25 : 40; int num230 = Projectile.NewProjectile(base.Center.X - (float)(this.direction * 30), base.Center.Y - 4f, (float)(-(float)this.direction) * 0.01f, 0f, 384, num229, 4f, this.owner, 16f, 15f); Main.projectile[num230].netUpdate = true; } else { int num231 = (int)(base.Center.Y / 16f); int num232 = (int)(base.Center.X / 16f); int num233 = 100; if (num232 < 10) { num232 = 10; } if (num232 > Main.maxTilesX - 10) { num232 = Main.maxTilesX - 10; } if (num231 < 10) { num231 = 10; } if (num231 > Main.maxTilesY - num233 - 10) { num231 = Main.maxTilesY - num233 - 10; } for (int num234 = num231; num234 < num231 + num233; num234++) { Tile tile = Main.tile[num232, num234]; if (tile.active() && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) { num231 = num234; break; } } int num235 = Main.expertMode ? 50 : 80; int num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, 386, num235, 4f, Main.myPlayer, 16f, 24f); Main.projectile[num236].netUpdate = true; } } } else if (this.type >= 424 && this.type <= 426) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 89); this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = (int)(128f * this.scale); this.height = (int)(128f * this.scale); this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); for (int num237 = 0; num237 < 8; num237++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f); } for (int num238 = 0; num238 < 32; num238++) { int num239 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 2.5f); Main.dust[num239].noGravity = true; Main.dust[num239].velocity *= 3f; num239 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num239].velocity *= 2f; Main.dust[num239].noGravity = true; } for (int num240 = 0; num240 < 2; num240++) { int num241 = 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, default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num241].velocity *= 0.3f; Gore expr_7D5F_cp_0 = Main.gore[num241]; expr_7D5F_cp_0.velocity.X = expr_7D5F_cp_0.velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; Gore expr_7D8F_cp_0 = Main.gore[num241]; expr_7D8F_cp_0.velocity.Y = expr_7D8F_cp_0.velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; } if (this.owner == Main.myPlayer) { this.localAI[1] = -1f; this.maxPenetrate = 0; this.Damage(); } for (int num242 = 0; num242 < 5; num242++) { int num243 = Utils.SelectRandom<int>(Main.rand, new int[] { 6, 259, 158 }); int num244 = Dust.NewDust(this.position, this.width, this.height, num243, 2.5f * (float)this.direction, -2.5f, 0, default(Color), 1f); Main.dust[num244].alpha = 200; Main.dust[num244].velocity *= 2.4f; Main.dust[num244].scale += Main.rand.NextFloat(); } } if (this.type == 399) { Main.PlaySound(13, (int)this.position.X, (int)this.position.Y, 1); Vector2 value18 = new Vector2(20f, 20f); for (int num245 = 0; num245 < 5; num245++) { Dust.NewDust(base.Center - value18 / 2f, (int)value18.X, (int)value18.Y, 12, 0f, 0f, 0, Color.Red, 1f); } for (int num246 = 0; num246 < 10; num246++) { int num247 = Dust.NewDust(base.Center - value18 / 2f, (int)value18.X, (int)value18.Y, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num247].velocity *= 1.4f; } for (int num248 = 0; num248 < 20; num248++) { int num249 = Dust.NewDust(base.Center - value18 / 2f, (int)value18.X, (int)value18.Y, 6, 0f, 0f, 100, default(Color), 2.5f); Main.dust[num249].noGravity = true; Main.dust[num249].velocity *= 5f; num249 = Dust.NewDust(base.Center - value18 / 2f, (int)value18.X, (int)value18.Y, 6, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num249].velocity *= 3f; } if (Main.myPlayer == this.owner) { for (int num250 = 0; num250 < 6; num250++) { float num251 = -this.velocity.X * (float)Main.rand.Next(20, 50) * 0.01f + (float)Main.rand.Next(-20, 21) * 0.4f; float num252 = -Math.Abs(this.velocity.Y) * (float)Main.rand.Next(30, 50) * 0.01f + (float)Main.rand.Next(-20, 5) * 0.4f; Projectile.NewProjectile(base.Center.X + num251, base.Center.Y + num252, num251, num252, 400 + Main.rand.Next(3), (int)((double)this.damage * 0.5), 0f, this.owner, 0f, 0f); } } } if (this.type == 384 || this.type == 386) { for (int num253 = 0; num253 < 20; num253++) { int num254 = Dust.NewDust(this.position, this.width, this.height, 212, (float)(this.direction * 2), 0f, 100, default(Color), 1.4f); Dust dust8 = Main.dust[num254]; dust8.color = Color.CornflowerBlue; dust8.color = Color.Lerp(dust8.color, Color.White, 0.3f); dust8.noGravity = true; } } if (this.type == 507 || this.type == 508) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); Vector2 vector8 = this.position; Vector2 oldVelocity = this.oldVelocity; oldVelocity.Normalize(); vector8 += oldVelocity * 16f; for (int num255 = 0; num255 < 20; num255++) { int num256 = Dust.NewDust(vector8, this.width, this.height, 81, 0f, 0f, 0, default(Color), 1f); Main.dust[num256].position = (Main.dust[num256].position + base.Center) / 2f; Main.dust[num256].velocity += this.oldVelocity * 0.4f; Main.dust[num256].velocity *= 0.5f; Main.dust[num256].noGravity = true; vector8 -= oldVelocity * 8f; } } if (this.type == 598) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); Vector2 vector9 = this.position; Vector2 value19 = (this.rotation - 1.57079637f).ToRotationVector2(); vector9 += value19 * 16f; for (int num257 = 0; num257 < 20; num257++) { int num258 = Dust.NewDust(vector9, this.width, this.height, 81, 0f, 0f, 0, default(Color), 1f); Main.dust[num258].position = (Main.dust[num258].position + base.Center) / 2f; Main.dust[num258].velocity += value19 * 2f; Main.dust[num258].velocity *= 0.5f; Main.dust[num258].noGravity = true; vector9 -= value19 * 8f; } } if (this.type == 1 || this.type == 81 || this.type == 98) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num259 = 0; num259 < 10; num259++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 7, 0f, 0f, 0, default(Color), 1f); } } if (this.type == 336 || this.type == 345) { for (int num260 = 0; num260 < 6; num260++) { int num261 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 196, 0f, 0f, 0, default(Color), 1f); Main.dust[num261].noGravity = true; Main.dust[num261].scale = this.scale; } } if (this.type == 358) { this.velocity = this.oldVelocity * 0.2f; for (int num262 = 0; num262 < 100; num262++) { int num263 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 211, 0f, 0f, 75, default(Color), 1.2f); if (Main.rand.Next(2) == 0) { Main.dust[num263].alpha += 25; } if (Main.rand.Next(2) == 0) { Main.dust[num263].alpha += 25; } if (Main.rand.Next(2) == 0) { Main.dust[num263].alpha += 25; } if (Main.rand.Next(2) == 0) { Main.dust[num263].scale = 0.6f; } else { Main.dust[num263].noGravity = true; } Main.dust[num263].velocity *= 0.3f; Main.dust[num263].velocity += this.velocity; Main.dust[num263].velocity *= 1f + (float)Main.rand.Next(-100, 101) * 0.01f; Dust expr_88DC_cp_0 = Main.dust[num263]; expr_88DC_cp_0.velocity.X = expr_88DC_cp_0.velocity.X + (float)Main.rand.Next(-50, 51) * 0.015f; Dust expr_890C_cp_0 = Main.dust[num263]; expr_890C_cp_0.velocity.Y = expr_890C_cp_0.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.015f; Main.dust[num263].position = base.Center; } } if (this.type == 406) { int num264 = 175; Color newColor3 = new Color(0, 80, 255, 100); this.velocity = this.oldVelocity * 0.2f; for (int num265 = 0; num265 < 40; num265++) { int num266 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 4, 0f, 0f, num264, newColor3, 1.6f); if (Main.rand.Next(2) == 0) { Main.dust[num266].alpha += 25; } if (Main.rand.Next(2) == 0) { Main.dust[num266].alpha += 25; } if (Main.rand.Next(2) == 0) { Main.dust[num266].alpha += 25; } if (Main.rand.Next(2) == 0) { Main.dust[num266].scale = 0.6f; } else { Main.dust[num266].noGravity = true; } Main.dust[num266].velocity *= 0.3f; Main.dust[num266].velocity += this.velocity; Main.dust[num266].velocity *= 1f + (float)Main.rand.Next(-100, 101) * 0.01f; Dust expr_8B10_cp_0 = Main.dust[num266]; expr_8B10_cp_0.velocity.X = expr_8B10_cp_0.velocity.X + (float)Main.rand.Next(-50, 51) * 0.015f; Dust expr_8B40_cp_0 = Main.dust[num266]; expr_8B40_cp_0.velocity.Y = expr_8B40_cp_0.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.015f; Main.dust[num266].position = base.Center; } } if (this.type == 344) { for (int num267 = 0; num267 < 3; num267++) { int num268 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 197, 0f, 0f, 0, default(Color), 1f); Main.dust[num268].noGravity = true; Main.dust[num268].scale = this.scale; } } else if (this.type == 343) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 27); for (int num269 = 4; num269 < 31; num269++) { float num270 = this.oldVelocity.X * (30f / (float)num269); float num271 = this.oldVelocity.Y * (30f / (float)num269); int num272 = Dust.NewDust(new Vector2(this.oldPosition.X - num270, this.oldPosition.Y - num271), 8, 8, 197, this.oldVelocity.X, this.oldVelocity.Y, 100, default(Color), 1.2f); Main.dust[num272].noGravity = true; Main.dust[num272].velocity *= 0.5f; } } else if (this.type == 349) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 27); for (int num273 = 0; num273 < 3; num273++) { int num274 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 76, 0f, 0f, 0, default(Color), 1f); Main.dust[num274].noGravity = true; Main.dust[num274].noLight = true; Main.dust[num274].scale = 0.7f; } } if (this.type == 323) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num275 = 0; num275 < 20; num275++) { int num276 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 7, 0f, 0f, 0, default(Color), 1f); if (Main.rand.Next(2) == 0) { Main.dust[num276].noGravity = true; Main.dust[num276].scale = 1.3f; Main.dust[num276].velocity *= 1.5f; Main.dust[num276].velocity -= this.oldVelocity * 0.5f; Main.dust[num276].velocity *= 1.5f; } else { Main.dust[num276].velocity *= 0.75f; Main.dust[num276].velocity -= this.oldVelocity * 0.25f; Main.dust[num276].scale = 0.8f; } } } if (this.type == 589) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 27); Color newColor4 = Color.Red; if (this.ai[1] == 1f) { newColor4 = Color.Green; } if (this.ai[1] == 2f) { newColor4 = Color.Purple; } if (this.ai[1] == 3f) { newColor4 = Color.Gold; } if (this.ai[1] == 4f) { newColor4 = Color.White; } newColor4.A = 100; for (int num277 = 0; num277 < 30; num277++) { int num278 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 11, 0f, 0f, 0, newColor4, 1f); Main.dust[num278].velocity *= 1f + Main.rand.NextFloat() * 1f; if (num277 < 10) { Main.dust[num278].noGravity = true; Main.dust[num278].velocity *= 0.5f; } } } if (this.type == 346) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 27); for (int num279 = 0; num279 < 10; num279++) { int num280 = 10; if (this.ai[1] == 1f) { num280 = 4; } int num281 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, num280, 0f, 0f, 0, default(Color), 1f); Main.dust[num281].noGravity = true; } } if (this.type == 335) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 27); for (int num282 = 0; num282 < 10; num282++) { int num283 = 90 - (int)this.ai[1]; int num284 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, num283, 0f, 0f, 0, default(Color), 1f); Main.dust[num284].noLight = true; Main.dust[num284].scale = 0.8f; } } if (this.type == 318) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num285 = 0; num285 < 10; num285++) { int num286 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 30, 0f, 0f, 0, default(Color), 1f); if (Main.rand.Next(2) == 0) { Main.dust[num286].noGravity = true; } } } if (this.type == 378) { for (int num287 = 0; num287 < 10; num287++) { int num288 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 30, 0f, 0f, 0, default(Color), 1f); if (Main.rand.Next(2) == 0) { Main.dust[num288].noGravity = true; } } } else if (this.type == 311) { for (int num289 = 0; num289 < 5; num289++) { int num290 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 189, 0f, 0f, 0, default(Color), 1f); Main.dust[num290].scale = 0.85f; Main.dust[num290].noGravity = true; Main.dust[num290].velocity += this.velocity * 0.5f; } } else if (this.type == 316) { for (int num291 = 0; num291 < 5; num291++) { int num292 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 195, 0f, 0f, 0, default(Color), 1f); Main.dust[num292].scale = 0.85f; Main.dust[num292].noGravity = true; Main.dust[num292].velocity += this.velocity * 0.5f; } } else if (this.type == 184 || this.type == 195) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num293 = 0; num293 < 5; num293++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 7, 0f, 0f, 0, default(Color), 1f); } } else if (this.type == 275 || this.type == 276) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num294 = 0; num294 < 5; num294++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 7, 0f, 0f, 0, default(Color), 1f); } } else if (this.type == 291) { if (this.owner == Main.myPlayer) { Projectile.NewProjectile(base.Center.X, base.Center.Y, 0f, 0f, 292, this.damage, this.knockBack, this.owner, 0f, 0f); } } else if (this.type == 295) { if (this.owner == Main.myPlayer) { Projectile.NewProjectile(base.Center.X, base.Center.Y, 0f, 0f, 296, (int)((double)this.damage * 0.65), this.knockBack, this.owner, 0f, 0f); } } else if (this.type == 270) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 27); if (this.ai[0] < 0f) { for (int num295 = 0; num295 < 20; num295++) { int num296 = Dust.NewDust(this.position, this.width, this.height, 26, 0f, 0f, 100, default(Color), 1f); Main.dust[num296].noGravity = true; Main.dust[num296].velocity *= 1.2f; Main.dust[num296].scale = 1.3f; Main.dust[num296].velocity -= this.oldVelocity * 0.3f; num296 = Dust.NewDust(new Vector2(this.position.X + 4f, this.position.Y + 4f), this.width - 8, this.height - 8, 5, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num296].noGravity = true; Main.dust[num296].velocity *= 3f; } } else { for (int num297 = 0; num297 < 20; num297++) { int num298 = Dust.NewDust(this.position, this.width, this.height, 26, 0f, 0f, 100, default(Color), 1f); Main.dust[num298].noGravity = true; Main.dust[num298].velocity *= 1.2f; Main.dust[num298].scale = 1.3f; Main.dust[num298].velocity -= this.oldVelocity * 0.3f; num298 = Dust.NewDust(new Vector2(this.position.X + 4f, this.position.Y + 4f), this.width - 8, this.height - 8, 6, 0f, 0f, 100, default(Color), 2f); Main.dust[num298].noGravity = true; Main.dust[num298].velocity *= 3f; } } } else if (this.type == 265) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 27); for (int num299 = 0; num299 < 15; num299++) { int num300 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 163, 0f, 0f, 100, default(Color), 1.2f); Main.dust[num300].noGravity = true; Main.dust[num300].velocity *= 1.2f; Main.dust[num300].velocity -= this.oldVelocity * 0.3f; } } else if (this.type == 355) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 27); for (int num301 = 0; num301 < 15; num301++) { int num302 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 205, 0f, 0f, 100, default(Color), 1.2f); Main.dust[num302].noGravity = true; Main.dust[num302].velocity *= 1.2f; Main.dust[num302].velocity -= this.oldVelocity * 0.3f; } } else if (this.type == 304) { for (int num303 = 0; num303 < 3; num303++) { int num304 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 182, 0f, 0f, 100, default(Color), 0.8f); Main.dust[num304].noGravity = true; Main.dust[num304].velocity *= 1.2f; Main.dust[num304].velocity -= this.oldVelocity * 0.3f; } } else if (this.type == 263) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 27); for (int num305 = 0; num305 < 15; num305++) { int num306 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 92, this.velocity.X, this.velocity.Y, Main.rand.Next(0, 101), default(Color), 1f + (float)Main.rand.Next(40) * 0.01f); Main.dust[num306].noGravity = true; Main.dust[num306].velocity *= 2f; } } else if (this.type == 261) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num307 = 0; num307 < 5; num307++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 148, 0f, 0f, 0, default(Color), 1f); } } else if (this.type == 229) { for (int num308 = 0; num308 < 25; num308++) { int num309 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 157, 0f, 0f, 0, default(Color), 1f); Main.dust[num309].noGravity = true; Main.dust[num309].velocity *= 1.5f; Main.dust[num309].scale = 1.5f; } } else if (this.type == 239) { int num310 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float)this.height - 2f), 2, 2, 154, 0f, 0f, 0, default(Color), 1f); Dust expr_A0A0_cp_0 = Main.dust[num310]; expr_A0A0_cp_0.position.X = expr_A0A0_cp_0.position.X - 2f; Main.dust[num310].alpha = 38; Main.dust[num310].velocity *= 0.1f; Main.dust[num310].velocity += -this.oldVelocity * 0.25f; Main.dust[num310].scale = 0.95f; } else if (this.type == 245) { int num311 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float)this.height - 2f), 2, 2, 114, 0f, 0f, 0, default(Color), 1f); Main.dust[num311].noGravity = true; Dust expr_A1AC_cp_0 = Main.dust[num311]; expr_A1AC_cp_0.position.X = expr_A1AC_cp_0.position.X - 2f; Main.dust[num311].alpha = 38; Main.dust[num311].velocity *= 0.1f; Main.dust[num311].velocity += -this.oldVelocity * 0.25f; Main.dust[num311].scale = 0.95f; } else if (this.type == 264) { int num312 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float)this.height - 2f), 2, 2, 54, 0f, 0f, 0, default(Color), 1f); Main.dust[num312].noGravity = true; Dust expr_A2B8_cp_0 = Main.dust[num312]; expr_A2B8_cp_0.position.X = expr_A2B8_cp_0.position.X - 2f; Main.dust[num312].alpha = 38; Main.dust[num312].velocity *= 0.1f; Main.dust[num312].velocity += -this.oldVelocity * 0.25f; Main.dust[num312].scale = 0.95f; } else if (this.type == 206 || this.type == 225) { Main.PlaySound(6, (int)this.position.X, (int)this.position.Y, 1); for (int num313 = 0; num313 < 5; num313++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 40, 0f, 0f, 0, default(Color), 1f); } } else if (this.type == 227) { Main.PlaySound(6, (int)this.position.X, (int)this.position.Y, 1); for (int num314 = 0; num314 < 15; num314++) { int num315 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 157, 0f, 0f, 0, default(Color), 1f); Main.dust[num315].noGravity = true; Main.dust[num315].velocity += this.oldVelocity; Main.dust[num315].scale = 1.5f; } } else if (this.type == 237 && this.owner == Main.myPlayer) { Projectile.NewProjectile(base.Center.X, base.Center.Y, 0f, 0f, 238, this.damage, this.knockBack, this.owner, 0f, 0f); } else if (this.type == 243 && this.owner == Main.myPlayer) { Projectile.NewProjectile(base.Center.X, base.Center.Y, 0f, 0f, 244, this.damage, this.knockBack, this.owner, 0f, 0f); } else if (this.type == 696 && this.owner == Main.myPlayer)// { Projectile.NewProjectile(base.Center.X, base.Center.Y, 0f, 0f, 694, this.damage, this.knockBack, this.owner, 0f, 0f); } else if (this.type == 120) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num316 = 0; num316 < 10; num316++) { int num317 = 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, default(Color), 1f); if (num316 < 5) { Main.dust[num317].noGravity = true; } Main.dust[num317].velocity *= 0.2f; } } else if (this.type == 181 || this.type == 189 || this.type == 566) { for (int num318 = 0; num318 < 6; num318++) { int num319 = Dust.NewDust(this.position, this.width, this.height, 150, this.velocity.X, this.velocity.Y, 50, default(Color), 1f); Main.dust[num319].noGravity = true; Main.dust[num319].scale = 1f; } } else if (this.type == 178) { for (int num320 = 0; num320 < 85; num320++) { int num321 = Main.rand.Next(139, 143); int num322 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, num321, this.velocity.X, this.velocity.Y, 0, default(Color), 1.2f); Dust expr_A7ED_cp_0 = Main.dust[num322]; expr_A7ED_cp_0.velocity.X = expr_A7ED_cp_0.velocity.X + (float)Main.rand.Next(-50, 51) * 0.01f; Dust expr_A81D_cp_0 = Main.dust[num322]; expr_A81D_cp_0.velocity.Y = expr_A81D_cp_0.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.01f; Dust expr_A84D_cp_0 = Main.dust[num322]; expr_A84D_cp_0.velocity.X = expr_A84D_cp_0.velocity.X * (1f + (float)Main.rand.Next(-50, 51) * 0.01f); Dust expr_A883_cp_0 = Main.dust[num322]; expr_A883_cp_0.velocity.Y = expr_A883_cp_0.velocity.Y * (1f + (float)Main.rand.Next(-50, 51) * 0.01f); Dust expr_A8B9_cp_0 = Main.dust[num322]; expr_A8B9_cp_0.velocity.X = expr_A8B9_cp_0.velocity.X + (float)Main.rand.Next(-50, 51) * 0.05f; Dust expr_A8E9_cp_0 = Main.dust[num322]; expr_A8E9_cp_0.velocity.Y = expr_A8E9_cp_0.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.05f; Main.dust[num322].scale *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; } for (int num323 = 0; num323 < 40; num323++) { int num324 = Main.rand.Next(276, 283); int num325 = Gore.NewGore(this.position, this.velocity, num324, 1f); Gore expr_A99F_cp_0 = Main.gore[num325]; expr_A99F_cp_0.velocity.X = expr_A99F_cp_0.velocity.X + (float)Main.rand.Next(-50, 51) * 0.01f; Gore expr_A9CF_cp_0 = Main.gore[num325]; expr_A9CF_cp_0.velocity.Y = expr_A9CF_cp_0.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.01f; Gore expr_A9FF_cp_0 = Main.gore[num325]; expr_A9FF_cp_0.velocity.X = expr_A9FF_cp_0.velocity.X * (1f + (float)Main.rand.Next(-50, 51) * 0.01f); Gore expr_AA35_cp_0 = Main.gore[num325]; expr_AA35_cp_0.velocity.Y = expr_AA35_cp_0.velocity.Y * (1f + (float)Main.rand.Next(-50, 51) * 0.01f); Main.gore[num325].scale *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f; Gore expr_AA9C_cp_0 = Main.gore[num325]; expr_AA9C_cp_0.velocity.X = expr_AA9C_cp_0.velocity.X + (float)Main.rand.Next(-50, 51) * 0.05f; Gore expr_AACC_cp_0 = Main.gore[num325]; expr_AACC_cp_0.velocity.Y = expr_AACC_cp_0.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.05f; } } else if (this.type == 289) { for (int num326 = 0; num326 < 30; num326++) { int num327 = Main.rand.Next(139, 143); int num328 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, num327, this.velocity.X, this.velocity.Y, 0, default(Color), 1.2f); Dust expr_ABA6_cp_0 = Main.dust[num328]; expr_ABA6_cp_0.velocity.X = expr_ABA6_cp_0.velocity.X + (float)Main.rand.Next(-50, 51) * 0.01f; Dust expr_ABD6_cp_0 = Main.dust[num328]; expr_ABD6_cp_0.velocity.Y = expr_ABD6_cp_0.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.01f; Dust expr_AC06_cp_0 = Main.dust[num328]; expr_AC06_cp_0.velocity.X = expr_AC06_cp_0.velocity.X * (1f + (float)Main.rand.Next(-50, 51) * 0.01f); Dust expr_AC3C_cp_0 = Main.dust[num328]; expr_AC3C_cp_0.velocity.Y = expr_AC3C_cp_0.velocity.Y * (1f + (float)Main.rand.Next(-50, 51) * 0.01f); Dust expr_AC72_cp_0 = Main.dust[num328]; expr_AC72_cp_0.velocity.X = expr_AC72_cp_0.velocity.X + (float)Main.rand.Next(-50, 51) * 0.05f; Dust expr_ACA2_cp_0 = Main.dust[num328]; expr_ACA2_cp_0.velocity.Y = expr_ACA2_cp_0.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.05f; Main.dust[num328].scale *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; } for (int num329 = 0; num329 < 15; num329++) { int num330 = Main.rand.Next(276, 283); int num331 = Gore.NewGore(this.position, this.velocity, num330, 1f); Gore expr_AD58_cp_0 = Main.gore[num331]; expr_AD58_cp_0.velocity.X = expr_AD58_cp_0.velocity.X + (float)Main.rand.Next(-50, 51) * 0.01f; Gore expr_AD88_cp_0 = Main.gore[num331]; expr_AD88_cp_0.velocity.Y = expr_AD88_cp_0.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.01f; Gore expr_ADB8_cp_0 = Main.gore[num331]; expr_ADB8_cp_0.velocity.X = expr_ADB8_cp_0.velocity.X * (1f + (float)Main.rand.Next(-50, 51) * 0.01f); Gore expr_ADEE_cp_0 = Main.gore[num331]; expr_ADEE_cp_0.velocity.Y = expr_ADEE_cp_0.velocity.Y * (1f + (float)Main.rand.Next(-50, 51) * 0.01f); Main.gore[num331].scale *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f; Gore expr_AE55_cp_0 = Main.gore[num331]; expr_AE55_cp_0.velocity.X = expr_AE55_cp_0.velocity.X + (float)Main.rand.Next(-50, 51) * 0.05f; Gore expr_AE85_cp_0 = Main.gore[num331]; expr_AE85_cp_0.velocity.Y = expr_AE85_cp_0.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.05f; } } else if (this.type == 475 || this.type == 505 || this.type == 506) { if (this.ai[1] == 0f) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); } if (this.ai[1] < 10f) { Vector2 position = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num332 = -this.velocity.X; float num333 = -this.velocity.Y; float num334 = 1f; if (this.ai[0] <= 17f) { num334 = this.ai[0] / 17f; } int num335 = (int)(30f * num334); float num336 = 1f; if (this.ai[0] <= 30f) { num336 = this.ai[0] / 30f; } float num337 = 0.4f * num336; float num338 = num337; num333 += num338; for (int num339 = 0; num339 < num335; num339++) { float num340 = (float)Math.Sqrt((double)(num332 * num332 + num333 * num333)); float num341 = 5.6f; if (Math.Abs(num332) + Math.Abs(num333) < 1f) { num341 *= Math.Abs(num332) + Math.Abs(num333) / 1f; } num340 = num341 / num340; num332 *= num340; num333 *= num340; Math.Atan2((double)num333, (double)num332); int num342 = 3; if (this.type == 506) { num342 = 30; } if (this.type == 505) { num342 = 239; } if ((float)num339 > this.ai[1]) { for (int num343 = 0; num343 < 4; num343++) { int num344 = Dust.NewDust(position, this.width, this.height, num342, 0f, 0f, 0, default(Color), 1f); Main.dust[num344].noGravity = true; Main.dust[num344].velocity *= 0.3f; } } position.X += num332; position.Y += num333; num332 = -this.velocity.X; num333 = -this.velocity.Y; num338 += num337; num333 += num338; } } } else if (this.type == 171) { if (this.ai[1] == 0f) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); } if (this.ai[1] < 10f) { Vector2 position2 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num345 = -this.velocity.X; float num346 = -this.velocity.Y; float num347 = 1f; if (this.ai[0] <= 17f) { num347 = this.ai[0] / 17f; } int num348 = (int)(30f * num347); float num349 = 1f; if (this.ai[0] <= 30f) { num349 = this.ai[0] / 30f; } float num350 = 0.4f * num349; float num351 = num350; num346 += num351; for (int num352 = 0; num352 < num348; num352++) { float num353 = (float)Math.Sqrt((double)(num345 * num345 + num346 * num346)); float num354 = 5.6f; if (Math.Abs(num345) + Math.Abs(num346) < 1f) { num354 *= Math.Abs(num345) + Math.Abs(num346) / 1f; } num353 = num354 / num353; num345 *= num353; num346 *= num353; Math.Atan2((double)num346, (double)num345); if ((float)num352 > this.ai[1]) { for (int num355 = 0; num355 < 4; num355++) { int num356 = Dust.NewDust(position2, this.width, this.height, 129, 0f, 0f, 0, default(Color), 1f); Main.dust[num356].noGravity = true; Main.dust[num356].velocity *= 0.3f; } } position2.X += num345; position2.Y += num346; num345 = -this.velocity.X; num346 = -this.velocity.Y; num351 += num350; num346 += num351; } } } else if (this.type == 117) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num357 = 0; num357 < 10; num357++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 26, 0f, 0f, 0, default(Color), 1f); } } else if (this.type == 166) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 51); for (int num358 = 0; num358 < 10; num358++) { int num359 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 76, 0f, 0f, 0, default(Color), 1f); Main.dust[num359].noGravity = true; Main.dust[num359].velocity -= this.oldVelocity * 0.25f; } } else if (this.type == 158) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num360 = 0; num360 < 10; num360++) { int num361 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 9, 0f, 0f, 0, default(Color), 1f); Main.dust[num361].noGravity = true; Main.dust[num361].velocity -= this.velocity * 0.5f; } } else if (this.type == 159) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num362 = 0; num362 < 10; num362++) { int num363 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 11, 0f, 0f, 0, default(Color), 1f); Main.dust[num363].noGravity = true; Main.dust[num363].velocity -= this.velocity * 0.5f; } } else if (this.type == 160) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num364 = 0; num364 < 10; num364++) { int num365 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 19, 0f, 0f, 0, default(Color), 1f); Main.dust[num365].noGravity = true; Main.dust[num365].velocity -= this.velocity * 0.5f; } } else if (this.type == 161) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num366 = 0; num366 < 10; num366++) { int num367 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 11, 0f, 0f, 0, default(Color), 1f); Main.dust[num367].noGravity = true; Main.dust[num367].velocity -= this.velocity * 0.5f; } } else if (this.type >= 191 && this.type <= 194) { int num368 = Gore.NewGore(new Vector2(this.position.X - (float)(this.width / 2), this.position.Y - (float)(this.height / 2)), new Vector2(0f, 0f), Main.rand.Next(61, 64), this.scale); Main.gore[num368].velocity *= 0.1f; } else if (!Main.projPet[this.type]) { if (this.type == 93) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num369 = 0; num369 < 10; num369++) { int num370 = Dust.NewDust(this.position, this.width, this.height, 57, 0f, 0f, 100, default(Color), 0.5f); Dust expr_BAEE_cp_0 = Main.dust[num370]; expr_BAEE_cp_0.velocity.X = expr_BAEE_cp_0.velocity.X * 2f; Dust expr_BB0E_cp_0 = Main.dust[num370]; expr_BB0E_cp_0.velocity.Y = expr_BB0E_cp_0.velocity.Y * 2f; } } else if (this.type == 99) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num371 = 0; num371 < 30; num371++) { int num372 = Dust.NewDust(this.position, this.width, this.height, 1, 0f, 0f, 0, default(Color), 1f); if (Main.rand.Next(2) == 0) { Main.dust[num372].scale *= 1.4f; } this.velocity *= 1.9f; } } else if (this.type == 91 || this.type == 92) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 10); for (int num373 = 0; num373 < 10; num373++) { Dust.NewDust(this.position, this.width, this.height, 58, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 150, default(Color), 1.2f); } for (int num374 = 0; num374 < 3; num374++) { Gore.NewGore(this.position, new Vector2(this.velocity.X * 0.05f, this.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); } if (this.type == 12 && this.damage < 500) { for (int num375 = 0; num375 < 10; num375++) { Dust.NewDust(this.position, this.width, this.height, 57, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 150, default(Color), 1.2f); } for (int num376 = 0; num376 < 3; num376++) { Gore.NewGore(this.position, new Vector2(this.velocity.X * 0.05f, this.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); } } if ((this.type == 91 || (this.type == 92 && this.ai[0] > 0f)) && this.owner == Main.myPlayer) { float x = this.position.X + (float)Main.rand.Next(-400, 400); float y = this.position.Y - (float)Main.rand.Next(600, 900); Vector2 vector10 = new Vector2(x, y); float num377 = this.position.X + (float)(this.width / 2) - vector10.X; float num378 = this.position.Y + (float)(this.height / 2) - vector10.Y; int num379 = 22; float num380 = (float)Math.Sqrt((double)(num377 * num377 + num378 * num378)); num380 = (float)num379 / num380; num377 *= num380; num378 *= num380; int num381 = this.damage; int num382 = Projectile.NewProjectile(x, y, num377, num378, 92, num381, this.knockBack, this.owner, 0f, 0f); if (this.type == 91) { Main.projectile[num382].ai[1] = this.position.Y; Main.projectile[num382].ai[0] = 1f; } else { Main.projectile[num382].ai[1] = this.position.Y; } } } else if (this.type == 89) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num383 = 0; num383 < 5; num383++) { int num384 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 68, 0f, 0f, 0, default(Color), 1f); Main.dust[num384].noGravity = true; Main.dust[num384].velocity *= 1.5f; Main.dust[num384].scale *= 0.9f; } if (this.type == 89 && this.owner == Main.myPlayer) { for (int num385 = 0; num385 < 3; num385++) { float num386 = -this.velocity.X * (float)Main.rand.Next(40, 70) * 0.01f + (float)Main.rand.Next(-20, 21) * 0.4f; float num387 = -this.velocity.Y * (float)Main.rand.Next(40, 70) * 0.01f + (float)Main.rand.Next(-20, 21) * 0.4f; Projectile.NewProjectile(this.position.X + num386, this.position.Y + num387, num386, num387, 90, (int)((double)this.damage * 0.5), 0f, this.owner, 0f, 0f); } } } else if (this.type == 177) { for (int num388 = 0; num388 < 20; num388++) { int num389 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 137, 0f, 0f, Main.rand.Next(0, 101), default(Color), 1f + (float)Main.rand.Next(-20, 40) * 0.01f); Main.dust[num389].velocity -= this.oldVelocity * 0.2f; if (Main.rand.Next(3) == 0) { Main.dust[num389].scale *= 0.8f; Main.dust[num389].velocity *= 0.5f; } else { Main.dust[num389].noGravity = true; } } } else if (this.type == 119 || this.type == 118 || this.type == 128 || this.type == 359) { int num390 = 10; if (this.type == 119 || this.type == 359) { num390 = 20; } Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 27); for (int num391 = 0; num391 < num390; num391++) { int num392 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 92, 0f, 0f, 0, default(Color), 1f); if (Main.rand.Next(3) != 0) { Main.dust[num392].velocity *= 2f; Main.dust[num392].noGravity = true; Main.dust[num392].scale *= 1.75f; } else { Main.dust[num392].scale *= 0.5f; } } } else if (this.type == 309) { int num393 = 10; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 27); for (int num394 = 0; num394 < num393; num394++) { int num395 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 185, 0f, 0f, 0, default(Color), 1f); if (Main.rand.Next(2) == 0) { Main.dust[num395].velocity *= 2f; Main.dust[num395].noGravity = true; Main.dust[num395].scale *= 1.75f; } } } else if (this.type == 308) { int num396 = 80; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 27); for (int num397 = 0; num397 < num396; num397++) { int num398 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 16f), this.width, this.height - 16, 185, 0f, 0f, 0, default(Color), 1f); Main.dust[num398].velocity *= 2f; Main.dust[num398].noGravity = true; Main.dust[num398].scale *= 1.15f; } } else if (this.aiStyle == 29 && this.type <= 126) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); int num399 = this.type - 121 + 86; for (int num400 = 0; num400 < 15; num400++) { int num401 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, num399, this.oldVelocity.X, this.oldVelocity.Y, 50, default(Color), 1.2f); Main.dust[num401].noGravity = true; Main.dust[num401].scale *= 1.25f; Main.dust[num401].velocity *= 0.5f; } } else if (this.type == 597) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num402 = 0; num402 < 15; num402++) { int num403 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 262, this.oldVelocity.X, this.oldVelocity.Y, 50, default(Color), 1.2f); Main.dust[num403].noGravity = true; Main.dust[num403].scale *= 1.25f; Main.dust[num403].velocity *= 0.5f; } } else if (this.type == 337) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 27); for (int num404 = 0; num404 < 10; num404++) { int num405 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 197, 0f, 0f, 0, default(Color), 1f); Main.dust[num405].noGravity = true; } } else if (this.type == 379 || this.type == 377) { for (int num406 = 0; num406 < 5; num406++) { int num407 = Dust.NewDust(this.position, this.width, this.height, 171, 0f, 0f, 100, default(Color), 1f); Main.dust[num407].scale = (float)Main.rand.Next(1, 10) * 0.1f; Main.dust[num407].noGravity = true; Main.dust[num407].fadeIn = 1.5f; Main.dust[num407].velocity *= 0.75f; } } else if (this.type == 80) { if (this.ai[0] >= 0f) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 27); for (int num408 = 0; num408 < 10; num408++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 67, 0f, 0f, 0, default(Color), 1f); } } int num409 = (int)this.position.X / 16; int num410 = (int)this.position.Y / 16; if (Main.tile[num409, num410] == null) { Main.tile[num409, num410] = new Tile(); } if (Main.tile[num409, num410].type == 127 && Main.tile[num409, num410].active()) { WorldGen.KillTile(num409, num410, false, false, false); } } else if (this.type == 76 || this.type == 77 || this.type == 78) { for (int num411 = 0; num411 < 5; num411++) { int num412 = Dust.NewDust(this.position, this.width, this.height, 27, 0f, 0f, 80, default(Color), 1.5f); Main.dust[num412].noGravity = true; } } else if (this.type == 55) { for (int num413 = 0; num413 < 5; num413++) { int num414 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 18, 0f, 0f, 0, default(Color), 1.5f); Main.dust[num414].noGravity = true; } } else if (this.type == 51 || this.type == 267) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num415 = 0; num415 < 5; num415++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 0, 0f, 0f, 0, default(Color), 0.7f); } } else if (this.type == 478) { if (this.owner == Main.myPlayer) { Projectile.NewProjectile(base.Center.X, base.Center.Y, 0f, 0f, 480, (int)((double)this.damage * 0.8), this.knockBack * 0.5f, this.owner, 0f, 0f); } } else if (this.type == 477 || this.type == 479) { for (int num416 = 0; num416 < 5; num416++) { } Collision.HitTiles(this.position, this.velocity, this.width, this.height); } else if (this.type == 2 || this.type == 82) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num417 = 0; num417 < 10; num417++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 1f); } } else if (this.type == 474) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num418 = 0; num418 < 20; num418++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 26, 0f, 0f, 0, default(Color), 0.9f); } } else if (this.type == 172) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num419 = 0; num419 < 20; num419++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 135, 0f, 0f, 100, default(Color), 1f); } } else if (this.type == 103) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num420 = 0; num420 < 20; num420++) { int num421 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 75, 0f, 0f, 100, default(Color), 1f); if (Main.rand.Next(2) == 0) { Main.dust[num421].scale *= 2.5f; Main.dust[num421].noGravity = true; Main.dust[num421].velocity *= 5f; } } } else if (this.type == 278) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num422 = 0; num422 < 20; num422++) { int num423 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 169, 0f, 0f, 100, default(Color), 1f); if (Main.rand.Next(2) == 0) { Main.dust[num423].scale *= 1.5f; Main.dust[num423].noGravity = true; Main.dust[num423].velocity *= 5f; } } } else if (this.type == 3 || this.type == 48 || this.type == 54 || this.type == 599) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num424 = 0; num424 < 10; num424++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 1, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 0, default(Color), 0.75f); } } else if (this.type == 330) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num425 = 0; num425 < 10; num425++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 0, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 0, default(Color), 0.75f); } } else if (this.type == 4) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num426 = 0; num426 < 10; num426++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 14, 0f, 0f, 150, default(Color), 1.1f); } } else if (this.type == 5) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 10); for (int num427 = 0; num427 < 60; num427++) { int num428 = Main.rand.Next(3); if (num428 == 0) { num428 = 15; } else if (num428 == 1) { num428 = 57; } else { num428 = 58; } Dust.NewDust(this.position, this.width, this.height, num428, this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 150, default(Color), 1.5f); } } else if (this.type == 9 || this.type == 12 || this.type == 503) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 10); int num429 = 10; int num430 = 3; if (this.type == 503) { num429 = 40; num430 = 2; this.velocity /= 2f; } for (int num431 = 0; num431 < num429; num431++) { Dust.NewDust(this.position, this.width, this.height, 58, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 150, default(Color), 1.2f); } for (int num432 = 0; num432 < num430; num432++) { int num433 = Main.rand.Next(16, 18); if (this.type == 503) { num433 = 16; } Gore.NewGore(this.position, new Vector2(this.velocity.X * 0.05f, this.velocity.Y * 0.05f), num433, 1f); } if (this.type == 12 && this.damage < 100) { for (int num434 = 0; num434 < 10; num434++) { Dust.NewDust(this.position, this.width, this.height, 57, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 150, default(Color), 1.2f); } for (int num435 = 0; num435 < 3; num435++) { Gore.NewGore(this.position, new Vector2(this.velocity.X * 0.05f, this.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); } } } else if (this.type == 281) { Main.PlaySound(4, (int)this.position.X, (int)this.position.Y, 1); int num436 = Gore.NewGore(this.position, new Vector2((float)Main.rand.Next(-20, 21) * 0.2f, (float)Main.rand.Next(-20, 21) * 0.2f), 76, 1f); Main.gore[num436].velocity -= this.velocity * 0.5f; num436 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2((float)Main.rand.Next(-20, 21) * 0.2f, (float)Main.rand.Next(-20, 21) * 0.2f), 77, 1f); Main.gore[num436].velocity -= this.velocity * 0.5f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); for (int num437 = 0; num437 < 20; num437++) { int num438 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num438].velocity *= 1.4f; } for (int num439 = 0; num439 < 10; num439++) { int num440 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 2.5f); Main.dust[num440].noGravity = true; Main.dust[num440].velocity *= 5f; num440 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num440].velocity *= 3f; } num436 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num436].velocity *= 0.4f; Gore expr_DA03_cp_0 = Main.gore[num436]; expr_DA03_cp_0.velocity.X = expr_DA03_cp_0.velocity.X + 1f; Gore expr_DA23_cp_0 = Main.gore[num436]; expr_DA23_cp_0.velocity.Y = expr_DA23_cp_0.velocity.Y + 1f; num436 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num436].velocity *= 0.4f; Gore expr_DAA7_cp_0 = Main.gore[num436]; expr_DAA7_cp_0.velocity.X = expr_DAA7_cp_0.velocity.X - 1f; Gore expr_DAC7_cp_0 = Main.gore[num436]; expr_DAC7_cp_0.velocity.Y = expr_DAC7_cp_0.velocity.Y + 1f; num436 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num436].velocity *= 0.4f; Gore expr_DB4B_cp_0 = Main.gore[num436]; expr_DB4B_cp_0.velocity.X = expr_DB4B_cp_0.velocity.X + 1f; Gore expr_DB6B_cp_0 = Main.gore[num436]; expr_DB6B_cp_0.velocity.Y = expr_DB6B_cp_0.velocity.Y - 1f; num436 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num436].velocity *= 0.4f; Gore expr_DBEF_cp_0 = Main.gore[num436]; expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X - 1f; Gore expr_DC0F_cp_0 = Main.gore[num436]; expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y - 1f; this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 128; this.height = 128; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.Damage(); } else if (this.type == 162) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); for (int num441 = 0; num441 < 20; num441++) { int num442 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num442].velocity *= 1.4f; } for (int num443 = 0; num443 < 10; num443++) { int num444 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 2.5f); Main.dust[num444].noGravity = true; Main.dust[num444].velocity *= 5f; num444 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num444].velocity *= 3f; } int num445 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num445].velocity *= 0.4f; Gore expr_DEE9_cp_0 = Main.gore[num445]; expr_DEE9_cp_0.velocity.X = expr_DEE9_cp_0.velocity.X + 1f; Gore expr_DF09_cp_0 = Main.gore[num445]; expr_DF09_cp_0.velocity.Y = expr_DF09_cp_0.velocity.Y + 1f; num445 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num445].velocity *= 0.4f; Gore expr_DF8D_cp_0 = Main.gore[num445]; expr_DF8D_cp_0.velocity.X = expr_DF8D_cp_0.velocity.X - 1f; Gore expr_DFAD_cp_0 = Main.gore[num445]; expr_DFAD_cp_0.velocity.Y = expr_DFAD_cp_0.velocity.Y + 1f; num445 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num445].velocity *= 0.4f; Gore expr_E031_cp_0 = Main.gore[num445]; expr_E031_cp_0.velocity.X = expr_E031_cp_0.velocity.X + 1f; Gore expr_E051_cp_0 = Main.gore[num445]; expr_E051_cp_0.velocity.Y = expr_E051_cp_0.velocity.Y - 1f; num445 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num445].velocity *= 0.4f; Gore expr_E0D5_cp_0 = Main.gore[num445]; expr_E0D5_cp_0.velocity.X = expr_E0D5_cp_0.velocity.X - 1f; Gore expr_E0F5_cp_0 = Main.gore[num445]; expr_E0F5_cp_0.velocity.Y = expr_E0F5_cp_0.velocity.Y - 1f; this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 128; this.height = 128; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.Damage(); } else if (this.type == 240) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); for (int num446 = 0; num446 < 20; num446++) { int num447 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num447].velocity *= 1.4f; } for (int num448 = 0; num448 < 10; num448++) { int num449 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 2.5f); Main.dust[num449].noGravity = true; Main.dust[num449].velocity *= 5f; num449 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num449].velocity *= 3f; } int num450 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num450].velocity *= 0.4f; Gore expr_E3CF_cp_0 = Main.gore[num450]; expr_E3CF_cp_0.velocity.X = expr_E3CF_cp_0.velocity.X + 1f; Gore expr_E3EF_cp_0 = Main.gore[num450]; expr_E3EF_cp_0.velocity.Y = expr_E3EF_cp_0.velocity.Y + 1f; num450 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num450].velocity *= 0.4f; Gore expr_E473_cp_0 = Main.gore[num450]; expr_E473_cp_0.velocity.X = expr_E473_cp_0.velocity.X - 1f; Gore expr_E493_cp_0 = Main.gore[num450]; expr_E493_cp_0.velocity.Y = expr_E493_cp_0.velocity.Y + 1f; num450 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num450].velocity *= 0.4f; Gore expr_E517_cp_0 = Main.gore[num450]; expr_E517_cp_0.velocity.X = expr_E517_cp_0.velocity.X + 1f; Gore expr_E537_cp_0 = Main.gore[num450]; expr_E537_cp_0.velocity.Y = expr_E537_cp_0.velocity.Y - 1f; num450 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num450].velocity *= 0.4f; Gore expr_E5BB_cp_0 = Main.gore[num450]; expr_E5BB_cp_0.velocity.X = expr_E5BB_cp_0.velocity.X - 1f; Gore expr_E5DB_cp_0 = Main.gore[num450]; expr_E5DB_cp_0.velocity.Y = expr_E5DB_cp_0.velocity.Y - 1f; this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 96; this.height = 96; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.Damage(); } else if (this.type == 283 || this.type == 282) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 10); for (int num451 = 0; num451 < 10; num451++) { int num452 = Dust.NewDust(this.position, this.width, this.height, 171, 0f, 0f, 100, default(Color), 1f); Main.dust[num452].scale = (float)Main.rand.Next(1, 10) * 0.1f; Main.dust[num452].noGravity = true; Main.dust[num452].fadeIn = 1.5f; Main.dust[num452].velocity *= 0.75f; } } else if (this.type == 284) { for (int num453 = 0; num453 < 10; num453++) { int num454 = Main.rand.Next(139, 143); int num455 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, num454, -this.velocity.X * 0.3f, -this.velocity.Y * 0.3f, 0, default(Color), 1.2f); Dust expr_E826_cp_0 = Main.dust[num455]; expr_E826_cp_0.velocity.X = expr_E826_cp_0.velocity.X + (float)Main.rand.Next(-50, 51) * 0.01f; Dust expr_E856_cp_0 = Main.dust[num455]; expr_E856_cp_0.velocity.Y = expr_E856_cp_0.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.01f; Dust expr_E886_cp_0 = Main.dust[num455]; expr_E886_cp_0.velocity.X = expr_E886_cp_0.velocity.X * (1f + (float)Main.rand.Next(-50, 51) * 0.01f); Dust expr_E8BC_cp_0 = Main.dust[num455]; expr_E8BC_cp_0.velocity.Y = expr_E8BC_cp_0.velocity.Y * (1f + (float)Main.rand.Next(-50, 51) * 0.01f); Dust expr_E8F2_cp_0 = Main.dust[num455]; expr_E8F2_cp_0.velocity.X = expr_E8F2_cp_0.velocity.X + (float)Main.rand.Next(-50, 51) * 0.05f; Dust expr_E922_cp_0 = Main.dust[num455]; expr_E922_cp_0.velocity.Y = expr_E922_cp_0.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.05f; Main.dust[num455].scale *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; } for (int num456 = 0; num456 < 5; num456++) { int num457 = Main.rand.Next(276, 283); int num458 = Gore.NewGore(this.position, -this.velocity * 0.3f, num457, 1f); Gore expr_E9E7_cp_0 = Main.gore[num458]; expr_E9E7_cp_0.velocity.X = expr_E9E7_cp_0.velocity.X + (float)Main.rand.Next(-50, 51) * 0.01f; Gore expr_EA17_cp_0 = Main.gore[num458]; expr_EA17_cp_0.velocity.Y = expr_EA17_cp_0.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.01f; Gore expr_EA47_cp_0 = Main.gore[num458]; expr_EA47_cp_0.velocity.X = expr_EA47_cp_0.velocity.X * (1f + (float)Main.rand.Next(-50, 51) * 0.01f); Gore expr_EA7D_cp_0 = Main.gore[num458]; expr_EA7D_cp_0.velocity.Y = expr_EA7D_cp_0.velocity.Y * (1f + (float)Main.rand.Next(-50, 51) * 0.01f); Main.gore[num458].scale *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f; Gore expr_EAE4_cp_0 = Main.gore[num458]; expr_EAE4_cp_0.velocity.X = expr_EAE4_cp_0.velocity.X + (float)Main.rand.Next(-50, 51) * 0.05f; Gore expr_EB14_cp_0 = Main.gore[num458]; expr_EB14_cp_0.velocity.Y = expr_EB14_cp_0.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.05f; } } else if (this.type == 286) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); for (int num459 = 0; num459 < 7; num459++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f); } for (int num460 = 0; num460 < 3; num460++) { int num461 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 2.5f); Main.dust[num461].noGravity = true; Main.dust[num461].velocity *= 3f; num461 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num461].velocity *= 2f; } int num462 = Gore.NewGore(new Vector2(this.position.X - 10f, this.position.Y - 10f), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num462].velocity *= 0.3f; Gore expr_ED6F_cp_0 = Main.gore[num462]; expr_ED6F_cp_0.velocity.X = expr_ED6F_cp_0.velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f; Gore expr_ED9F_cp_0 = Main.gore[num462]; expr_ED9F_cp_0.velocity.Y = expr_ED9F_cp_0.velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f; if (this.owner == Main.myPlayer) { this.localAI[1] = -1f; this.maxPenetrate = 0; this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 80; this.height = 80; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.Damage(); } } else if (this.type == 14 || this.type == 20 || this.type == 36 || this.type == 83 || this.type == 84 || this.type == 389 || this.type == 104 || this.type == 279 || this.type == 100 || this.type == 661 || this.type == 110 || this.type == 180 || this.type == 207 || this.type == 357 || this.type == 242 || this.type == 302 || this.type == 257 || this.type == 259 || this.type == 285 || this.type == 287 || this.type == 576 || this.type == 577) { Collision.HitTiles(this.position, this.velocity, this.width, this.height); Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 10); } else if (this.type == 638) { Collision.HitTiles(this.position, this.velocity, this.width, this.height); Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 10); int num463 = Main.rand.Next(2, 5); for (int num464 = 0; num464 < num463; num464++) { int num465 = Dust.NewDust(base.Center, 0, 0, 229, 0f, 0f, 100, default(Color), 1f); Main.dust[num465].velocity *= 1.6f; Dust expr_F091_cp_0 = Main.dust[num465]; expr_F091_cp_0.velocity.Y = expr_F091_cp_0.velocity.Y - 1f; Main.dust[num465].position -= Vector2.One * 4f; Main.dust[num465].position = Vector2.Lerp(Main.dust[num465].position, base.Center, 0.5f); Main.dust[num465].noGravity = true; } } else if (this.type == 15 || this.type == 34 || this.type == 321) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 10); for (int num466 = 0; num466 < 20; num466++) { int num467 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 100, default(Color), 2f); Main.dust[num467].noGravity = true; Main.dust[num467].velocity *= 2f; num467 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 100, default(Color), 1f); Main.dust[num467].velocity *= 2f; } } else if (this.type == 253) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 10); for (int num468 = 0; num468 < 20; num468++) { int num469 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 135, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 100, default(Color), 2f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 2f; num469 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 135, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 100, default(Color), 1f); Main.dust[num469].velocity *= 2f; } } else if (this.type == 95 || this.type == 96) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 10); for (int num470 = 0; num470 < 20; num470++) { int num471 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 75, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 100, default(Color), 2f * this.scale); Main.dust[num471].noGravity = true; Main.dust[num471].velocity *= 2f; num471 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 75, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 100, default(Color), 1f * this.scale); Main.dust[num471].velocity *= 2f; } } else if (this.type == 79) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 10); for (int num472 = 0; num472 < 20; num472++) { int num473 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2f); Main.dust[num473].noGravity = true; Main.dust[num473].velocity *= 4f; } } else if (this.type == 16) { if (this.type == 16 && this.penetrate == 1) { this.maxPenetrate = -1; this.penetrate = -1; int num474 = 60; this.position.X = this.position.X - (float)(num474 / 2); this.position.Y = this.position.Y - (float)(num474 / 2); this.width += num474; this.height += num474; this.tileCollide = false; this.velocity *= 0.01f; this.Damage(); this.scale = 0.01f; } this.position.X = this.position.X + (float)(this.width / 2); this.width = 10; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.height = 10; this.position.Y = this.position.Y - (float)(this.height / 2); Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 10); for (int num475 = 0; num475 < 20; num475++) { int num476 = Dust.NewDust(new Vector2(this.position.X - this.velocity.X, this.position.Y - this.velocity.Y), this.width, this.height, 15, 0f, 0f, 100, default(Color), 2f); Main.dust[num476].noGravity = true; Main.dust[num476].velocity *= 2f; num476 = Dust.NewDust(new Vector2(this.position.X - this.velocity.X, this.position.Y - this.velocity.Y), this.width, this.height, 15, 0f, 0f, 100, default(Color), 1f); } } else if (this.type == 17) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num477 = 0; num477 < 5; num477++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 0, 0f, 0f, 0, default(Color), 1f); } } else if (this.type == 31 || this.type == 42) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num478 = 0; num478 < 5; num478++) { int num479 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 32, 0f, 0f, 0, default(Color), 1f); Main.dust[num479].velocity *= 0.6f; } } else if (this.type >= 411 && this.type <= 414) { int num480 = 9; if (this.type == 412 || this.type == 414) { num480 = 11; } if (this.type == 413) { num480 = 19; } for (int num481 = 0; num481 < 5; num481++) { int num482 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, num480, 0f, this.velocity.Y / 2f, 0, default(Color), 1f); Main.dust[num482].noGravity = true; Main.dust[num482].velocity -= this.velocity * 0.5f; } } else if (this.type == 109) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num483 = 0; num483 < 5; num483++) { int num484 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 51, 0f, 0f, 0, default(Color), 0.6f); Main.dust[num484].velocity *= 0.6f; } } else if (this.type == 39) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num485 = 0; num485 < 5; num485++) { int num486 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 38, 0f, 0f, 0, default(Color), 1f); Main.dust[num486].velocity *= 0.6f; } } else if (this.type == 71) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num487 = 0; num487 < 5; num487++) { int num488 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 53, 0f, 0f, 0, default(Color), 1f); Main.dust[num488].velocity *= 0.6f; } } else if (this.type == 40) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num489 = 0; num489 < 5; num489++) { int num490 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 36, 0f, 0f, 0, default(Color), 1f); Main.dust[num490].velocity *= 0.6f; } } else if (this.type == 21 || this.type == 471 || this.type == 532) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num491 = 0; num491 < 10; num491++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 26, 0f, 0f, 0, default(Color), 0.8f); } } else if (this.type == 583) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num492 = 0; num492 < 10; num492++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 4, 0f, 0f, 100, new Color(20, 250, 20, 240), 0.8f); } } else if (this.type == 584) { Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num493 = 0; num493 < 10; num493++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 4, 0f, 0f, 100, new Color(250, 20, 120, 240), 0.8f); } } else if (this.type == 24) { for (int num494 = 0; num494 < 10; num494++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 1, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 0, default(Color), 0.75f); } } else if (this.type == 27) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 10); for (int num495 = 0; num495 < 30; num495++) { int num496 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 172, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 100, default(Color), 1f); Main.dust[num496].noGravity = true; Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 172, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 100, default(Color), 0.5f); } } else if (this.type == 38) { for (int num497 = 0; num497 < 10; num497++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 42, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 0, default(Color), 1f); } } else if (this.type == 44 || this.type == 45) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 10); for (int num498 = 0; num498 < 30; num498++) { int num499 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 27, this.velocity.X, this.velocity.Y, 100, default(Color), 1.7f); Main.dust[num499].noGravity = true; Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 27, this.velocity.X, this.velocity.Y, 100, default(Color), 1f); } } else if (this.type == 41) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); for (int num500 = 0; num500 < 10; num500++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f); } for (int num501 = 0; num501 < 5; num501++) { int num502 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 2.5f); Main.dust[num502].noGravity = true; Main.dust[num502].velocity *= 3f; num502 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num502].velocity *= 2f; } int num503 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num503].velocity *= 0.4f; Gore expr_105D2_cp_0 = Main.gore[num503]; expr_105D2_cp_0.velocity.X = expr_105D2_cp_0.velocity.X + (float)Main.rand.Next(-10, 11) * 0.1f; Gore expr_10602_cp_0 = Main.gore[num503]; expr_10602_cp_0.velocity.Y = expr_10602_cp_0.velocity.Y + (float)Main.rand.Next(-10, 11) * 0.1f; num503 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num503].velocity *= 0.4f; Gore expr_10696_cp_0 = Main.gore[num503]; expr_10696_cp_0.velocity.X = expr_10696_cp_0.velocity.X + (float)Main.rand.Next(-10, 11) * 0.1f; Gore expr_106C6_cp_0 = Main.gore[num503]; expr_106C6_cp_0.velocity.Y = expr_106C6_cp_0.velocity.Y + (float)Main.rand.Next(-10, 11) * 0.1f; if (this.owner == Main.myPlayer) { this.penetrate = -1; this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 64; this.height = 64; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.Damage(); } } else if (this.type == 514) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); for (int num504 = 0; num504 < 10; num504++) { int num505 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.3f); Main.dust[num505].velocity *= 1.4f; } for (int num506 = 0; num506 < 6; num506++) { int num507 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 2.1f); Main.dust[num507].noGravity = true; Main.dust[num507].velocity *= 4.6f; num507 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 1.3f); Main.dust[num507].velocity *= 3.3f; if (Main.rand.Next(2) == 0) { num507 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 1.1f); Main.dust[num507].velocity *= 2.7f; } } if (this.owner == Main.myPlayer) { this.penetrate = -1; this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 112; this.height = 112; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.ai[0] = 2f; this.Damage(); } } else if (this.type == 306) { Main.PlaySound(3, (int)this.position.X, (int)this.position.Y, 1); for (int num508 = 0; num508 < 20; num508++) { int num509 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 184, 0f, 0f, 0, default(Color), 1f); Main.dust[num509].scale *= 1.1f; Main.dust[num509].noGravity = true; } for (int num510 = 0; num510 < 30; num510++) { int num511 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 184, 0f, 0f, 0, default(Color), 1f); Main.dust[num511].velocity *= 2.5f; Main.dust[num511].scale *= 0.8f; Main.dust[num511].noGravity = true; } if (this.owner == Main.myPlayer) { int num512 = 2; if (Main.rand.Next(10) == 0) { num512++; } if (Main.rand.Next(10) == 0) { num512++; } if (Main.rand.Next(10) == 0) { num512++; } for (int num513 = 0; num513 < num512; num513++) { float num514 = (float)Main.rand.Next(-35, 36) * 0.02f; float num515 = (float)Main.rand.Next(-35, 36) * 0.02f; num514 *= 10f; num515 *= 10f; Projectile.NewProjectile(this.position.X, this.position.Y, num514, num515, 307, (int)((double)this.damage * 0.7), (float)((int)((double)this.knockBack * 0.35)), Main.myPlayer, 0f, 0f); } } } else if (this.type == 469) { if (this.owner == Main.myPlayer) { int num516 = 6; for (int num517 = 0; num517 < num516; num517++) { if (num517 % 2 != 1 || Main.rand.Next(3) == 0) { Vector2 value20 = this.position; Vector2 value21 = this.oldVelocity; value21.Normalize(); value21 *= 8f; float num518 = (float)Main.rand.Next(-35, 36) * 0.01f; float num519 = (float)Main.rand.Next(-35, 36) * 0.01f; value20 -= value21 * (float)num517; num518 += this.oldVelocity.X / 6f; num519 += this.oldVelocity.Y / 6f; int num520 = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[this.owner].beeType(), Main.player[this.owner].beeDamage(this.damage / 3), Main.player[this.owner].beeKB(0f), Main.myPlayer, 0f, 0f); Main.projectile[num520].magic = false; Main.projectile[num520].ranged = true; Main.projectile[num520].penetrate = 2; } } } } else if (this.type == 183) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); for (int num521 = 0; num521 < 20; num521++) { int num522 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num522].velocity *= 1f; } int num523 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Gore expr_10FF0_cp_0 = Main.gore[num523]; expr_10FF0_cp_0.velocity.X = expr_10FF0_cp_0.velocity.X + 1f; Gore expr_11010_cp_0 = Main.gore[num523]; expr_11010_cp_0.velocity.Y = expr_11010_cp_0.velocity.Y + 1f; Main.gore[num523].velocity *= 0.3f; num523 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Gore expr_11094_cp_0 = Main.gore[num523]; expr_11094_cp_0.velocity.X = expr_11094_cp_0.velocity.X - 1f; Gore expr_110B4_cp_0 = Main.gore[num523]; expr_110B4_cp_0.velocity.Y = expr_110B4_cp_0.velocity.Y + 1f; Main.gore[num523].velocity *= 0.3f; num523 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Gore expr_11138_cp_0 = Main.gore[num523]; expr_11138_cp_0.velocity.X = expr_11138_cp_0.velocity.X + 1f; Gore expr_11158_cp_0 = Main.gore[num523]; expr_11158_cp_0.velocity.Y = expr_11158_cp_0.velocity.Y - 1f; Main.gore[num523].velocity *= 0.3f; num523 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Gore expr_111DC_cp_0 = Main.gore[num523]; expr_111DC_cp_0.velocity.X = expr_111DC_cp_0.velocity.X - 1f; Gore expr_111FC_cp_0 = Main.gore[num523]; expr_111FC_cp_0.velocity.Y = expr_111FC_cp_0.velocity.Y - 1f; Main.gore[num523].velocity *= 0.3f; if (this.owner == Main.myPlayer) { int num524 = Main.rand.Next(15, 25); for (int num525 = 0; num525 < num524; num525++) { float speedX = (float)Main.rand.Next(-35, 36) * 0.02f; float speedY = (float)Main.rand.Next(-35, 36) * 0.02f; Projectile.NewProjectile(this.position.X, this.position.Y, speedX, speedY, Main.player[this.owner].beeType(), Main.player[this.owner].beeDamage(this.damage), Main.player[this.owner].beeKB(0f), Main.myPlayer, 0f, 0f); } } } else if (this.aiStyle == 34) { if (this.owner != Main.myPlayer) { this.timeLeft = 60; } Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); if (this.type == 167) { for (int num526 = 0; num526 < 400; num526++) { float num527 = 16f; if (num526 < 300) { num527 = 12f; } if (num526 < 200) { num527 = 8f; } if (num526 < 100) { num527 = 4f; } int num528 = 130; int num529 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), 6, 6, num528, 0f, 0f, 100, default(Color), 1f); float num530 = Main.dust[num529].velocity.X; float num531 = Main.dust[num529].velocity.Y; if (num530 == 0f && num531 == 0f) { num530 = 1f; } float num532 = (float)Math.Sqrt((double)(num530 * num530 + num531 * num531)); num532 = num527 / num532; num530 *= num532; num531 *= num532; Main.dust[num529].velocity *= 0.5f; Dust expr_114C9_cp_0 = Main.dust[num529]; expr_114C9_cp_0.velocity.X = expr_114C9_cp_0.velocity.X + num530; Dust expr_114E8_cp_0 = Main.dust[num529]; expr_114E8_cp_0.velocity.Y = expr_114E8_cp_0.velocity.Y + num531; Main.dust[num529].scale = 1.3f; Main.dust[num529].noGravity = true; } } if (this.type == 168) { for (int num533 = 0; num533 < 400; num533++) { float num534 = 2f * ((float)num533 / 100f); if (num533 > 100) { num534 = 10f; } if (num533 > 250) { num534 = 13f; } int num535 = 131; int num536 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), 6, 6, num535, 0f, 0f, 100, default(Color), 1f); float num537 = Main.dust[num536].velocity.X; float num538 = Main.dust[num536].velocity.Y; if (num537 == 0f && num538 == 0f) { num537 = 1f; } float num539 = (float)Math.Sqrt((double)(num537 * num537 + num538 * num538)); num539 = num534 / num539; if (num533 <= 200) { num537 *= num539; num538 *= num539; } else { num537 = num537 * num539 * 1.25f; num538 = num538 * num539 * 0.75f; } Main.dust[num536].velocity *= 0.5f; Dust expr_116CF_cp_0 = Main.dust[num536]; expr_116CF_cp_0.velocity.X = expr_116CF_cp_0.velocity.X + num537; Dust expr_116EE_cp_0 = Main.dust[num536]; expr_116EE_cp_0.velocity.Y = expr_116EE_cp_0.velocity.Y + num538; if (num533 > 100) { Main.dust[num536].scale = 1.3f; Main.dust[num536].noGravity = true; } } } if (this.type == 169) { Vector2 vector11 = ((float)Main.rand.NextDouble() * 6.28318548f).ToRotationVector2(); float num540 = (float)Main.rand.Next(5, 9); float num541 = (float)Main.rand.Next(12, 17); float value22 = (float)Main.rand.Next(3, 7); float num542 = 20f; for (float num543 = 0f; num543 < num540; num543 += 1f) { for (int num544 = 0; num544 < 2; num544++) { Vector2 value23 = vector11.RotatedBy((double)(((num544 == 0) ? 1f : -1f) * 6.28318548f / (num540 * 2f)), default(Vector2)); for (float num545 = 0f; num545 < num542; num545 += 1f) { Vector2 value24 = Vector2.Lerp(vector11, value23, num545 / num542); float scaleFactor2 = MathHelper.Lerp(num541, value22, num545 / num542); int num546 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), 6, 6, 133, 0f, 0f, 100, default(Color), 1.3f); Main.dust[num546].velocity *= 0.1f; Main.dust[num546].noGravity = true; Main.dust[num546].velocity += value24 * scaleFactor2; } } vector11 = vector11.RotatedBy((double)(6.28318548f / num540), default(Vector2)); } for (float num547 = 0f; num547 < num540; num547 += 1f) { for (int num548 = 0; num548 < 2; num548++) { Vector2 value25 = vector11.RotatedBy((double)(((num548 == 0) ? 1f : -1f) * 6.28318548f / (num540 * 2f)), default(Vector2)); for (float num549 = 0f; num549 < num542; num549 += 1f) { Vector2 value26 = Vector2.Lerp(vector11, value25, num549 / num542); float scaleFactor3 = MathHelper.Lerp(num541, value22, num549 / num542) / 2f; int num550 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), 6, 6, 133, 0f, 0f, 100, default(Color), 1.3f); Main.dust[num550].velocity *= 0.1f; Main.dust[num550].noGravity = true; Main.dust[num550].velocity += value26 * scaleFactor3; } } vector11 = vector11.RotatedBy((double)(6.28318548f / num540), default(Vector2)); } for (int num551 = 0; num551 < 100; num551++) { float num552 = num541; int num553 = 132; int num554 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), 6, 6, num553, 0f, 0f, 100, default(Color), 1f); float num555 = Main.dust[num554].velocity.X; float num556 = Main.dust[num554].velocity.Y; if (num555 == 0f && num556 == 0f) { num555 = 1f; } float num557 = (float)Math.Sqrt((double)(num555 * num555 + num556 * num556)); num557 = num552 / num557; num555 *= num557; num556 *= num557; Main.dust[num554].velocity *= 0.5f; Dust expr_11C29_cp_0 = Main.dust[num554]; expr_11C29_cp_0.velocity.X = expr_11C29_cp_0.velocity.X + num555; Dust expr_11C48_cp_0 = Main.dust[num554]; expr_11C48_cp_0.velocity.Y = expr_11C48_cp_0.velocity.Y + num556; Main.dust[num554].scale = 1.3f; Main.dust[num554].noGravity = true; } } if (this.type == 664) { for (int i = 0; i < 4; i++ ) { int p = Projectile.NewProjectile(this.Center.X, this.Center.Y, Main.rand.Next(-50, 50) / 10, -5, 665, (int)((double)this.damage * 0.5f), 1f, this.owner, 0f, 0f); } for (int num526 = 0; num526 < 400; num526++) { float num527 = 16f; if (num526 < 300) { num527 = 12f; } if (num526 < 200) { num527 = 8f; } if (num526 < 100) { num527 = 4f; } int num528 = 127; int num529 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), 6, 6, num528, 0f, 0f, 100, default(Color), 1f); float num530 = Main.dust[num529].velocity.X; float num531 = Main.dust[num529].velocity.Y; if (num530 == 0f && num531 == 0f) { num530 = 1f; } float num532 = (float)Math.Sqrt((double)(num530 * num530 + num531 * num531)); num532 = num527 / num532; num530 *= num532; num531 *= num532; Main.dust[num529].velocity *= 0.5f; Dust expr_114C9_cp_0 = Main.dust[num529]; expr_114C9_cp_0.velocity.X = expr_114C9_cp_0.velocity.X + num530; Dust expr_114E8_cp_0 = Main.dust[num529]; expr_114E8_cp_0.velocity.Y = expr_114E8_cp_0.velocity.Y + num531; Main.dust[num529].scale = 1.3f; Main.dust[num529].noGravity = true; } }// if (this.type == 711) { for (int num526 = 0; num526 < 800; num526++) { float num527 = 16f; if (num526 < 300) { num527 = 12f; } if (num526 < 200) { num527 = 8f; } if (num526 < 100) { num527 = 4f; } int num528 = Utils.SelectRandom<int>(Main.rand, new int[] { 252, 253, 197 }); int num529 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), 6, 6, num528, 0f, 0f, 100, default(Color), 1f); float num530 = Main.dust[num529].velocity.X; float num531 = Main.dust[num529].velocity.Y; if (num530 == 0f && num531 == 0f) { num530 = 1f; } float num532 = (float)Math.Sqrt((double)(num530 * num530 + num531 * num531)); num532 = num527 / num532; num530 *= num532; num531 *= num532; Main.dust[num529].velocity *= 0.8f; Dust expr_114C9_cp_0 = Main.dust[num529]; expr_114C9_cp_0.velocity.X = expr_114C9_cp_0.velocity.X + num530; Dust expr_114E8_cp_0 = Main.dust[num529]; expr_114E8_cp_0.velocity.Y = expr_114E8_cp_0.velocity.Y + num531; Main.dust[num529].scale = 1.5f; Main.dust[num529].noGravity = true; } } if (this.type == 170) { for (int num558 = 0; num558 < 400; num558++) { int num559 = 133; float num560 = 16f; if (num558 > 100) { num560 = 11f; } if (num558 > 100) { num559 = 134; } if (num558 > 200) { num560 = 8f; } if (num558 > 200) { num559 = 133; } if (num558 > 300) { num560 = 5f; } if (num558 > 300) { num559 = 134; } int num561 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), 6, 6, num559, 0f, 0f, 100, default(Color), 1f); float num562 = Main.dust[num561].velocity.X; float num563 = Main.dust[num561].velocity.Y; if (num562 == 0f && num563 == 0f) { num562 = 1f; } float num564 = (float)Math.Sqrt((double)(num562 * num562 + num563 * num563)); num564 = num560 / num564; if (num558 > 300) { num562 = num562 * num564 * 0.7f; num563 *= num564; } else if (num558 > 200) { num562 *= num564; num563 = num563 * num564 * 0.7f; } else if (num558 > 100) { num562 = num562 * num564 * 0.7f; num563 *= num564; } else { num562 *= num564; num563 = num563 * num564 * 0.7f; } Main.dust[num561].velocity *= 0.5f; Dust expr_11EC4_cp_0 = Main.dust[num561]; expr_11EC4_cp_0.velocity.X = expr_11EC4_cp_0.velocity.X + num562; Dust expr_11EE3_cp_0 = Main.dust[num561]; expr_11EE3_cp_0.velocity.Y = expr_11EE3_cp_0.velocity.Y + num563; if (Main.rand.Next(3) != 0) { Main.dust[num561].scale = 1.3f; Main.dust[num561].noGravity = true; } } } if (this.type == 415) { Vector2 vector12 = ((float)Main.rand.NextDouble() * 6.28318548f).ToRotationVector2(); float num565 = (float)Main.rand.Next(5, 9); float num566 = (float)Main.rand.Next(10, 15) * 0.66f; float num567 = (float)Main.rand.Next(4, 7) / 2f; int num568 = 30; int num569 = 0; while ((float)num569 < (float)num568 * num565) { if (num569 % num568 == 0) { vector12 = vector12.RotatedBy((double)(6.28318548f / num565), default(Vector2)); } float scaleFactor4 = MathHelper.Lerp(num567, num566, (float)(num569 % num568) / (float)num568); int num570 = 130; int num571 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), 6, 6, num570, 0f, 0f, 100, default(Color), 1f); Main.dust[num571].velocity *= 0.1f; Main.dust[num571].velocity += vector12 * scaleFactor4; Main.dust[num571].scale = 1.3f; Main.dust[num571].noGravity = true; num569++; } for (int num572 = 0; num572 < 100; num572++) { float num573 = num566; if (num572 < 30) { num573 = (num567 + num566) / 2f; } int num574 = 130; int num575 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), 6, 6, num574, 0f, 0f, 100, default(Color), 1f); float num576 = Main.dust[num575].velocity.X; float num577 = Main.dust[num575].velocity.Y; if (num576 == 0f && num577 == 0f) { num576 = 1f; } float num578 = (float)Math.Sqrt((double)(num576 * num576 + num577 * num577)); num578 = num573 / num578; num576 *= num578; num577 *= num578; Main.dust[num575].velocity *= 0.5f; Dust expr_1222A_cp_0 = Main.dust[num575]; expr_1222A_cp_0.velocity.X = expr_1222A_cp_0.velocity.X + num576; Dust expr_12249_cp_0 = Main.dust[num575]; expr_12249_cp_0.velocity.Y = expr_12249_cp_0.velocity.Y + num577; Main.dust[num575].scale = 1.3f; Main.dust[num575].noGravity = true; } } if (this.type == 416) { Vector2 vector13 = ((float)Main.rand.NextDouble() * 6.28318548f).ToRotationVector2(); Vector2 vector14 = vector13; float num579 = (float)(Main.rand.Next(3, 6) * 2); int num580 = 20; float num581 = (Main.rand.Next(2) == 0) ? 1f : -1f; bool flag2 = true; int num582 = 0; while ((float)num582 < (float)num580 * num579) { if (num582 % num580 == 0) { vector14 = vector14.RotatedBy((double)(num581 * (6.28318548f / num579)), default(Vector2)); vector13 = vector14; flag2 = !flag2; } else { float num583 = 6.28318548f / ((float)num580 * num579); vector13 = vector13.RotatedBy((double)(num583 * num581 * 3f), default(Vector2)); } float scaleFactor5 = MathHelper.Lerp(1f, 8f, (float)(num582 % num580) / (float)num580); int num584 = 131; int num585 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), 6, 6, num584, 0f, 0f, 100, default(Color), 1.4f); Main.dust[num585].velocity *= 0.1f; Main.dust[num585].velocity += vector13 * scaleFactor5; if (flag2) { Main.dust[num585].scale = 0.9f; } Main.dust[num585].noGravity = true; num582++; } } if (this.type == 417) { float num586 = (float)Main.rand.NextDouble() * 6.28318548f; float num587 = (float)Main.rand.NextDouble() * 6.28318548f; float num588 = 4f + (float)Main.rand.NextDouble() * 3f; float num589 = 4f + (float)Main.rand.NextDouble() * 3f; float num590 = num588; if (num589 > num590) { num590 = num589; } for (int num591 = 0; num591 < 150; num591++) { int num592 = 132; float scaleFactor6 = num590; if (num591 > 50) { scaleFactor6 = num589; } if (num591 > 50) { num592 = 133; } if (num591 > 100) { scaleFactor6 = num588; } if (num591 > 100) { num592 = 132; } int num593 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), 6, 6, num592, 0f, 0f, 100, default(Color), 1f); Vector2 vector15 = Main.dust[num593].velocity; vector15.Normalize(); vector15 *= scaleFactor6; if (num591 > 100) { vector15.X *= 0.5f; vector15 = vector15.RotatedBy((double)num586, default(Vector2)); } else if (num591 > 50) { vector15.Y *= 0.5f; vector15 = vector15.RotatedBy((double)num587, default(Vector2)); } Main.dust[num593].velocity *= 0.2f; Main.dust[num593].velocity += vector15; if (num591 <= 200) { Main.dust[num593].scale = 1.3f; Main.dust[num593].noGravity = true; } } } if (this.type == 418) { Vector2 vector16 = ((float)Main.rand.NextDouble() * 6.28318548f).ToRotationVector2(); float num594 = (float)Main.rand.Next(5, 12); float num595 = (float)Main.rand.Next(9, 14) * 0.66f; float num596 = (float)Main.rand.Next(2, 4) * 0.66f; float num597 = 15f; for (float num598 = 0f; num598 < num594; num598 += 1f) { for (int num599 = 0; num599 < 2; num599++) { Vector2 value27 = vector16.RotatedBy((double)(((num599 == 0) ? 1f : -1f) * 6.28318548f / (num594 * 2f)), default(Vector2)); for (float num600 = 0f; num600 < num597; num600 += 1f) { Vector2 value28 = Vector2.SmoothStep(vector16, value27, num600 / num597); float scaleFactor7 = MathHelper.SmoothStep(num595, num596, num600 / num597); int num601 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), 6, 6, 134, 0f, 0f, 100, default(Color), 1.3f); Main.dust[num601].velocity *= 0.1f; Main.dust[num601].noGravity = true; Main.dust[num601].velocity += value28 * scaleFactor7; } } vector16 = vector16.RotatedBy((double)(6.28318548f / num594), default(Vector2)); } for (int num602 = 0; num602 < 120; num602++) { float num603 = num595; int num604 = 133; if (num602 < 80) { num603 = num596 - 0.5f; } else { num604 = 131; } int num605 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), 6, 6, num604, 0f, 0f, 100, default(Color), 1f); float num606 = Main.dust[num605].velocity.X; float num607 = Main.dust[num605].velocity.Y; if (num606 == 0f && num607 == 0f) { num606 = 1f; } float num608 = (float)Math.Sqrt((double)(num606 * num606 + num607 * num607)); num608 = num603 / num608; num606 *= num608; num607 *= num608; Main.dust[num605].velocity *= 0.2f; Dust expr_12A59_cp_0 = Main.dust[num605]; expr_12A59_cp_0.velocity.X = expr_12A59_cp_0.velocity.X + num606; Dust expr_12A78_cp_0 = Main.dust[num605]; expr_12A78_cp_0.velocity.Y = expr_12A78_cp_0.velocity.Y + num607; Main.dust[num605].scale = 1.3f; Main.dust[num605].noGravity = true; } } this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 192; this.height = 192; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.penetrate = -1; this.Damage(); } else if (this.type == 312) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 22; this.height = 22; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); for (int num609 = 0; num609 < 30; num609++) { int num610 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num610].velocity *= 1.4f; } for (int num611 = 0; num611 < 20; num611++) { int num612 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 3.5f); Main.dust[num612].noGravity = true; Main.dust[num612].velocity *= 7f; num612 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num612].velocity *= 3f; } for (int num613 = 0; num613 < 2; num613++) { float scaleFactor8 = 0.4f; if (num613 == 1) { scaleFactor8 = 0.8f; } int num614 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num614].velocity *= scaleFactor8; Gore expr_12E2F_cp_0 = Main.gore[num614]; expr_12E2F_cp_0.velocity.X = expr_12E2F_cp_0.velocity.X + 1f; Gore expr_12E4F_cp_0 = Main.gore[num614]; expr_12E4F_cp_0.velocity.Y = expr_12E4F_cp_0.velocity.Y + 1f; num614 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num614].velocity *= scaleFactor8; Gore expr_12ED2_cp_0 = Main.gore[num614]; expr_12ED2_cp_0.velocity.X = expr_12ED2_cp_0.velocity.X - 1f; Gore expr_12EF2_cp_0 = Main.gore[num614]; expr_12EF2_cp_0.velocity.Y = expr_12EF2_cp_0.velocity.Y + 1f; num614 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num614].velocity *= scaleFactor8; Gore expr_12F75_cp_0 = Main.gore[num614]; expr_12F75_cp_0.velocity.X = expr_12F75_cp_0.velocity.X + 1f; Gore expr_12F95_cp_0 = Main.gore[num614]; expr_12F95_cp_0.velocity.Y = expr_12F95_cp_0.velocity.Y - 1f; num614 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num614].velocity *= scaleFactor8; Gore expr_13018_cp_0 = Main.gore[num614]; expr_13018_cp_0.velocity.X = expr_13018_cp_0.velocity.X - 1f; Gore expr_13038_cp_0 = Main.gore[num614]; expr_13038_cp_0.velocity.Y = expr_13038_cp_0.velocity.Y - 1f; } this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 128; this.height = 128; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.Damage(); } else if (this.type == 30 || this.type == 133 || this.type == 134 || this.type == 135 || this.type == 136 || this.type == 137 || this.type == 138 || this.type == 303 || this.type == 338 || this.type == 339 || this.type == 654 || this.type == 657 || this.type == 752 || this.type == 753)// { if (this.type == 30 || this.type == 133 || this.type == 136 || this.type == 139 || this.type == 654 || this.type == 657 || this.type == 752 || this.type == 753)// { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 62); } else { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); } this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 22; this.height = 22; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); for (int num615 = 0; num615 < 30; num615++) { int num616 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num616].velocity *= 1.4f; } for (int num617 = 0; num617 < 20; num617++) { int num618 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 3.5f); Main.dust[num618].noGravity = true; Main.dust[num618].velocity *= 7f; num618 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num618].velocity *= 3f; } for (int num619 = 0; num619 < 2; num619++) { float scaleFactor9 = 0.4f; if (num619 == 1) { scaleFactor9 = 0.8f; } int num620 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num620].velocity *= scaleFactor9; Gore expr_1347F_cp_0 = Main.gore[num620]; expr_1347F_cp_0.velocity.X = expr_1347F_cp_0.velocity.X + 1f; Gore expr_1349F_cp_0 = Main.gore[num620]; expr_1349F_cp_0.velocity.Y = expr_1349F_cp_0.velocity.Y + 1f; num620 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num620].velocity *= scaleFactor9; Gore expr_13522_cp_0 = Main.gore[num620]; expr_13522_cp_0.velocity.X = expr_13522_cp_0.velocity.X - 1f; Gore expr_13542_cp_0 = Main.gore[num620]; expr_13542_cp_0.velocity.Y = expr_13542_cp_0.velocity.Y + 1f; num620 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num620].velocity *= scaleFactor9; Gore expr_135C5_cp_0 = Main.gore[num620]; expr_135C5_cp_0.velocity.X = expr_135C5_cp_0.velocity.X + 1f; Gore expr_135E5_cp_0 = Main.gore[num620]; expr_135E5_cp_0.velocity.Y = expr_135E5_cp_0.velocity.Y - 1f; num620 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num620].velocity *= scaleFactor9; Gore expr_13668_cp_0 = Main.gore[num620]; expr_13668_cp_0.velocity.X = expr_13668_cp_0.velocity.X - 1f; Gore expr_13688_cp_0 = Main.gore[num620]; expr_13688_cp_0.velocity.Y = expr_13688_cp_0.velocity.Y - 1f; } } else if (this.type == 139 || this.type == 140 || this.type == 141 || this.type == 142 || this.type == 143 || this.type == 144 || this.type == 340 || this.type == 341) { if (this.type == 30 || this.type == 133 || this.type == 136 || this.type == 139) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 62); } else { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); } this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 80; this.height = 80; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); for (int num621 = 0; num621 < 40; num621++) { int num622 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.Next(2) == 0) { Main.dust[num622].scale = 0.5f; Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 70; num623++) { int num624 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; num624 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 2f); Main.dust[num624].velocity *= 2f; } for (int num625 = 0; num625 < 3; num625++) { float scaleFactor10 = 0.33f; if (num625 == 1) { scaleFactor10 = 0.66f; } if (num625 == 2) { scaleFactor10 = 1f; } int num626 = Gore.NewGore(new Vector2(this.position.X + (float)(this.width / 2) - 24f, this.position.Y + (float)(this.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13AB6_cp_0 = Main.gore[num626]; expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; Gore expr_13AD6_cp_0 = Main.gore[num626]; expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f; num626 = Gore.NewGore(new Vector2(this.position.X + (float)(this.width / 2) - 24f, this.position.Y + (float)(this.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13B79_cp_0 = Main.gore[num626]; expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; Gore expr_13B99_cp_0 = Main.gore[num626]; expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f; num626 = Gore.NewGore(new Vector2(this.position.X + (float)(this.width / 2) - 24f, this.position.Y + (float)(this.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13C3C_cp_0 = Main.gore[num626]; expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; Gore expr_13C5C_cp_0 = Main.gore[num626]; expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; num626 = Gore.NewGore(new Vector2(this.position.X + (float)(this.width / 2) - 24f, this.position.Y + (float)(this.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num626].velocity *= scaleFactor10; Gore expr_13CFF_cp_0 = Main.gore[num626]; expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; Gore expr_13D1F_cp_0 = Main.gore[num626]; expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; } this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 10; this.height = 10; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); } else if (this.type == 246) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); for (int num627 = 0; num627 < 10; num627++) { int num628 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num628].velocity *= 0.9f; } for (int num629 = 0; num629 < 5; num629++) { int num630 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 2.5f); Main.dust[num630].noGravity = true; Main.dust[num630].velocity *= 3f; num630 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num630].velocity *= 2f; } int num631 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num631].velocity *= 0.3f; Gore expr_14000_cp_0 = Main.gore[num631]; expr_14000_cp_0.velocity.X = expr_14000_cp_0.velocity.X + (float)Main.rand.Next(-1, 2); Gore expr_14028_cp_0 = Main.gore[num631]; expr_14028_cp_0.velocity.Y = expr_14028_cp_0.velocity.Y + (float)Main.rand.Next(-1, 2); this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 150; this.height = 150; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.penetrate = -1; this.maxPenetrate = 0; this.Damage(); if (this.owner == Main.myPlayer) { int num632 = Main.rand.Next(2, 6); for (int num633 = 0; num633 < num632; num633++) { float num634 = (float)Main.rand.Next(-100, 101); num634 += 0.01f; float num635 = (float)Main.rand.Next(-100, 101); num634 -= 0.01f; float num636 = (float)Math.Sqrt((double)(num634 * num634 + num635 * num635)); num636 = 8f / num636; num634 *= num636; num635 *= num636; int num637 = Projectile.NewProjectile(base.Center.X - this.oldVelocity.X, base.Center.Y - this.oldVelocity.Y, num634, num635, 249, this.damage, this.knockBack, this.owner, 0f, 0f); Main.projectile[num637].maxPenetrate = 0; } } } else if (this.type == 249) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); for (int num638 = 0; num638 < 7; num638++) { int num639 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num639].velocity *= 0.8f; } for (int num640 = 0; num640 < 2; num640++) { int num641 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 2.5f); Main.dust[num641].noGravity = true; Main.dust[num641].velocity *= 2.5f; num641 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num641].velocity *= 1.5f; } int num642 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num642].velocity *= 0.2f; Gore expr_1444F_cp_0 = Main.gore[num642]; expr_1444F_cp_0.velocity.X = expr_1444F_cp_0.velocity.X + (float)Main.rand.Next(-1, 2); Gore expr_14477_cp_0 = Main.gore[num642]; expr_14477_cp_0.velocity.Y = expr_14477_cp_0.velocity.Y + (float)Main.rand.Next(-1, 2); this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 100; this.height = 100; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.penetrate = -1; this.Damage(); } else if (this.type == 588) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); this.position = base.Center; this.width = (this.height = 22); base.Center = this.position; for (int num643 = 0; num643 < 8; num643++) { int num644 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 219 + Main.rand.Next(5), 0f, 0f, 0, default(Color), 1f); Main.dust[num644].velocity *= 1.4f; Main.dust[num644].fadeIn = 1f; Main.dust[num644].noGravity = true; } for (int num645 = 0; num645 < 15; num645++) { int num646 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 139 + Main.rand.Next(4), 0f, 0f, 0, default(Color), 1.6f); Main.dust[num646].noGravity = true; Main.dust[num646].velocity *= 5f; num646 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 139 + Main.rand.Next(4), 0f, 0f, 0, default(Color), 1.9f); Main.dust[num646].velocity *= 3f; } if (Main.rand.Next(2) == 0) { int num647 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(276, 283), 1f); Main.gore[num647].velocity *= 0.4f; Gore expr_147F1_cp_0 = Main.gore[num647]; expr_147F1_cp_0.velocity.X = expr_147F1_cp_0.velocity.X + 1f; Gore expr_14811_cp_0 = Main.gore[num647]; expr_14811_cp_0.velocity.Y = expr_14811_cp_0.velocity.Y + 1f; } if (Main.rand.Next(2) == 0) { int num647 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(276, 283), 1f); Main.gore[num647].velocity *= 0.4f; Gore expr_148AB_cp_0 = Main.gore[num647]; expr_148AB_cp_0.velocity.X = expr_148AB_cp_0.velocity.X - 1f; Gore expr_148CB_cp_0 = Main.gore[num647]; expr_148CB_cp_0.velocity.Y = expr_148CB_cp_0.velocity.Y + 1f; } if (Main.rand.Next(2) == 0) { int num647 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(276, 283), 1f); Main.gore[num647].velocity *= 0.4f; Gore expr_14965_cp_0 = Main.gore[num647]; expr_14965_cp_0.velocity.X = expr_14965_cp_0.velocity.X + 1f; Gore expr_14985_cp_0 = Main.gore[num647]; expr_14985_cp_0.velocity.Y = expr_14985_cp_0.velocity.Y - 1f; } if (Main.rand.Next(2) == 0) { int num647 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(276, 283), 1f); Main.gore[num647].velocity *= 0.4f; Gore expr_14A1F_cp_0 = Main.gore[num647]; expr_14A1F_cp_0.velocity.X = expr_14A1F_cp_0.velocity.X - 1f; Gore expr_14A3F_cp_0 = Main.gore[num647]; expr_14A3F_cp_0.velocity.Y = expr_14A3F_cp_0.velocity.Y - 1f; } } else if (this.type == 28 || this.type == 30 || this.type == 37 || this.type == 75 || this.type == 102 || this.type == 164 || this.type == 397 || this.type == 517 || this.type == 516 || this.type == 519 || this.type == 654 || this.type == 657) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 22; this.height = 22; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); for (int num648 = 0; num648 < 20; num648++) { int num649 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num649].velocity *= 1.4f; } for (int num650 = 0; num650 < 10; num650++) { int num651 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 2.5f); Main.dust[num651].noGravity = true; Main.dust[num651].velocity *= 5f; num651 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num651].velocity *= 3f; } int num652 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num652].velocity *= 0.4f; Gore expr_14D73_cp_0 = Main.gore[num652]; expr_14D73_cp_0.velocity.X = expr_14D73_cp_0.velocity.X + 1f; Gore expr_14D93_cp_0 = Main.gore[num652]; expr_14D93_cp_0.velocity.Y = expr_14D93_cp_0.velocity.Y + 1f; num652 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num652].velocity *= 0.4f; Gore expr_14E17_cp_0 = Main.gore[num652]; expr_14E17_cp_0.velocity.X = expr_14E17_cp_0.velocity.X - 1f; Gore expr_14E37_cp_0 = Main.gore[num652]; expr_14E37_cp_0.velocity.Y = expr_14E37_cp_0.velocity.Y + 1f; num652 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num652].velocity *= 0.4f; Gore expr_14EBB_cp_0 = Main.gore[num652]; expr_14EBB_cp_0.velocity.X = expr_14EBB_cp_0.velocity.X + 1f; Gore expr_14EDB_cp_0 = Main.gore[num652]; expr_14EDB_cp_0.velocity.Y = expr_14EDB_cp_0.velocity.Y - 1f; num652 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num652].velocity *= 0.4f; Gore expr_14F5F_cp_0 = Main.gore[num652]; expr_14F5F_cp_0.velocity.X = expr_14F5F_cp_0.velocity.X - 1f; Gore expr_14F7F_cp_0 = Main.gore[num652]; expr_14F7F_cp_0.velocity.Y = expr_14F7F_cp_0.velocity.Y - 1f; if (this.type == 102) { this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 128; this.height = 128; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.damage = 40; this.Damage(); } } else if (this.type == 29 || this.type == 108 || this.type == 470 || this.type == 637) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); if (this.type == 29) { this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 200; this.height = 200; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); } for (int num653 = 0; num653 < 50; num653++) { int num654 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 2f); Main.dust[num654].velocity *= 1.4f; } for (int num655 = 0; num655 < 80; num655++) { int num656 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 3f); Main.dust[num656].noGravity = true; Main.dust[num656].velocity *= 5f; num656 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 2f); Main.dust[num656].velocity *= 3f; } for (int num657 = 0; num657 < 2; num657++) { int num658 = Gore.NewGore(new Vector2(this.position.X + (float)(this.width / 2) - 24f, this.position.Y + (float)(this.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num658].scale = 1.5f; Gore expr_1533D_cp_0 = Main.gore[num658]; expr_1533D_cp_0.velocity.X = expr_1533D_cp_0.velocity.X + 1.5f; Gore expr_1535D_cp_0 = Main.gore[num658]; expr_1535D_cp_0.velocity.Y = expr_1535D_cp_0.velocity.Y + 1.5f; num658 = Gore.NewGore(new Vector2(this.position.X + (float)(this.width / 2) - 24f, this.position.Y + (float)(this.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num658].scale = 1.5f; Gore expr_153F6_cp_0 = Main.gore[num658]; expr_153F6_cp_0.velocity.X = expr_153F6_cp_0.velocity.X - 1.5f; Gore expr_15416_cp_0 = Main.gore[num658]; expr_15416_cp_0.velocity.Y = expr_15416_cp_0.velocity.Y + 1.5f; num658 = Gore.NewGore(new Vector2(this.position.X + (float)(this.width / 2) - 24f, this.position.Y + (float)(this.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num658].scale = 1.5f; Gore expr_154AF_cp_0 = Main.gore[num658]; expr_154AF_cp_0.velocity.X = expr_154AF_cp_0.velocity.X + 1.5f; Gore expr_154CF_cp_0 = Main.gore[num658]; expr_154CF_cp_0.velocity.Y = expr_154CF_cp_0.velocity.Y - 1.5f; num658 = Gore.NewGore(new Vector2(this.position.X + (float)(this.width / 2) - 24f, this.position.Y + (float)(this.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num658].scale = 1.5f; Gore expr_15568_cp_0 = Main.gore[num658]; expr_15568_cp_0.velocity.X = expr_15568_cp_0.velocity.X - 1.5f; Gore expr_15588_cp_0 = Main.gore[num658]; expr_15588_cp_0.velocity.Y = expr_15588_cp_0.velocity.Y - 1.5f; } this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 10; this.height = 10; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); } else if (this.type == 69) { Main.PlaySound(13, (int)this.position.X, (int)this.position.Y, 1); for (int num659 = 0; num659 < 5; num659++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 13, 0f, 0f, 0, default(Color), 1f); } for (int num660 = 0; num660 < 30; num660++) { int num661 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 33, 0f, -2f, 0, default(Color), 1.1f); Main.dust[num661].alpha = 100; Dust expr_1573A_cp_0 = Main.dust[num661]; expr_1573A_cp_0.velocity.X = expr_1573A_cp_0.velocity.X * 1.5f; Main.dust[num661].velocity *= 3f; } } else if (this.type == 70) { Main.PlaySound(13, (int)this.position.X, (int)this.position.Y, 1); for (int num662 = 0; num662 < 5; num662++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 13, 0f, 0f, 0, default(Color), 1f); } for (int num663 = 0; num663 < 30; num663++) { int num664 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 52, 0f, -2f, 0, default(Color), 1.1f); Main.dust[num664].alpha = 100; Dust expr_15890_cp_0 = Main.dust[num664]; expr_15890_cp_0.velocity.X = expr_15890_cp_0.velocity.X * 1.5f; Main.dust[num664].velocity *= 3f; } } else if (this.type == 621) { Main.PlaySound(13, (int)this.position.X, (int)this.position.Y, 1); for (int num665 = 0; num665 < 5; num665++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 13, 0f, 0f, 0, default(Color), 1f); } for (int num666 = 0; num666 < 30; num666++) { int num667 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 266, 0f, -2f, 0, default(Color), 1.1f); Main.dust[num667].alpha = 100; Dust expr_159EC_cp_0 = Main.dust[num667]; expr_159EC_cp_0.velocity.X = expr_159EC_cp_0.velocity.X * 1.5f; Main.dust[num667].velocity *= 3f; } } else if (this.type == 114 || this.type == 115) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 10); for (int num668 = 4; num668 < 31; num668++) { float num669 = this.oldVelocity.X * (30f / (float)num668); float num670 = this.oldVelocity.Y * (30f / (float)num668); int num671 = Dust.NewDust(new Vector2(this.position.X - num669, this.position.Y - num670), 8, 8, 27, this.oldVelocity.X, this.oldVelocity.Y, 100, default(Color), 1.4f); Main.dust[num671].noGravity = true; Main.dust[num671].velocity *= 0.5f; num671 = Dust.NewDust(new Vector2(this.position.X - num669, this.position.Y - num670), 8, 8, 27, this.oldVelocity.X, this.oldVelocity.Y, 100, default(Color), 0.9f); Main.dust[num671].velocity *= 0.5f; } } else if (this.type == 116) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 10); for (int num672 = 4; num672 < 31; num672++) { float num673 = this.oldVelocity.X * (30f / (float)num672); float num674 = this.oldVelocity.Y * (30f / (float)num672); int num675 = Dust.NewDust(new Vector2(this.position.X - num673, this.position.Y - num674), 8, 8, 64, this.oldVelocity.X, this.oldVelocity.Y, 100, default(Color), 1.8f); Main.dust[num675].noGravity = true; num675 = Dust.NewDust(new Vector2(this.position.X - num673, this.position.Y - num674), 8, 8, 64, this.oldVelocity.X, this.oldVelocity.Y, 100, default(Color), 1.4f); Main.dust[num675].noGravity = true; } } else if (this.type == 173) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 10); for (int num676 = 4; num676 < 24; num676++) { float num677 = this.oldVelocity.X * (30f / (float)num676); float num678 = this.oldVelocity.Y * (30f / (float)num676); int num679 = Main.rand.Next(3); if (num679 == 0) { num679 = 15; } else if (num679 == 1) { num679 = 57; } else { num679 = 58; } int num680 = Dust.NewDust(new Vector2(this.position.X - num677, this.position.Y - num678), 8, 8, num679, this.oldVelocity.X * 0.2f, this.oldVelocity.Y * 0.2f, 100, default(Color), 1.8f); Main.dust[num680].velocity *= 1.5f; Main.dust[num680].noGravity = true; } } else if (this.type == 132) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 10); for (int num681 = 4; num681 < 31; num681++) { float num682 = this.oldVelocity.X * (30f / (float)num681); float num683 = this.oldVelocity.Y * (30f / (float)num681); int num684 = Dust.NewDust(new Vector2(this.oldPosition.X - num682, this.oldPosition.Y - num683), 8, 8, 107, this.oldVelocity.X, this.oldVelocity.Y, 100, default(Color), 1.8f); Main.dust[num684].noGravity = true; Main.dust[num684].velocity *= 0.5f; num684 = Dust.NewDust(new Vector2(this.oldPosition.X - num682, this.oldPosition.Y - num683), 8, 8, 107, this.oldVelocity.X, this.oldVelocity.Y, 100, default(Color), 1.4f); Main.dust[num684].velocity *= 0.05f; } } else if (this.type == 156) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 10); for (int num685 = 4; num685 < 31; num685++) { float num686 = this.oldVelocity.X * (30f / (float)num685); float num687 = this.oldVelocity.Y * (30f / (float)num685); int num688 = Dust.NewDust(new Vector2(this.oldPosition.X - num686, this.oldPosition.Y - num687), 8, 8, 73, this.oldVelocity.X, this.oldVelocity.Y, 255, default(Color), 1.8f); Main.dust[num688].noGravity = true; Main.dust[num688].velocity *= 0.5f; num688 = Dust.NewDust(new Vector2(this.oldPosition.X - num686, this.oldPosition.Y - num687), 8, 8, 73, this.oldVelocity.X, this.oldVelocity.Y, 255, default(Color), 1.4f); Main.dust[num688].velocity *= 0.05f; Main.dust[num688].noGravity = true; } } else if (this.type == 157) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 10); for (int num689 = 4; num689 < 31; num689++) { int num690 = Dust.NewDust(this.position, this.width, this.height, 107, this.oldVelocity.X, this.oldVelocity.Y, 100, default(Color), 1.8f); Main.dust[num690].noGravity = true; Main.dust[num690].velocity *= 0.5f; } } else if (this.type == 370) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 4); for (int num691 = 0; num691 < 5; num691++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 13, 0f, 0f, 0, default(Color), 1f); } for (int num692 = 0; num692 < 30; num692++) { Vector2 value29 = new Vector2((float)Main.rand.Next(-10, 11), (float)Main.rand.Next(-10, 11)); value29.Normalize(); int num693 = Gore.NewGore(base.Center + value29 * 10f, value29 * (float)Main.rand.Next(4, 9) * 0.66f + Vector2.UnitY * 1.5f, 331, (float)Main.rand.Next(40, 141) * 0.01f); Main.gore[num693].sticky = false; } } else if (this.type == 371) { Main.PlaySound(13, (int)this.position.X, (int)this.position.Y, 1); Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 16); for (int num694 = 0; num694 < 5; num694++) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 13, 0f, 0f, 0, default(Color), 1f); } for (int num695 = 0; num695 < 30; num695++) { Vector2 value30 = new Vector2((float)Main.rand.Next(-10, 11), (float)Main.rand.Next(-10, 11)); value30.Normalize(); value30 *= 0.4f; int num696 = Gore.NewGore(base.Center + value30 * 10f, value30 * (float)Main.rand.Next(4, 9) * 0.66f + Vector2.UnitY * 1.5f, Main.rand.Next(435, 438), (float)Main.rand.Next(20, 100) * 0.01f); Main.gore[num696].sticky = false; } } } if (this.owner == Main.myPlayer) { if (this.type == 28 || this.type == 29 || this.type == 37 || this.type == 108 || this.type == 136 || this.type == 137 || this.type == 138 || this.type == 142 || this.type == 143 || this.type == 144 || this.type == 339 || this.type == 341 || this.type == 470 || this.type == 516 || this.type == 519 || this.type == 637) { int num697 = 3; if (this.type == 28 || this.type == 37 || this.type == 516 || this.type == 519) { num697 = 4; } if (this.type == 29 || this.type == 470 || this.type == 637) { num697 = 7; } if (this.type == 142 || this.type == 143 || this.type == 144 || this.type == 341) { num697 = 5; } if (this.type == 108) { num697 = 10; } int num698 = (int)(this.position.X / 16f - (float)num697); int num699 = (int)(this.position.X / 16f + (float)num697); int num700 = (int)(this.position.Y / 16f - (float)num697); int num701 = (int)(this.position.Y / 16f + (float)num697); if (num698 < 0) { num698 = 0; } if (num699 > Main.maxTilesX) { num699 = Main.maxTilesX; } if (num700 < 0) { num700 = 0; } if (num701 > Main.maxTilesY) { num701 = Main.maxTilesY; } bool flag3 = false; for (int num702 = num698; num702 <= num699; num702++) { for (int num703 = num700; num703 <= num701; num703++) { float num704 = Math.Abs((float)num702 - this.position.X / 16f); float num705 = Math.Abs((float)num703 - this.position.Y / 16f); double num706 = Math.Sqrt((double)(num704 * num704 + num705 * num705)); if (num706 < (double)num697 && Main.tile[num702, num703] != null && Main.tile[num702, num703].wall == 0) { flag3 = true; break; } } } AchievementsHelper.CurrentlyMining = true; for (int num707 = num698; num707 <= num699; num707++) { for (int num708 = num700; num708 <= num701; num708++) { float num709 = Math.Abs((float)num707 - this.position.X / 16f); float num710 = Math.Abs((float)num708 - this.position.Y / 16f); double num711 = Math.Sqrt((double)(num709 * num709 + num710 * num710)); if (num711 < (double)num697) { bool flag4 = true; if (Main.tile[num707, num708] != null && Main.tile[num707, num708].active()) { flag4 = true; if (Main.tileDungeon[(int)Main.tile[num707, num708].type] || Main.tile[num707, num708].type == 21 || Main.tile[num707, num708].type == 26 || Main.tile[num707, num708].type == 107 || Main.tile[num707, num708].type == 108 || Main.tile[num707, num708].type == 111 || Main.tile[num707, num708].type == 226 || Main.tile[num707, num708].type == 237 || Main.tile[num707, num708].type == 221 || Main.tile[num707, num708].type == 222 || Main.tile[num707, num708].type == 223 || Main.tile[num707, num708].type == 211 || Main.tile[num707, num708].type == 404) { flag4 = false; } if (!Main.hardMode && Main.tile[num707, num708].type == 58) { flag4 = false; } if (flag4) { WorldGen.KillTile(num707, num708, false, false, false); if (!Main.tile[num707, num708].active() && Main.netMode != 0) { NetMessage.SendData(17, -1, -1, "", 0, (float)num707, (float)num708, 0f, 0, 0, 0); } } } if (flag4) { for (int num712 = num707 - 1; num712 <= num707 + 1; num712++) { for (int num713 = num708 - 1; num713 <= num708 + 1; num713++) { if (Main.tile[num712, num713] != null && Main.tile[num712, num713].wall > 0 && flag3) { WorldGen.KillWall(num712, num713, false); if (Main.tile[num712, num713].wall == 0 && Main.netMode != 0) { NetMessage.SendData(17, -1, -1, "", 2, (float)num712, (float)num713, 0f, 0, 0, 0); } } } } } } } } AchievementsHelper.CurrentlyMining = false; } if (Main.netMode != 0) { NetMessage.SendData(29, -1, -1, "", this.identity, (float)this.owner, 0f, 0f, 0, 0, 0); } if (!this.noDropItem) { int num714 = -1; if (this.aiStyle == 10) { int num715 = (int)(this.position.X + (float)(this.width / 2)) / 16; int num716 = (int)(this.position.Y + (float)(this.width / 2)) / 16; int num717 = 0; int num718 = 2; if (this.type == 109) { num717 = 147; num718 = 0; } if (this.type == 31) { num717 = 53; num718 = 0; } if (this.type == 42) { num717 = 53; num718 = 0; } if (this.type == 56) { num717 = 112; num718 = 0; } if (this.type == 65) { num717 = 112; num718 = 0; } if (this.type == 67) { num717 = 116; num718 = 0; } if (this.type == 68) { num717 = 116; num718 = 0; } if (this.type == 71) { num717 = 123; num718 = 0; } if (this.type == 39) { num717 = 59; num718 = 176; } if (this.type == 40) { num717 = 57; num718 = 172; } if (this.type == 179) { num717 = 224; num718 = 0; } if (this.type == 241) { num717 = 234; num718 = 0; } if (this.type == 354) { num717 = 234; num718 = 0; } if (this.type == 411) { num717 = 330; num718 = 71; } if (this.type == 412) { num717 = 331; num718 = 72; } if (this.type == 413) { num717 = 332; num718 = 73; } if (this.type == 414) { num717 = 333; num718 = 74; } // if (this.type == 746) { num717 = 422; num718 = 3808; // to be creamsand } // if (this.type == 109) { int num719 = (int)Player.FindClosest(this.position, this.width, this.height); if ((double)(base.Center - Main.player[num719].Center).Length() > (double)Main.maxScreenW * 0.75) { num717 = -1; num718 = 593; } } if (Main.tile[num715, num716].halfBrick() && this.velocity.Y > 0f && Math.Abs(this.velocity.Y) > Math.Abs(this.velocity.X)) { num716--; } if (!Main.tile[num715, num716].active() && num717 >= 0) { bool flag5 = false; if (num716 < Main.maxTilesY - 2 && Main.tile[num715, num716 + 1] != null && Main.tile[num715, num716 + 1].active() && Main.tile[num715, num716 + 1].type == 314) { flag5 = true; } if (!flag5) { WorldGen.PlaceTile(num715, num716, num717, false, true, -1, 0); } if (!flag5 && Main.tile[num715, num716].active() && (int)Main.tile[num715, num716].type == num717) { if (Main.tile[num715, num716 + 1].halfBrick() || Main.tile[num715, num716 + 1].slope() != 0) { WorldGen.SlopeTile(num715, num716 + 1, 0); if (Main.netMode == 2) { NetMessage.SendData(17, -1, -1, "", 14, (float)num715, (float)(num716 + 1), 0f, 0, 0, 0); } } if (Main.netMode != 0) { NetMessage.SendData(17, -1, -1, "", 1, (float)num715, (float)num716, (float)num717, 0, 0, 0); } } else if (num718 > 0) { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, num718, 1, false, 0, false, false); } } else if (num718 > 0) { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, num718, 1, false, 0, false, false); } } if (this.type == 1 && Main.rand.Next(3) == 0) { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 40, 1, false, 0, false, false); } if (this.type == 474 && Main.rand.Next(3) == 0) { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 3003, 1, false, 0, false, false); } if (this.type == 103 && Main.rand.Next(6) == 0) { if (Main.rand.Next(3) == 0) { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 545, 1, false, 0, false, false); } else { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 40, 1, false, 0, false, false); } } if (this.type == 2 && Main.rand.Next(3) == 0) { if (Main.rand.Next(3) == 0) { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 41, 1, false, 0, false, false); } else { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 40, 1, false, 0, false, false); } } if (this.type == 172 && Main.rand.Next(3) == 0) { if (Main.rand.Next(3) == 0) { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 988, 1, false, 0, false, false); } else { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 40, 1, false, 0, false, false); } } if (this.type == 171) { if (this.ai[1] == 0f) { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 985, 1, false, 0, false, false); Main.item[num714].noGrabDelay = 0; } else if (this.ai[1] < 10f) { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 965, (int)(10f - this.ai[1]), false, 0, false, false); Main.item[num714].noGrabDelay = 0; } } if (this.type == 475) { if (this.ai[1] == 0f) { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 3005, 1, false, 0, false, false); Main.item[num714].noGrabDelay = 0; } else if (this.ai[1] < 10f) { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 2996, (int)(10f - this.ai[1]), false, 0, false, false); Main.item[num714].noGrabDelay = 0; } } if (this.type == 505) { if (this.ai[1] == 0f) { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 3079, 1, false, 0, false, false); Main.item[num714].noGrabDelay = 0; } else if (this.ai[1] < 10f) { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 3077, (int)(10f - this.ai[1]), false, 0, false, false); Main.item[num714].noGrabDelay = 0; } } if (this.type == 506) { if (this.ai[1] == 0f) { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 3080, 1, false, 0, false, false); Main.item[num714].noGrabDelay = 0; } else if (this.ai[1] < 10f) { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 3078, (int)(10f - this.ai[1]), false, 0, false, false); Main.item[num714].noGrabDelay = 0; } } if (this.type == 91 && Main.rand.Next(6) == 0) { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 516, 1, false, 0, false, false); } if (this.type == 50 && Main.rand.Next(3) == 0) { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 282, 1, false, 0, false, false); } if (this.type == 515 && Main.rand.Next(3) == 0) { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 3112, 1, false, 0, false, false); } if (this.type == 53 && Main.rand.Next(3) == 0) { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 286, 1, false, 0, false, false); } if (this.type == 48 && Main.rand.Next(2) == 0) { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 279, 1, false, 0, false, false); } if (this.type == 54 && Main.rand.Next(2) == 0) { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 287, 1, false, 0, false, false); } if (this.type == 3 && Main.rand.Next(2) == 0) { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 42, 1, false, 0, false, false); } if (this.type == 4 && Main.rand.Next(4) == 0) { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 47, 1, false, 0, false, false); } if (this.type == 12 && this.damage > 500) { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 75, 1, false, 0, false, false); } if (this.type == 155) { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 859, 1, false, 0, false, false); } if (this.type == 598 && Main.rand.Next(4) == 0) { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 3378, 1, false, 0, false, false); } if (this.type == 599 && Main.rand.Next(4) == 0) { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 3379, 1, false, 0, false, false); } if (this.type == 21 && Main.rand.Next(2) == 0) { num714 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, 154, 1, false, 0, false, false); } if (Main.netMode == 1 && num714 >= 0) { NetMessage.SendData(21, -1, -1, "", num714, 1f, 0f, 0f, 0, 0, 0); } } if (this.type == 69 || this.type == 70 || this.type == 621 || this.type == 756) { int i2 = (int)(this.position.X + (float)(this.width / 2)) / 16; int j2 = (int)(this.position.Y + (float)(this.height / 2)) / 16; if (this.type == 69) { WorldGen.Convert(i2, j2, 2, 4); } if (this.type == 70) { WorldGen.Convert(i2, j2, 1, 4); } if (this.type == 621) { WorldGen.Convert(i2, j2, 4, 4); } if (this.type == 756) { WorldGen.Convert(i2, j2, 5, 4); } } if (this.type == 370 || this.type == 371) { float num720 = 80f; int num721 = 119; if (this.type == 371) { num721 = 120; } for (int num722 = 0; num722 < 255; num722++) { Player player = Main.player[num722]; if (player.active && !player.dead && Vector2.Distance(base.Center, player.Center) < num720) { player.AddBuff(num721, 1800, true); } } for (int num723 = 0; num723 < 200; num723++) { NPC nPC = Main.npc[num723]; if (nPC.active && nPC.life > 0 && Vector2.Distance(base.Center, nPC.Center) < num720) { nPC.AddBuff(num721, 1800, false); } } } if (this.type == 378) { int num724 = Main.rand.Next(2, 4); if (Main.rand.Next(5) == 0) { num724++; } for (int num725 = 0; num725 < num724; num725++) { float num726 = this.velocity.X; float num727 = this.velocity.Y; num726 *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f; num727 *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f; Projectile.NewProjectile(base.Center.X, base.Center.Y, num726, num727, 379, this.damage, this.knockBack, this.owner, 0f, 0f); } } } this.active = false; }
public override void AI() { // Consistently update the worm if ((int)Main.time % 120 == 0) { projectile.netUpdate = true; } if (projectile.ai[1] == 1f) { projectile.ai[1] = 0f; projectile.netUpdate = true; } float segmentAheadRotation; // This, and Size will likely need to be changed based on the sprite size of the segment float travelFactor = 30f; Vector2 segmentAheadCenter; int byUUID = Projectile.GetByUUID(projectile.owner, (int)projectile.ai[0]); // Verify the projectile we specified as the segment ahead is a part of this worm, and exists if (byUUID >= 0 && Main.projectile[byUUID].active && (Main.projectile[byUUID].type == ModContent.ProjectileType <DesertBody>()) || Main.projectile[byUUID].type == ModContent.ProjectileType <DesertHead>()) { segmentAheadCenter = Main.projectile[byUUID].Center; segmentAheadRotation = Main.projectile[byUUID].rotation; // Define the localAI[0] (i.e segment behind) of the segment ahead as this segment Main.projectile[byUUID].localAI[0] = projectile.localAI[0] + 1f; // If this is a tail, and the UUID projectile is a head, kill the tail and head if (Main.projectile[byUUID].type == ModContent.ProjectileType <DesertHead>() && projectile.type == ModContent.ProjectileType <DesertTail>()) { Main.projectile[byUUID].Kill(); projectile.Kill(); return; } } // Otherwise, kill the segment and ignore the rest of the code else { projectile.Kill(); return; } projectile.velocity = Vector2.Zero; Vector2 vectorToAhead = segmentAheadCenter - projectile.Center; if (segmentAheadRotation != projectile.rotation) { // Fix the angle between -pi and pi (wraps back over if one of the bounds are reached) float deltaAngle = MathHelper.WrapAngle(segmentAheadRotation - projectile.rotation); vectorToAhead = vectorToAhead.RotatedBy(deltaAngle * 0.1f); } projectile.rotation = vectorToAhead.ToRotation() + MathHelper.PiOver2; projectile.position = projectile.Center; // If scale is not 1, adjust the width and height based on that too projectile.width = projectile.height = Size; projectile.Center = projectile.position; // Adjust the position of this segment relative to the one ahead if (vectorToAhead != Vector2.Zero) { projectile.Center = segmentAheadCenter - Vector2.Normalize(vectorToAhead) * travelFactor; } projectile.spriteDirection = (vectorToAhead.X > 0f).ToDirectionInt(); Player player = Main.player[projectile.owner]; CalValEXPlayer modPlayer = player.GetModPlayer <CalValEXPlayer>(); if (modPlayer.dsPet) { projectile.timeLeft = 2; } }
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { Vector2 origVect = new Vector2(speedX, speedY); SMGBullets--; Vector2 muzzleOffset = Vector2.Normalize(new Vector2(speedX, speedY - 2)) * 38f; if (Collision.CanHit(position, 0, 0, position + muzzleOffset, 0, 0)) { position += muzzleOffset; } float spread = MathHelper.ToRadians(23f); //45 degrees converted to radians float baseSpeed = (float)Math.Sqrt(speedX * speedX + speedY * speedY); double baseAngle = Math.Atan2(speedX, speedY); double randomAngle = baseAngle + (Main.rand.NextFloat() - 0.5f) * spread; speedX = baseSpeed * (float)Math.Sin(randomAngle); speedY = baseSpeed * (float)Math.Cos(randomAngle); int projectileShockd = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); Main.projectile[projectileShockd].GetGlobalProjectile <GloriousGunsGProj>().shotFromShockWeaponCommon = true; if (SMGBullets == 1) { CombatText.NewText(new Rectangle((int)player.position.X, (int)player.position.Y - 20, player.width, player.height), new Color(255, 255, 255, 100), "Reloading!"); Main.PlaySound(SoundLoader.customSoundType, player.position, mod.GetSoundSlot(SoundType.Custom, "Sounds/Reload")); item.reuseDelay = 90; } else { item.reuseDelay = 0; } if (SMGBullets <= 1) { SMGBullets = SMGBulletsMax; } if (Main.mouseRight) { if (SMGBullets > 3) { SMGBullets--; } for (int index = 0; index < 58; ++index) { if (player.inventory[index].ammo == item.useAmmo && player.inventory[index].stack > 1) { player.inventory[index].stack -= 1; break; } } Main.PlaySound(new Terraria.Audio.LegacySoundStyle(2, 11)); if (Main.rand.Next(2) == 1) { newVect = origVect.RotatedBy(System.Math.PI / (Main.rand.Next(82, 400) / 14)); } else { newVect = origVect.RotatedBy(-System.Math.PI / (Main.rand.Next(82, 400) / 14)); } int proj2 = Projectile.NewProjectile(position.X, position.Y, newVect.X, newVect.Y, type, damage, 0, player.whoAmI); Projectile newProj2 = Main.projectile[proj2]; Main.projectile[proj2].GetGlobalProjectile <GloriousGunsGProj>().shotFromShockWeaponCommon = true; } return(false); }
public override void PostUpdate() { if (Main.dayTime && VolcanoCountdown == 0) { if (VolcanoCooldown > 0) { VolcanoCooldown--; } if (VolcanoCooldown <= 0 && Main.rand.NextBool(VolcanoChance) && !ExampleConfigServer.Instance.DisableVolcanos) { string key = "Mods.ExampleMod.VolcanoWarning"; Color messageColor = Color.Orange; if (Main.netMode == 2) // Server { NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); } else if (Main.netMode == 0) // Single Player { Main.NewText(Language.GetTextValue(key), messageColor); } VolcanoCountdown = DefaultVolcanoCountdown; VolcanoCooldown = DefaultVolcanoCooldown; } } if (VolcanoCountdown > 0) { VolcanoCountdown--; if (VolcanoCountdown == 0) { VolcanoTremorTime = DefaultVolcanoTremorTime; // Since PostUpdate only happens in single and server, we need to inform the clients to shake if this is a server if (Main.netMode == 2) { var netMessage = mod.GetPacket(); netMessage.Write((byte)ExampleModMessageType.SetTremorTime); netMessage.Write(VolcanoTremorTime); netMessage.Send(); } for (int playerIndex = 0; playerIndex < 255; playerIndex++) { if (Main.player[playerIndex].active) { Player player = Main.player[playerIndex]; int speed = 12; float spawnX = Main.rand.Next(1000) - 500 + player.Center.X; float spawnY = -1000 + player.Center.Y; Vector2 baseSpawn = new Vector2(spawnX, spawnY); Vector2 baseVelocity = player.Center - baseSpawn; baseVelocity.Normalize(); baseVelocity = baseVelocity * speed; List <int> identities = new List <int>(); for (int i = 0; i < VolcanoProjectiles; i++) { Vector2 spawn = baseSpawn; spawn.X = spawn.X + i * 30 - VolcanoProjectiles * 15; Vector2 velocity = baseVelocity; velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-VolcanoAngleSpread / 2 + VolcanoAngleSpread * i / (float)VolcanoProjectiles)); velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; int projectile = Projectile.NewProjectile(spawn.X, spawn.Y, velocity.X, velocity.Y, Main.rand.Next(ProjectileID.MolotovFire, ProjectileID.MolotovFire3 + 1), 10, 10f, Main.myPlayer, 0f, 0f); Main.projectile[projectile].hostile = true; Main.projectile[projectile].Name = "Volcanic Rubble"; identities.Add(Main.projectile[projectile].identity); } if (Main.netMode == 2) { var netMessage = mod.GetPacket(); netMessage.Write((byte)ExampleModMessageType.VolcanicRubbleMultiplayerFix); netMessage.Write(identities.Count); for (int i = 0; i < identities.Count; i++) { netMessage.Write(identities[i]); } netMessage.Send(); } } } } } }
public void ItemCheck(int i) { if (this.webbed || this.frozen || this.stoned) { return; } bool flag = false; float num = (float)this.mount.PlayerOffsetHitbox; Item item = this.inventory[this.selectedItem]; if (this.mount.Active) { if (this.mount.Type == 8) { this.noItems = true; if (this.controlUseItem) { this.channel = true; if (this.releaseUseItem) { this.mount.UseAbility(this, Vector2.Zero, true); } this.releaseUseItem = false; } } if (this.whoAmI == Main.myPlayer && this.gravDir == -1f) { this.mount.Dismount(this); } } int weaponDamage = this.GetWeaponDamage(item); if (item.autoReuse && !this.noItems) { this.releaseUseItem = true; if (this.itemAnimation == 1 && item.stack > 0) { if (item.shoot > 0 && this.whoAmI != Main.myPlayer && this.controlUseItem && item.useStyle == 5) { this.ApplyAnimation(item); if (item.useSound > 0) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, item.useSound); } } else { this.itemAnimation = 0; } } } if (item.fishingPole > 0) { item.holdStyle = 0; if (this.itemTime == 0 && this.itemAnimation == 0) { for (int j = 0; j < 1000; j++) { if (Main.projectile[j].active && Main.projectile[j].owner == this.whoAmI && Main.projectile[j].bobber) { item.holdStyle = 1; } } } } if (this.itemAnimation == 0 && this.altFunctionUse == 2) { this.altFunctionUse = 0; } if (this.itemAnimation == 0 && this.reuseDelay > 0) { this.itemAnimation = this.reuseDelay; this.itemTime = this.reuseDelay; this.reuseDelay = 0; } if (this.controlUseItem && this.releaseUseItem && (item.headSlot > 0 || item.bodySlot > 0 || item.legSlot > 0)) { if (item.useStyle == 0) { this.releaseUseItem = false; } if (this.position.X / 16f - (float)Player.tileRangeX - (float)item.tileBoost <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)item.tileBoost - 1f >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)item.tileBoost <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)item.tileBoost - 2f >= (float)Player.tileTargetY) { int num2 = Player.tileTargetX; int num3 = Player.tileTargetY; if (Main.tile[num2, num3].active() && (Main.tile[num2, num3].type == 128 || Main.tile[num2, num3].type == 269)) { int num4 = (int)Main.tile[num2, num3].frameY; int k = 0; if (item.bodySlot >= 0) { k = 1; } if (item.legSlot >= 0) { k = 2; } num4 /= 18; while (k > num4) { num3++; num4 = (int)Main.tile[num2, num3].frameY; num4 /= 18; } while (k < num4) { num3--; num4 = (int)Main.tile[num2, num3].frameY; num4 /= 18; } int l; for (l = (int)Main.tile[num2, num3].frameX; l >= 100; l -= 100) { } if (l >= 36) { l -= 36; } num2 -= l / 18; int m = (int)Main.tile[num2, num3].frameX; WorldGen.KillTile(num2, num3, true, false, false); if (Main.netMode == 1) { NetMessage.SendData(17, -1, -1, "", 0, (float)num2, (float)num3, 1f, 0, 0, 0); } while (m >= 100) { m -= 100; } if (num4 == 0 && item.headSlot >= 0) { Main.blockMouse = true; Main.tile[num2, num3].frameX = (short)(m + item.headSlot * 100); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num2, num3, 1); } item.stack--; if (item.stack <= 0) { item.SetDefaults(0, false); Main.mouseItem.SetDefaults(0, false); } if (this.selectedItem == 58) { Main.mouseItem = item.Clone(); } this.releaseUseItem = false; this.mouseInterface = true; } else if (num4 == 1 && item.bodySlot >= 0) { Main.blockMouse = true; Main.tile[num2, num3].frameX = (short)(m + item.bodySlot * 100); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num2, num3, 1); } item.stack--; if (item.stack <= 0) { item.SetDefaults(0, false); Main.mouseItem.SetDefaults(0, false); } if (this.selectedItem == 58) { Main.mouseItem = item.Clone(); } this.releaseUseItem = false; this.mouseInterface = true; } else if (num4 == 2 && item.legSlot >= 0) { Main.blockMouse = true; Main.tile[num2, num3].frameX = (short)(m + item.legSlot * 100); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num2, num3, 1); } item.stack--; if (item.stack <= 0) { item.SetDefaults(0, false); Main.mouseItem.SetDefaults(0, false); } if (this.selectedItem == 58) { Main.mouseItem = item.Clone(); } this.releaseUseItem = false; this.mouseInterface = true; } } } } if (Main.myPlayer == i && this.itemAnimation == 0 && TileObjectData.CustomPlace(item.createTile, item.placeStyle)) { TileObject tileObject; TileObject.CanPlace(Player.tileTargetX, Player.tileTargetY, item.createTile, item.placeStyle, this.direction, out tileObject, true); } if (this.controlUseItem && this.itemAnimation == 0 && this.releaseUseItem && item.useStyle > 0) { if (this.altFunctionUse == 1) { this.altFunctionUse = 2; } bool flag2 = true; if (item.shoot == 0) { this.itemRotation = 0f; } if (item.type == 3335 && (this.extraAccessory || !Main.expertMode)) { flag2 = false; } if (this.pulley && item.fishingPole > 0) { flag2 = false; } if (this.wet && (item.shoot == 85 || item.shoot == 15 || item.shoot == 34)) { flag2 = false; } if (item.makeNPC > 0 && !NPC.CanReleaseNPCs(this.whoAmI)) { flag2 = false; } if (this.whoAmI == Main.myPlayer && item.type == 603 && !Main.cEd) { flag2 = false; } if (item.type == 1071 || item.type == 1072) { bool flag3 = false; for (int n = 0; n < 58; n++) { if (this.inventory[n].paint > 0) { flag3 = true; break; } } if (!flag3) { flag2 = false; } } if (this.noItems) { flag2 = false; } if (item.tileWand > 0) { int tileWand = item.tileWand; flag2 = false; for (int num5 = 0; num5 < 58; num5++) { if (tileWand == this.inventory[num5].type && this.inventory[num5].stack > 0) { flag2 = true; break; } } } if (item.fishingPole > 0) { for (int num6 = 0; num6 < 1000; num6++) { if (Main.projectile[num6].active && Main.projectile[num6].owner == this.whoAmI && Main.projectile[num6].bobber) { flag2 = false; if (this.whoAmI == Main.myPlayer && Main.projectile[num6].ai[0] == 0f) { Main.projectile[num6].ai[0] = 1f; float num7 = -10f; if (Main.projectile[num6].wet && Main.projectile[num6].velocity.Y > num7) { Main.projectile[num6].velocity.Y = num7; } Main.projectile[num6].netUpdate2 = true; if (Main.projectile[num6].ai[1] < 0f && Main.projectile[num6].localAI[1] != 0f) { bool flag4 = false; int num8 = 0; for (int num9 = 0; num9 < 58; num9++) { if (this.inventory[num9].stack > 0 && this.inventory[num9].bait > 0) { bool flag5 = false; int num10 = 1 + this.inventory[num9].bait / 5; if (num10 < 1) { num10 = 1; } if (this.accTackleBox) { num10++; } if (Main.rand.Next(num10) == 0) { flag5 = true; } if (Main.projectile[num6].localAI[1] < 0f) { flag5 = true; } if (Main.projectile[num6].localAI[1] > 0f) { Item item2 = new Item(); item2.SetDefaults((int)Main.projectile[num6].localAI[1], false); if (item2.rare < 0) { flag5 = false; } } if (flag5) { num8 = this.inventory[num9].type; this.inventory[num9].stack--; if (this.inventory[num9].stack <= 0) { this.inventory[num9].SetDefaults(0, false); } } flag4 = true; break; } } if (flag4) { if (num8 == 2673) { if (Main.netMode != 1) { NPC.SpawnOnPlayer(this.whoAmI, 370); } else { NetMessage.SendData(61, -1, -1, "", this.whoAmI, 370f, 0f, 0f, 0, 0, 0); } Main.projectile[num6].ai[0] = 2f; } else if (Main.rand.Next(7) == 0 && !this.accFishingLine) { Main.projectile[num6].ai[0] = 2f; } else { Main.projectile[num6].ai[1] = Main.projectile[num6].localAI[1]; } Main.projectile[num6].netUpdate = true; } } } } } } if (item.shoot == 6 || item.shoot == 19 || item.shoot == 33 || item.shoot == 52 || item.shoot == 113 || item.shoot == 320 || item.shoot == 333 || item.shoot == 383 || item.shoot == 491) { for (int num11 = 0; num11 < 1000; num11++) { if (Main.projectile[num11].active && Main.projectile[num11].owner == Main.myPlayer && Main.projectile[num11].type == item.shoot) { flag2 = false; } } } if (item.shoot == 106) { int num12 = 0; for (int num13 = 0; num13 < 1000; num13++) { if (Main.projectile[num13].active && Main.projectile[num13].owner == Main.myPlayer && Main.projectile[num13].type == item.shoot) { num12++; } } if (num12 >= item.stack) { flag2 = false; } } if (item.shoot == 272) { int num14 = 0; for (int num15 = 0; num15 < 1000; num15++) { if (Main.projectile[num15].active && Main.projectile[num15].owner == Main.myPlayer && Main.projectile[num15].type == item.shoot) { num14++; } } if (num14 >= item.stack) { flag2 = false; } } if (item.shoot == 13 || item.shoot == 32 || (item.shoot >= 230 && item.shoot <= 235) || item.shoot == 315 || item.shoot == 331 || item.shoot == 372) { for (int num16 = 0; num16 < 1000; num16++) { if (Main.projectile[num16].active && Main.projectile[num16].owner == Main.myPlayer && Main.projectile[num16].type == item.shoot && Main.projectile[num16].ai[0] != 2f) { flag2 = false; } } } if (item.shoot == 332) { int num17 = 0; for (int num18 = 0; num18 < 1000; num18++) { if (Main.projectile[num18].active && Main.projectile[num18].owner == Main.myPlayer && Main.projectile[num18].type == item.shoot && Main.projectile[num18].ai[0] != 2f) { num17++; } } if (num17 >= 3) { flag2 = false; } } if (item.potion && flag2) { if (this.potionDelay <= 0) { if (item.type == 227) { this.potionDelay = this.restorationDelayTime; this.AddBuff(21, this.potionDelay, true); } else { this.potionDelay = this.potionDelayTime; this.AddBuff(21, this.potionDelay, true); } } else { flag2 = false; } } if (item.mana > 0 && this.silence) { flag2 = false; } if (item.mana > 0 && flag2) { bool flag6 = false; if (item.type == 2795) { flag6 = true; } if (item.type != 127 || !this.spaceGun) { if (this.statMana >= (int)((float)item.mana * this.manaCost)) { if (!flag6) { this.statMana -= (int)((float)item.mana * this.manaCost); } } else if (this.manaFlower) { this.QuickMana(); if (this.statMana >= (int)((float)item.mana * this.manaCost)) { if (!flag6) { this.statMana -= (int)((float)item.mana * this.manaCost); } } else { flag2 = false; } } else { flag2 = false; } } if (this.whoAmI == Main.myPlayer && item.buffType != 0 && flag2) { this.AddBuff(item.buffType, item.buffTime, true); } } if (this.whoAmI == Main.myPlayer && item.type == 603 && Main.cEd) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 669) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 115) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 3060) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 3062) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 3577) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 425) { int num19 = Main.rand.Next(3); if (num19 == 0) { num19 = 27; } if (num19 == 1) { num19 = 101; } if (num19 == 2) { num19 = 102; } for (int num20 = 0; num20 < 22; num20++) { if (this.buffType[num20] == 27 || this.buffType[num20] == 101 || this.buffType[num20] == 102) { this.DelBuff(num20); num20--; } } this.AddBuff(num19, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 753) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 994) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 1169) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 1170) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 1171) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 1172) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 1180) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 1181) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 1182) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 1183) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 1242) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 1157) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 1309) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 1311) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 1837) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 1312) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 1798) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 1799) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 1802) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 1810) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 1927) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 1959) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 2364) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 2365) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 3043) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 2420) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 2535) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 2551) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 2584) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 2587) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 2621) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 2749) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 3249) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 3474) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == 3531) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && this.gravDir == 1f && item.mountType != -1 && this.mount.CanMount(item.mountType, this)) { this.mount.SetMount(item.mountType, this, false); } if (item.type == 43 && Main.dayTime) { flag2 = false; } if (item.type == 544 && Main.dayTime) { flag2 = false; } if (item.type == 556 && Main.dayTime) { flag2 = false; } if (item.type == 557 && Main.dayTime) { flag2 = false; } if (item.type == 70 && !this.ZoneCorrupt) { flag2 = false; } if (item.type == 1133 && !this.ZoneJungle) { flag2 = false; } if (item.type == 1844 && (Main.dayTime || Main.pumpkinMoon || Main.snowMoon)) { flag2 = false; } if (item.type == 1958 && (Main.dayTime || Main.pumpkinMoon || Main.snowMoon)) { flag2 = false; } if (item.type == 2767 && (!Main.dayTime || Main.eclipse || !Main.hardMode)) { flag2 = false; } if (item.type == 3601 && (!NPC.downedGolemBoss || !Main.hardMode || NPC.AnyDanger() || NPC.AnyoneNearCultists())) { flag2 = false; } if (!this.SummonItemCheck()) { flag2 = false; } if (item.shoot == 17 && flag2 && i == Main.myPlayer) { int num21 = (int)((float)Main.mouseX + Main.screenPosition.X) / 16; int num22 = (int)((float)Main.mouseY + Main.screenPosition.Y) / 16; if (this.gravDir == -1f) { num22 = (int)(Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY) / 16; } Tile tile = Main.tile[num21, num22]; if (tile.active() && (tile.type == 0 || tile.type == 2 || tile.type == 23 || tile.type == 109 || tile.type == 199)) { WorldGen.KillTile(num21, num22, false, false, true); if (!Main.tile[num21, num22].active()) { if (Main.netMode == 1) { NetMessage.SendData(17, -1, -1, "", 4, (float)num21, (float)num22, 0f, 0, 0, 0); } } else { flag2 = false; } } else { flag2 = false; } } if (flag2) { flag2 = this.HasAmmo(item, flag2); } if (flag2) { if (item.pick > 0 || item.axe > 0 || item.hammer > 0) { this.toolTime = 1; } if (this.grappling[0] > -1) { this.pulley = false; this.pulleyDir = 1; if (this.controlRight) { this.direction = 1; } else if (this.controlLeft) { this.direction = -1; } } this.channel = item.channel; this.attackCD = 0; this.ApplyAnimation(item); if (item.useSound > 0) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, item.useSound); } } if (flag2 && this.whoAmI == Main.myPlayer && item.shoot >= 0 && item.shoot < 651 && (ProjectileID.Sets.LightPet[item.shoot] || Main.projPet[item.shoot])) { if (ProjectileID.Sets.MinionSacrificable[item.shoot]) { List<int> list = new List<int>(); float num23 = 0f; for (int num24 = 0; num24 < 1000; num24++) { if (Main.projectile[num24].active && Main.projectile[num24].owner == i && Main.projectile[num24].minion) { int num25; for (num25 = 0; num25 < list.Count; num25++) { if (Main.projectile[list[num25]].minionSlots > Main.projectile[num24].minionSlots) { list.Insert(num25, num24); break; } } if (num25 == list.Count) { list.Add(num24); } num23 += Main.projectile[num24].minionSlots; } } float num26 = (float)ItemID.Sets.StaffMinionSlotsRequired[item.type]; float num27 = 0f; int num28 = 388; int num29 = -1; for (int num30 = 0; num30 < list.Count; num30++) { int type = Main.projectile[list[num30]].type; if (type == 626) { list.RemoveAt(num30); num30--; } if (type == 627) { if (Main.projectile[(int)Main.projectile[list[num30]].localAI[1]].type == 628) { num29 = list[num30]; } list.RemoveAt(num30); num30--; } } if (num29 != -1) { list.Add(num29); list.Add(Projectile.GetByUUID(Main.projectile[num29].owner, Main.projectile[num29].ai[0])); } int num31 = 0; while (num31 < list.Count && num23 - num27 > (float)this.maxMinions - num26) { int type2 = Main.projectile[list[num31]].type; if (type2 != num28 && type2 != 625 && type2 != 628 && type2 != 623) { if (type2 == 388 && num28 == 387) { num28 = 388; } if (type2 == 387 && num28 == 388) { num28 = 387; } num27 += Main.projectile[list[num31]].minionSlots; if (type2 == 626 || type2 == 627) { int byUUID = Projectile.GetByUUID(Main.projectile[list[num31]].owner, Main.projectile[list[num31]].ai[0]); if (byUUID >= 0) { Projectile projectile = Main.projectile[byUUID]; if (projectile.type != 625) { projectile.localAI[1] = Main.projectile[list[num31]].localAI[1]; } projectile = Main.projectile[(int)Main.projectile[list[num31]].localAI[1]]; projectile.ai[0] = Main.projectile[list[num31]].ai[0]; projectile.ai[1] = 1f; projectile.netUpdate = true; } } Main.projectile[list[num31]].Kill(); } num31++; } list.Clear(); if (num23 + num26 >= 9f) { AchievementsHelper.HandleSpecialEvent(this, 6); } } else { for (int num32 = 0; num32 < 1000; num32++) { if (Main.projectile[num32].active && Main.projectile[num32].owner == i && Main.projectile[num32].type == item.shoot) { Main.projectile[num32].Kill(); } if (item.shoot == 72) { if (Main.projectile[num32].active && Main.projectile[num32].owner == i && Main.projectile[num32].type == 86) { Main.projectile[num32].Kill(); } if (Main.projectile[num32].active && Main.projectile[num32].owner == i && Main.projectile[num32].type == 87) { Main.projectile[num32].Kill(); } } } } } } if (!this.controlUseItem) { bool arg_1F24_0 = this.channel; this.channel = false; } if (this.itemAnimation > 0) { if (item.melee) { this.itemAnimationMax = (int)((float)item.useAnimation * this.meleeSpeed); } else { this.itemAnimationMax = item.useAnimation; } if (item.mana > 0 && !flag && (item.type != 127 || !this.spaceGun)) { this.manaRegenDelay = (int)this.maxRegenDelay; } if (Main.dedServ) { this.itemHeight = item.height; this.itemWidth = item.width; } else { this.itemHeight = Main.itemTexture[item.type].Height; this.itemWidth = Main.itemTexture[item.type].Width; } this.itemAnimation--; if (!Main.dedServ) { if (item.useStyle == 1) { if (item.type > -1 && Item.claw[item.type]) { if ((double)this.itemAnimation < (double)this.itemAnimationMax * 0.333) { float num33 = 10f; this.itemLocation.X = this.position.X + (float)this.width * 0.5f + ((float)Main.itemTexture[item.type].Width * 0.5f - num33) * (float)this.direction; this.itemLocation.Y = this.position.Y + 26f + num; } else if ((double)this.itemAnimation < (double)this.itemAnimationMax * 0.666) { float num34 = 8f; this.itemLocation.X = this.position.X + (float)this.width * 0.5f + ((float)Main.itemTexture[item.type].Width * 0.5f - num34) * (float)this.direction; num34 = 24f; this.itemLocation.Y = this.position.Y + num34 + num; } else { float num35 = 6f; this.itemLocation.X = this.position.X + (float)this.width * 0.5f - ((float)Main.itemTexture[item.type].Width * 0.5f - num35) * (float)this.direction; num35 = 20f; this.itemLocation.Y = this.position.Y + num35 + num; } this.itemRotation = ((float)this.itemAnimation / (float)this.itemAnimationMax - 0.5f) * (float)(-(float)this.direction) * 3.5f - (float)this.direction * 0.3f; } else { if ((double)this.itemAnimation < (double)this.itemAnimationMax * 0.333) { float num36 = 10f; if (Main.itemTexture[item.type].Width > 32) { num36 = 14f; } if (Main.itemTexture[item.type].Width >= 52) { num36 = 24f; } if (Main.itemTexture[item.type].Width >= 64) { num36 = 28f; } if (Main.itemTexture[item.type].Width >= 92) { num36 = 38f; } if (item.type == 2330 || item.type == 2320 || item.type == 2341) { num36 += 8f; } this.itemLocation.X = this.position.X + (float)this.width * 0.5f + ((float)Main.itemTexture[item.type].Width * 0.5f - num36) * (float)this.direction; this.itemLocation.Y = this.position.Y + 24f + num; } else if ((double)this.itemAnimation < (double)this.itemAnimationMax * 0.666) { float num37 = 10f; if (Main.itemTexture[item.type].Width > 32) { num37 = 18f; } if (Main.itemTexture[item.type].Width >= 52) { num37 = 24f; } if (Main.itemTexture[item.type].Width >= 64) { num37 = 28f; } if (Main.itemTexture[item.type].Width >= 92) { num37 = 38f; } if (item.type == 2330 || item.type == 2320 || item.type == 2341) { num37 += 4f; } this.itemLocation.X = this.position.X + (float)this.width * 0.5f + ((float)Main.itemTexture[item.type].Width * 0.5f - num37) * (float)this.direction; num37 = 10f; if (Main.itemTexture[item.type].Height > 32) { num37 = 8f; } if (Main.itemTexture[item.type].Height > 52) { num37 = 12f; } if (Main.itemTexture[item.type].Height > 64) { num37 = 14f; } if (item.type == 2330 || item.type == 2320 || item.type == 2341) { num37 += 4f; } this.itemLocation.Y = this.position.Y + num37 + num; } else { float num38 = 6f; if (Main.itemTexture[item.type].Width > 32) { num38 = 14f; } if (Main.itemTexture[item.type].Width >= 48) { num38 = 18f; } if (Main.itemTexture[item.type].Width >= 52) { num38 = 24f; } if (Main.itemTexture[item.type].Width >= 64) { num38 = 28f; } if (Main.itemTexture[item.type].Width >= 92) { num38 = 38f; } if (item.type == 2330 || item.type == 2320 || item.type == 2341) { num38 += 4f; } this.itemLocation.X = this.position.X + (float)this.width * 0.5f - ((float)Main.itemTexture[item.type].Width * 0.5f - num38) * (float)this.direction; num38 = 10f; if (Main.itemTexture[item.type].Height > 32) { num38 = 10f; } if (Main.itemTexture[item.type].Height > 52) { num38 = 12f; } if (Main.itemTexture[item.type].Height > 64) { num38 = 14f; } if (item.type == 2330 || item.type == 2320 || item.type == 2341) { num38 += 4f; } this.itemLocation.Y = this.position.Y + num38 + num; } this.itemRotation = ((float)this.itemAnimation / (float)this.itemAnimationMax - 0.5f) * (float)(-(float)this.direction) * 3.5f - (float)this.direction * 0.3f; } if (this.gravDir == -1f) { this.itemRotation = -this.itemRotation; this.itemLocation.Y = this.position.Y + (float)this.height + (this.position.Y - this.itemLocation.Y); } } else if (item.useStyle == 2) { this.itemRotation = (float)this.itemAnimation / (float)this.itemAnimationMax * (float)this.direction * 2f + -1.4f * (float)this.direction; if ((double)this.itemAnimation < (double)this.itemAnimationMax * 0.5) { this.itemLocation.X = this.position.X + (float)this.width * 0.5f + ((float)Main.itemTexture[item.type].Width * 0.5f - 9f - this.itemRotation * 12f * (float)this.direction) * (float)this.direction; this.itemLocation.Y = this.position.Y + 38f + this.itemRotation * (float)this.direction * 4f + num; } else { this.itemLocation.X = this.position.X + (float)this.width * 0.5f + ((float)Main.itemTexture[item.type].Width * 0.5f - 9f - this.itemRotation * 16f * (float)this.direction) * (float)this.direction; this.itemLocation.Y = this.position.Y + 38f + this.itemRotation * (float)this.direction + num; } if (this.gravDir == -1f) { this.itemRotation = -this.itemRotation; this.itemLocation.Y = this.position.Y + (float)this.height + (this.position.Y - this.itemLocation.Y); } } else if (item.useStyle == 3) { if ((double)this.itemAnimation > (double)this.itemAnimationMax * 0.666) { this.itemLocation.X = -1000f; this.itemLocation.Y = -1000f; this.itemRotation = -1.3f * (float)this.direction; } else { this.itemLocation.X = this.position.X + (float)this.width * 0.5f + ((float)Main.itemTexture[item.type].Width * 0.5f - 4f) * (float)this.direction; this.itemLocation.Y = this.position.Y + 24f + num; float num39 = (float)this.itemAnimation / (float)this.itemAnimationMax * (float)Main.itemTexture[item.type].Width * (float)this.direction * item.scale * 1.2f - (float)(10 * this.direction); if (num39 > -4f && this.direction == -1) { num39 = -8f; } if (num39 < 4f && this.direction == 1) { num39 = 8f; } this.itemLocation.X = this.itemLocation.X - num39; this.itemRotation = 0.8f * (float)this.direction; } if (this.gravDir == -1f) { this.itemRotation = -this.itemRotation; this.itemLocation.Y = this.position.Y + (float)this.height + (this.position.Y - this.itemLocation.Y); } } else if (item.useStyle == 4) { int num40 = 0; if (item.type == 3601) { num40 = 10; } this.itemRotation = 0f; this.itemLocation.X = this.position.X + (float)this.width * 0.5f + ((float)Main.itemTexture[item.type].Width * 0.5f - 9f - this.itemRotation * 14f * (float)this.direction - 4f - (float)num40) * (float)this.direction; this.itemLocation.Y = this.position.Y + (float)Main.itemTexture[item.type].Height * 0.5f + 4f + num; if (this.gravDir == -1f) { this.itemRotation = -this.itemRotation; this.itemLocation.Y = this.position.Y + (float)this.height + (this.position.Y - this.itemLocation.Y); } } else if (item.useStyle == 5) { if (Item.staff[item.type]) { float scaleFactor = 6f; if (item.type == 3476) { scaleFactor = 14f; } this.itemLocation = this.MountedCenter; this.itemLocation += this.itemRotation.ToRotationVector2() * scaleFactor * (float)this.direction; } else { this.itemLocation.X = this.position.X + (float)this.width * 0.5f - (float)Main.itemTexture[item.type].Width * 0.5f - (float)(this.direction * 2); this.itemLocation.Y = this.MountedCenter.Y - (float)Main.itemTexture[item.type].Height * 0.5f; } } } } else if (item.holdStyle == 1 && !this.pulley) { if (Main.dedServ) { this.itemLocation.X = this.position.X + (float)this.width * 0.5f + 20f * (float)this.direction; } else if (item.type == 930) { this.itemLocation.X = this.position.X + (float)(this.width / 2) * 0.5f - 12f - (float)(2 * this.direction); float num41 = this.position.X + (float)(this.width / 2) + (float)(38 * this.direction); if (this.direction == 1) { num41 -= 10f; } float num42 = this.MountedCenter.Y - 4f * this.gravDir; if (this.gravDir == -1f) { num42 -= 8f; } this.RotateRelativePoint(ref num41, ref num42); int num43 = 0; for (int num44 = 54; num44 < 58; num44++) { if (this.inventory[num44].stack > 0 && this.inventory[num44].ammo == 931) { num43 = this.inventory[num44].type; break; } } if (num43 == 0) { for (int num45 = 0; num45 < 54; num45++) { if (this.inventory[num45].stack > 0 && this.inventory[num45].ammo == 931) { num43 = this.inventory[num45].type; break; } } } if (num43 == 931) { num43 = 127; } else if (num43 == 1614) { num43 = 187; } if (num43 > 0) { int num46 = Dust.NewDust(new Vector2(num41, num42 + this.gfxOffY), 6, 6, num43, 0f, 0f, 100, default(Color), 1.6f); Main.dust[num46].noGravity = true; Dust expr_2ED9_cp_0 = Main.dust[num46]; expr_2ED9_cp_0.velocity.Y = expr_2ED9_cp_0.velocity.Y - 4f * this.gravDir; } } else if (item.type == 968) { this.itemLocation.X = this.position.X + (float)this.width * 0.5f + (float)(8 * this.direction); if (this.whoAmI == Main.myPlayer) { int num47 = (int)(this.itemLocation.X + (float)Main.itemTexture[item.type].Width * 0.8f * (float)this.direction) / 16; int num48 = (int)(this.itemLocation.Y + num + (float)(Main.itemTexture[item.type].Height / 2)) / 16; if (Main.tile[num47, num48] == null) { Main.tile[num47, num48] = new Tile(); } if (Main.tile[num47, num48].active() && Main.tile[num47, num48].type == 215 && Main.tile[num47, num48].frameY < 54) { this.miscTimer++; if (Main.rand.Next(5) == 0) { this.miscTimer++; } if (this.miscTimer > 900) { this.miscTimer = 0; item.SetDefaults(969, false); if (this.selectedItem == 58) { Main.mouseItem.SetDefaults(969, false); } for (int num49 = 0; num49 < 58; num49++) { if (this.inventory[num49].type == item.type && num49 != this.selectedItem && this.inventory[num49].stack < this.inventory[num49].maxStack) { Main.PlaySound(7, -1, -1, 1); this.inventory[num49].stack++; item.SetDefaults(0, false); if (this.selectedItem == 58) { Main.mouseItem.SetDefaults(0, false); } } } } } else { this.miscTimer = 0; } } } else if (item.type == 856) { this.itemLocation.X = this.position.X + (float)this.width * 0.5f + (float)(4 * this.direction); } else if (item.fishingPole > 0) { this.itemLocation.X = this.position.X + (float)this.width * 0.5f + (float)Main.itemTexture[item.type].Width * 0.18f * (float)this.direction; } else { this.itemLocation.X = this.position.X + (float)this.width * 0.5f + ((float)Main.itemTexture[item.type].Width * 0.5f + 2f) * (float)this.direction; if (item.type == 282 || item.type == 286 || item.type == 3112) { this.itemLocation.X = this.itemLocation.X - (float)(this.direction * 2); this.itemLocation.Y = this.itemLocation.Y + 4f; } else if (item.type == 3002) { this.itemLocation.X = this.itemLocation.X - (float)(4 * this.direction); this.itemLocation.Y = this.itemLocation.Y + 2f; } } this.itemLocation.Y = this.position.Y + 24f + num; if (item.type == 856) { this.itemLocation.Y = this.position.Y + 34f + num; } if (item.type == 930) { this.itemLocation.Y = this.position.Y + 9f + num; } if (item.fishingPole > 0) { this.itemLocation.Y = this.itemLocation.Y + 4f; } else if (item.type == 3476) { this.itemLocation.X = base.Center.X + (float)(14 * this.direction); this.itemLocation.Y = this.MountedCenter.Y; } this.itemRotation = 0f; if (this.gravDir == -1f) { this.itemRotation = -this.itemRotation; this.itemLocation.Y = this.position.Y + (float)this.height + (this.position.Y - this.itemLocation.Y) + num; if (item.type == 930) { this.itemLocation.Y = this.itemLocation.Y - 24f; } } } else if (item.holdStyle == 2 && !this.pulley) { if (item.type == 946) { this.itemRotation = 0f; this.itemLocation.X = this.position.X + (float)this.width * 0.5f - (float)(16 * this.direction); this.itemLocation.Y = this.position.Y + 22f + num; this.fallStart = (int)(this.position.Y / 16f); if (this.gravDir == -1f) { this.itemRotation = -this.itemRotation; this.itemLocation.Y = this.position.Y + (float)this.height + (this.position.Y - this.itemLocation.Y); if (this.velocity.Y < -2f) { this.velocity.Y = -2f; } } else if (this.velocity.Y > 2f) { this.velocity.Y = 2f; } } else { this.itemLocation.X = this.position.X + (float)this.width * 0.5f + (float)(6 * this.direction); this.itemLocation.Y = this.position.Y + 16f + num; this.itemRotation = 0.79f * (float)(-(float)this.direction); if (this.gravDir == -1f) { this.itemRotation = -this.itemRotation; this.itemLocation.Y = this.position.Y + (float)this.height + (this.position.Y - this.itemLocation.Y); } } } else if (item.holdStyle == 3 && !this.pulley && !Main.dedServ) { this.itemLocation.X = this.position.X + (float)this.width * 0.5f - (float)Main.itemTexture[item.type].Width * 0.5f - (float)(this.direction * 2); this.itemLocation.Y = this.MountedCenter.Y - (float)Main.itemTexture[item.type].Height * 0.5f; this.itemRotation = 0f; } if ((((item.type == 974 || item.type == 8 || item.type == 1245 || item.type == 2274 || item.type == 3004 || item.type == 3045 || item.type == 3114 || (item.type >= 427 && item.type <= 433)) && !this.wet) || item.type == 523 || item.type == 1333) && !this.pulley) { float num50 = 1f; float num51 = 0.95f; float num52 = 0.8f; int num53 = 0; if (item.type == 523) { num53 = 8; } else if (item.type == 974) { num53 = 9; } else if (item.type == 1245) { num53 = 10; } else if (item.type == 1333) { num53 = 11; } else if (item.type == 2274) { num53 = 12; } else if (item.type == 3004) { num53 = 13; } else if (item.type == 3045) { num53 = 14; } else if (item.type == 3114) { num53 = 15; } else if (item.type >= 427) { num53 = item.type - 426; } if (num53 == 1) { num50 = 0f; num51 = 0.1f; num52 = 1.3f; } else if (num53 == 2) { num50 = 1f; num51 = 0.1f; num52 = 0.1f; } else if (num53 == 3) { num50 = 0f; num51 = 1f; num52 = 0.1f; } else if (num53 == 4) { num50 = 0.9f; num51 = 0f; num52 = 0.9f; } else if (num53 == 5) { num50 = 1.3f; num51 = 1.3f; num52 = 1.3f; } else if (num53 == 6) { num50 = 0.9f; num51 = 0.9f; num52 = 0f; } else if (num53 == 7) { num50 = 0.5f * Main.demonTorch + 1f * (1f - Main.demonTorch); num51 = 0.3f; num52 = 1f * Main.demonTorch + 0.5f * (1f - Main.demonTorch); } else if (num53 == 8) { num52 = 0.7f; num50 = 0.85f; num51 = 1f; } else if (num53 == 9) { num52 = 1f; num50 = 0.7f; num51 = 0.85f; } else if (num53 == 10) { num52 = 0f; num50 = 1f; num51 = 0.5f; } else if (num53 == 11) { num52 = 0.8f; num50 = 1.25f; num51 = 1.25f; } else if (num53 == 12) { num50 *= 0.75f; num51 *= 1.3499999f; num52 *= 1.5f; } else if (num53 == 13) { num50 = 0.95f; num51 = 0.65f; num52 = 1.3f; } else if (num53 == 14) { num50 = (float)Main.DiscoR / 255f; num51 = (float)Main.DiscoG / 255f; num52 = (float)Main.DiscoB / 255f; } else if (num53 == 15) { num50 = 1f; num51 = 0f; num52 = 1f; } int num54 = num53; if (num54 == 0) { num54 = 6; } else if (num54 == 8) { num54 = 75; } else if (num54 == 9) { num54 = 135; } else if (num54 == 10) { num54 = 158; } else if (num54 == 11) { num54 = 169; } else if (num54 == 12) { num54 = 156; } else if (num54 == 13) { num54 = 234; } else if (num54 == 14) { num54 = 66; } else if (num54 == 15) { num54 = 242; } else { num54 = 58 + num54; } int maxValue = 30; if (this.itemAnimation > 0) { maxValue = 7; } if (this.direction == -1) { if (Main.rand.Next(maxValue) == 0) { int num55 = Dust.NewDust(new Vector2(this.itemLocation.X - 16f, this.itemLocation.Y - 14f * this.gravDir), 4, 4, num54, 0f, 0f, 100, default(Color), 1f); if (Main.rand.Next(3) != 0) { Main.dust[num55].noGravity = true; } Main.dust[num55].velocity *= 0.3f; Dust expr_3B64_cp_0 = Main.dust[num55]; expr_3B64_cp_0.velocity.Y = expr_3B64_cp_0.velocity.Y - 1.5f; Main.dust[num55].position = this.RotatedRelativePoint(Main.dust[num55].position, true); if (num54 == 66) { Main.dust[num55].color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); Main.dust[num55].noGravity = true; } } Vector2 position = this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 12f + this.velocity.X, this.itemLocation.Y - 14f + this.velocity.Y), true); Lighting.AddLight(position, num50, num51, num52); } else { if (Main.rand.Next(maxValue) == 0) { int num56 = Dust.NewDust(new Vector2(this.itemLocation.X + 6f, this.itemLocation.Y - 14f * this.gravDir), 4, 4, num54, 0f, 0f, 100, default(Color), 1f); if (Main.rand.Next(3) != 0) { Main.dust[num56].noGravity = true; } Main.dust[num56].velocity *= 0.3f; Dust expr_3CD3_cp_0 = Main.dust[num56]; expr_3CD3_cp_0.velocity.Y = expr_3CD3_cp_0.velocity.Y - 1.5f; Main.dust[num56].position = this.RotatedRelativePoint(Main.dust[num56].position, true); if (num54 == 66) { Main.dust[num56].color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); Main.dust[num56].noGravity = true; } } Vector2 position2 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 12f + this.velocity.X, this.itemLocation.Y - 14f + this.velocity.Y), true); Lighting.AddLight(position2, num50, num51, num52); } } if ((item.type == 105 || item.type == 713) && !this.wet && !this.pulley) { int maxValue2 = 20; if (this.itemAnimation > 0) { maxValue2 = 7; } if (this.direction == -1) { if (Main.rand.Next(maxValue2) == 0) { int num57 = Dust.NewDust(new Vector2(this.itemLocation.X - 12f, this.itemLocation.Y - 20f * this.gravDir), 4, 4, 6, 0f, 0f, 100, default(Color), 1f); if (Main.rand.Next(3) != 0) { Main.dust[num57].noGravity = true; } Main.dust[num57].velocity *= 0.3f; Dust expr_3E88_cp_0 = Main.dust[num57]; expr_3E88_cp_0.velocity.Y = expr_3E88_cp_0.velocity.Y - 1.5f; Main.dust[num57].position = this.RotatedRelativePoint(Main.dust[num57].position, true); } Vector2 position3 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 16f + this.velocity.X, this.itemLocation.Y - 14f), true); Lighting.AddLight(position3, 1f, 0.95f, 0.8f); } else { if (Main.rand.Next(maxValue2) == 0) { int num58 = Dust.NewDust(new Vector2(this.itemLocation.X + 4f, this.itemLocation.Y - 20f * this.gravDir), 4, 4, 6, 0f, 0f, 100, default(Color), 1f); if (Main.rand.Next(3) != 0) { Main.dust[num58].noGravity = true; } Main.dust[num58].velocity *= 0.3f; Dust expr_3FBE_cp_0 = Main.dust[num58]; expr_3FBE_cp_0.velocity.Y = expr_3FBE_cp_0.velocity.Y - 1.5f; Main.dust[num58].position = this.RotatedRelativePoint(Main.dust[num58].position, true); } Vector2 position4 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 6f + this.velocity.X, this.itemLocation.Y - 14f), true); Lighting.AddLight(position4, 1f, 0.95f, 0.8f); } } else if (item.type == 148 && !this.wet) { int maxValue3 = 10; if (this.itemAnimation > 0) { maxValue3 = 7; } if (this.direction == -1) { if (Main.rand.Next(maxValue3) == 0) { int num59 = Dust.NewDust(new Vector2(this.itemLocation.X - 12f, this.itemLocation.Y - 20f * this.gravDir), 4, 4, 172, 0f, 0f, 100, default(Color), 1f); if (Main.rand.Next(3) != 0) { Main.dust[num59].noGravity = true; } Main.dust[num59].velocity *= 0.3f; Dust expr_412F_cp_0 = Main.dust[num59]; expr_412F_cp_0.velocity.Y = expr_412F_cp_0.velocity.Y - 1.5f; Main.dust[num59].position = this.RotatedRelativePoint(Main.dust[num59].position, true); } Vector2 position5 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 16f + this.velocity.X, this.itemLocation.Y - 14f), true); Lighting.AddLight(position5, 0f, 0.5f, 1f); } else { if (Main.rand.Next(maxValue3) == 0) { int num60 = Dust.NewDust(new Vector2(this.itemLocation.X + 4f, this.itemLocation.Y - 20f * this.gravDir), 4, 4, 172, 0f, 0f, 100, default(Color), 1f); if (Main.rand.Next(3) != 0) { Main.dust[num60].noGravity = true; } Main.dust[num60].velocity *= 0.3f; Dust expr_4269_cp_0 = Main.dust[num60]; expr_4269_cp_0.velocity.Y = expr_4269_cp_0.velocity.Y - 1.5f; Main.dust[num60].position = this.RotatedRelativePoint(Main.dust[num60].position, true); } Vector2 position6 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 6f + this.velocity.X, this.itemLocation.Y - 14f), true); Lighting.AddLight(position6, 0f, 0.5f, 1f); } } else if (item.type == 3117 && !this.wet) { this.itemLocation.X = this.itemLocation.X - (float)(this.direction * 4); int maxValue4 = 10; if (this.itemAnimation > 0) { maxValue4 = 7; } if (this.direction == -1) { if (Main.rand.Next(maxValue4) == 0) { int num61 = Dust.NewDust(new Vector2(this.itemLocation.X - 10f, this.itemLocation.Y - 20f * this.gravDir), 4, 4, 242, 0f, 0f, 100, default(Color), 1f); if (Main.rand.Next(3) != 0) { Main.dust[num61].noGravity = true; } Main.dust[num61].velocity *= 0.3f; Dust expr_43F5_cp_0 = Main.dust[num61]; expr_43F5_cp_0.velocity.Y = expr_43F5_cp_0.velocity.Y - 1.5f; Main.dust[num61].position = this.RotatedRelativePoint(Main.dust[num61].position, true); } Vector2 position7 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 16f + this.velocity.X, this.itemLocation.Y - 14f), true); Lighting.AddLight(position7, 0.9f, 0.1f, 0.75f); } else { if (Main.rand.Next(maxValue4) == 0) { int num62 = Dust.NewDust(new Vector2(this.itemLocation.X + 6f, this.itemLocation.Y - 20f * this.gravDir), 4, 4, 242, 0f, 0f, 100, default(Color), 1f); if (Main.rand.Next(3) != 0) { Main.dust[num62].noGravity = true; } Main.dust[num62].velocity *= 0.3f; Dust expr_452F_cp_0 = Main.dust[num62]; expr_452F_cp_0.velocity.Y = expr_452F_cp_0.velocity.Y - 1.5f; Main.dust[num62].position = this.RotatedRelativePoint(Main.dust[num62].position, true); } Vector2 position8 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 6f + this.velocity.X, this.itemLocation.Y - 14f), true); Lighting.AddLight(position8, 0.9f, 0.1f, 0.75f); } } if (item.type == 282 && !this.pulley) { if (this.direction == -1) { Vector2 position9 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 16f + this.velocity.X, this.itemLocation.Y - 14f), true); Lighting.AddLight(position9, 0.7f, 1f, 0.8f); } else { Vector2 position10 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 6f + this.velocity.X, this.itemLocation.Y - 14f), true); Lighting.AddLight(position10, 0.7f, 1f, 0.8f); } } if (item.type == 3002 && !this.pulley) { float r = 1.05f; float g = 0.95f; float b = 0.55f; if (this.direction == -1) { Vector2 position11 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 16f + this.velocity.X, this.itemLocation.Y - 14f), true); Lighting.AddLight(position11, r, g, b); } else { Vector2 position12 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 6f + this.velocity.X, this.itemLocation.Y - 14f), true); Lighting.AddLight(position12, r, g, b); } this.spelunkerTimer += 1; if (this.spelunkerTimer >= 10) { this.spelunkerTimer = 0; int num63 = 30; int num64 = (int)base.Center.X / 16; int num65 = (int)base.Center.Y / 16; for (int num66 = num64 - num63; num66 <= num64 + num63; num66++) { for (int num67 = num65 - num63; num67 <= num65 + num63; num67++) { if (Main.rand.Next(4) == 0) { Vector2 vector = new Vector2((float)(num64 - num66), (float)(num65 - num67)); if (vector.Length() < (float)num63 && num66 > 0 && num66 < Main.maxTilesX - 1 && num67 > 0 && num67 < Main.maxTilesY - 1 && Main.tile[num66, num67] != null && Main.tile[num66, num67].active()) { bool flag7 = false; if (Main.tile[num66, num67].type == 185 && Main.tile[num66, num67].frameY == 18) { if (Main.tile[num66, num67].frameX >= 576 && Main.tile[num66, num67].frameX <= 882) { flag7 = true; } } else if (Main.tile[num66, num67].type == 186 && Main.tile[num66, num67].frameX >= 864 && Main.tile[num66, num67].frameX <= 1170) { flag7 = true; } if (flag7 || Main.tileSpelunker[(int)Main.tile[num66, num67].type] || (Main.tileAlch[(int)Main.tile[num66, num67].type] && Main.tile[num66, num67].type != 82)) { int num68 = Dust.NewDust(new Vector2((float)(num66 * 16), (float)(num67 * 16)), 16, 16, 204, 0f, 0f, 150, default(Color), 0.3f); Main.dust[num68].fadeIn = 0.75f; Main.dust[num68].velocity *= 0.1f; Main.dust[num68].noLight = true; } } } } } } } if (item.type == 286 && !this.pulley) { if (this.direction == -1) { Vector2 position13 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 16f + this.velocity.X, this.itemLocation.Y - 14f), true); Lighting.AddLight(position13, 0.7f, 0.8f, 1f); } else { Vector2 position14 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 6f + this.velocity.X, this.itemLocation.Y - 14f), true); Lighting.AddLight(position14, 0.7f, 0.8f, 1f); } } if (item.type == 3112 && !this.pulley) { if (this.direction == -1) { Vector2 position15 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X - 16f + this.velocity.X, this.itemLocation.Y - 14f), true); Lighting.AddLight(position15, 1f, 0.6f, 0.85f); } else { Vector2 position16 = this.RotatedRelativePoint(new Vector2(this.itemLocation.X + 6f + this.velocity.X, this.itemLocation.Y - 14f), true); Lighting.AddLight(position16, 1f, 0.6f, 0.85f); } } if (this.controlUseItem) { this.releaseUseItem = false; } else { this.releaseUseItem = true; } if (this.itemTime > 0) { this.itemTime--; if (this.itemTime == 0 && this.whoAmI == Main.myPlayer) { int type3 = item.type; if (type3 == 65 || type3 == 676 || type3 == 723 || type3 == 724 || type3 == 989 || type3 == 1226 || type3 == 1227) { Main.PlaySound(25, -1, -1, 1); for (int num69 = 0; num69 < 5; num69++) { int num70 = Dust.NewDust(this.position, this.width, this.height, 45, 0f, 0f, 255, default(Color), (float)Main.rand.Next(20, 26) * 0.1f); Main.dust[num70].noLight = true; Main.dust[num70].noGravity = true; Main.dust[num70].velocity *= 0.5f; } } } } if (i == Main.myPlayer) { bool flag8 = true; int type4 = item.type; if ((type4 == 65 || type4 == 676 || type4 == 723 || type4 == 724 || type4 == 757 || type4 == 674 || type4 == 675 || type4 == 989 || type4 == 1226 || type4 == 1227) && this.itemAnimation != this.itemAnimationMax - 1) { flag8 = false; } if (item.shoot > 0 && this.itemAnimation > 0 && this.itemTime == 0 && flag8) { int num71 = item.shoot; float num72 = item.shootSpeed; if (this.inventory[this.selectedItem].thrown && num72 < 16f) { num72 *= this.thrownVelocity; if (num72 > 16f) { num72 = 16f; } } if (item.melee && num71 != 25 && num71 != 26 && num71 != 35) { num72 /= this.meleeSpeed; } bool flag9 = false; int num73 = weaponDamage; float num74 = item.knockBack; if (num71 == 13 || num71 == 32 || num71 == 315 || (num71 >= 230 && num71 <= 235) || num71 == 331) { this.grappling[0] = -1; this.grapCount = 0; for (int num75 = 0; num75 < 1000; num75++) { if (Main.projectile[num75].active && Main.projectile[num75].owner == i) { if (Main.projectile[num75].type == 13) { Main.projectile[num75].Kill(); } if (Main.projectile[num75].type == 331) { Main.projectile[num75].Kill(); } if (Main.projectile[num75].type == 315) { Main.projectile[num75].Kill(); } if (Main.projectile[num75].type >= 230 && Main.projectile[num75].type <= 235) { Main.projectile[num75].Kill(); } } } } if (item.useAmmo > 0) { this.PickAmmo(item, ref num71, ref num72, ref flag9, ref num73, ref num74, ItemID.Sets.gunProj[item.type]); } else { flag9 = true; } if (item.type == 3475 || item.type == 3540) { num74 = item.knockBack; num73 = weaponDamage; num72 = item.shootSpeed; } if (item.type == 71) { flag9 = false; } if (item.type == 72) { flag9 = false; } if (item.type == 73) { flag9 = false; } if (item.type == 74) { flag9 = false; } if (item.type == 1254 && num71 == 14) { num71 = 242; } if (item.type == 1255 && num71 == 14) { num71 = 242; } if (item.type == 1265 && num71 == 14) { num71 = 242; } if (item.type == 3542) { bool flag10 = Main.rand.Next(100) < 20; if (flag10) { num71++; num73 *= 3; } else { num72 -= 1f; } } if (num71 == 73) { for (int num76 = 0; num76 < 1000; num76++) { if (Main.projectile[num76].active && Main.projectile[num76].owner == i) { if (Main.projectile[num76].type == 73) { num71 = 74; } if (num71 == 74 && Main.projectile[num76].type == 74) { flag9 = false; } } } } if (flag9) { num74 = this.GetWeaponKnockback(item, num74); if (num71 == 228) { num74 = 0f; } if (num71 == 1 && item.type == 120) { num71 = 2; } if (item.type == 682) { num71 = 117; } if (item.type == 725) { num71 = 120; } if (item.type == 2796) { num71 = 442; } if (item.type == 2223) { num71 = 357; } this.itemTime = item.useTime; Vector2 vector2 = this.RotatedRelativePoint(this.MountedCenter, true); Vector2 value = Vector2.UnitX.RotatedBy((double)this.fullRotation, default(Vector2)); Vector2 vector3 = Main.MouseWorld - vector2; if (vector3 != Vector2.Zero) { vector3.Normalize(); } float num77 = Vector2.Dot(value, vector3); if (num77 > 0f) { this.ChangeDir(1); } else { this.ChangeDir(-1); } if (item.type == 3094 || item.type == 3378 || item.type == 3543) { vector2.Y = this.position.Y + (float)(this.height / 3); } if (num71 == 9) { vector2 = new Vector2(this.position.X + (float)this.width * 0.5f + (float)(Main.rand.Next(201) * -(float)this.direction) + ((float)Main.mouseX + Main.screenPosition.X - this.position.X), this.MountedCenter.Y - 600f); num74 = 0f; num73 *= 2; } if (item.type == 986 || item.type == 281) { vector2.X += (float)(6 * this.direction); vector2.Y -= 6f * this.gravDir; } if (item.type == 3007) { vector2.X -= (float)(4 * this.direction); vector2.Y -= 1f * this.gravDir; } float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; if (this.gravDir == -1f) { num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; } float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); float num81 = num80; if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) { num78 = (float)this.direction; num79 = 0f; num80 = num72; } else { num80 = num72 / num80; } if (item.type == 1929 || item.type == 2270) { num78 += (float)Main.rand.Next(-50, 51) * 0.03f / num80; num79 += (float)Main.rand.Next(-50, 51) * 0.03f / num80; } num78 *= num80; num79 *= num80; if (item.type == 757) { num73 = (int)((float)num73 * 1.25f); } if (num71 == 250) { for (int num82 = 0; num82 < 1000; num82++) { if (Main.projectile[num82].active && Main.projectile[num82].owner == this.whoAmI && (Main.projectile[num82].type == 250 || Main.projectile[num82].type == 251)) { Main.projectile[num82].Kill(); } } } if (num71 == 12) { vector2.X += num78 * 3f; vector2.Y += num79 * 3f; } if (item.useStyle == 5) { if (item.type == 3029) { Vector2 vector4 = new Vector2(num78, num79); vector4.X = (float)Main.mouseX + Main.screenPosition.X - vector2.X; vector4.Y = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y - 1000f; this.itemRotation = (float)Math.Atan2((double)(vector4.Y * (float)this.direction), (double)(vector4.X * (float)this.direction)); NetMessage.SendData(13, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); NetMessage.SendData(41, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); } else { this.itemRotation = (float)Math.Atan2((double)(num79 * (float)this.direction), (double)(num78 * (float)this.direction)) - this.fullRotation; NetMessage.SendData(13, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); NetMessage.SendData(41, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } if (num71 == 17) { vector2.X = (float)Main.mouseX + Main.screenPosition.X; vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; if (this.gravDir == -1f) { vector2.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY; } } if (num71 == 76) { num71 += Main.rand.Next(3); num81 /= (float)(Main.screenHeight / 2); if (num81 > 1f) { num81 = 1f; } float num83 = num78 + (float)Main.rand.Next(-40, 41) * 0.01f; float num84 = num79 + (float)Main.rand.Next(-40, 41) * 0.01f; num83 *= num81 + 0.25f; num84 *= num81 + 0.25f; int num85 = Projectile.NewProjectile(vector2.X, vector2.Y, num83, num84, num71, num73, num74, i, 0f, 0f); Main.projectile[num85].ai[1] = 1f; num81 = num81 * 2f - 1f; if (num81 < -1f) { num81 = -1f; } if (num81 > 1f) { num81 = 1f; } Main.projectile[num85].ai[0] = num81; NetMessage.SendData(27, -1, -1, "", num85, 0f, 0f, 0f, 0, 0, 0); } else if (item.type == 3029) { int num86 = 3; if (Main.rand.Next(3) == 0) { num86++; } for (int num87 = 0; num87 < num86; num87++) { vector2 = new Vector2(this.position.X + (float)this.width * 0.5f + (float)(Main.rand.Next(201) * -(float)this.direction) + ((float)Main.mouseX + Main.screenPosition.X - this.position.X), this.MountedCenter.Y - 600f); vector2.X = (vector2.X * 10f + base.Center.X) / 11f + (float)Main.rand.Next(-100, 101); vector2.Y -= (float)(150 * num87); num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; if (num79 < 0f) { num79 *= -1f; } if (num79 < 20f) { num79 = 20f; } num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); num80 = num72 / num80; num78 *= num80; num79 *= num80; float num88 = num78 + (float)Main.rand.Next(-40, 41) * 0.03f; float speedY = num79 + (float)Main.rand.Next(-40, 41) * 0.03f; num88 *= (float)Main.rand.Next(75, 150) * 0.01f; vector2.X += (float)Main.rand.Next(-50, 51); int num89 = Projectile.NewProjectile(vector2.X, vector2.Y, num88, speedY, num71, num73, num74, i, 0f, 0f); Main.projectile[num89].noDropItem = true; } } else if (item.type == 98 || item.type == 533) { float speedX = num78 + (float)Main.rand.Next(-40, 41) * 0.01f; float speedY2 = num79 + (float)Main.rand.Next(-40, 41) * 0.01f; Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY2, num71, num73, num74, i, 0f, 0f); } else if (item.type == 1319) { float speedX2 = num78 + (float)Main.rand.Next(-40, 41) * 0.02f; float speedY3 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; int num90 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX2, speedY3, num71, num73, num74, i, 0f, 0f); Main.projectile[num90].ranged = true; Main.projectile[num90].thrown = false; } else if (item.type == 3107) { float speedX3 = num78 + (float)Main.rand.Next(-40, 41) * 0.02f; float speedY4 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; Projectile.NewProjectile(vector2.X, vector2.Y, speedX3, speedY4, num71, num73, num74, i, 0f, 0f); } else if (item.type == 3053) { Vector2 value2 = new Vector2(num78, num79); value2.Normalize(); Vector2 value3 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); value3.Normalize(); value2 = value2 * 4f + value3; value2.Normalize(); value2 *= item.shootSpeed; float num91 = (float)Main.rand.Next(10, 80) * 0.001f; if (Main.rand.Next(2) == 0) { num91 *= -1f; } float num92 = (float)Main.rand.Next(10, 80) * 0.001f; if (Main.rand.Next(2) == 0) { num92 *= -1f; } Projectile.NewProjectile(vector2.X, vector2.Y, value2.X, value2.Y, num71, num73, num74, i, num92, num91); } else if (item.type == 3019) { Vector2 value4 = new Vector2(num78, num79); float num93 = value4.Length(); value4.X += (float)Main.rand.Next(-100, 101) * 0.01f * num93 * 0.15f; value4.Y += (float)Main.rand.Next(-100, 101) * 0.01f * num93 * 0.15f; float num94 = num78 + (float)Main.rand.Next(-40, 41) * 0.03f; float num95 = num79 + (float)Main.rand.Next(-40, 41) * 0.03f; value4.Normalize(); value4 *= num93; num94 *= (float)Main.rand.Next(50, 150) * 0.01f; num95 *= (float)Main.rand.Next(50, 150) * 0.01f; Vector2 value5 = new Vector2(num94, num95); value5.X += (float)Main.rand.Next(-100, 101) * 0.025f; value5.Y += (float)Main.rand.Next(-100, 101) * 0.025f; value5.Normalize(); value5 *= num93; num94 = value5.X; num95 = value5.Y; Projectile.NewProjectile(vector2.X, vector2.Y, num94, num95, num71, num73, num74, i, value4.X, value4.Y); } else if (item.type == 2797) { Vector2 value6 = Vector2.Normalize(new Vector2(num78, num79)) * 40f * item.scale; if (Collision.CanHit(vector2, 0, 0, vector2 + value6, 0, 0)) { vector2 += value6; } float ai = new Vector2(num78, num79).ToRotation(); float num96 = 2.09439516f; int num97 = Main.rand.Next(4, 5); if (Main.rand.Next(4) == 0) { num97++; } for (int num98 = 0; num98 < num97; num98++) { float scaleFactor2 = (float)Main.rand.NextDouble() * 0.2f + 0.05f; Vector2 vector5 = new Vector2(num78, num79).RotatedBy((double)(num96 * (float)Main.rand.NextDouble() - num96 / 2f), default(Vector2)) * scaleFactor2; int num99 = Projectile.NewProjectile(vector2.X, vector2.Y, vector5.X, vector5.Y, 444, num73, num74, i, ai, 0f); Main.projectile[num99].localAI[0] = (float)num71; Main.projectile[num99].localAI[1] = num72; } } else if (item.type == 2270) { float num100 = num78 + (float)Main.rand.Next(-40, 41) * 0.05f; float num101 = num79 + (float)Main.rand.Next(-40, 41) * 0.05f; if (Main.rand.Next(3) == 0) { num100 *= 1f + (float)Main.rand.Next(-30, 31) * 0.02f; num101 *= 1f + (float)Main.rand.Next(-30, 31) * 0.02f; } Projectile.NewProjectile(vector2.X, vector2.Y, num100, num101, num71, num73, num74, i, 0f, 0f); } else if (item.type == 1930) { int num102 = 2 + Main.rand.Next(3); for (int num103 = 0; num103 < num102; num103++) { float num104 = num78; float num105 = num79; float num106 = 0.025f * (float)num103; num104 += (float)Main.rand.Next(-35, 36) * num106; num105 += (float)Main.rand.Next(-35, 36) * num106; num80 = (float)Math.Sqrt((double)(num104 * num104 + num105 * num105)); num80 = num72 / num80; num104 *= num80; num105 *= num80; float x = vector2.X + num78 * (float)(num102 - num103) * 1.75f; float y = vector2.Y + num79 * (float)(num102 - num103) * 1.75f; Projectile.NewProjectile(x, y, num104, num105, num71, num73, num74, i, (float)Main.rand.Next(0, 10 * (num103 + 1)), 0f); } } else if (item.type == 1931) { int num107 = 2; for (int num108 = 0; num108 < num107; num108++) { vector2 = new Vector2(this.position.X + (float)this.width * 0.5f + (float)(Main.rand.Next(201) * -(float)this.direction) + ((float)Main.mouseX + Main.screenPosition.X - this.position.X), this.MountedCenter.Y - 600f); vector2.X = (vector2.X + base.Center.X) / 2f + (float)Main.rand.Next(-200, 201); vector2.Y -= (float)(100 * num108); num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; if (num79 < 0f) { num79 *= -1f; } if (num79 < 20f) { num79 = 20f; } num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); num80 = num72 / num80; num78 *= num80; num79 *= num80; float speedX4 = num78 + (float)Main.rand.Next(-40, 41) * 0.02f; float speedY5 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, num71, num73, num74, i, 0f, (float)Main.rand.Next(5)); } } else if (item.type == 2750) { int num109 = 1; for (int num110 = 0; num110 < num109; num110++) { vector2 = new Vector2(this.position.X + (float)this.width * 0.5f + (float)(Main.rand.Next(201) * -(float)this.direction) + ((float)Main.mouseX + Main.screenPosition.X - this.position.X), this.MountedCenter.Y - 600f); vector2.X = (vector2.X + base.Center.X) / 2f + (float)Main.rand.Next(-200, 201); vector2.Y -= (float)(100 * num110); num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X + (float)Main.rand.Next(-40, 41) * 0.03f; num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; if (num79 < 0f) { num79 *= -1f; } if (num79 < 20f) { num79 = 20f; } num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); num80 = num72 / num80; num78 *= num80; num79 *= num80; float num111 = num78; float num112 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; Projectile.NewProjectile(vector2.X, vector2.Y, num111 * 0.75f, num112 * 0.75f, num71 + Main.rand.Next(3), num73, num74, i, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); } } else if (item.type == 3570) { int num113 = 3; for (int num114 = 0; num114 < num113; num114++) { vector2 = new Vector2(this.position.X + (float)this.width * 0.5f + (float)(Main.rand.Next(201) * -(float)this.direction) + ((float)Main.mouseX + Main.screenPosition.X - this.position.X), this.MountedCenter.Y - 600f); vector2.X = (vector2.X + base.Center.X) / 2f + (float)Main.rand.Next(-200, 201); vector2.Y -= (float)(100 * num114); num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; float ai2 = num79 + vector2.Y; if (num79 < 0f) { num79 *= -1f; } if (num79 < 20f) { num79 = 20f; } num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); num80 = num72 / num80; num78 *= num80; num79 *= num80; Vector2 vector6 = new Vector2(num78, num79) / 2f; Projectile.NewProjectile(vector2.X, vector2.Y, vector6.X, vector6.Y, num71, num73, num74, i, 0f, ai2); } } else if (item.type == 3065) { Vector2 value7 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY); float num115 = value7.Y; if (num115 > base.Center.Y - 200f) { num115 = base.Center.Y - 200f; } for (int num116 = 0; num116 < 3; num116++) { vector2 = base.Center + new Vector2((float)(-(float)Main.rand.Next(0, 401) * this.direction), -600f); vector2.Y -= (float)(100 * num116); Vector2 value8 = value7 - vector2; if (value8.Y < 0f) { value8.Y *= -1f; } if (value8.Y < 20f) { value8.Y = 20f; } value8.Normalize(); value8 *= num72; num78 = value8.X; num79 = value8.Y; float speedX5 = num78; float speedY6 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; Projectile.NewProjectile(vector2.X, vector2.Y, speedX5, speedY6, num71, num73 * 2, num74, i, 0f, num115); } } else if (item.type == 2624) { float num117 = 0.314159274f; int num118 = 5; Vector2 vector7 = new Vector2(num78, num79); vector7.Normalize(); vector7 *= 40f; bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); for (int num119 = 0; num119 < num118; num119++) { float num120 = (float)num119 - ((float)num118 - 1f) / 2f; Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default(Vector2)); if (!flag11) { value9 -= vector7; } int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, num78, num79, num71, num73, num74, i, 0f, 0f); Main.projectile[num121].noDropItem = true; } } else if (item.type == 1929) { float speedX6 = num78 + (float)Main.rand.Next(-40, 41) * 0.03f; float speedY7 = num79 + (float)Main.rand.Next(-40, 41) * 0.03f; Projectile.NewProjectile(vector2.X, vector2.Y, speedX6, speedY7, num71, num73, num74, i, 0f, 0f); } else if (item.type == 1553) { float speedX7 = num78 + (float)Main.rand.Next(-40, 41) * 0.005f; float speedY8 = num79 + (float)Main.rand.Next(-40, 41) * 0.005f; Projectile.NewProjectile(vector2.X, vector2.Y, speedX7, speedY8, num71, num73, num74, i, 0f, 0f); } else if (item.type == 518) { float num122 = num78; float num123 = num79; num122 += (float)Main.rand.Next(-40, 41) * 0.04f; num123 += (float)Main.rand.Next(-40, 41) * 0.04f; Projectile.NewProjectile(vector2.X, vector2.Y, num122, num123, num71, num73, num74, i, 0f, 0f); } else if (item.type == 1265) { float num124 = num78; float num125 = num79; num124 += (float)Main.rand.Next(-30, 31) * 0.03f; num125 += (float)Main.rand.Next(-30, 31) * 0.03f; Projectile.NewProjectile(vector2.X, vector2.Y, num124, num125, num71, num73, num74, i, 0f, 0f); } else if (item.type == 534) { int num126 = Main.rand.Next(4, 6); for (int num127 = 0; num127 < num126; num127++) { float num128 = num78; float num129 = num79; num128 += (float)Main.rand.Next(-40, 41) * 0.05f; num129 += (float)Main.rand.Next(-40, 41) * 0.05f; Projectile.NewProjectile(vector2.X, vector2.Y, num128, num129, num71, num73, num74, i, 0f, 0f); } } else if (item.type == 2188) { int num130 = 4; if (Main.rand.Next(3) == 0) { num130++; } if (Main.rand.Next(4) == 0) { num130++; } if (Main.rand.Next(5) == 0) { num130++; } for (int num131 = 0; num131 < num130; num131++) { float num132 = num78; float num133 = num79; float num134 = 0.05f * (float)num131; num132 += (float)Main.rand.Next(-35, 36) * num134; num133 += (float)Main.rand.Next(-35, 36) * num134; num80 = (float)Math.Sqrt((double)(num132 * num132 + num133 * num133)); num80 = num72 / num80; num132 *= num80; num133 *= num80; float x2 = vector2.X; float y2 = vector2.Y; Projectile.NewProjectile(x2, y2, num132, num133, num71, num73, num74, i, 0f, 0f); } } else if (item.type == 1308) { int num135 = 3; if (Main.rand.Next(3) == 0) { num135++; } for (int num136 = 0; num136 < num135; num136++) { float num137 = num78; float num138 = num79; float num139 = 0.05f * (float)num136; num137 += (float)Main.rand.Next(-35, 36) * num139; num138 += (float)Main.rand.Next(-35, 36) * num139; num80 = (float)Math.Sqrt((double)(num137 * num137 + num138 * num138)); num80 = num72 / num80; num137 *= num80; num138 *= num80; float x3 = vector2.X; float y3 = vector2.Y; Projectile.NewProjectile(x3, y3, num137, num138, num71, num73, num74, i, 0f, 0f); } } else if (item.type == 1258) { float num140 = num78; float num141 = num79; num140 += (float)Main.rand.Next(-40, 41) * 0.01f; num141 += (float)Main.rand.Next(-40, 41) * 0.01f; vector2.X += (float)Main.rand.Next(-40, 41) * 0.05f; vector2.Y += (float)Main.rand.Next(-45, 36) * 0.05f; Projectile.NewProjectile(vector2.X, vector2.Y, num140, num141, num71, num73, num74, i, 0f, 0f); } else if (item.type == 964) { int num142 = Main.rand.Next(3, 5); for (int num143 = 0; num143 < num142; num143++) { float num144 = num78; float num145 = num79; num144 += (float)Main.rand.Next(-35, 36) * 0.04f; num145 += (float)Main.rand.Next(-35, 36) * 0.04f; Projectile.NewProjectile(vector2.X, vector2.Y, num144, num145, num71, num73, num74, i, 0f, 0f); } } else if (item.type == 1569) { int num146 = 4; if (Main.rand.Next(2) == 0) { num146++; } if (Main.rand.Next(4) == 0) { num146++; } if (Main.rand.Next(8) == 0) { num146++; } if (Main.rand.Next(16) == 0) { num146++; } for (int num147 = 0; num147 < num146; num147++) { float num148 = num78; float num149 = num79; float num150 = 0.05f * (float)num147; num148 += (float)Main.rand.Next(-35, 36) * num150; num149 += (float)Main.rand.Next(-35, 36) * num150; num80 = (float)Math.Sqrt((double)(num148 * num148 + num149 * num149)); num80 = num72 / num80; num148 *= num80; num149 *= num80; float x4 = vector2.X; float y4 = vector2.Y; Projectile.NewProjectile(x4, y4, num148, num149, num71, num73, num74, i, 0f, 0f); } } else if (item.type == 1572 || item.type == 2366 || item.type == 3571 || item.type == 3569) { int shoot = item.shoot; for (int num151 = 0; num151 < 1000; num151++) { if (Main.projectile[num151].owner == this.whoAmI && Main.projectile[num151].type == shoot) { Main.projectile[num151].Kill(); } } bool flag12 = item.type == 3571 || item.type == 3569; int num152 = (int)((float)Main.mouseX + Main.screenPosition.X) / 16; int num153 = (int)((float)Main.mouseY + Main.screenPosition.Y) / 16; if (this.gravDir == -1f) { num153 = (int)(Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY) / 16; } if (!flag12) { while (num153 < Main.maxTilesY - 10 && Main.tile[num152, num153] != null && !WorldGen.SolidTile2(num152, num153) && Main.tile[num152 - 1, num153] != null && !WorldGen.SolidTile2(num152 - 1, num153) && Main.tile[num152 + 1, num153] != null && !WorldGen.SolidTile2(num152 + 1, num153)) { num153++; } num153--; } Projectile.NewProjectile((float)Main.mouseX + Main.screenPosition.X, (float)(num153 * 16 - 24), 0f, 15f, num71, num73, num74, i, 0f, 0f); } else if (item.type == 1244 || item.type == 1256) { int num154 = Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, num71, num73, num74, i, 0f, 0f); Main.projectile[num154].ai[0] = (float)Main.mouseX + Main.screenPosition.X; Main.projectile[num154].ai[1] = (float)Main.mouseY + Main.screenPosition.Y; } else if (item.type == 1229) { int num155 = Main.rand.Next(2, 4); if (Main.rand.Next(5) == 0) { num155++; } for (int num156 = 0; num156 < num155; num156++) { float num157 = num78; float num158 = num79; if (num156 > 0) { num157 += (float)Main.rand.Next(-35, 36) * 0.04f; num158 += (float)Main.rand.Next(-35, 36) * 0.04f; } if (num156 > 1) { num157 += (float)Main.rand.Next(-35, 36) * 0.04f; num158 += (float)Main.rand.Next(-35, 36) * 0.04f; } if (num156 > 2) { num157 += (float)Main.rand.Next(-35, 36) * 0.04f; num158 += (float)Main.rand.Next(-35, 36) * 0.04f; } int num159 = Projectile.NewProjectile(vector2.X, vector2.Y, num157, num158, num71, num73, num74, i, 0f, 0f); Main.projectile[num159].noDropItem = true; } } else if (item.type == 1121) { int num160 = Main.rand.Next(1, 4); if (Main.rand.Next(6) == 0) { num160++; } if (Main.rand.Next(6) == 0) { num160++; } if (this.strongBees && Main.rand.Next(3) == 0) { num160++; } for (int num161 = 0; num161 < num160; num161++) { float num162 = num78; float num163 = num79; num162 += (float)Main.rand.Next(-35, 36) * 0.02f; num163 += (float)Main.rand.Next(-35, 36) * 0.02f; int num164 = Projectile.NewProjectile(vector2.X, vector2.Y, num162, num163, this.beeType(), this.beeDamage(num73), this.beeKB(num74), i, 0f, 0f); Main.projectile[num164].magic = true; } } else if (item.type == 1155) { int num165 = Main.rand.Next(2, 5); if (Main.rand.Next(5) == 0) { num165++; } if (Main.rand.Next(5) == 0) { num165++; } for (int num166 = 0; num166 < num165; num166++) { float num167 = num78; float num168 = num79; num167 += (float)Main.rand.Next(-35, 36) * 0.02f; num168 += (float)Main.rand.Next(-35, 36) * 0.02f; Projectile.NewProjectile(vector2.X, vector2.Y, num167, num168, num71, num73, num74, i, 0f, 0f); } } else if (item.type == 1801) { int num169 = Main.rand.Next(1, 4); for (int num170 = 0; num170 < num169; num170++) { float num171 = num78; float num172 = num79; num171 += (float)Main.rand.Next(-35, 36) * 0.05f; num172 += (float)Main.rand.Next(-35, 36) * 0.05f; Projectile.NewProjectile(vector2.X, vector2.Y, num171, num172, num71, num73, num74, i, 0f, 0f); } } else if (item.type == 679) { for (int num173 = 0; num173 < 6; num173++) { float num174 = num78; float num175 = num79; num174 += (float)Main.rand.Next(-40, 41) * 0.05f; num175 += (float)Main.rand.Next(-40, 41) * 0.05f; Projectile.NewProjectile(vector2.X, vector2.Y, num174, num175, num71, num73, num74, i, 0f, 0f); } } else if (item.type == 2623) { for (int num176 = 0; num176 < 3; num176++) { float num177 = num78; float num178 = num79; num177 += (float)Main.rand.Next(-40, 41) * 0.1f; num178 += (float)Main.rand.Next(-40, 41) * 0.1f; Projectile.NewProjectile(vector2.X, vector2.Y, num177, num178, num71, num73, num74, i, 0f, 0f); } } else if (item.type == 3210) { Vector2 value10 = new Vector2(num78, num79); value10.X += (float)Main.rand.Next(-30, 31) * 0.04f; value10.Y += (float)Main.rand.Next(-30, 31) * 0.03f; value10.Normalize(); value10 *= (float)Main.rand.Next(70, 91) * 0.1f; value10.X += (float)Main.rand.Next(-30, 31) * 0.04f; value10.Y += (float)Main.rand.Next(-30, 31) * 0.03f; Projectile.NewProjectile(vector2.X, vector2.Y, value10.X, value10.Y, num71, num73, num74, i, (float)Main.rand.Next(20), 0f); } else if (item.type == 434) { float num179 = num78; float num180 = num79; if (this.itemAnimation < 5) { num179 += (float)Main.rand.Next(-40, 41) * 0.01f; num180 += (float)Main.rand.Next(-40, 41) * 0.01f; num179 *= 1.1f; num180 *= 1.1f; } else if (this.itemAnimation < 10) { num179 += (float)Main.rand.Next(-20, 21) * 0.01f; num180 += (float)Main.rand.Next(-20, 21) * 0.01f; num179 *= 1.05f; num180 *= 1.05f; } Projectile.NewProjectile(vector2.X, vector2.Y, num179, num180, num71, num73, num74, i, 0f, 0f); } else if (item.type == 1157) { num71 = Main.rand.Next(191, 195); num78 = 0f; num79 = 0f; vector2.X = (float)Main.mouseX + Main.screenPosition.X; vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; int num181 = Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, num71, num73, num74, i, 0f, 0f); Main.projectile[num181].localAI[0] = 30f; } else if (item.type == 1802) { num78 = 0f; num79 = 0f; vector2.X = (float)Main.mouseX + Main.screenPosition.X; vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, num71, num73, num74, i, 0f, 0f); } else if (item.type == 2364 || item.type == 2365) { num78 = 0f; num79 = 0f; vector2.X = (float)Main.mouseX + Main.screenPosition.X; vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, num71, num73, num74, i, 0f, 0f); } else if (item.type == 2535) { num78 = 0f; num79 = 0f; vector2.X = (float)Main.mouseX + Main.screenPosition.X; vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; Vector2 spinningpoint = new Vector2(num78, num79); spinningpoint = spinningpoint.RotatedBy(1.5707963705062866, default(Vector2)); Projectile.NewProjectile(vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, num71, num73, num74, i, 0f, 0f); spinningpoint = spinningpoint.RotatedBy(-3.1415927410125732, default(Vector2)); Projectile.NewProjectile(vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, num71 + 1, num73, num74, i, 0f, 0f); } else if (item.type == 2551) { num78 = 0f; num79 = 0f; vector2.X = (float)Main.mouseX + Main.screenPosition.X; vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, num71 + Main.rand.Next(3), num73, num74, i, 0f, 0f); } else if (item.type == 2584) { num78 = 0f; num79 = 0f; vector2.X = (float)Main.mouseX + Main.screenPosition.X; vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, num71 + Main.rand.Next(3), num73, num74, i, 0f, 0f); } else if (item.type == 2621) { num78 = 0f; num79 = 0f; vector2.X = (float)Main.mouseX + Main.screenPosition.X; vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, num71, num73, num74, i, 0f, 0f); } else if (item.type == 2749 || item.type == 3249 || item.type == 3474) { num78 = 0f; num79 = 0f; vector2.X = (float)Main.mouseX + Main.screenPosition.X; vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, num71, num73, num74, i, 0f, 0f); } else if (item.type == 3531) { int num182 = -1; int num183 = -1; for (int num184 = 0; num184 < 1000; num184++) { if (Main.projectile[num184].active && Main.projectile[num184].owner == Main.myPlayer) { if (num182 == -1 && Main.projectile[num184].type == 625) { num182 = num184; } if (num183 == -1 && Main.projectile[num184].type == 628) { num183 = num184; } if (num182 != -1 && num183 != -1) { break; } } } if (num182 == -1 && num183 == -1) { num78 = 0f; num79 = 0f; vector2.X = (float)Main.mouseX + Main.screenPosition.X; vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; int num185 = Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, num71, num73, num74, i, 0f, 0f); num185 = Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, num71 + 1, num73, num74, i, (float)num185, 0f); int num186 = num185; num185 = Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, num71 + 2, num73, num74, i, (float)num185, 0f); Main.projectile[num186].localAI[1] = (float)num185; num186 = num185; num185 = Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, num71 + 3, num73, num74, i, (float)num185, 0f); Main.projectile[num186].localAI[1] = (float)num185; } else if (num182 != -1 && num183 != -1) { int num187 = Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, num71 + 1, num73, num74, i, (float)Projectile.GetByUUID(Main.myPlayer, Main.projectile[num183].ai[0]), 0f); int num188 = num187; num187 = Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, num71 + 2, num73, num74, i, (float)num187, 0f); Main.projectile[num188].localAI[1] = (float)num187; Main.projectile[num188].netUpdate = true; Main.projectile[num188].ai[1] = 1f; Main.projectile[num187].localAI[1] = (float)num183; Main.projectile[num187].netUpdate = true; Main.projectile[num187].ai[1] = 1f; Main.projectile[num183].ai[0] = (float)Main.projectile[num187].projUUID; Main.projectile[num183].netUpdate = true; Main.projectile[num183].ai[1] = 1f; } } else if (item.type == 1309) { num78 = 0f; num79 = 0f; vector2.X = (float)Main.mouseX + Main.screenPosition.X; vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, num71, num73, num74, i, 0f, 0f); } else if (item.shoot > 0 && (Main.projPet[item.shoot] || item.shoot == 72 || item.shoot == 18 || item.shoot == 500 || item.shoot == 650) && !item.summon) { for (int num189 = 0; num189 < 1000; num189++) { if (Main.projectile[num189].active && Main.projectile[num189].owner == this.whoAmI) { if (item.shoot == 72) { if (Main.projectile[num189].type == 72 || Main.projectile[num189].type == 86 || Main.projectile[num189].type == 87) { Main.projectile[num189].Kill(); } } else if (item.shoot == Main.projectile[num189].type) { Main.projectile[num189].Kill(); } } } Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, num71, num73, num74, i, 0f, 0f); } else if (item.type == 3006) { Vector2 vector8; vector8.X = (float)Main.mouseX + Main.screenPosition.X; vector8.Y = (float)Main.mouseY + Main.screenPosition.Y; while (Collision.CanHitLine(this.position, this.width, this.height, vector2, 1, 1)) { vector2.X += num78; vector2.Y += num79; if ((vector2 - vector8).Length() < 20f + Math.Abs(num78) + Math.Abs(num79)) { vector2 = vector8; break; } } Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, num71, num73, num74, i, 0f, 0f); } else if (item.type == 3014) { Vector2 vector9; vector9.X = (float)Main.mouseX + Main.screenPosition.X; vector9.Y = (float)Main.mouseY + Main.screenPosition.Y; while (Collision.CanHitLine(this.position, this.width, this.height, vector2, 1, 1)) { vector2.X += num78; vector2.Y += num79; if ((vector2 - vector9).Length() < 20f + Math.Abs(num78) + Math.Abs(num79)) { vector2 = vector9; break; } } bool flag13 = false; int num190 = (int)vector2.Y / 16; int i2 = (int)vector2.X / 16; int num191 = num190; while (num190 < Main.maxTilesY - 10 && num190 - num191 < 30 && !WorldGen.SolidTile(i2, num190)) { num190++; } if (!WorldGen.SolidTile(i2, num190)) { flag13 = true; } float num192 = (float)(num190 * 16); num190 = num191; while (num190 > 10 && num191 - num190 < 30 && !WorldGen.SolidTile(i2, num190)) { num190--; } float num193 = (float)(num190 * 16 + 16); float num194 = num192 - num193; int num195 = 10; if (num194 > (float)(16 * num195)) { num194 = (float)(16 * num195); } num193 = num192 - num194; vector2.X = (float)((int)(vector2.X / 16f) * 16); if (!flag13) { Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, num71, num73, num74, i, num193, num194); } } else if (item.type == 3384) { int num196 = (this.altFunctionUse == 2) ? 1 : 0; Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, num71, num73, num74, i, 0f, (float)num196); } else if (item.type == 3473) { float ai3 = (Main.rand.NextFloat() - 0.5f) * 0.7853982f; Vector2 vector10 = new Vector2(num78, num79); Projectile.NewProjectile(vector2.X, vector2.Y, vector10.X, vector10.Y, num71, num73, num74, i, 0f, ai3); } else if (item.type == 3542) { float num197 = (Main.rand.NextFloat() - 0.5f) * 0.7853982f * 0.7f; int num198 = 0; while (num198 < 10 && !Collision.CanHit(vector2, 0, 0, vector2 + new Vector2(num78, num79).RotatedBy((double)num197, default(Vector2)) * 100f, 0, 0)) { num197 = (Main.rand.NextFloat() - 0.5f) * 0.7853982f * 0.7f; num198++; } Vector2 vector11 = new Vector2(num78, num79).RotatedBy((double)num197, default(Vector2)) * (0.95f + Main.rand.NextFloat() * 0.3f); Projectile.NewProjectile(vector2.X, vector2.Y, vector11.X, vector11.Y, num71, num73, num74, i, 0f, 0f); } else if (item.type == 3475) { Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, 615, num73, num74, i, (float)(5 * Main.rand.Next(0, 20)), 0f); } else if (item.type == 3540) { Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, 630, num73, num74, i, 0f, 0f); } else if (item.type == 3546) { for (int num199 = 0; num199 < 2; num199++) { float num200 = num78; float num201 = num79; num200 += (float)Main.rand.Next(-40, 41) * 0.05f; num201 += (float)Main.rand.Next(-40, 41) * 0.05f; Vector2 vector12 = vector2 + Vector2.Normalize(new Vector2(num200, num201).RotatedBy((double)(-1.57079637f * (float)this.direction), default(Vector2))) * 6f; Projectile.NewProjectile(vector12.X, vector12.Y, num200, num201, 167 + Main.rand.Next(4), num73, num74, i, 0f, 1f); } } else if (item.type == 3350) { float num202 = num78; float num203 = num79; num202 += (float)Main.rand.Next(-1, 2) * 0.5f; num203 += (float)Main.rand.Next(-1, 2) * 0.5f; if (Collision.CanHitLine(base.Center, 0, 0, vector2 + new Vector2(num202, num203) * 2f, 0, 0)) { vector2 += new Vector2(num202, num203); } Projectile.NewProjectile(vector2.X, vector2.Y - this.gravDir * 4f, num202, num203, num71, num73, num74, i, 0f, (float)Main.rand.Next(12) / 6f); } else { int num204 = Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, num71, num73, num74, i, 0f, 0f); if (item.type == 726) { Main.projectile[num204].magic = true; } if (item.type == 724 || item.type == 676) { Main.projectile[num204].melee = true; } if (num71 == 80) { Main.projectile[num204].ai[0] = (float)Player.tileTargetX; Main.projectile[num204].ai[1] = (float)Player.tileTargetY; } if (num71 == 442) { Main.projectile[num204].ai[0] = (float)Player.tileTargetX; Main.projectile[num204].ai[1] = (float)Player.tileTargetY; } if ((this.thrownCost50 || this.thrownCost33) && this.inventory[this.selectedItem].thrown) { Main.projectile[num204].noDropItem = true; } if (Main.projectile[num204].aiStyle == 99) { AchievementsHelper.HandleSpecialEvent(this, 7); } } } else if (item.useStyle == 5) { this.itemRotation = 0f; NetMessage.SendData(41, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } if (this.whoAmI == Main.myPlayer && (item.type == 509 || item.type == 510 || item.type == 849 || item.type == 850 || item.type == 851) && this.position.X / 16f - (float)Player.tileRangeX - (float)item.tileBoost - (float)this.blockRange <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)item.tileBoost - 1f + (float)this.blockRange >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)item.tileBoost - (float)this.blockRange <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)item.tileBoost - 2f + (float)this.blockRange >= (float)Player.tileTargetY) { this.showItemIcon = true; if (this.itemAnimation > 0 && this.itemTime == 0 && this.controlUseItem) { int i3 = Player.tileTargetX; int j2 = Player.tileTargetY; if (item.type == 509) { int num205 = -1; for (int num206 = 0; num206 < 58; num206++) { if (this.inventory[num206].stack > 0 && this.inventory[num206].type == 530) { num205 = num206; break; } } if (num205 >= 0 && WorldGen.PlaceWire(i3, j2)) { this.inventory[num205].stack--; if (this.inventory[num205].stack <= 0) { this.inventory[num205].SetDefaults(0, false); } this.itemTime = item.useTime; NetMessage.SendData(17, -1, -1, "", 5, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0); } } else if (item.type == 850) { int num207 = -1; for (int num208 = 0; num208 < 58; num208++) { if (this.inventory[num208].stack > 0 && this.inventory[num208].type == 530) { num207 = num208; break; } } if (num207 >= 0 && WorldGen.PlaceWire2(i3, j2)) { this.inventory[num207].stack--; if (this.inventory[num207].stack <= 0) { this.inventory[num207].SetDefaults(0, false); } this.itemTime = item.useTime; NetMessage.SendData(17, -1, -1, "", 10, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0); } } if (item.type == 851) { int num209 = -1; for (int num210 = 0; num210 < 58; num210++) { if (this.inventory[num210].stack > 0 && this.inventory[num210].type == 530) { num209 = num210; break; } } if (num209 >= 0 && WorldGen.PlaceWire3(i3, j2)) { this.inventory[num209].stack--; if (this.inventory[num209].stack <= 0) { this.inventory[num209].SetDefaults(0, false); } this.itemTime = item.useTime; NetMessage.SendData(17, -1, -1, "", 12, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0); } } else if (item.type == 510) { if (WorldGen.KillActuator(i3, j2)) { this.itemTime = item.useTime; NetMessage.SendData(17, -1, -1, "", 9, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0); } else if (WorldGen.KillWire3(i3, j2)) { this.itemTime = item.useTime; NetMessage.SendData(17, -1, -1, "", 13, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0); } else if (WorldGen.KillWire2(i3, j2)) { this.itemTime = item.useTime; NetMessage.SendData(17, -1, -1, "", 11, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0); } else if (WorldGen.KillWire(i3, j2)) { this.itemTime = item.useTime; NetMessage.SendData(17, -1, -1, "", 6, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0); } } else if (item.type == 849 && item.stack > 0 && WorldGen.PlaceActuator(i3, j2)) { this.itemTime = item.useTime; NetMessage.SendData(17, -1, -1, "", 8, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0); item.stack--; if (item.stack <= 0) { item.SetDefaults(0, false); } } } } if (this.itemAnimation > 0 && this.itemTime == 0 && (item.type == 507 || item.type == 508)) { this.itemTime = item.useTime; Vector2 vector13 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num211 = (float)Main.mouseX + Main.screenPosition.X - vector13.X; float num212 = (float)Main.mouseY + Main.screenPosition.Y - vector13.Y; float num213 = (float)Math.Sqrt((double)(num211 * num211 + num212 * num212)); num213 /= (float)(Main.screenHeight / 2); if (num213 > 1f) { num213 = 1f; } num213 = num213 * 2f - 1f; if (num213 < -1f) { num213 = -1f; } if (num213 > 1f) { num213 = 1f; } Main.harpNote = num213; int style = 26; if (item.type == 507) { style = 35; } Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, style); NetMessage.SendData(58, -1, -1, "", this.whoAmI, num213, 0f, 0f, 0, 0, 0); } if (((item.type >= 205 && item.type <= 207) || item.type == 1128 || item.type == 3031 || item.type == 3032) && this.position.X / 16f - (float)Player.tileRangeX - (float)item.tileBoost <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)item.tileBoost - 1f >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)item.tileBoost <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)item.tileBoost - 2f >= (float)Player.tileTargetY) { this.showItemIcon = true; if (this.itemTime == 0 && this.itemAnimation > 0 && this.controlUseItem) { if (item.type == 205 || (item.type == 3032 && Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType() == 0)) { int num214 = (int)Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType(); int num215 = 0; for (int num216 = Player.tileTargetX - 1; num216 <= Player.tileTargetX + 1; num216++) { for (int num217 = Player.tileTargetY - 1; num217 <= Player.tileTargetY + 1; num217++) { if ((int)Main.tile[num216, num217].liquidType() == num214) { num215 += (int)Main.tile[num216, num217].liquid; } } } if (Main.tile[Player.tileTargetX, Player.tileTargetY].liquid > 0 && (num215 > 100 || item.type == 3032)) { int liquidType = (int)Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType(); if (item.type != 3032) { if (!Main.tile[Player.tileTargetX, Player.tileTargetY].lava()) { if (Main.tile[Player.tileTargetX, Player.tileTargetY].honey()) { item.stack--; this.PutItemInInventory(1128, this.selectedItem); } else { item.stack--; this.PutItemInInventory(206, this.selectedItem); } } else { item.stack--; this.PutItemInInventory(207, this.selectedItem); } } Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 1); this.itemTime = item.useTime; int num218 = (int)Main.tile[Player.tileTargetX, Player.tileTargetY].liquid; Main.tile[Player.tileTargetX, Player.tileTargetY].liquid = 0; Main.tile[Player.tileTargetX, Player.tileTargetY].lava(false); Main.tile[Player.tileTargetX, Player.tileTargetY].honey(false); WorldGen.SquareTileFrame(Player.tileTargetX, Player.tileTargetY, false); if (Main.netMode == 1) { NetMessage.sendWater(Player.tileTargetX, Player.tileTargetY); } else { Liquid.AddWater(Player.tileTargetX, Player.tileTargetY); } for (int num219 = Player.tileTargetX - 1; num219 <= Player.tileTargetX + 1; num219++) { for (int num220 = Player.tileTargetY - 1; num220 <= Player.tileTargetY + 1; num220++) { if (num218 < 256 && (int)Main.tile[num219, num220].liquidType() == num214) { int num221 = (int)Main.tile[num219, num220].liquid; if (num221 + num218 > 255) { num221 = 255 - num218; } num218 += num221; Tile expr_97D9 = Main.tile[num219, num220]; expr_97D9.liquid -= (byte)num221; Main.tile[num219, num220].liquidType(liquidType); if (Main.tile[num219, num220].liquid == 0) { Main.tile[num219, num220].lava(false); Main.tile[num219, num220].honey(false); } WorldGen.SquareTileFrame(num219, num220, false); if (Main.netMode == 1) { NetMessage.sendWater(num219, num220); } else { Liquid.AddWater(num219, num220); } } } } } } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].liquid < 200 && (!Main.tile[Player.tileTargetX, Player.tileTargetY].nactive() || !Main.tileSolid[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type] || Main.tileSolidTop[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type])) { if (item.type == 207) { if (Main.tile[Player.tileTargetX, Player.tileTargetY].liquid == 0 || Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType() == 1) { Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 1); Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType(1); Main.tile[Player.tileTargetX, Player.tileTargetY].liquid = 255; WorldGen.SquareTileFrame(Player.tileTargetX, Player.tileTargetY, true); item.stack--; this.PutItemInInventory(205, this.selectedItem); this.itemTime = item.useTime; if (Main.netMode == 1) { NetMessage.sendWater(Player.tileTargetX, Player.tileTargetY); } } } else if (item.type == 206 || item.type == 3031) { if (Main.tile[Player.tileTargetX, Player.tileTargetY].liquid == 0 || Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType() == 0) { Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 1); Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType(0); Main.tile[Player.tileTargetX, Player.tileTargetY].liquid = 255; WorldGen.SquareTileFrame(Player.tileTargetX, Player.tileTargetY, true); if (item.type != 3031) { item.stack--; this.PutItemInInventory(205, this.selectedItem); } this.itemTime = item.useTime; if (Main.netMode == 1) { NetMessage.sendWater(Player.tileTargetX, Player.tileTargetY); } } } else if (item.type == 1128 && (Main.tile[Player.tileTargetX, Player.tileTargetY].liquid == 0 || Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType() == 2)) { Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 1); Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType(2); Main.tile[Player.tileTargetX, Player.tileTargetY].liquid = 255; WorldGen.SquareTileFrame(Player.tileTargetX, Player.tileTargetY, true); item.stack--; this.PutItemInInventory(205, this.selectedItem); this.itemTime = item.useTime; if (Main.netMode == 1) { NetMessage.sendWater(Player.tileTargetX, Player.tileTargetY); } } } } } if (!this.channel) { this.toolTime = this.itemTime; } else { this.toolTime--; if (this.toolTime < 0) { if (item.pick > 0) { this.toolTime = item.useTime; } else { this.toolTime = (int)((float)item.useTime * this.pickSpeed); } } } if ((item.pick > 0 || item.axe > 0 || item.hammer > 0) && this.position.X / 16f - (float)Player.tileRangeX - (float)item.tileBoost <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)item.tileBoost - 1f >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)item.tileBoost <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)item.tileBoost - 2f >= (float)Player.tileTargetY) { int num222 = 0; bool flag14 = true; this.showItemIcon = true; if (this.toolTime == 0 && this.itemAnimation > 0 && this.controlUseItem && (!Main.tile[Player.tileTargetX, Player.tileTargetY].active() || (!Main.tileHammer[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type] && !Main.tileSolid[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type] && Main.tile[Player.tileTargetX, Player.tileTargetY].type != 314 && Main.tile[Player.tileTargetX, Player.tileTargetY].type != 351))) { this.poundRelease = false; } if (Main.tile[Player.tileTargetX, Player.tileTargetY].active()) { if ((item.pick > 0 && !Main.tileAxe[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type] && !Main.tileHammer[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type]) || (item.axe > 0 && Main.tileAxe[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type]) || (item.hammer > 0 && Main.tileHammer[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type])) { flag14 = false; } if (this.toolTime == 0 && this.itemAnimation > 0 && this.controlUseItem) { int tileId = this.hitTile.HitObject(Player.tileTargetX, Player.tileTargetY, 1); if (Main.tileNoFail[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type]) { num222 = 100; } if (Main.tileHammer[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type]) { flag14 = false; if (item.hammer > 0) { num222 += item.hammer; if (!WorldGen.CanKillTile(Player.tileTargetX, Player.tileTargetY)) { num222 = 0; } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 26 && (item.hammer < 80 || !Main.hardMode)) { num222 = 0; this.Hurt(this.statLife / 2, -this.direction, false, false, Lang.deathMsg(-1, -1, -1, 4), false, -1); } AchievementsHelper.CurrentlyMining = true; if (this.hitTile.AddDamage(tileId, num222, true) >= 100) { this.hitTile.Clear(tileId); WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY, false, false, false); if (Main.netMode == 1) { NetMessage.SendData(17, -1, -1, "", 0, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0); } } else { WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY, true, false, false); if (Main.netMode == 1) { NetMessage.SendData(17, -1, -1, "", 0, (float)Player.tileTargetX, (float)Player.tileTargetY, 1f, 0, 0, 0); } } if (num222 != 0) { this.hitTile.Prune(); } this.itemTime = item.useTime; AchievementsHelper.CurrentlyMining = false; } } else if (Main.tileAxe[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type]) { if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 80) { num222 += item.axe * 3; } else { num222 += item.axe; } if (item.axe > 0) { AchievementsHelper.CurrentlyMining = true; if (!WorldGen.CanKillTile(Player.tileTargetX, Player.tileTargetY)) { num222 = 0; } if (this.hitTile.AddDamage(tileId, num222, true) >= 100) { this.hitTile.Clear(tileId); WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY, false, false, false); if (Main.netMode == 1) { NetMessage.SendData(17, -1, -1, "", 0, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0); } } else { WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY, true, false, false); if (Main.netMode == 1) { NetMessage.SendData(17, -1, -1, "", 0, (float)Player.tileTargetX, (float)Player.tileTargetY, 1f, 0, 0, 0); } } if (num222 != 0) { this.hitTile.Prune(); } this.itemTime = item.useTime; AchievementsHelper.CurrentlyMining = false; } } else if (item.pick > 0) { this.PickTile(Player.tileTargetX, Player.tileTargetY, item.pick); this.itemTime = (int)((float)item.useTime * this.pickSpeed); } if (item.pick > 0) { this.itemTime = (int)((float)item.useTime * this.pickSpeed); } if (item.hammer > 0 && Main.tile[Player.tileTargetX, Player.tileTargetY].active() && ((Main.tileSolid[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type] && Main.tile[Player.tileTargetX, Player.tileTargetY].type != 10) || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 314 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 351) && this.poundRelease) { flag14 = false; this.itemTime = item.useTime; num222 += (int)((double)item.hammer * 1.25); num222 = 100; if (Main.tile[Player.tileTargetX, Player.tileTargetY - 1].active() && Main.tile[Player.tileTargetX, Player.tileTargetY - 1].type == 10) { num222 = 0; } if (Main.tile[Player.tileTargetX, Player.tileTargetY + 1].active() && Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type == 10) { num222 = 0; } if (this.hitTile.AddDamage(tileId, num222, true) >= 100) { this.hitTile.Clear(tileId); if (this.poundRelease) { int num223 = Player.tileTargetX; int num224 = Player.tileTargetY; if (Main.tile[num223, num224].type == 19) { if (Main.tile[num223, num224].halfBrick()) { WorldGen.PoundTile(num223, num224); if (Main.netMode == 1) { NetMessage.SendData(17, -1, -1, "", 7, (float)Player.tileTargetX, (float)Player.tileTargetY, 1f, 0, 0, 0); } } else { int num225 = 1; int slope = 2; if (Main.tile[num223 + 1, num224 - 1].type == 19 || Main.tile[num223 - 1, num224 + 1].type == 19 || (WorldGen.SolidTile(num223 + 1, num224) && !WorldGen.SolidTile(num223 - 1, num224))) { num225 = 2; slope = 1; } if (Main.tile[num223, num224].slope() == 0) { WorldGen.SlopeTile(num223, num224, num225); int num226 = (int)Main.tile[num223, num224].slope(); if (Main.netMode == 1) { NetMessage.SendData(17, -1, -1, "", 14, (float)Player.tileTargetX, (float)Player.tileTargetY, (float)num226, 0, 0, 0); } } else if ((int)Main.tile[num223, num224].slope() == num225) { WorldGen.SlopeTile(num223, num224, slope); int num227 = (int)Main.tile[num223, num224].slope(); if (Main.netMode == 1) { NetMessage.SendData(17, -1, -1, "", 14, (float)Player.tileTargetX, (float)Player.tileTargetY, (float)num227, 0, 0, 0); } } else { WorldGen.SlopeTile(num223, num224, 0); int num228 = (int)Main.tile[num223, num224].slope(); if (Main.netMode == 1) { NetMessage.SendData(17, -1, -1, "", 14, (float)Player.tileTargetX, (float)Player.tileTargetY, (float)num228, 0, 0, 0); } WorldGen.PoundTile(num223, num224); if (Main.netMode == 1) { NetMessage.SendData(17, -1, -1, "", 7, (float)Player.tileTargetX, (float)Player.tileTargetY, 1f, 0, 0, 0); } } } } else if (Main.tile[num223, num224].type == 314) { if (Minecart.FrameTrack(num223, num224, true, false) && Main.netMode == 1) { NetMessage.SendData(17, -1, -1, "", 15, (float)Player.tileTargetX, (float)Player.tileTargetY, 1f, 0, 0, 0); } } else if (Main.tile[num223, num224].type == 137) { if (Main.tile[num223, num224].frameX == 18) { Main.tile[num223, num224].frameX = 0; } else { Main.tile[num223, num224].frameX = 18; } if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, Player.tileTargetX, Player.tileTargetY, 1); } } else if ((Main.tile[num223, num224].halfBrick() || Main.tile[num223, num224].slope() != 0) && !Main.tileSolidTop[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type]) { int num229 = 1; int num230 = 1; int num231 = 2; if ((WorldGen.SolidTile(num223 + 1, num224) || Main.tile[num223 + 1, num224].slope() == 1 || Main.tile[num223 + 1, num224].slope() == 3) && !WorldGen.SolidTile(num223 - 1, num224)) { num230 = 2; num231 = 1; } if (WorldGen.SolidTile(num223, num224 - 1) && !WorldGen.SolidTile(num223, num224 + 1)) { num229 = -1; } if (num229 == 1) { if (Main.tile[num223, num224].slope() == 0) { WorldGen.SlopeTile(num223, num224, num230); } else if ((int)Main.tile[num223, num224].slope() == num230) { WorldGen.SlopeTile(num223, num224, num231); } else if ((int)Main.tile[num223, num224].slope() == num231) { WorldGen.SlopeTile(num223, num224, num230 + 2); } else if ((int)Main.tile[num223, num224].slope() == num230 + 2) { WorldGen.SlopeTile(num223, num224, num231 + 2); } else { WorldGen.SlopeTile(num223, num224, 0); } } else if (Main.tile[num223, num224].slope() == 0) { WorldGen.SlopeTile(num223, num224, num230 + 2); } else if ((int)Main.tile[num223, num224].slope() == num230 + 2) { WorldGen.SlopeTile(num223, num224, num231 + 2); } else if ((int)Main.tile[num223, num224].slope() == num231 + 2) { WorldGen.SlopeTile(num223, num224, num230); } else if ((int)Main.tile[num223, num224].slope() == num230) { WorldGen.SlopeTile(num223, num224, num231); } else { WorldGen.SlopeTile(num223, num224, 0); } int num232 = (int)Main.tile[num223, num224].slope(); if (Main.netMode == 1) { NetMessage.SendData(17, -1, -1, "", 14, (float)Player.tileTargetX, (float)Player.tileTargetY, (float)num232, 0, 0, 0); } } else { WorldGen.PoundTile(num223, num224); if (Main.netMode == 1) { NetMessage.SendData(17, -1, -1, "", 7, (float)Player.tileTargetX, (float)Player.tileTargetY, 1f, 0, 0, 0); } } this.poundRelease = false; } } else { WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY, true, true, false); Main.PlaySound(0, Player.tileTargetX * 16, Player.tileTargetY * 16, 1); } } else { this.poundRelease = false; } } } if (this.releaseUseItem) { this.poundRelease = true; } int num233 = Player.tileTargetX; int num234 = Player.tileTargetY; bool flag15 = true; if (Main.tile[num233, num234].wall > 0) { if (!Main.wallHouse[(int)Main.tile[num233, num234].wall]) { for (int num235 = num233 - 1; num235 < num233 + 2; num235++) { for (int num236 = num234 - 1; num236 < num234 + 2; num236++) { if (Main.tile[num235, num236].wall != Main.tile[num233, num234].wall) { flag15 = false; break; } } } } else { flag15 = false; } } if (flag15 && !Main.tile[num233, num234].active()) { int num237 = -1; if ((double)(((float)Main.mouseX + Main.screenPosition.X) / 16f) < Math.Round((double)(((float)Main.mouseX + Main.screenPosition.X) / 16f))) { num237 = 0; } int num238 = -1; if ((double)(((float)Main.mouseY + Main.screenPosition.Y) / 16f) < Math.Round((double)(((float)Main.mouseY + Main.screenPosition.Y) / 16f))) { num238 = 0; } for (int num239 = Player.tileTargetX + num237; num239 <= Player.tileTargetX + num237 + 1; num239++) { for (int num240 = Player.tileTargetY + num238; num240 <= Player.tileTargetY + num238 + 1; num240++) { if (flag15) { num233 = num239; num234 = num240; if (Main.tile[num233, num234].wall > 0) { if (!Main.wallHouse[(int)Main.tile[num233, num234].wall]) { for (int num241 = num233 - 1; num241 < num233 + 2; num241++) { for (int num242 = num234 - 1; num242 < num234 + 2; num242++) { if (Main.tile[num241, num242].wall != Main.tile[num233, num234].wall) { flag15 = false; break; } } } } else { flag15 = false; } } } } } } if (flag14 && Main.tile[num233, num234].wall > 0 && (!Main.tile[num233, num234].active() || num233 != Player.tileTargetX || num234 != Player.tileTargetY || (!Main.tileHammer[(int)Main.tile[num233, num234].type] && !this.poundRelease)) && this.toolTime == 0 && this.itemAnimation > 0 && this.controlUseItem && item.hammer > 0) { bool flag16 = true; if (!Main.wallHouse[(int)Main.tile[num233, num234].wall]) { flag16 = false; for (int num243 = num233 - 1; num243 < num233 + 2; num243++) { for (int num244 = num234 - 1; num244 < num234 + 2; num244++) { if (Main.tile[num243, num244].wall == 0 || Main.wallHouse[(int)Main.tile[num243, num244].wall]) { flag16 = true; break; } } } } if (flag16) { int tileId = this.hitTile.HitObject(num233, num234, 2); num222 += (int)((float)item.hammer * 1.5f); if (this.hitTile.AddDamage(tileId, num222, true) >= 100) { this.hitTile.Clear(tileId); WorldGen.KillWall(num233, num234, false); if (Main.netMode == 1) { NetMessage.SendData(17, -1, -1, "", 2, (float)num233, (float)num234, 0f, 0, 0, 0); } } else { WorldGen.KillWall(num233, num234, true); if (Main.netMode == 1) { NetMessage.SendData(17, -1, -1, "", 2, (float)num233, (float)num234, 1f, 0, 0, 0); } } if (num222 != 0) { this.hitTile.Prune(); } this.itemTime = item.useTime / 2; } } } if (Main.myPlayer == this.whoAmI && item.type == 1326 && this.itemAnimation > 0 && this.itemTime == 0) { this.itemTime = item.useTime; Vector2 vector14; vector14.X = (float)Main.mouseX + Main.screenPosition.X; if (this.gravDir == 1f) { vector14.Y = (float)Main.mouseY + Main.screenPosition.Y - (float)this.height; } else { vector14.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY; } vector14.X -= (float)(this.width / 2); if (vector14.X > 50f && vector14.X < (float)(Main.maxTilesX * 16 - 50) && vector14.Y > 50f && vector14.Y < (float)(Main.maxTilesY * 16 - 50)) { int num245 = (int)(vector14.X / 16f); int num246 = (int)(vector14.Y / 16f); if ((Main.tile[num245, num246].wall != 87 || (double)num246 <= Main.worldSurface || NPC.downedPlantBoss) && !Collision.SolidCollision(vector14, this.width, this.height)) { this.Teleport(vector14, 1, 0); NetMessage.SendData(65, -1, -1, "", 0, (float)this.whoAmI, vector14.X, vector14.Y, 1, 0, 0); if (this.chaosState) { this.statLife -= this.statLifeMax2 / 7; if (Lang.lang <= 1) { string deathText = " didn't materialize"; if (Main.rand.Next(2) == 0) { if (this.Male) { deathText = "'s legs appeared where his head should be"; } else { deathText = "'s legs appeared where her head should be"; } } if (this.statLife <= 0) { this.KillMe(1.0, 0, false, deathText); } } else if (this.statLife <= 0) { this.KillMe(1.0, 0, false, ""); } this.lifeRegenCount = 0; this.lifeRegenTime = 0; } this.AddBuff(88, 360, true); } } } if (item.type == 29 && this.itemAnimation > 0 && this.statLifeMax < 400 && this.itemTime == 0) { this.itemTime = item.useTime; this.statLifeMax += 20; this.statLifeMax2 += 20; this.statLife += 20; if (Main.myPlayer == this.whoAmI) { this.HealEffect(20, true); } AchievementsHelper.HandleSpecialEvent(this, 0); } if (item.type == 1291 && this.itemAnimation > 0 && this.statLifeMax >= 400 && this.statLifeMax < 500 && this.itemTime == 0) { this.itemTime = item.useTime; this.statLifeMax += 5; this.statLifeMax2 += 5; this.statLife += 5; if (Main.myPlayer == this.whoAmI) { this.HealEffect(5, true); } AchievementsHelper.HandleSpecialEvent(this, 2); } if (item.type == 109 && this.itemAnimation > 0 && this.statManaMax < 200 && this.itemTime == 0) { this.itemTime = item.useTime; this.statManaMax += 20; this.statManaMax2 += 20; this.statMana += 20; if (Main.myPlayer == this.whoAmI) { this.ManaEffect(20); } AchievementsHelper.HandleSpecialEvent(this, 1); } if (item.type == 3335 && this.itemAnimation > 0 && !this.extraAccessory && Main.expertMode && this.itemTime == 0) { this.itemTime = item.useTime; this.extraAccessory = true; NetMessage.SendData(4, -1, -1, Main.player[this.whoAmI].name, this.whoAmI, 0f, 0f, 0f, 0, 0, 0); } this.PlaceThing(); } if (item.type == 3542) { Vector2 vector15 = Main.OffsetsPlayerOnhand[this.bodyFrame.Y / 56] * 2f; if (this.direction != 1) { vector15.X = (float)this.bodyFrame.Width - vector15.X; } if (this.gravDir != 1f) { vector15.Y = (float)this.bodyFrame.Height - vector15.Y; } vector15 -= new Vector2((float)(this.bodyFrame.Width - this.width), (float)(this.bodyFrame.Height - 42)) / 2f; Vector2 position17 = this.RotatedRelativePoint(this.position + vector15, true) - this.velocity; for (int num247 = 0; num247 < 4; num247++) { Dust dust = Main.dust[Dust.NewDust(base.Center, 0, 0, 242, (float)(this.direction * 2), 0f, 150, default(Color), 1.3f)]; dust.position = position17; dust.velocity *= 0f; dust.noGravity = true; dust.fadeIn = 1f; dust.velocity += this.velocity; if (Main.rand.Next(2) == 0) { dust.position += Utils.RandomVector2(Main.rand, -4f, 4f); dust.scale += Main.rand.NextFloat(); if (Main.rand.Next(2) == 0) { dust.customData = this; } } } } if (((item.damage >= 0 && item.type > 0 && !item.noMelee) || item.type == 1450 || item.type == 1991 || item.type == 3183 || item.type == 3542) && this.itemAnimation > 0) { bool flag17 = false; Rectangle r2 = new Rectangle((int)this.itemLocation.X, (int)this.itemLocation.Y, 32, 32); if (!Main.dedServ) { r2 = new Rectangle((int)this.itemLocation.X, (int)this.itemLocation.Y, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height); } r2.Width = (int)((float)r2.Width * item.scale); r2.Height = (int)((float)r2.Height * item.scale); if (this.direction == -1) { r2.X -= r2.Width; } if (this.gravDir == 1f) { r2.Y -= r2.Height; } if (item.useStyle == 1) { if ((double)this.itemAnimation < (double)this.itemAnimationMax * 0.333) { if (this.direction == -1) { r2.X -= (int)((double)r2.Width * 1.4 - (double)r2.Width); } r2.Width = (int)((double)r2.Width * 1.4); r2.Y += (int)((double)r2.Height * 0.5 * (double)this.gravDir); r2.Height = (int)((double)r2.Height * 1.1); } else if ((double)this.itemAnimation >= (double)this.itemAnimationMax * 0.666) { if (this.direction == 1) { r2.X -= (int)((double)r2.Width * 1.2); } r2.Width *= 2; r2.Y -= (int)(((double)r2.Height * 1.4 - (double)r2.Height) * (double)this.gravDir); r2.Height = (int)((double)r2.Height * 1.4); } } else if (item.useStyle == 3) { if ((double)this.itemAnimation > (double)this.itemAnimationMax * 0.666) { flag17 = true; } else { if (this.direction == -1) { r2.X -= (int)((double)r2.Width * 1.4 - (double)r2.Width); } r2.Width = (int)((double)r2.Width * 1.4); r2.Y += (int)((double)r2.Height * 0.6); r2.Height = (int)((double)r2.Height * 0.6); } } float arg_BA93_0 = this.gravDir; if (item.type == 1450 && Main.rand.Next(3) == 0) { int num248 = -1; float x5 = (float)(r2.X + Main.rand.Next(r2.Width)); float y5 = (float)(r2.Y + Main.rand.Next(r2.Height)); if (Main.rand.Next(500) == 0) { num248 = Gore.NewGore(new Vector2(x5, y5), default(Vector2), 415, (float)Main.rand.Next(51, 101) * 0.01f); } else if (Main.rand.Next(250) == 0) { num248 = Gore.NewGore(new Vector2(x5, y5), default(Vector2), 414, (float)Main.rand.Next(51, 101) * 0.01f); } else if (Main.rand.Next(80) == 0) { num248 = Gore.NewGore(new Vector2(x5, y5), default(Vector2), 413, (float)Main.rand.Next(51, 101) * 0.01f); } else if (Main.rand.Next(10) == 0) { num248 = Gore.NewGore(new Vector2(x5, y5), default(Vector2), 412, (float)Main.rand.Next(51, 101) * 0.01f); } else if (Main.rand.Next(3) == 0) { num248 = Gore.NewGore(new Vector2(x5, y5), default(Vector2), 411, (float)Main.rand.Next(51, 101) * 0.01f); } if (num248 >= 0) { Gore expr_BCA5_cp_0 = Main.gore[num248]; expr_BCA5_cp_0.velocity.X = expr_BCA5_cp_0.velocity.X + (float)(this.direction * 2); Gore expr_BCC9_cp_0 = Main.gore[num248]; expr_BCC9_cp_0.velocity.Y = expr_BCC9_cp_0.velocity.Y * 0.3f; } } if (item.type == 3542) { flag17 = true; } if (!flag17) { if (item.type == 989 && Main.rand.Next(5) == 0) { int num249 = Main.rand.Next(3); if (num249 == 0) { num249 = 15; } else if (num249 == 1) { num249 = 57; } else { num249 = 58; } int num250 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, num249, (float)(this.direction * 2), 0f, 150, default(Color), 1.3f); Main.dust[num250].velocity *= 0.2f; } if (item.type == 2880 && Main.rand.Next(2) == 0) { int type5 = Utils.SelectRandom<int>(Main.rand, new int[] { 226, 229 }); int num251 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, type5, (float)(this.direction * 2), 0f, 150, default(Color), 1f); Main.dust[num251].velocity *= 0.2f; Main.dust[num251].noGravity = true; } if ((item.type == 44 || item.type == 45 || item.type == 46 || item.type == 103 || item.type == 104) && Main.rand.Next(15) == 0) { Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 14, (float)(this.direction * 2), 0f, 150, default(Color), 1.3f); } if (item.type == 273 || item.type == 675) { if (Main.rand.Next(5) == 0) { Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 14, (float)(this.direction * 2), 0f, 150, default(Color), 1.4f); } int num252 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 27, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 1.2f); Main.dust[num252].noGravity = true; Dust expr_C055_cp_0 = Main.dust[num252]; expr_C055_cp_0.velocity.X = expr_C055_cp_0.velocity.X / 2f; Dust expr_C075_cp_0 = Main.dust[num252]; expr_C075_cp_0.velocity.Y = expr_C075_cp_0.velocity.Y / 2f; } if (item.type == 723 && Main.rand.Next(2) == 0) { int num253 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 64, 0f, 0f, 150, default(Color), 1.2f); Main.dust[num253].noGravity = true; } if (item.type == 65) { if (Main.rand.Next(5) == 0) { Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 58, 0f, 0f, 150, default(Color), 1.2f); } if (Main.rand.Next(10) == 0) { Gore.NewGore(new Vector2((float)r2.X, (float)r2.Y), default(Vector2), Main.rand.Next(16, 18), 1f); } } if (item.type == 3065) { int num254 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 58, 0f, 0f, 150, default(Color), 1.2f); Main.dust[num254].velocity *= 0.5f; if (Main.rand.Next(8) == 0) { int num255 = Gore.NewGore(new Vector2((float)r2.Center.X, (float)r2.Center.Y), default(Vector2), 16, 1f); Main.gore[num255].velocity *= 0.5f; Main.gore[num255].velocity += new Vector2((float)this.direction, 0f); } } if (item.type == 190) { int num256 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 40, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 0, default(Color), 1.2f); Main.dust[num256].noGravity = true; } else if (item.type == 213) { int num257 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 3, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 0, default(Color), 1.2f); Main.dust[num257].noGravity = true; } if (item.type == 121) { for (int num258 = 0; num258 < 2; num258++) { int num259 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 6, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 2.5f); Main.dust[num259].noGravity = true; Dust expr_C4C3_cp_0 = Main.dust[num259]; expr_C4C3_cp_0.velocity.X = expr_C4C3_cp_0.velocity.X * 2f; Dust expr_C4E3_cp_0 = Main.dust[num259]; expr_C4E3_cp_0.velocity.Y = expr_C4E3_cp_0.velocity.Y * 2f; } } if (item.type == 122 || item.type == 217) { int num260 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 6, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 1.9f); Main.dust[num260].noGravity = true; } if (item.type == 155) { int num261 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 172, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 0.9f); Main.dust[num261].noGravity = true; Main.dust[num261].velocity *= 0.1f; } if (item.type == 676 && Main.rand.Next(3) == 0) { int num262 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 67, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 90, default(Color), 1.5f); Main.dust[num262].noGravity = true; Main.dust[num262].velocity *= 0.2f; } if (item.type == 3063) { int num263 = Dust.NewDust(r2.TopLeft(), r2.Width, r2.Height, 66, 0f, 0f, 150, Color.Transparent, 0.85f); Main.dust[num263].color = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.5f); Main.dust[num263].noGravity = true; Main.dust[num263].velocity /= 2f; } if (item.type == 724 && Main.rand.Next(5) == 0) { int num264 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 67, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 90, default(Color), 1.5f); Main.dust[num264].noGravity = true; Main.dust[num264].velocity *= 0.2f; } if (item.type >= 795 && item.type <= 802 && Main.rand.Next(3) == 0) { int num265 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 115, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 140, default(Color), 1.5f); Main.dust[num265].noGravity = true; Main.dust[num265].velocity *= 0.25f; } if (item.type == 367 || item.type == 368 || item.type == 674) { if (Main.rand.Next(3) == 0) { int num266 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 57, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 1.1f); Main.dust[num266].noGravity = true; Dust expr_CA41_cp_0 = Main.dust[num266]; expr_CA41_cp_0.velocity.X = expr_CA41_cp_0.velocity.X / 2f; Dust expr_CA61_cp_0 = Main.dust[num266]; expr_CA61_cp_0.velocity.Y = expr_CA61_cp_0.velocity.Y / 2f; Dust expr_CA81_cp_0 = Main.dust[num266]; expr_CA81_cp_0.velocity.X = expr_CA81_cp_0.velocity.X + (float)(this.direction * 2); } if (Main.rand.Next(4) == 0) { int num266 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 43, 0f, 0f, 254, default(Color), 0.3f); Main.dust[num266].velocity *= 0f; } } if (item.type >= 198 && item.type <= 203) { float num267 = 0.5f; float num268 = 0.5f; float num269 = 0.5f; if (item.type == 198) { num267 *= 0.1f; num268 *= 0.5f; num269 *= 1.2f; } else if (item.type == 199) { num267 *= 1f; num268 *= 0.2f; num269 *= 0.1f; } else if (item.type == 200) { num267 *= 0.1f; num268 *= 1f; num269 *= 0.2f; } else if (item.type == 201) { num267 *= 0.8f; num268 *= 0.1f; num269 *= 1f; } else if (item.type == 202) { num267 *= 0.8f; num268 *= 0.9f; num269 *= 1f; } else if (item.type == 203) { num267 *= 0.9f; num268 *= 0.9f; num269 *= 0.1f; } Lighting.AddLight((int)((this.itemLocation.X + 6f + this.velocity.X) / 16f), (int)((this.itemLocation.Y - 14f) / 16f), num267, num268, num269); } if (this.frostBurn && item.melee && !item.noMelee && !item.noUseGraphic && Main.rand.Next(2) == 0) { int num270 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 135, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 2.5f); Main.dust[num270].noGravity = true; Main.dust[num270].velocity *= 0.7f; Dust expr_CDF3_cp_0 = Main.dust[num270]; expr_CDF3_cp_0.velocity.Y = expr_CDF3_cp_0.velocity.Y - 0.5f; } if (item.melee && !item.noMelee && !item.noUseGraphic && this.meleeEnchant > 0) { if (this.meleeEnchant == 1) { if (Main.rand.Next(3) == 0) { int num271 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 171, 0f, 0f, 100, default(Color), 1f); Main.dust[num271].noGravity = true; Main.dust[num271].fadeIn = 1.5f; Main.dust[num271].velocity *= 0.25f; } } else if (this.meleeEnchant == 2) { if (Main.rand.Next(2) == 0) { int num272 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 75, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 2.5f); Main.dust[num272].noGravity = true; Main.dust[num272].velocity *= 0.7f; Dust expr_CFBE_cp_0 = Main.dust[num272]; expr_CFBE_cp_0.velocity.Y = expr_CFBE_cp_0.velocity.Y - 0.5f; } } else if (this.meleeEnchant == 3) { if (Main.rand.Next(2) == 0) { int num273 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 6, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 2.5f); Main.dust[num273].noGravity = true; Main.dust[num273].velocity *= 0.7f; Dust expr_D0A4_cp_0 = Main.dust[num273]; expr_D0A4_cp_0.velocity.Y = expr_D0A4_cp_0.velocity.Y - 0.5f; } } else if (this.meleeEnchant == 4) { if (Main.rand.Next(2) == 0) { int num274 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 57, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 1.1f); Main.dust[num274].noGravity = true; Dust expr_D171_cp_0 = Main.dust[num274]; expr_D171_cp_0.velocity.X = expr_D171_cp_0.velocity.X / 2f; Dust expr_D191_cp_0 = Main.dust[num274]; expr_D191_cp_0.velocity.Y = expr_D191_cp_0.velocity.Y / 2f; } } else if (this.meleeEnchant == 5) { if (Main.rand.Next(2) == 0) { int num275 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 169, 0f, 0f, 100, default(Color), 1f); Dust expr_D22A_cp_0 = Main.dust[num275]; expr_D22A_cp_0.velocity.X = expr_D22A_cp_0.velocity.X + (float)this.direction; Dust expr_D24C_cp_0 = Main.dust[num275]; expr_D24C_cp_0.velocity.Y = expr_D24C_cp_0.velocity.Y + 0.2f; Main.dust[num275].noGravity = true; } } else if (this.meleeEnchant == 6) { if (Main.rand.Next(2) == 0) { int num276 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 135, 0f, 0f, 100, default(Color), 1f); Dust expr_D2F5_cp_0 = Main.dust[num276]; expr_D2F5_cp_0.velocity.X = expr_D2F5_cp_0.velocity.X + (float)this.direction; Dust expr_D317_cp_0 = Main.dust[num276]; expr_D317_cp_0.velocity.Y = expr_D317_cp_0.velocity.Y + 0.2f; Main.dust[num276].noGravity = true; } } else if (this.meleeEnchant == 7) { if (Main.rand.Next(20) == 0) { int type6 = Main.rand.Next(139, 143); int num277 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, type6, this.velocity.X, this.velocity.Y, 0, default(Color), 1.2f); Dust expr_D3E3_cp_0 = Main.dust[num277]; expr_D3E3_cp_0.velocity.X = expr_D3E3_cp_0.velocity.X * (1f + (float)Main.rand.Next(-50, 51) * 0.01f); Dust expr_D419_cp_0 = Main.dust[num277]; expr_D419_cp_0.velocity.Y = expr_D419_cp_0.velocity.Y * (1f + (float)Main.rand.Next(-50, 51) * 0.01f); Dust expr_D44F_cp_0 = Main.dust[num277]; expr_D44F_cp_0.velocity.X = expr_D44F_cp_0.velocity.X + (float)Main.rand.Next(-50, 51) * 0.05f; Dust expr_D47F_cp_0 = Main.dust[num277]; expr_D47F_cp_0.velocity.Y = expr_D47F_cp_0.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.05f; Main.dust[num277].scale *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; } if (Main.rand.Next(40) == 0) { int type7 = Main.rand.Next(276, 283); int num278 = Gore.NewGore(new Vector2((float)r2.X, (float)r2.Y), this.velocity, type7, 1f); Gore expr_D53A_cp_0 = Main.gore[num278]; expr_D53A_cp_0.velocity.X = expr_D53A_cp_0.velocity.X * (1f + (float)Main.rand.Next(-50, 51) * 0.01f); Gore expr_D570_cp_0 = Main.gore[num278]; expr_D570_cp_0.velocity.Y = expr_D570_cp_0.velocity.Y * (1f + (float)Main.rand.Next(-50, 51) * 0.01f); Main.gore[num278].scale *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f; Gore expr_D5D7_cp_0 = Main.gore[num278]; expr_D5D7_cp_0.velocity.X = expr_D5D7_cp_0.velocity.X + (float)Main.rand.Next(-50, 51) * 0.05f; Gore expr_D607_cp_0 = Main.gore[num278]; expr_D607_cp_0.velocity.Y = expr_D607_cp_0.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.05f; } } else if (this.meleeEnchant == 8 && Main.rand.Next(4) == 0) { int num279 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 46, 0f, 0f, 100, default(Color), 1f); Main.dust[num279].noGravity = true; Main.dust[num279].fadeIn = 1.5f; Main.dust[num279].velocity *= 0.25f; } } if (this.magmaStone && item.melee && !item.noMelee && !item.noUseGraphic && Main.rand.Next(3) != 0) { int num280 = Dust.NewDust(new Vector2((float)r2.X, (float)r2.Y), r2.Width, r2.Height, 6, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 2.5f); Main.dust[num280].noGravity = true; Dust expr_D7B2_cp_0 = Main.dust[num280]; expr_D7B2_cp_0.velocity.X = expr_D7B2_cp_0.velocity.X * 2f; Dust expr_D7D2_cp_0 = Main.dust[num280]; expr_D7D2_cp_0.velocity.Y = expr_D7D2_cp_0.velocity.Y * 2f; } if (Main.myPlayer == i && (item.type == 1991 || item.type == 3183)) { for (int num281 = 0; num281 < 200; num281++) { if (Main.npc[num281].active && Main.npc[num281].catchItem > 0) { Rectangle value11 = new Rectangle((int)Main.npc[num281].position.X, (int)Main.npc[num281].position.Y, Main.npc[num281].width, Main.npc[num281].height); if (r2.Intersects(value11) && (item.type == 3183 || Main.npc[num281].noTileCollide || Collision.CanHit(this.position, this.width, this.height, Main.npc[num281].position, Main.npc[num281].width, Main.npc[num281].height))) { NPC.CatchNPC(num281, i); } } } } if (Main.myPlayer == i && (item.damage > 0 || item.type == 3183)) { int num282 = (int)((float)item.damage * this.meleeDamage); float num283 = item.knockBack; float num284 = 1f; if (this.kbGlove) { num284 += 1f; } if (this.kbBuff) { num284 += 0.5f; } num283 *= num284; if (this.inventory[this.selectedItem].type == 3106) { num283 += num283 * (1f - this.stealth); } List<ushort> list2 = null; int type8 = item.type; if (type8 == 213) { list2 = new List<ushort>(new ushort[] { 3, 24, 52, 61, 62, 71, 73, 74, 82, 83, 84, 110, 113, 115, 184, 205, 201 }); } int num285 = r2.X / 16; int num286 = (r2.X + r2.Width) / 16 + 1; int num287 = r2.Y / 16; int num288 = (r2.Y + r2.Height) / 16 + 1; for (int num289 = num285; num289 < num286; num289++) { for (int num290 = num287; num290 < num288; num290++) { if (Main.tile[num289, num290] != null && Main.tileCut[(int)Main.tile[num289, num290].type] && (list2 == null || !list2.Contains(Main.tile[num289, num290].type)) && Main.tile[num289, num290 + 1] != null && Main.tile[num289, num290 + 1].type != 78 && Main.tile[num289, num290 + 1].type != 380) { if (item.type == 1786) { int type9 = (int)Main.tile[num289, num290].type; WorldGen.KillTile(num289, num290, false, false, false); if (!Main.tile[num289, num290].active()) { int num291 = 0; if (type9 == 3 || type9 == 24 || type9 == 61 || type9 == 110 || type9 == 201) { num291 = Main.rand.Next(1, 3); } if (type9 == 73 || type9 == 74 || type9 == 113) { num291 = Main.rand.Next(2, 5); } if (num291 > 0) { int number = Item.NewItem(num289 * 16, num290 * 16, 16, 16, 1727, num291, false, 0, false, false); if (Main.netMode == 1) { NetMessage.SendData(21, -1, -1, "", number, 1f, 0f, 0f, 0, 0, 0); } } } if (Main.netMode == 1) { NetMessage.SendData(17, -1, -1, "", 0, (float)num289, (float)num290, 0f, 0, 0, 0); } } else { WorldGen.KillTile(num289, num290, false, false, false); if (Main.netMode == 1) { NetMessage.SendData(17, -1, -1, "", 0, (float)num289, (float)num290, 0f, 0, 0, 0); } } } } } if (item.type != 3183) { for (int num292 = 0; num292 < 200; num292++) { if (Main.npc[num292].active && Main.npc[num292].immune[i] == 0 && this.attackCD == 0) { if (!Main.npc[num292].dontTakeDamage) { if (!Main.npc[num292].friendly || (Main.npc[num292].type == 22 && this.killGuide) || (Main.npc[num292].type == 54 && this.killClothier)) { Rectangle value12 = new Rectangle((int)Main.npc[num292].position.X, (int)Main.npc[num292].position.Y, Main.npc[num292].width, Main.npc[num292].height); if (r2.Intersects(value12) && (Main.npc[num292].noTileCollide || Collision.CanHit(this.position, this.width, this.height, Main.npc[num292].position, Main.npc[num292].width, Main.npc[num292].height))) { bool flag18 = false; if (Main.rand.Next(1, 101) <= this.meleeCrit) { flag18 = true; } int num293 = Item.NPCtoBanner(Main.npc[num292].BannerID()); if (num293 > 0 && this.NPCBannerBuff[num293]) { if (Main.expertMode) { num282 *= 2; } else { num282 = (int)((double)num282 * 1.5); } } int num294 = Main.DamageVar((float)num282); this.StatusNPC(item.type, num292); this.OnHit(Main.npc[num292].Center.X, Main.npc[num292].Center.Y, Main.npc[num292]); if (this.armorPenetration > 0) { num294 += Main.npc[num292].checkArmorPenetration(this.armorPenetration); } int num295 = (int)Main.npc[num292].StrikeNPC(num294, num283, this.direction, flag18, false, false); if (this.inventory[this.selectedItem].type == 3211) { Vector2 value13 = new Vector2((float)(this.direction * 100 + Main.rand.Next(-25, 26)), (float)Main.rand.Next(-75, 76)); value13.Normalize(); value13 *= (float)Main.rand.Next(30, 41) * 0.1f; Vector2 value14 = new Vector2((float)(r2.X + Main.rand.Next(r2.Width)), (float)(r2.Y + Main.rand.Next(r2.Height))); value14 = (value14 + Main.npc[num292].Center * 2f) / 3f; Projectile.NewProjectile(value14.X, value14.Y, value13.X, value13.Y, 524, (int)((double)num282 * 0.7), num283 * 0.7f, this.whoAmI, 0f, 0f); } bool flag19 = !Main.npc[num292].immortal; if (this.beetleOffense && flag19) { this.beetleCounter += (float)num295; this.beetleCountdown = 0; } if (item.type == 1826 && (Main.npc[num292].value > 0f || (Main.npc[num292].damage > 0 && !Main.npc[num292].friendly))) { this.pumpkinSword(num292, (int)((double)num282 * 1.5), num283); } if (this.meleeEnchant == 7) { Projectile.NewProjectile(Main.npc[num292].Center.X, Main.npc[num292].Center.Y, Main.npc[num292].velocity.X, Main.npc[num292].velocity.Y, 289, 0, 0f, this.whoAmI, 0f, 0f); } if (this.inventory[this.selectedItem].type == 3106) { this.stealth = 1f; if (Main.netMode == 1) { NetMessage.SendData(84, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } if (item.type == 1123 && flag19) { int num296 = Main.rand.Next(1, 4); if (this.strongBees && Main.rand.Next(3) == 0) { num296++; } for (int num297 = 0; num297 < num296; num297++) { float num298 = (float)(this.direction * 2) + (float)Main.rand.Next(-35, 36) * 0.02f; float num299 = (float)Main.rand.Next(-35, 36) * 0.02f; num298 *= 0.2f; num299 *= 0.2f; Projectile.NewProjectile((float)(r2.X + r2.Width / 2), (float)(r2.Y + r2.Height / 2), num298, num299, this.beeType(), this.beeDamage(num294 / 3), this.beeKB(0f), i, 0f, 0f); } } if (Main.npc[num292].value > 0f && this.coins && Main.rand.Next(5) == 0) { int type10 = 71; if (Main.rand.Next(10) == 0) { type10 = 72; } if (Main.rand.Next(100) == 0) { type10 = 73; } int num300 = Item.NewItem((int)Main.npc[num292].position.X, (int)Main.npc[num292].position.Y, Main.npc[num292].width, Main.npc[num292].height, type10, 1, false, 0, false, false); Main.item[num300].stack = Main.rand.Next(1, 11); Main.item[num300].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f; Main.item[num300].velocity.X = (float)Main.rand.Next(10, 31) * 0.2f * (float)this.direction; if (Main.netMode == 1) { NetMessage.SendData(21, -1, -1, "", num300, 0f, 0f, 0f, 0, 0, 0); } } int num301 = Item.NPCtoBanner(Main.npc[num292].BannerID()); if (num301 >= 0) { this.lastCreatureHit = num301; } if (Main.netMode != 0) { if (flag18) { NetMessage.SendData(28, -1, -1, "", num292, (float)num294, num283, (float)this.direction, 1, 0, 0); } else { NetMessage.SendData(28, -1, -1, "", num292, (float)num294, num283, (float)this.direction, 0, 0, 0); } } if (this.accDreamCatcher) { this.addDPS(num294); } Main.npc[num292].immune[i] = this.itemAnimation; this.attackCD = (int)((double)this.itemAnimationMax * 0.33); } } } else if (Main.npc[num292].type == 63 || Main.npc[num292].type == 64 || Main.npc[num292].type == 103 || Main.npc[num292].type == 242) { Rectangle value15 = new Rectangle((int)Main.npc[num292].position.X, (int)Main.npc[num292].position.Y, Main.npc[num292].width, Main.npc[num292].height); if (r2.Intersects(value15) && (Main.npc[num292].noTileCollide || Collision.CanHit(this.position, this.width, this.height, Main.npc[num292].position, Main.npc[num292].width, Main.npc[num292].height))) { this.Hurt((int)((double)Main.npc[num292].damage * 1.3), -this.direction, false, false, " was slain...", false, -1); Main.npc[num292].immune[i] = this.itemAnimation; this.attackCD = (int)((double)this.itemAnimationMax * 0.33); } } } } if (this.hostile) { for (int num302 = 0; num302 < 255; num302++) { if (num302 != i && Main.player[num302].active && Main.player[num302].hostile && !Main.player[num302].immune && !Main.player[num302].dead && (Main.player[i].team == 0 || Main.player[i].team != Main.player[num302].team)) { Rectangle value16 = new Rectangle((int)Main.player[num302].position.X, (int)Main.player[num302].position.Y, Main.player[num302].width, Main.player[num302].height); if (r2.Intersects(value16) && Collision.CanHit(this.position, this.width, this.height, Main.player[num302].position, Main.player[num302].width, Main.player[num302].height)) { bool flag20 = false; if (Main.rand.Next(1, 101) <= 10) { flag20 = true; } int num303 = Main.DamageVar((float)num282); this.StatusPvP(item.type, num302); this.OnHit(Main.player[num302].Center.X, Main.player[num302].Center.Y, Main.player[num302]); int num304 = (int)Main.player[num302].Hurt(num303, this.direction, true, false, "", flag20, -1); if (this.inventory[this.selectedItem].type == 3211) { Vector2 value17 = new Vector2((float)(this.direction * 100 + Main.rand.Next(-25, 26)), (float)Main.rand.Next(-75, 76)); value17.Normalize(); value17 *= (float)Main.rand.Next(30, 41) * 0.1f; Vector2 value18 = new Vector2((float)(r2.X + Main.rand.Next(r2.Width)), (float)(r2.Y + Main.rand.Next(r2.Height))); value18 = (value18 + Main.player[num302].Center * 2f) / 3f; Projectile.NewProjectile(value18.X, value18.Y, value17.X, value17.Y, 524, (int)((double)num282 * 0.7), num283 * 0.7f, this.whoAmI, 0f, 0f); } if (this.beetleOffense) { this.beetleCounter += (float)num304; this.beetleCountdown = 0; } if (this.meleeEnchant == 7) { Projectile.NewProjectile(Main.player[num302].Center.X, Main.player[num302].Center.Y, Main.player[num302].velocity.X, Main.player[num302].velocity.Y, 289, 0, 0f, this.whoAmI, 0f, 0f); } if (item.type == 1123) { int num305 = Main.rand.Next(1, 4); if (this.strongBees && Main.rand.Next(3) == 0) { num305++; } for (int num306 = 0; num306 < num305; num306++) { float num307 = (float)(this.direction * 2) + (float)Main.rand.Next(-35, 36) * 0.02f; float num308 = (float)Main.rand.Next(-35, 36) * 0.02f; num307 *= 0.2f; num308 *= 0.2f; Projectile.NewProjectile((float)(r2.X + r2.Width / 2), (float)(r2.Y + r2.Height / 2), num307, num308, this.beeType(), this.beeDamage(num303 / 3), this.beeKB(0f), i, 0f, 0f); } } if (this.inventory[this.selectedItem].type == 3106) { this.stealth = 1f; if (Main.netMode == 1) { NetMessage.SendData(84, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } if (item.type == 1826 && Main.npc[num302].value > 0f) { this.pumpkinSword(num302, (int)((double)num282 * 1.5), num283); } if (Main.netMode != 0) { if (flag20) { NetMessage.SendData(26, -1, -1, Lang.deathMsg(this.whoAmI, -1, -1, -1), num302, (float)this.direction, (float)num303, 1f, 1, 0, 0); } else { NetMessage.SendData(26, -1, -1, Lang.deathMsg(this.whoAmI, -1, -1, -1), num302, (float)this.direction, (float)num303, 1f, 0, 0, 0); } } this.attackCD = (int)((double)this.itemAnimationMax * 0.33); } } } } if (item.type == 787 && (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.1) || this.itemAnimation == (int)((double)this.itemAnimationMax * 0.3) || this.itemAnimation == (int)((double)this.itemAnimationMax * 0.5) || this.itemAnimation == (int)((double)this.itemAnimationMax * 0.7) || this.itemAnimation == (int)((double)this.itemAnimationMax * 0.9))) { float num309 = 0f; float num310 = 0f; float num311 = 0f; float num312 = 0f; if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.9)) { num309 = -7f; } if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.7)) { num309 = -6f; num310 = 2f; } if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.5)) { num309 = -4f; num310 = 4f; } if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.3)) { num309 = -2f; num310 = 6f; } if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.1)) { num310 = 7f; } if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.7)) { num312 = 26f; } if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.3)) { num312 -= 4f; num311 -= 20f; } if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.1)) { num311 += 6f; } if (this.direction == -1) { if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.9)) { num312 -= 8f; } if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.7)) { num312 -= 6f; } } num309 *= 1.5f; num310 *= 1.5f; num312 *= (float)this.direction; num311 *= this.gravDir; Projectile.NewProjectile((float)(r2.X + r2.Width / 2) + num312, (float)(r2.Y + r2.Height / 2) + num311, (float)this.direction * num310, num309 * this.gravDir, 131, num282 / 2, 0f, i, 0f, 0f); } } } } } if (this.itemTime == 0 && this.itemAnimation > 0) { if (item.hairDye >= 0) { this.itemTime = item.useTime; if (this.whoAmI == Main.myPlayer) { this.hairDye = (byte)item.hairDye; NetMessage.SendData(4, -1, -1, Main.player[this.whoAmI].name, this.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } if (item.healLife > 0) { this.statLife += item.healLife; this.itemTime = item.useTime; if (Main.myPlayer == this.whoAmI) { this.HealEffect(item.healLife, true); } } if (item.healMana > 0) { this.statMana += item.healMana; this.itemTime = item.useTime; if (Main.myPlayer == this.whoAmI) { this.AddBuff(94, Player.manaSickTime, true); this.ManaEffect(item.healMana); } } if (item.buffType > 0) { if (this.whoAmI == Main.myPlayer && item.buffType != 90 && item.buffType != 27) { this.AddBuff(item.buffType, item.buffTime, true); } this.itemTime = item.useTime; } if (item.type == 678) { this.itemTime = item.useTime; if (this.whoAmI == Main.myPlayer) { this.AddBuff(20, 216000, true); this.AddBuff(22, 216000, true); this.AddBuff(23, 216000, true); this.AddBuff(24, 216000, true); this.AddBuff(30, 216000, true); this.AddBuff(31, 216000, true); this.AddBuff(32, 216000, true); this.AddBuff(33, 216000, true); this.AddBuff(35, 216000, true); this.AddBuff(36, 216000, true); this.AddBuff(68, 216000, true); } } } if (this.whoAmI == Main.myPlayer) { if (this.itemTime == 0 && this.itemAnimation > 0 && item.type == 361 && Main.CanStartInvasion(1, true)) { this.itemTime = item.useTime; Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); if (Main.netMode != 1) { if (Main.invasionType == 0) { Main.invasionDelay = 0; Main.StartInvasion(1); } } else { NetMessage.SendData(61, -1, -1, "", this.whoAmI, -1f, 0f, 0f, 0, 0, 0); } } if (this.itemTime == 0 && this.itemAnimation > 0 && item.type == 602 && Main.CanStartInvasion(2, true)) { this.itemTime = item.useTime; Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); if (Main.netMode != 1) { if (Main.invasionType == 0) { Main.invasionDelay = 0; Main.StartInvasion(2); } } else { NetMessage.SendData(61, -1, -1, "", this.whoAmI, -2f, 0f, 0f, 0, 0, 0); } } if (this.itemTime == 0 && this.itemAnimation > 0 && item.type == 1315 && Main.CanStartInvasion(3, true)) { this.itemTime = item.useTime; Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); if (Main.netMode != 1) { if (Main.invasionType == 0) { Main.invasionDelay = 0; Main.StartInvasion(3); } } else { NetMessage.SendData(61, -1, -1, "", this.whoAmI, -3f, 0f, 0f, 0, 0, 0); } } if (this.itemTime == 0 && this.itemAnimation > 0 && item.type == 1844 && !Main.dayTime && !Main.pumpkinMoon && !Main.snowMoon) { this.itemTime = item.useTime; Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); if (Main.netMode != 1) { Main.NewText(Lang.misc[31], 50, 255, 130, false); Main.startPumpkinMoon(); } else { NetMessage.SendData(61, -1, -1, "", this.whoAmI, -4f, 0f, 0f, 0, 0, 0); } } if (this.itemTime == 0 && this.itemAnimation > 0 && item.type == 2767 && Main.dayTime && !Main.eclipse) { Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); this.itemTime = item.useTime; if (Main.netMode == 0) { Main.eclipse = true; Main.NewText(Lang.misc[20], 50, 255, 130, false); } else { NetMessage.SendData(61, -1, -1, "", this.whoAmI, -6f, 0f, 0f, 0, 0, 0); } } if (this.itemTime == 0 && this.itemAnimation > 0 && item.type == 3601 && NPC.downedGolemBoss && Main.hardMode && !NPC.AnyDanger() && !NPC.AnyoneNearCultists()) { Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); this.itemTime = item.useTime; if (Main.netMode == 0) { WorldGen.StartImpendingDoom(); } else { NetMessage.SendData(61, -1, -1, "", this.whoAmI, -8f, 0f, 0f, 0, 0, 0); } } if (this.itemTime == 0 && this.itemAnimation > 0 && item.type == 1958 && !Main.dayTime && !Main.pumpkinMoon && !Main.snowMoon) { this.itemTime = item.useTime; Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); if (Main.netMode != 1) { Main.NewText(Lang.misc[34], 50, 255, 130, false); Main.startSnowMoon(); } else { NetMessage.SendData(61, -1, -1, "", this.whoAmI, -5f, 0f, 0f, 0, 0, 0); } } if (this.itemTime == 0 && this.itemAnimation > 0 && item.makeNPC > 0 && this.controlUseItem && this.position.X / 16f - (float)Player.tileRangeX - (float)item.tileBoost <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)item.tileBoost - 1f >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)item.tileBoost <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)item.tileBoost - 2f >= (float)Player.tileTargetY) { int num313 = Main.mouseX + (int)Main.screenPosition.X; int num314 = Main.mouseY + (int)Main.screenPosition.Y; this.itemTime = item.useTime; int i4 = num313 / 16; int j3 = num314 / 16; if (!WorldGen.SolidTile(i4, j3)) { NPC.ReleaseNPC(num313, num314, (int)item.makeNPC, item.placeStyle, this.whoAmI); } } if (this.itemTime == 0 && this.itemAnimation > 0 && (item.type == 43 || item.type == 70 || item.type == 544 || item.type == 556 || item.type == 557 || item.type == 560 || item.type == 1133 || item.type == 1331) && this.SummonItemCheck()) { if (item.type == 560) { this.itemTime = item.useTime; Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); if (Main.netMode != 1) { NPC.SpawnOnPlayer(i, 50); } else { NetMessage.SendData(61, -1, -1, "", this.whoAmI, 50f, 0f, 0f, 0, 0, 0); } } else if (item.type == 43) { if (!Main.dayTime) { this.itemTime = item.useTime; Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); if (Main.netMode != 1) { NPC.SpawnOnPlayer(i, 4); } else { NetMessage.SendData(61, -1, -1, "", this.whoAmI, 4f, 0f, 0f, 0, 0, 0); } } } else if (item.type == 70) { if (this.ZoneCorrupt) { this.itemTime = item.useTime; Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); if (Main.netMode != 1) { NPC.SpawnOnPlayer(i, 13); } else { NetMessage.SendData(61, -1, -1, "", this.whoAmI, 13f, 0f, 0f, 0, 0, 0); } } } else if (item.type == 544) { if (!Main.dayTime) { this.itemTime = item.useTime; Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); if (Main.netMode != 1) { NPC.SpawnOnPlayer(i, 125); NPC.SpawnOnPlayer(i, 126); } else { NetMessage.SendData(61, -1, -1, "", this.whoAmI, 125f, 0f, 0f, 0, 0, 0); NetMessage.SendData(61, -1, -1, "", this.whoAmI, 126f, 0f, 0f, 0, 0, 0); } } } else if (item.type == 556) { if (!Main.dayTime) { this.itemTime = item.useTime; Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); if (Main.netMode != 1) { NPC.SpawnOnPlayer(i, 134); } else { NetMessage.SendData(61, -1, -1, "", this.whoAmI, 134f, 0f, 0f, 0, 0, 0); } } } else if (item.type == 557) { if (!Main.dayTime) { this.itemTime = item.useTime; Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); if (Main.netMode != 1) { NPC.SpawnOnPlayer(i, 127); } else { NetMessage.SendData(61, -1, -1, "", this.whoAmI, 127f, 0f, 0f, 0, 0, 0); } } } else if (item.type == 1133) { this.itemTime = item.useTime; Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); if (Main.netMode != 1) { NPC.SpawnOnPlayer(i, 222); } else { NetMessage.SendData(61, -1, -1, "", this.whoAmI, 222f, 0f, 0f, 0, 0, 0); } } else if (item.type == 1331 && this.ZoneCrimson) { this.itemTime = item.useTime; Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); if (Main.netMode != 1) { NPC.SpawnOnPlayer(i, 266); } else { NetMessage.SendData(61, -1, -1, "", this.whoAmI, 266f, 0f, 0f, 0, 0, 0); } } } } if ((item.type == 50 || item.type == 3124 || item.type == 3199) && this.itemAnimation > 0) { if (Main.rand.Next(2) == 0) { Dust.NewDust(this.position, this.width, this.height, 15, 0f, 0f, 150, default(Color), 1.1f); } if (this.itemTime == 0) { this.itemTime = item.useTime; } else if (this.itemTime == item.useTime / 2) { for (int num315 = 0; num315 < 70; num315++) { Dust.NewDust(this.position, this.width, this.height, 15, this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 150, default(Color), 1.5f); } this.grappling[0] = -1; this.grapCount = 0; for (int num316 = 0; num316 < 1000; num316++) { if (Main.projectile[num316].active && Main.projectile[num316].owner == i && Main.projectile[num316].aiStyle == 7) { Main.projectile[num316].Kill(); } } this.Spawn(); for (int num317 = 0; num317 < 70; num317++) { Dust.NewDust(this.position, this.width, this.height, 15, 0f, 0f, 150, default(Color), 1.5f); } } } if (item.type == 2350 && this.itemAnimation > 0) { if (this.itemTime == 0) { this.itemTime = item.useTime; } else if (this.itemTime == 2) { for (int num318 = 0; num318 < 70; num318++) { Main.dust[Dust.NewDust(this.position, this.width, this.height, 15, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 150, Color.Cyan, 1.2f)].velocity *= 0.5f; } this.grappling[0] = -1; this.grapCount = 0; for (int num319 = 0; num319 < 1000; num319++) { if (Main.projectile[num319].active && Main.projectile[num319].owner == i && Main.projectile[num319].aiStyle == 7) { Main.projectile[num319].Kill(); } } bool flag21 = this.immune; int num320 = this.immuneTime; this.Spawn(); this.immune = flag21; this.immuneTime = num320; for (int num321 = 0; num321 < 70; num321++) { Main.dust[Dust.NewDust(this.position, this.width, this.height, 15, 0f, 0f, 150, Color.Cyan, 1.2f)].velocity *= 0.5f; } if (item.stack > 0) { item.stack--; } } } if (item.type == 2351 && this.itemAnimation > 0) { if (this.itemTime == 0) { this.itemTime = item.useTime; } else if (this.itemTime == 2) { if (Main.netMode == 0) { this.TeleportationPotion(); } else if (Main.netMode == 1 && this.whoAmI == Main.myPlayer) { NetMessage.SendData(73, -1, -1, "", 0, 0f, 0f, 0f, 0, 0, 0); } if (item.stack > 0) { item.stack--; } } } if (item.type == 2756 && this.itemAnimation > 0) { if (this.itemTime == 0) { this.itemTime = item.useTime; } else if (this.itemTime == 2) { if (this.whoAmI == Main.myPlayer) { this.Male = !this.Male; if (Main.netMode == 1) { NetMessage.SendData(4, -1, -1, this.name, this.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } if (item.stack > 0) { item.stack--; } } else { float num322 = (float)item.useTime; num322 = (num322 - (float)this.itemTime) / num322; float x6 = 15f; float num323 = 44f; float num324 = 9.424778f; Vector2 vector16 = new Vector2(x6, 0f).RotatedBy((double)(num324 * num322), default(Vector2)); vector16.X *= (float)this.direction; for (int num325 = 0; num325 < 2; num325++) { int type11 = 221; if (num325 == 1) { vector16.X *= -1f; type11 = 219; } Vector2 vector17 = new Vector2(vector16.X, num323 * (1f - num322) - num323 + (float)(this.height / 2)); vector17 += base.Center; int num326 = Dust.NewDust(vector17, 0, 0, type11, 0f, 0f, 100, default(Color), 1f); Main.dust[num326].position = vector17; Main.dust[num326].noGravity = true; Main.dust[num326].velocity = Vector2.Zero; Main.dust[num326].scale = 1.3f; Main.dust[num326].customData = this; } } } if (i == Main.myPlayer) { if (this.itemTime == (int)((float)item.useTime * this.tileSpeed) && item.tileWand > 0) { int tileWand2 = item.tileWand; int num327 = 0; while (num327 < 58) { if (tileWand2 == this.inventory[num327].type && this.inventory[num327].stack > 0) { this.inventory[num327].stack--; if (this.inventory[num327].stack <= 0) { this.inventory[num327] = new Item(); break; } break; } else { num327++; } } } int num328; if (item.createTile >= 0) { num328 = (int)((float)item.useTime * this.tileSpeed); } else if (item.createWall > 0) { num328 = (int)((float)item.useTime * this.wallSpeed); } else { num328 = item.useTime; } if (this.itemTime == num328 && item.consumable) { bool flag22 = true; if (item.type == 2350 || item.type == 2351) { flag22 = false; } if (item.type == 2756) { flag22 = false; } if (item.ranged) { if (this.ammoCost80 && Main.rand.Next(5) == 0) { flag22 = false; } if (this.ammoCost75 && Main.rand.Next(4) == 0) { flag22 = false; } } if (item.thrown) { if (this.thrownCost50 && Main.rand.Next(100) < 50) { flag22 = false; } if (this.thrownCost33 && Main.rand.Next(100) < 33) { flag22 = false; } } if (item.type >= 71 && item.type <= 74) { flag22 = true; } if (flag22) { if (item.stack > 0) { item.stack--; } if (item.stack <= 0) { this.itemTime = this.itemAnimation; Main.blockMouse = true; } } } if (item.stack <= 0 && this.itemAnimation == 0) { this.inventory[this.selectedItem] = new Item(); } if (this.selectedItem == 58) { if (this.itemAnimation == 0) { return; } Main.mouseItem = item.Clone(); } } }
public void Yoraiz0rEye() { int num = 0; num += this.bodyFrame.Y / 56; if (num >= Main.OffsetsPlayerHeadgear.Length) { num = 0; } Vector2 vector = new Vector2((float)(3 * this.direction - ((this.direction == 1) ? 1 : 0)), -11.5f * this.gravDir) + Vector2.UnitY * this.gfxOffY + base.Size / 2f + Main.OffsetsPlayerHeadgear[num]; Vector2 vector2 = new Vector2((float)(3 * this.shadowDirection[1] - ((this.direction == 1) ? 1 : 0)), -11.5f * this.gravDir) + base.Size / 2f + Main.OffsetsPlayerHeadgear[num]; Vector2 vector3 = Vector2.Zero; if (this.mount.Active && this.mount.Cart) { int num2 = Math.Sign(this.velocity.X); if (num2 == 0) { num2 = this.direction; } vector3 = new Vector2(MathHelper.Lerp(0f, -8f, this.fullRotation / 0.7853982f), MathHelper.Lerp(0f, 2f, Math.Abs(this.fullRotation / 0.7853982f))).RotatedBy((double)this.fullRotation, default(Vector2)); if (num2 == Math.Sign(this.fullRotation)) { vector3 *= MathHelper.Lerp(1f, 0.6f, Math.Abs(this.fullRotation / 0.7853982f)); } } if (this.fullRotation != 0f) { vector = vector.RotatedBy((double)this.fullRotation, this.fullRotationOrigin); vector2 = vector2.RotatedBy((double)this.fullRotation, this.fullRotationOrigin); } Vector2 vector4 = this.position + vector + vector3; Vector2 vector5 = this.oldPosition + vector2 + vector3; float num3 = 1f; switch (this.yoraiz0rEye % 10) { case 1: return; case 2: num3 = 0.5f; break; case 3: num3 = 0.625f; break; case 4: num3 = 0.75f; break; case 5: num3 = 0.875f; break; case 6: num3 = 1f; break; case 7: num3 = 1.1f; break; } if (this.yoraiz0rEye < 7) { DelegateMethods.v3_1 = Main.hslToRgb(Main.rgbToHsl(this.eyeColor).X, 1f, 0.5f).ToVector3() * 0.5f * num3; if (this.velocity != Vector2.Zero) { Utils.PlotTileLine(base.Center, base.Center + this.velocity * 2f, 4f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); } else { Utils.PlotTileLine(base.Left, base.Right, 4f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); } } int num4 = (int)Vector2.Distance(vector4, vector5) / 3 + 1; if (Vector2.Distance(vector4, vector5) % 3f != 0f) { num4++; } for (float num5 = 1f; num5 <= (float)num4; num5 += 1f) { Dust dust = Main.dust[Dust.NewDust(base.Center, 0, 0, 182, 0f, 0f, 0, default(Color), 1f)]; dust.position = Vector2.Lerp(vector5, vector4, num5 / (float)num4); dust.noGravity = true; dust.velocity = Vector2.Zero; dust.customData = this; dust.scale = num3; dust.shader = GameShaders.Armor.GetSecondaryShader(this.cYorai, this); } }
public void Update(int i) { if (this.launcherWait > 0) { this.launcherWait--; } this.maxFallSpeed = 10f; this.gravity = Player.defaultGravity; Player.jumpHeight = 15; Player.jumpSpeed = 5.01f; this.maxRunSpeed = 3f; this.runAcceleration = 0.08f; this.runSlowdown = 0.2f; this.accRunSpeed = this.maxRunSpeed; if (!this.mount.Active || !this.mount.Cart) { this.onWrongGround = false; } this.heldProj = -1; if (this.PortalPhysicsEnabled) { this.maxFallSpeed = 35f; } if (this.wet) { if (this.honeyWet) { this.gravity = 0.1f; this.maxFallSpeed = 3f; } else if (this.merman) { this.gravity = 0.3f; this.maxFallSpeed = 7f; } else { this.gravity = 0.2f; this.maxFallSpeed = 5f; Player.jumpHeight = 30; Player.jumpSpeed = 6.01f; } } if (this.vortexDebuff) { this.gravity = 0f; } this.maxFallSpeed += 0.01f; bool flag = false; if (Main.myPlayer == i) { TileObject.objectPreview.Reset(); } if (this.active) { if (this.ghostDmg > 0f) { this.ghostDmg -= 2.5f; } if (this.ghostDmg < 0f) { this.ghostDmg = 0f; } if (Main.expertMode) { if (this.lifeSteal < 70f) { this.lifeSteal += 0.5f; } if (this.lifeSteal > 70f) { this.lifeSteal = 70f; } } else { if (this.lifeSteal < 80f) { this.lifeSteal += 0.6f; } if (this.lifeSteal > 80f) { this.lifeSteal = 80f; } } if (this.mount.Active) { this.position.Y = this.position.Y + (float)this.height; this.height = 42 + this.mount.HeightBoost; this.position.Y = this.position.Y - (float)this.height; if (this.mount.Type == 0) { int num = (int)(this.position.X + (float)(this.width / 2)) / 16; int j = (int)(this.position.Y + (float)(this.height / 2) - 14f) / 16; Lighting.AddLight(num, j, 0.5f, 0.2f, 0.05f); Lighting.AddLight(num + this.direction, j, 0.5f, 0.2f, 0.05f); Lighting.AddLight(num + this.direction * 2, j, 0.5f, 0.2f, 0.05f); } } else { this.position.Y = this.position.Y + (float)this.height; this.height = 42; this.position.Y = this.position.Y - (float)this.height; } Main.numPlayers++; this.outOfRange = false; if (this.whoAmI != Main.myPlayer) { int num2 = (int)(this.position.X + (float)(this.width / 2)) / 16; int num3 = (int)(this.position.Y + (float)(this.height / 2)) / 16; if (!WorldGen.InWorld(num2, num3, 4)) { flag = true; } else if (Main.tile[num2, num3] == null) { flag = true; } else if (Main.tile[num2 - 3, num3] == null) { flag = true; } else if (Main.tile[num2 + 3, num3] == null) { flag = true; } else if (Main.tile[num2, num3 - 3] == null) { flag = true; } else if (Main.tile[num2, num3 + 3] == null) { flag = true; } if (flag) { this.outOfRange = true; this.numMinions = 0; this.slotsMinions = 0f; this.itemAnimation = 0; this.PlayerFrame(); } } if (this.tankPet >= 0) { if (!this.tankPetReset) { this.tankPetReset = true; } else { this.tankPet = -1; } } } if (this.chatOverhead.timeLeft > 0) { this.chatOverhead.timeLeft = this.chatOverhead.timeLeft - 1; } if (!this.active || flag) { return; } this.miscCounter++; if (this.miscCounter >= 300) { this.miscCounter = 0; } this.infernoCounter++; if (this.infernoCounter >= 180) { this.infernoCounter = 0; } float num4 = (float)(Main.maxTilesX / 4200); num4 *= num4; float num5 = (float)((double)(this.position.Y / 16f - (60f + 10f * num4)) / (Main.worldSurface / 6.0)); if ((double)num5 < 0.25) { num5 = 0.25f; } if (num5 > 1f) { num5 = 1f; } this.gravity *= num5; this.maxRegenDelay = (1f - (float)this.statMana / (float)this.statManaMax2) * 60f * 4f + 45f; this.maxRegenDelay *= 0.7f; this.UpdateSocialShadow(); this.UpdateTeleportVisuals(); this.whoAmI = i; if (this.whoAmI == Main.myPlayer) { this.TryPortalJumping(); } if (this.runSoundDelay > 0) { this.runSoundDelay--; } if (this.attackCD > 0) { this.attackCD--; } if (this.itemAnimation == 0) { this.attackCD = 0; } if (this.potionDelay > 0) { this.potionDelay--; } if (i == Main.myPlayer) { if (this.trashItem.type >= 1522 && this.trashItem.type <= 1527) { this.trashItem.SetDefaults(0, false); } this.UpdateBiomes(); this.UpdateMinionTarget(); } if (this.ghost) { this.Ghost(); return; } if (this.dead) { this.UpdateDead(); return; } if (i == Main.myPlayer) { this.controlUp = false; this.controlLeft = false; this.controlDown = false; this.controlRight = false; this.controlJump = false; this.controlUseItem = false; this.controlUseTile = false; this.controlThrow = false; this.controlInv = false; this.controlHook = false; this.controlTorch = false; this.controlSmart = false; this.controlMount = false; this.mapStyle = false; this.mapAlphaDown = false; this.mapAlphaUp = false; this.mapFullScreen = false; this.mapZoomIn = false; this.mapZoomOut = false; bool flag2 = false; bool flag3 = false; Keys[] pressedKeys = Main.keyState.GetPressedKeys(); for (int k = 0; k < pressedKeys.Length; k++) { if (pressedKeys[k] == Keys.LeftShift || pressedKeys[k] == Keys.RightShift) { flag2 = true; } else if (pressedKeys[k] == Keys.LeftAlt || pressedKeys[k] == Keys.RightAlt) { flag3 = true; } } if (Main.hasFocus) { if (!Main.chatMode && !Main.editSign && !Main.editChest && !Main.blockInput) { if (Main.blockKey != Keys.None) { bool flag4 = false; for (int l = 0; l < pressedKeys.Length; l++) { if (pressedKeys[l] == Main.blockKey) { pressedKeys[l] = Keys.None; flag4 = true; } } if (!flag4) { Main.blockKey = Keys.None; } } bool flag5 = false; bool flag6 = false; for (int m = 0; m < pressedKeys.Length; m++) { string a = string.Concat(pressedKeys[m]); if (pressedKeys[m] != Keys.Tab || ((!flag2 || SocialAPI.Mode != SocialMode.Steam) && !flag3)) { if (a == Main.cUp) { this.controlUp = true; } if (a == Main.cLeft) { this.controlLeft = true; } if (a == Main.cDown) { this.controlDown = true; } if (a == Main.cRight) { this.controlRight = true; } if (a == Main.cJump) { this.controlJump = true; } if (a == Main.cThrowItem) { this.controlThrow = true; } if (a == Main.cInv) { this.controlInv = true; } if (a == Main.cBuff) { this.QuickBuff(); } if (a == Main.cHeal) { flag6 = true; } if (a == Main.cMana) { flag5 = true; } if (a == Main.cHook) { this.controlHook = true; } if (a == Main.cTorch) { this.controlTorch = true; } if (a == Main.cSmart) { this.controlSmart = true; } if (a == Main.cMount) { this.controlMount = true; } if (Main.mapEnabled) { if (a == Main.cMapZoomIn) { this.mapZoomIn = true; } if (a == Main.cMapZoomOut) { this.mapZoomOut = true; } if (a == Main.cMapAlphaUp) { this.mapAlphaUp = true; } if (a == Main.cMapAlphaDown) { this.mapAlphaDown = true; } if (a == Main.cMapFull) { this.mapFullScreen = true; } if (a == Main.cMapStyle) { this.mapStyle = true; } } } } if (Main.gamePad) { GamePadState state = GamePad.GetState(PlayerIndex.One); if (state.DPad.Up == ButtonState.Pressed) { this.controlUp = true; } if (state.DPad.Down == ButtonState.Pressed) { this.controlDown = true; } if (state.DPad.Left == ButtonState.Pressed) { this.controlLeft = true; } if (state.DPad.Right == ButtonState.Pressed) { this.controlRight = true; } if (state.Triggers.Left > 0f) { this.controlJump = true; } if (state.Triggers.Right > 0f) { this.controlUseItem = true; } Main.mouseX = (int)((float)(Main.screenWidth / 2) + state.ThumbSticks.Right.X * (float)Player.tileRangeX * 16f); Main.mouseY = (int)((float)(Main.screenHeight / 2) - state.ThumbSticks.Right.Y * (float)Player.tileRangeX * 16f); if (state.ThumbSticks.Right.X == 0f) { Main.mouseX = Main.screenWidth / 2 + this.direction * 2; } } if (Main.mapFullscreen) { if (this.controlUp) { Main.mapFullscreenPos.Y = Main.mapFullscreenPos.Y - 1f * (16f / Main.mapFullscreenScale); } if (this.controlDown) { Main.mapFullscreenPos.Y = Main.mapFullscreenPos.Y + 1f * (16f / Main.mapFullscreenScale); } if (this.controlLeft) { Main.mapFullscreenPos.X = Main.mapFullscreenPos.X - 1f * (16f / Main.mapFullscreenScale); } if (this.controlRight) { Main.mapFullscreenPos.X = Main.mapFullscreenPos.X + 1f * (16f / Main.mapFullscreenScale); } this.controlUp = false; this.controlLeft = false; this.controlDown = false; this.controlRight = false; this.controlJump = false; this.controlUseItem = false; this.controlUseTile = false; this.controlThrow = false; this.controlHook = false; this.controlTorch = false; this.controlSmart = false; this.controlMount = false; } if (flag6) { if (this.releaseQuickHeal) { this.QuickHeal(); } this.releaseQuickHeal = false; } else { this.releaseQuickHeal = true; } if (flag5) { if (this.releaseQuickMana) { this.QuickMana(); } this.releaseQuickMana = false; } else { this.releaseQuickMana = true; } if (this.controlLeft && this.controlRight) { this.controlLeft = false; this.controlRight = false; } if (Main.cSmartToggle) { if (this.controlSmart && this.releaseSmart) { Main.PlaySound(12, -1, -1, 1); Main.smartDigEnabled = !Main.smartDigEnabled; } } else { if (Main.smartDigEnabled != this.controlSmart) { Main.PlaySound(12, -1, -1, 1); } Main.smartDigEnabled = this.controlSmart; } if (this.controlSmart) { this.releaseSmart = false; } else { this.releaseSmart = true; } if (this.controlMount) { if (this.releaseMount) { this.QuickMount(); } this.releaseMount = false; } else { this.releaseMount = true; } if (Main.mapFullscreen) { if (this.mapZoomIn) { Main.mapFullscreenScale *= 1.05f; } if (this.mapZoomOut) { Main.mapFullscreenScale *= 0.95f; } } else { if (Main.mapStyle == 1) { if (this.mapZoomIn) { Main.mapMinimapScale *= 1.025f; } if (this.mapZoomOut) { Main.mapMinimapScale *= 0.975f; } if (this.mapAlphaUp) { Main.mapMinimapAlpha += 0.015f; } if (this.mapAlphaDown) { Main.mapMinimapAlpha -= 0.015f; } } else if (Main.mapStyle == 2) { if (this.mapZoomIn) { Main.mapOverlayScale *= 1.05f; } if (this.mapZoomOut) { Main.mapOverlayScale *= 0.95f; } if (this.mapAlphaUp) { Main.mapOverlayAlpha += 0.015f; } if (this.mapAlphaDown) { Main.mapOverlayAlpha -= 0.015f; } } if (this.mapStyle) { if (this.releaseMapStyle) { Main.PlaySound(12, -1, -1, 1); Main.mapStyle++; if (Main.mapStyle > 2) { Main.mapStyle = 0; } } this.releaseMapStyle = false; } else { this.releaseMapStyle = true; } } if (this.mapFullScreen) { if (this.releaseMapFullscreen) { if (Main.mapFullscreen) { Main.PlaySound(11, -1, -1, 1); Main.mapFullscreen = false; } else { Main.playerInventory = false; this.talkNPC = -1; Main.npcChatCornerItem = 0; Main.PlaySound(10, -1, -1, 1); float mapFullscreenScale = 2.5f; Main.mapFullscreenScale = mapFullscreenScale; Main.mapFullscreen = true; Main.resetMapFull = true; Main.buffString = string.Empty; } } this.releaseMapFullscreen = false; } else { this.releaseMapFullscreen = true; } } if (this.confused) { bool flag7 = this.controlLeft; bool flag8 = this.controlUp; this.controlLeft = this.controlRight; this.controlRight = flag7; this.controlUp = this.controlRight; this.controlDown = flag8; } else if (this.cartFlip) { if (this.controlRight || this.controlLeft) { bool flag9 = this.controlLeft; this.controlLeft = this.controlRight; this.controlRight = flag9; } else { this.cartFlip = false; } } for (int n = 0; n < this.doubleTapCardinalTimer.Length; n++) { this.doubleTapCardinalTimer[n]--; if (this.doubleTapCardinalTimer[n] < 0) { this.doubleTapCardinalTimer[n] = 0; } } for (int num6 = 0; num6 < 4; num6++) { bool flag10 = false; bool flag11 = false; switch (num6) { case 0: flag10 = (this.controlDown && this.releaseDown); flag11 = this.controlDown; break; case 1: flag10 = (this.controlUp && this.releaseUp); flag11 = this.controlUp; break; case 2: flag10 = (this.controlRight && this.releaseRight); flag11 = this.controlRight; break; case 3: flag10 = (this.controlLeft && this.releaseLeft); flag11 = this.controlLeft; break; } if (flag10) { if (this.doubleTapCardinalTimer[num6] > 0) { this.KeyDoubleTap(num6); } else { this.doubleTapCardinalTimer[num6] = 15; } } if (flag11) { this.holdDownCardinalTimer[num6]++; this.KeyHoldDown(num6, this.holdDownCardinalTimer[num6]); } else { this.holdDownCardinalTimer[num6] = 0; } } if (Main.mouseLeft) { if (!Main.blockMouse && !this.mouseInterface) { this.controlUseItem = true; } } else { Main.blockMouse = false; } if (Main.mouseRight && !this.mouseInterface && !Main.blockMouse) { this.controlUseTile = true; } if (this.controlInv) { if (this.releaseInventory) { if (Main.mapFullscreen) { Main.mapFullscreen = false; this.releaseInventory = false; Main.PlaySound(11, -1, -1, 1); } else { this.ToggleInv(); } } this.releaseInventory = false; } else { this.releaseInventory = true; } if (this.delayUseItem) { if (!this.controlUseItem) { this.delayUseItem = false; } this.controlUseItem = false; } if (this.itemAnimation == 0 && this.itemTime == 0) { this.dropItemCheck(); int num7 = this.selectedItem; bool flag12 = false; if (!Main.chatMode && this.selectedItem != 58 && !Main.editSign && !Main.editChest) { if (Main.keyState.IsKeyDown(Keys.D1)) { this.selectedItem = 0; flag12 = true; } if (Main.keyState.IsKeyDown(Keys.D2)) { this.selectedItem = 1; flag12 = true; } if (Main.keyState.IsKeyDown(Keys.D3)) { this.selectedItem = 2; flag12 = true; } if (Main.keyState.IsKeyDown(Keys.D4)) { this.selectedItem = 3; flag12 = true; } if (Main.keyState.IsKeyDown(Keys.D5)) { this.selectedItem = 4; flag12 = true; } if (Main.keyState.IsKeyDown(Keys.D6)) { this.selectedItem = 5; flag12 = true; } if (Main.keyState.IsKeyDown(Keys.D7)) { this.selectedItem = 6; flag12 = true; } if (Main.keyState.IsKeyDown(Keys.D8)) { this.selectedItem = 7; flag12 = true; } if (Main.keyState.IsKeyDown(Keys.D9)) { this.selectedItem = 8; flag12 = true; } if (Main.keyState.IsKeyDown(Keys.D0)) { this.selectedItem = 9; flag12 = true; } if (this.controlTorch && flag12) { if (this.selectedItem != this.nonTorch) { Main.PlaySound(12, -1, -1, 1); } this.nonTorch = this.selectedItem; this.selectedItem = num7; flag12 = false; } } bool flag13 = Main.hairWindow; if (flag13) { int y = Main.screenHeight / 2 + 60; int x = Main.screenWidth / 2 - Main.hairStyleBackTexture.Width / 2; flag13 = new Rectangle(x, y, Main.hairStyleBackTexture.Width, Main.hairStyleBackTexture.Height).Contains(Main.MouseScreen.ToPoint()); } if (flag12 && CaptureManager.Instance.Active) { CaptureManager.Instance.Active = false; } if (num7 != this.selectedItem) { Main.PlaySound(12, -1, -1, 1); } if (Main.mapFullscreen) { int num8 = (Main.mouseState.ScrollWheelValue - Main.oldMouseWheel) / 120; Main.mapFullscreenScale *= 1f + (float)num8 * 0.3f; } else if (CaptureManager.Instance.Active) { CaptureManager.Instance.Scrolling(); } else if (!flag13) { if (!Main.playerInventory) { int num9; for (num9 = (Main.mouseState.ScrollWheelValue - Main.oldMouseWheel) / 120; num9 > 9; num9 -= 10) { } while (num9 < 0) { num9 += 10; } this.selectedItem -= num9; if (num9 != 0) { Main.PlaySound(12, -1, -1, 1); } if (this.changeItem >= 0) { if (this.selectedItem != this.changeItem) { Main.PlaySound(12, -1, -1, 1); } this.selectedItem = this.changeItem; this.changeItem = -1; } if (this.itemAnimation == 0) { while (this.selectedItem > 9) { this.selectedItem -= 10; } while (this.selectedItem < 0) { this.selectedItem += 10; } } } else { int num10 = (Main.mouseState.ScrollWheelValue - Main.oldMouseWheel) / 120; bool flag14 = true; if (Main.recBigList) { int num11 = 42; int num12 = 340; int num13 = 310; int num14 = (Main.screenWidth - num13 - 280) / num11; int num15 = (Main.screenHeight - num12 - 20) / num11; if (new Rectangle(num13, num12, num14 * num11, num15 * num11).Contains(Main.MouseScreen.ToPoint())) { num10 *= -1; int num16 = Math.Sign(num10); while (num10 != 0) { if (num10 < 0) { Main.recStart -= num14; if (Main.recStart < 0) { Main.recStart = 0; } } else { Main.recStart += num14; if (Main.recStart > Main.numAvailableRecipes - num14) { Main.recStart = Main.numAvailableRecipes - num14; } } num10 -= num16; } } } if (flag14) { Main.focusRecipe += num10; if (Main.focusRecipe > Main.numAvailableRecipes - 1) { Main.focusRecipe = Main.numAvailableRecipes - 1; } if (Main.focusRecipe < 0) { Main.focusRecipe = 0; } } } } } else { bool flag15 = false; if (!Main.chatMode && this.selectedItem != 58 && !Main.editSign && !Main.editChest) { int num17 = -1; if (Main.keyState.IsKeyDown(Keys.D1)) { num17 = 0; flag15 = true; } if (Main.keyState.IsKeyDown(Keys.D2)) { num17 = 1; flag15 = true; } if (Main.keyState.IsKeyDown(Keys.D3)) { num17 = 2; flag15 = true; } if (Main.keyState.IsKeyDown(Keys.D4)) { num17 = 3; flag15 = true; } if (Main.keyState.IsKeyDown(Keys.D5)) { num17 = 4; flag15 = true; } if (Main.keyState.IsKeyDown(Keys.D6)) { num17 = 5; flag15 = true; } if (Main.keyState.IsKeyDown(Keys.D7)) { num17 = 6; flag15 = true; } if (Main.keyState.IsKeyDown(Keys.D8)) { num17 = 7; flag15 = true; } if (Main.keyState.IsKeyDown(Keys.D9)) { num17 = 8; flag15 = true; } if (Main.keyState.IsKeyDown(Keys.D0)) { num17 = 9; flag15 = true; } if (flag15) { if (num17 != this.nonTorch) { Main.PlaySound(12, -1, -1, 1); } this.nonTorch = num17; } } } } if (this.selectedItem == 58) { this.nonTorch = -1; } else { this.SmartitemLookup(); } if (this.stoned != this.lastStoned) { if (this.whoAmI == Main.myPlayer && this.stoned) { int damage = (int)(20.0 * (double)Main.damageMultiplier); this.Hurt(damage, 0, false, false, Lang.deathMsg(-1, -1, -1, 4), false, -1); } Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); for (int num18 = 0; num18 < 20; num18++) { int num19 = Dust.NewDust(this.position, this.width, this.height, 1, 0f, 0f, 0, default(Color), 1f); if (Main.rand.Next(2) == 0) { Main.dust[num19].noGravity = true; } } } this.lastStoned = this.stoned; if (this.frozen || this.webbed || this.stoned) { this.controlJump = false; this.controlDown = false; this.controlLeft = false; this.controlRight = false; this.controlUp = false; this.controlUseItem = false; this.controlUseTile = false; this.controlThrow = false; this.gravDir = 1f; } if (!this.controlThrow) { this.releaseThrow = true; } else { this.releaseThrow = false; } if (Main.netMode == 1) { bool flag16 = false; if (this.controlUp != Main.clientPlayer.controlUp) { flag16 = true; } if (this.controlDown != Main.clientPlayer.controlDown) { flag16 = true; } if (this.controlLeft != Main.clientPlayer.controlLeft) { flag16 = true; } if (this.controlRight != Main.clientPlayer.controlRight) { flag16 = true; } if (this.controlJump != Main.clientPlayer.controlJump) { flag16 = true; } if (this.controlUseItem != Main.clientPlayer.controlUseItem) { flag16 = true; } if (this.selectedItem != Main.clientPlayer.selectedItem) { flag16 = true; } if (flag16) { NetMessage.SendData(13, -1, -1, "", Main.myPlayer, 0f, 0f, 0f, 0, 0, 0); } } if (Main.playerInventory) { this.AdjTiles(); } if (this.chest != -1) { if (this.chest != -2) { this.flyingPigChest = -1; } if (this.flyingPigChest >= 0) { if (!Main.projectile[this.flyingPigChest].active || Main.projectile[this.flyingPigChest].type != 525) { Main.PlaySound(2, -1, -1, 59); this.chest = -1; Recipe.FindRecipes(); } else { int num20 = (int)(((double)this.position.X + (double)this.width * 0.5) / 16.0); int num21 = (int)(((double)this.position.Y + (double)this.height * 0.5) / 16.0); this.chestX = (int)Main.projectile[this.flyingPigChest].Center.X / 16; this.chestY = (int)Main.projectile[this.flyingPigChest].Center.Y / 16; if (num20 < this.chestX - Player.tileRangeX || num20 > this.chestX + Player.tileRangeX + 1 || num21 < this.chestY - Player.tileRangeY || num21 > this.chestY + Player.tileRangeY + 1) { if (this.chest != -1) { Main.PlaySound(2, -1, -1, 59); } this.chest = -1; Recipe.FindRecipes(); } } } else { int num22 = (int)(((double)this.position.X + (double)this.width * 0.5) / 16.0); int num23 = (int)(((double)this.position.Y + (double)this.height * 0.5) / 16.0); if (num22 < this.chestX - Player.tileRangeX || num22 > this.chestX + Player.tileRangeX + 1 || num23 < this.chestY - Player.tileRangeY || num23 > this.chestY + Player.tileRangeY + 1) { if (this.chest != -1) { Main.PlaySound(11, -1, -1, 1); } this.chest = -1; Recipe.FindRecipes(); } else if (!Main.tile[this.chestX, this.chestY].active()) { Main.PlaySound(11, -1, -1, 1); this.chest = -1; Recipe.FindRecipes(); } } } else { this.flyingPigChest = -1; } if (this.velocity.Y <= 0f) { this.fallStart2 = (int)(this.position.Y / 16f); } if (this.velocity.Y == 0f) { int num24 = 25; num24 += this.extraFall; int num25 = (int)(this.position.Y / 16f) - this.fallStart; if (this.mount.CanFly) { num25 = 0; } if (this.mount.Cart && Minecart.OnTrack(this.position, this.width, this.height)) { num25 = 0; } if (this.mount.Type == 1) { num25 = 0; } this.mount.FatigueRecovery(); bool flag17 = false; for (int num26 = 3; num26 < 10; num26++) { if (this.armor[num26].stack > 0 && this.armor[num26].wingSlot > -1) { flag17 = true; } } if (this.stoned) { int num27 = (int)(((float)num25 * this.gravDir - 2f) * 20f); if (num27 > 0) { this.Hurt(num27, 0, false, false, Lang.deathMsg(-1, -1, -1, 4), false, -1); this.immune = false; } } else if (((this.gravDir == 1f && num25 > num24) || (this.gravDir == -1f && num25 < -num24)) && !this.noFallDmg && !flag17) { this.immune = false; int num28 = (int)((float)num25 * this.gravDir - (float)num24) * 10; if (this.mount.Active) { num28 = (int)((float)num28 * this.mount.FallDamage); } this.Hurt(num28, 0, false, false, Lang.deathMsg(-1, -1, -1, 0), false, -1); if (!this.dead && this.statLife <= this.statLifeMax2 / 10) { AchievementsHelper.HandleSpecialEvent(this, 8); } } this.fallStart = (int)(this.position.Y / 16f); } if (this.jump > 0 || this.rocketDelay > 0 || this.wet || this.slowFall || (double)num5 < 0.8 || this.tongued) { this.fallStart = (int)(this.position.Y / 16f); } } if (Main.netMode != 1) { if (this.chest == -1 && this.lastChest >= 0 && Main.chest[this.lastChest] != null && Main.chest[this.lastChest] != null) { int x2 = Main.chest[this.lastChest].x; int y2 = Main.chest[this.lastChest].y; NPC.BigMimicSummonCheck(x2, y2); } this.lastChest = this.chest; } if (this.mouseInterface) { this.delayUseItem = true; } Player.tileTargetX = (int)(((float)Main.mouseX + Main.screenPosition.X) / 16f); Player.tileTargetY = (int)(((float)Main.mouseY + Main.screenPosition.Y) / 16f); if (this.gravDir == -1f) { Player.tileTargetY = (int)((Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY) / 16f); } if (Player.tileTargetX >= Main.maxTilesX - 5) { Player.tileTargetX = Main.maxTilesX - 5; } if (Player.tileTargetY >= Main.maxTilesY - 5) { Player.tileTargetY = Main.maxTilesY - 5; } if (Player.tileTargetX < 5) { Player.tileTargetX = 5; } if (Player.tileTargetY < 5) { Player.tileTargetY = 5; } if (Main.tile[Player.tileTargetX - 1, Player.tileTargetY] == null) { Main.tile[Player.tileTargetX - 1, Player.tileTargetY] = new Tile(); } if (Main.tile[Player.tileTargetX + 1, Player.tileTargetY] == null) { Main.tile[Player.tileTargetX + 1, Player.tileTargetY] = new Tile(); } if (Main.tile[Player.tileTargetX, Player.tileTargetY] == null) { Main.tile[Player.tileTargetX, Player.tileTargetY] = new Tile(); } if (!Main.tile[Player.tileTargetX, Player.tileTargetY].active()) { if (Main.tile[Player.tileTargetX - 1, Player.tileTargetY].active() && Main.tile[Player.tileTargetX - 1, Player.tileTargetY].type == 323) { int frameY = (int)Main.tile[Player.tileTargetX - 1, Player.tileTargetY].frameY; if (frameY < -4) { Player.tileTargetX++; } if (frameY > 4) { Player.tileTargetX--; } } else if (Main.tile[Player.tileTargetX + 1, Player.tileTargetY].active() && Main.tile[Player.tileTargetX + 1, Player.tileTargetY].type == 323) { int frameY2 = (int)Main.tile[Player.tileTargetX + 1, Player.tileTargetY].frameY; if (frameY2 < -4) { Player.tileTargetX++; } if (frameY2 > 4) { Player.tileTargetX--; } } } this.SmartCursorLookup(); this.UpdateImmunity(); if (this.petalTimer > 0) { this.petalTimer--; } if (this.shadowDodgeTimer > 0) { this.shadowDodgeTimer--; } if (this.jump > 0 || this.velocity.Y != 0f) { this.slippy = false; this.slippy2 = false; this.powerrun = false; this.sticky = false; } this.potionDelayTime = Item.potionDelay; this.restorationDelayTime = Item.restorationDelay; if (this.pStone) { this.potionDelayTime = (int)((double)this.potionDelayTime * 0.75); this.restorationDelayTime = (int)((double)this.restorationDelayTime * 0.75); } if (this.yoraiz0rEye > 0) { this.Yoraiz0rEye(); } this.ResetEffects(); this.UpdateDyes(i); this.meleeCrit += this.inventory[this.selectedItem].crit; this.magicCrit += this.inventory[this.selectedItem].crit; this.rangedCrit += this.inventory[this.selectedItem].crit; this.thrownCrit += this.inventory[this.selectedItem].crit; if (this.whoAmI == Main.myPlayer) { Main.musicBox2 = -1; if (Main.waterCandles > 0) { this.AddBuff(86, 2, false); } if (Main.peaceCandles > 0) { this.AddBuff(157, 2, false); } if (Main.campfire) { this.AddBuff(87, 2, false); } if (Main.starInBottle) { this.AddBuff(158, 2, false); } if (Main.heartLantern) { this.AddBuff(89, 2, false); } if (Main.sunflower) { this.AddBuff(146, 2, false); } if (this.hasBanner) { this.AddBuff(147, 2, false); } } for (int num29 = 0; num29 < 191; num29++) { this.buffImmune[num29] = false; } this.UpdateBuffs(i); if (this.whoAmI == Main.myPlayer) { if (!this.onFire && !this.poisoned) { this.trapDebuffSource = false; } this.UpdatePet(i); this.UpdatePetLight(i); } bool flag18 = this.wet && !this.lavaWet && (!this.mount.Active || this.mount.Type != 3); if (this.accMerman && flag18) { this.releaseJump = true; this.wings = 0; this.merman = true; this.accFlipper = true; this.AddBuff(34, 2, true); } else { this.merman = false; } if (!flag18 && this.forceWerewolf) { this.forceMerman = false; } if (this.forceMerman && flag18) { this.wings = 0; } this.accMerman = false; this.hideMerman = false; this.forceMerman = false; if (this.wolfAcc && !this.merman && !Main.dayTime && !this.wereWolf) { this.AddBuff(28, 60, true); } this.wolfAcc = false; this.hideWolf = false; this.forceWerewolf = false; if (this.whoAmI == Main.myPlayer) { for (int num30 = 0; num30 < 22; num30++) { if (this.buffType[num30] > 0 && this.buffTime[num30] <= 0) { this.DelBuff(num30); } } } this.beetleDefense = false; this.beetleOffense = false; this.doubleJumpCloud = false; this.setSolar = false; this.head = this.armor[0].headSlot; this.body = this.armor[1].bodySlot; this.legs = this.armor[2].legSlot; this.handon = -1; this.handoff = -1; this.back = -1; this.front = -1; this.shoe = -1; this.waist = -1; this.shield = -1; this.neck = -1; this.face = -1; this.balloon = -1; if (this.MountFishronSpecialCounter > 0f) { this.MountFishronSpecialCounter -= 1f; } if (this._portalPhysicsTime > 0) { this._portalPhysicsTime--; } this.UpdateEquips(i); if (this.velocity.Y == 0f || this.controlJump) { this.portalPhysicsFlag = false; } if (this.inventory[this.selectedItem].type == 3384 || this.portalPhysicsFlag) { this._portalPhysicsTime = 30; } if (this.mount.Active) { this.mount.UpdateEffects(this); } this.gemCount++; if (this.gemCount >= 10) { this.gem = -1; this.gemCount = 0; for (int num31 = 0; num31 <= 58; num31++) { if (this.inventory[num31].type == 0 || this.inventory[num31].stack == 0) { this.inventory[num31].type = 0; this.inventory[num31].stack = 0; this.inventory[num31].name = ""; this.inventory[num31].netID = 0; } if (this.inventory[num31].type >= 1522 && this.inventory[num31].type <= 1527) { this.gem = this.inventory[num31].type - 1522; } } } if (!this.vortexStealthActive) { float num32 = 0f; float num33 = 0f; float num34 = 0f; int num35 = this.head; if (num35 <= 171) { if (num35 != 11) { switch (num35) { case 169: num32 = 0f; num33 = 0.36f; num34 = 0.4f; break; case 170: num32 = 0.4f; num33 = 0.16f; num34 = 0.36f; break; case 171: num32 = 0.5f; num33 = 0.25f; num34 = 0.05f; break; } } else { num32 = 0.92f; num33 = 0.8f; num34 = 0.65f; } } else if (num35 != 178) { if (num35 == 189) { num32 = 0.9f; num33 = 0.9f; num34 = 0.7f; } } else { num32 = 0.1f; num33 = 0.2f; num34 = 0.3f; } float num36 = 0f; float num37 = 0f; float num38 = 0f; num35 = this.body; switch (num35) { case 175: num36 = 0f; num37 = 0.36f; num38 = 0.4f; break; case 176: num36 = 0.4f; num37 = 0.16f; num38 = 0.36f; break; case 177: num36 = 0.5f; num37 = 0.25f; num38 = 0.05f; break; default: if (num35 == 190) { num32 = 0.9f; num33 = 0.9f; num34 = 0.7f; } break; } float num39 = 0f; float num40 = 0f; float num41 = 0f; num35 = this.legs; switch (num35) { case 110: num39 = 0f; num40 = 0.36f; num41 = 0.4f; break; case 111: num39 = 0.4f; num40 = 0.16f; num41 = 0.36f; break; case 112: num39 = 0.5f; num40 = 0.25f; num41 = 0.05f; break; default: if (num35 == 130) { num32 = 0.9f; num33 = 0.9f; num34 = 0.7f; } break; } if (num32 != 0f || num33 != 0f || num34 != 0f) { float num42 = 1f; if (num32 == num36 && num33 == num37 && num34 == num38) { num42 += 0.5f; } if (num32 == num39 && num33 == num40 && num34 == num41) { num42 += 0.5f; } Vector2 spinningpoint = new Vector2((float)(this.width / 2 + 8 * this.direction), 2f); if (this.fullRotation != 0f) { spinningpoint = spinningpoint.RotatedBy((double)this.fullRotation, this.fullRotationOrigin); } int i2 = (int)(this.position.X + spinningpoint.X) / 16; int j2 = (int)(this.position.Y + spinningpoint.Y) / 16; Lighting.AddLight(i2, j2, num32 * num42, num33 * num42, num34 * num42); } if (num36 != 0f || num37 != 0f || num38 != 0f) { float num43 = 1f; if (num36 == num32 && num37 == num33 && num38 == num34) { num43 += 0.5f; } if (num36 == num39 && num37 == num40 && num38 == num41) { num43 += 0.5f; } Vector2 spinningpoint2 = new Vector2((float)(this.width / 2 + 8), (float)(this.height / 2)); if (this.fullRotation != 0f) { spinningpoint2 = spinningpoint2.RotatedBy((double)this.fullRotation, this.fullRotationOrigin); } int i3 = (int)(this.position.X + spinningpoint2.X) / 16; int j3 = (int)(this.position.Y + spinningpoint2.Y) / 16; Lighting.AddLight(i3, j3, num36 * num43, num37 * num43, num38 * num43); } if (num39 != 0f || num40 != 0f || num41 != 0f) { float num44 = 1f; if (num39 == num36 && num40 == num37 && num41 == num38) { num44 += 0.5f; } if (num39 == num32 && num40 == num33 && num41 == num34) { num44 += 0.5f; } Vector2 spinningpoint3 = new Vector2((float)(this.width / 2 + 8 * this.direction), (float)this.height * 0.75f); if (this.fullRotation != 0f) { spinningpoint3 = spinningpoint3.RotatedBy((double)this.fullRotation, this.fullRotationOrigin); } int i4 = (int)(this.position.X + spinningpoint3.X) / 16; int j4 = (int)(this.position.Y + spinningpoint3.Y) / 16; Lighting.AddLight(i4, j4, num39 * num44, num40 * num44, num41 * num44); } } this.UpdateArmorSets(i); if ((this.merman || this.forceMerman) && flag18) { this.wings = 0; } if (this.invis) { if (this.itemAnimation == 0 && this.aggro > -750) { this.aggro = -750; } else if (this.aggro > -250) { this.aggro = -250; } } if (this.inventory[this.selectedItem].type == 3106) { if (this.itemAnimation > 0) { this.stealthTimer = 15; if (this.stealth > 0f) { this.stealth += 0.1f; } } else if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1 && (double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1 && !this.mount.Active) { if (this.stealthTimer == 0 && this.stealth > 0f) { this.stealth -= 0.02f; if ((double)this.stealth <= 0.0) { this.stealth = 0f; if (Main.netMode == 1) { NetMessage.SendData(84, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } } } else { if (this.stealth > 0f) { this.stealth += 0.1f; } if (this.mount.Active) { this.stealth = 1f; } } if (this.stealth > 1f) { this.stealth = 1f; } this.meleeDamage += (1f - this.stealth) * 3f; this.meleeCrit += (int)((1f - this.stealth) * 30f); if (this.meleeCrit > 100) { this.meleeCrit = 100; } this.aggro -= (int)((1f - this.stealth) * 750f); if (this.stealthTimer > 0) { this.stealthTimer--; } } else if (this.shroomiteStealth) { if (this.itemAnimation > 0) { this.stealthTimer = 5; } if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1 && (double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1 && !this.mount.Active) { if (this.stealthTimer == 0 && this.stealth > 0f) { this.stealth -= 0.015f; if ((double)this.stealth <= 0.0) { this.stealth = 0f; if (Main.netMode == 1) { NetMessage.SendData(84, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } } } else { float num45 = Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y); this.stealth += num45 * 0.0075f; if (this.stealth > 1f) { this.stealth = 1f; } if (this.mount.Active) { this.stealth = 1f; } } this.rangedDamage += (1f - this.stealth) * 0.6f; this.rangedCrit += (int)((1f - this.stealth) * 10f); this.aggro -= (int)((1f - this.stealth) * 750f); if (this.stealthTimer > 0) { this.stealthTimer--; } } else if (this.setVortex) { bool flag19 = false; if (this.vortexStealthActive) { float num46 = this.stealth; this.stealth -= 0.04f; if (this.stealth < 0f) { this.stealth = 0f; } else { flag19 = true; } if (this.stealth == 0f && num46 != this.stealth && Main.netMode == 1) { NetMessage.SendData(84, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); } this.rangedDamage += (1f - this.stealth) * 0.8f; this.rangedCrit += (int)((1f - this.stealth) * 20f); this.aggro -= (int)((1f - this.stealth) * 1200f); this.moveSpeed *= 0.3f; if (this.mount.Active) { this.vortexStealthActive = false; } } else { float num47 = this.stealth; this.stealth += 0.04f; if (this.stealth > 1f) { this.stealth = 1f; } else { flag19 = true; } if (this.stealth == 1f && num47 != this.stealth && Main.netMode == 1) { NetMessage.SendData(84, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } if (flag19) { if (Main.rand.Next(2) == 0) { Vector2 vector = Vector2.UnitY.RotatedByRandom(6.2831854820251465); Dust dust = Main.dust[Dust.NewDust(base.Center - vector * 30f, 0, 0, 229, 0f, 0f, 0, default(Color), 1f)]; dust.noGravity = true; dust.position = base.Center - vector * (float)Main.rand.Next(5, 11); dust.velocity = vector.RotatedBy(1.5707963705062866, default(Vector2)) * 4f; dust.scale = 0.5f + Main.rand.NextFloat(); dust.fadeIn = 0.5f; } if (Main.rand.Next(2) == 0) { Vector2 vector2 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); Dust dust2 = Main.dust[Dust.NewDust(base.Center - vector2 * 30f, 0, 0, 240, 0f, 0f, 0, default(Color), 1f)]; dust2.noGravity = true; dust2.position = base.Center - vector2 * 12f; dust2.velocity = vector2.RotatedBy(-1.5707963705062866, default(Vector2)) * 2f; dust2.scale = 0.5f + Main.rand.NextFloat(); dust2.fadeIn = 0.5f; } } } else { this.stealth = 1f; } if (this.manaSick) { this.magicDamage *= 1f - this.manaSickReduction; } if (this.inventory[this.selectedItem].type == 1947) { this.meleeSpeed = (1f + this.meleeSpeed) / 2f; } if ((double)this.pickSpeed < 0.3) { this.pickSpeed = 0.3f; } if (this.meleeSpeed > 3f) { this.meleeSpeed = 3f; } if ((double)this.moveSpeed > 1.6) { this.moveSpeed = 1.6f; } if (this.tileSpeed > 3f) { this.tileSpeed = 3f; } this.tileSpeed = 1f / this.tileSpeed; if (this.wallSpeed > 3f) { this.wallSpeed = 3f; } this.wallSpeed = 1f / this.wallSpeed; if (this.statManaMax2 > 400) { this.statManaMax2 = 400; } if (this.statDefense < 0) { this.statDefense = 0; } if (this.dazed) { this.moveSpeed /= 3f; } else if (this.slow) { this.moveSpeed /= 2f; } else if (this.chilled) { this.moveSpeed *= 0.75f; } this.meleeSpeed = 1f / this.meleeSpeed; this.UpdateLifeRegen(); this.soulDrain = 0; this.UpdateManaRegen(); if (this.manaRegenCount < 0) { this.manaRegenCount = 0; } if (this.statMana > this.statManaMax2) { this.statMana = this.statManaMax2; } this.runAcceleration *= this.moveSpeed; this.maxRunSpeed *= this.moveSpeed; this.UpdateJumpHeight(); for (int num48 = 0; num48 < 22; num48++) { if (this.buffType[num48] > 0 && this.buffTime[num48] > 0 && this.buffImmune[this.buffType[num48]]) { this.DelBuff(num48); } } if (this.brokenArmor) { this.statDefense /= 2; } this.lastTileRangeX = Player.tileRangeX; this.lastTileRangeY = Player.tileRangeY; if (this.mount.Active && this.mount.BlockExtraJumps) { this.jumpAgainCloud = false; this.jumpAgainSandstorm = false; this.jumpAgainBlizzard = false; this.jumpAgainFart = false; this.jumpAgainSail = false; this.jumpAgainUnicorn = false; } else { if (!this.doubleJumpCloud) { this.jumpAgainCloud = false; } else if (this.velocity.Y == 0f || this.sliding) { this.jumpAgainCloud = true; } if (!this.doubleJumpSandstorm) { this.jumpAgainSandstorm = false; } else if (this.velocity.Y == 0f || this.sliding) { this.jumpAgainSandstorm = true; } if (!this.doubleJumpBlizzard) { this.jumpAgainBlizzard = false; } else if (this.velocity.Y == 0f || this.sliding) { this.jumpAgainBlizzard = true; } if (!this.doubleJumpFart) { this.jumpAgainFart = false; } else if (this.velocity.Y == 0f || this.sliding) { this.jumpAgainFart = true; } if (!this.doubleJumpSail) { this.jumpAgainSail = false; } else if (this.velocity.Y == 0f || this.sliding) { this.jumpAgainSail = true; } if (!this.doubleJumpUnicorn) { this.jumpAgainUnicorn = false; } else if (this.velocity.Y == 0f || this.sliding) { this.jumpAgainUnicorn = true; } } if (!this.carpet) { this.canCarpet = false; this.carpetFrame = -1; } else if (this.velocity.Y == 0f || this.sliding) { this.canCarpet = true; this.carpetTime = 0; this.carpetFrame = -1; this.carpetFrameCounter = 0f; } if (this.gravDir == -1f) { this.canCarpet = false; } if (this.ropeCount > 0) { this.ropeCount--; } if (!this.pulley && !this.frozen && !this.webbed && !this.stoned && !this.controlJump && this.gravDir == 1f && this.ropeCount == 0 && this.grappling[0] == -1 && !this.tongued && !this.mount.Active) { this.FindPulley(); } if (this.pulley) { if (this.mount.Active) { this.pulley = false; } this.sandStorm = false; this.dJumpEffectCloud = false; this.dJumpEffectSandstorm = false; this.dJumpEffectBlizzard = false; this.dJumpEffectFart = false; this.dJumpEffectSail = false; this.dJumpEffectUnicorn = false; int num49 = (int)(this.position.X + (float)(this.width / 2)) / 16; int num50 = (int)(this.position.Y - 8f) / 16; bool flag20 = false; if (this.pulleyDir == 0) { this.pulleyDir = 1; } if (this.pulleyDir == 1) { if (this.direction == -1 && this.controlLeft && (this.releaseLeft || this.leftTimer == 0)) { this.pulleyDir = 2; flag20 = true; } else if ((this.direction == 1 && this.controlRight && this.releaseRight) || this.rightTimer == 0) { this.pulleyDir = 2; flag20 = true; } else { if (this.direction == 1 && this.controlLeft) { this.direction = -1; flag20 = true; } if (this.direction == -1 && this.controlRight) { this.direction = 1; flag20 = true; } } } else if (this.pulleyDir == 2) { if (this.direction == 1 && this.controlLeft) { flag20 = true; int num51 = num49 * 16 + 8 - this.width / 2; if (!Collision.SolidCollision(new Vector2((float)num51, this.position.Y), this.width, this.height)) { this.pulleyDir = 1; this.direction = -1; flag20 = true; } } if (this.direction == -1 && this.controlRight) { flag20 = true; int num52 = num49 * 16 + 8 - this.width / 2; if (!Collision.SolidCollision(new Vector2((float)num52, this.position.Y), this.width, this.height)) { this.pulleyDir = 1; this.direction = 1; flag20 = true; } } } bool flag21 = false; if (!flag20 && ((this.controlLeft && (this.releaseLeft || this.leftTimer == 0)) || (this.controlRight && (this.releaseRight || this.rightTimer == 0)))) { int num53 = 1; if (this.controlLeft) { num53 = -1; } int num54 = num49 + num53; if (Main.tile[num54, num50].active() && Main.tileRope[(int)Main.tile[num54, num50].type]) { this.pulleyDir = 1; this.direction = num53; int num55 = num54 * 16 + 8 - this.width / 2; float num56 = this.position.Y; num56 = (float)(num50 * 16 + 22); if ((!Main.tile[num54, num50 - 1].active() || !Main.tileRope[(int)Main.tile[num54, num50 - 1].type]) && (!Main.tile[num54, num50 + 1].active() || !Main.tileRope[(int)Main.tile[num54, num50 + 1].type])) { num56 = (float)(num50 * 16 + 22); } if (Collision.SolidCollision(new Vector2((float)num55, num56), this.width, this.height)) { this.pulleyDir = 2; this.direction = -num53; if (this.direction == 1) { num55 = num54 * 16 + 8 - this.width / 2 + 6; } else { num55 = num54 * 16 + 8 - this.width / 2 + -6; } } if (i == Main.myPlayer) { Main.cameraX = Main.cameraX + this.position.X - (float)num55; } this.position.X = (float)num55; this.gfxOffY = this.position.Y - num56; this.position.Y = num56; flag21 = true; } } if (!flag21 && !flag20 && !this.controlUp && ((this.controlLeft && this.releaseLeft) || (this.controlRight && this.releaseRight))) { this.pulley = false; if (this.controlLeft && this.velocity.X == 0f) { this.velocity.X = -1f; } if (this.controlRight && this.velocity.X == 0f) { this.velocity.X = 1f; } } if (this.velocity.X != 0f) { this.pulley = false; } if (Main.tile[num49, num50] == null) { Main.tile[num49, num50] = new Tile(); } if (!Main.tile[num49, num50].active() || !Main.tileRope[(int)Main.tile[num49, num50].type]) { this.pulley = false; } if (this.gravDir != 1f) { this.pulley = false; } if (this.frozen || this.webbed || this.stoned) { this.pulley = false; } if (!this.pulley) { this.velocity.Y = this.velocity.Y - this.gravity; } if (this.controlJump) { this.pulley = false; this.jump = Player.jumpHeight; this.velocity.Y = -Player.jumpSpeed; } } if (this.pulley) { this.fallStart = (int)this.position.Y / 16; this.wingFrame = 0; if (this.wings == 4) { this.wingFrame = 3; } int num57 = (int)(this.position.X + (float)(this.width / 2)) / 16; int num58 = (int)(this.position.Y - 16f) / 16; int num59 = (int)(this.position.Y - 8f) / 16; bool flag22 = true; bool flag23 = false; if ((Main.tile[num57, num59 - 1].active() && Main.tileRope[(int)Main.tile[num57, num59 - 1].type]) || (Main.tile[num57, num59 + 1].active() && Main.tileRope[(int)Main.tile[num57, num59 + 1].type])) { flag23 = true; } if (Main.tile[num57, num58] == null) { Main.tile[num57, num58] = new Tile(); } if (!Main.tile[num57, num58].active() || !Main.tileRope[(int)Main.tile[num57, num58].type]) { flag22 = false; if (this.velocity.Y < 0f) { this.velocity.Y = 0f; } } if (flag23) { if (this.controlUp && flag22) { float num60 = this.position.X; float y3 = this.position.Y - Math.Abs(this.velocity.Y) - 2f; if (Collision.SolidCollision(new Vector2(num60, y3), this.width, this.height)) { num60 = (float)(num57 * 16 + 8 - this.width / 2 + 6); if (!Collision.SolidCollision(new Vector2(num60, y3), this.width, (int)((float)this.height + Math.Abs(this.velocity.Y) + 2f))) { if (i == Main.myPlayer) { Main.cameraX = Main.cameraX + this.position.X - num60; } this.pulleyDir = 2; this.direction = 1; this.position.X = num60; this.velocity.X = 0f; } else { num60 = (float)(num57 * 16 + 8 - this.width / 2 + -6); if (!Collision.SolidCollision(new Vector2(num60, y3), this.width, (int)((float)this.height + Math.Abs(this.velocity.Y) + 2f))) { if (i == Main.myPlayer) { Main.cameraX = Main.cameraX + this.position.X - num60; } this.pulleyDir = 2; this.direction = -1; this.position.X = num60; this.velocity.X = 0f; } } } if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.7f; } if (this.velocity.Y > -3f) { this.velocity.Y = this.velocity.Y - 0.2f; } else { this.velocity.Y = this.velocity.Y - 0.02f; } if (this.velocity.Y < -8f) { this.velocity.Y = -8f; } } else if (this.controlDown) { float num61 = this.position.X; float y4 = this.position.Y; if (Collision.SolidCollision(new Vector2(num61, y4), this.width, (int)((float)this.height + Math.Abs(this.velocity.Y) + 2f))) { num61 = (float)(num57 * 16 + 8 - this.width / 2 + 6); if (!Collision.SolidCollision(new Vector2(num61, y4), this.width, (int)((float)this.height + Math.Abs(this.velocity.Y) + 2f))) { if (i == Main.myPlayer) { Main.cameraX = Main.cameraX + this.position.X - num61; } this.pulleyDir = 2; this.direction = 1; this.position.X = num61; this.velocity.X = 0f; } else { num61 = (float)(num57 * 16 + 8 - this.width / 2 + -6); if (!Collision.SolidCollision(new Vector2(num61, y4), this.width, (int)((float)this.height + Math.Abs(this.velocity.Y) + 2f))) { if (i == Main.myPlayer) { Main.cameraX = Main.cameraX + this.position.X - num61; } this.pulleyDir = 2; this.direction = -1; this.position.X = num61; this.velocity.X = 0f; } } } if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.7f; } if (this.velocity.Y < 3f) { this.velocity.Y = this.velocity.Y + 0.2f; } else { this.velocity.Y = this.velocity.Y + 0.1f; } if (this.velocity.Y > this.maxFallSpeed) { this.velocity.Y = this.maxFallSpeed; } } else { this.velocity.Y = this.velocity.Y * 0.7f; if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1) { this.velocity.Y = 0f; } } } else if (this.controlDown) { this.ropeCount = 10; this.pulley = false; this.velocity.Y = 1f; } else { this.velocity.Y = 0f; this.position.Y = (float)(num58 * 16 + 22); } float num62 = (float)(num57 * 16 + 8 - this.width / 2); if (this.pulleyDir == 1) { num62 = (float)(num57 * 16 + 8 - this.width / 2); } if (this.pulleyDir == 2) { num62 = (float)(num57 * 16 + 8 - this.width / 2 + 6 * this.direction); } if (i == Main.myPlayer) { Main.cameraX = Main.cameraX + this.position.X - num62; } this.position.X = num62; this.pulleyFrameCounter += Math.Abs(this.velocity.Y * 0.75f); if (this.velocity.Y != 0f) { this.pulleyFrameCounter += 0.75f; } if (this.pulleyFrameCounter > 10f) { this.pulleyFrame++; this.pulleyFrameCounter = 0f; } if (this.pulleyFrame > 1) { this.pulleyFrame = 0; } this.canCarpet = true; this.carpetFrame = -1; this.wingTime = (float)this.wingTimeMax; this.rocketTime = this.rocketTimeMax; this.rocketDelay = 0; this.rocketFrame = false; this.canRocket = false; this.rocketRelease = false; this.DashMovement(); } else if (this.grappling[0] == -1 && !this.tongued) { if (this.wingsLogic > 0 && this.velocity.Y != 0f && !this.merman) { if (this.wingsLogic == 1 || this.wingsLogic == 2) { this.accRunSpeed = 6.25f; } if (this.wingsLogic == 4) { this.accRunSpeed = 6.5f; } if (this.wingsLogic == 5 || this.wingsLogic == 6 || this.wingsLogic == 13 || this.wingsLogic == 15) { this.accRunSpeed = 6.75f; } if (this.wingsLogic == 7 || this.wingsLogic == 8) { this.accRunSpeed = 7f; } if (this.wingsLogic == 9 || this.wingsLogic == 10 || this.wingsLogic == 11 || this.wingsLogic == 20 || this.wingsLogic == 21 || this.wingsLogic == 23 || this.wingsLogic == 24) { this.accRunSpeed = 7.5f; } if (this.wingsLogic == 22) { if (this.controlDown && this.controlJump && this.wingTime > 0f) { this.accRunSpeed = 10f; this.runAcceleration *= 10f; } else { this.accRunSpeed = 6.25f; } } if (this.wingsLogic == 30) { if (this.controlDown && this.controlJump && this.wingTime > 0f) { this.accRunSpeed = 12f; this.runAcceleration *= 12f; } else { this.accRunSpeed = 6.5f; this.runAcceleration *= 1.5f; } } if (this.wingsLogic == 32) { if (this.controlDown && this.controlJump && this.wingTime > 0f) { this.accRunSpeed = 7.5f; this.runAcceleration *= 5f; } else { this.accRunSpeed = 5.5f; this.runAcceleration *= 1.1f; } } if (this.wingsLogic == 26) { this.accRunSpeed = 8f; this.runAcceleration *= 2f; } if (this.wingsLogic == 29) { this.accRunSpeed = 9f; this.runAcceleration *= 2.5f; } if (this.wingsLogic == 12) { this.accRunSpeed = 7.75f; } if (this.wingsLogic == 16 || this.wingsLogic == 17 || this.wingsLogic == 18 || this.wingsLogic == 19 || this.wingsLogic == 34 || this.wingsLogic == 3 || this.wingsLogic == 28 || this.wingsLogic == 33 || this.wingsLogic == 34 || this.wingsLogic == 35 || this.wingsLogic == 36) { this.accRunSpeed = 7f; } } if (this.sticky) { this.maxRunSpeed *= 0.25f; this.runAcceleration *= 0.25f; this.runSlowdown *= 2f; if (this.velocity.X > this.maxRunSpeed) { this.velocity.X = this.maxRunSpeed; } if (this.velocity.X < -this.maxRunSpeed) { this.velocity.X = -this.maxRunSpeed; } } else if (this.powerrun) { this.maxRunSpeed *= 3.5f; this.runAcceleration *= 1f; this.runSlowdown *= 2f; } else if (this.slippy2) { this.runAcceleration *= 0.6f; this.runSlowdown = 0f; if (this.iceSkate) { this.runAcceleration *= 3.5f; this.maxRunSpeed *= 1.25f; } } else if (this.slippy) { this.runAcceleration *= 0.7f; if (this.iceSkate) { this.runAcceleration *= 3.5f; this.maxRunSpeed *= 1.25f; } else { this.runSlowdown *= 0.1f; } } if (this.sandStorm) { this.runAcceleration *= 1.5f; this.maxRunSpeed *= 2f; } if (this.dJumpEffectBlizzard && this.doubleJumpBlizzard) { this.runAcceleration *= 3f; this.maxRunSpeed *= 1.5f; } if (this.dJumpEffectFart && this.doubleJumpFart) { this.runAcceleration *= 3f; this.maxRunSpeed *= 1.75f; } if (this.dJumpEffectUnicorn && this.doubleJumpUnicorn) { this.runAcceleration *= 3f; this.maxRunSpeed *= 1.5f; } if (this.dJumpEffectSail && this.doubleJumpSail) { this.runAcceleration *= 1.5f; this.maxRunSpeed *= 1.25f; } if (this.carpetFrame != -1) { this.runAcceleration *= 1.25f; this.maxRunSpeed *= 1.5f; } if (this.inventory[this.selectedItem].type == 3106 && this.stealth < 1f) { float num63 = this.maxRunSpeed / 2f * (1f - this.stealth); this.maxRunSpeed -= num63; this.accRunSpeed = this.maxRunSpeed; } if (this.mount.Active) { this.rocketBoots = 0; this.wings = 0; this.wingsLogic = 0; this.maxRunSpeed = this.mount.RunSpeed; this.accRunSpeed = this.mount.DashSpeed; this.runAcceleration = this.mount.Acceleration; if (this.mount.Type == 12 && !this.MountFishronSpecial) { this.runAcceleration /= 2f; this.maxRunSpeed /= 2f; } this.mount.AbilityRecovery(); if (this.mount.Cart && this.velocity.Y == 0f) { if (!Minecart.OnTrack(this.position, this.width, this.height)) { this.fullRotation = 0f; this.onWrongGround = true; this.runSlowdown = 0.2f; if ((this.controlLeft && this.releaseLeft) || (this.controlRight && this.releaseRight)) { this.mount.Dismount(this); } } else { this.runSlowdown = this.runAcceleration; this.onWrongGround = false; } } if (this.mount.Type == 8) { this.mount.UpdateDrill(this, this.controlUp, this.controlDown); } } this.HorizontalMovement(); if (this.gravControl) { if (this.controlUp && this.releaseUp) { if (this.gravDir == 1f) { this.gravDir = -1f; this.fallStart = (int)(this.position.Y / 16f); this.jump = 0; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8); } else { this.gravDir = 1f; this.fallStart = (int)(this.position.Y / 16f); this.jump = 0; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8); } } } else if (this.gravControl2) { if (this.controlUp && this.releaseUp && this.velocity.Y == 0f) { if (this.gravDir == 1f) { this.gravDir = -1f; this.fallStart = (int)(this.position.Y / 16f); this.jump = 0; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8); } else { this.gravDir = 1f; this.fallStart = (int)(this.position.Y / 16f); this.jump = 0; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8); } } } else { this.gravDir = 1f; } if (this.velocity.Y == 0f && this.mount.Active && this.mount.CanHover && this.controlUp && this.releaseUp) { this.velocity.Y = -(this.mount.Acceleration + this.gravity + 0.001f); } if (this.controlUp) { this.releaseUp = false; } else { this.releaseUp = true; } this.sandStorm = false; this.JumpMovement(); if (this.wingsLogic == 0) { this.wingTime = 0f; } if (this.rocketBoots == 0) { this.rocketTime = 0; } if (this.jump == 0) { this.dJumpEffectCloud = false; this.dJumpEffectSandstorm = false; this.dJumpEffectBlizzard = false; this.dJumpEffectFart = false; this.dJumpEffectSail = false; this.dJumpEffectUnicorn = false; } this.DashMovement(); this.WallslideMovement(); this.CarpetMovement(); this.DoubleJumpVisuals(); if (this.wings > 0 || this.mount.Active) { this.sandStorm = false; } if (((this.gravDir == 1f && this.velocity.Y > -Player.jumpSpeed) || (this.gravDir == -1f && this.velocity.Y < Player.jumpSpeed)) && this.velocity.Y != 0f) { this.canRocket = true; } bool flag24 = false; if (((this.velocity.Y == 0f || this.sliding) && this.releaseJump) || (this.autoJump && this.justJumped)) { this.mount.ResetFlightTime(this.velocity.X); this.wingTime = (float)this.wingTimeMax; } if (this.wingsLogic > 0 && this.controlJump && this.wingTime > 0f && !this.jumpAgainCloud && this.jump == 0 && this.velocity.Y != 0f) { flag24 = true; } if ((this.wingsLogic == 22 || this.wingsLogic == 28 || this.wingsLogic == 30 || this.wingsLogic == 32 || this.wingsLogic == 33 || this.wingsLogic == 35) && this.controlJump && this.controlDown && this.wingTime > 0f) { flag24 = true; } if (this.frozen || this.webbed || this.stoned) { if (this.mount.Active) { this.mount.Dismount(this); } this.velocity.Y = this.velocity.Y + this.gravity; if (this.velocity.Y > this.maxFallSpeed) { this.velocity.Y = this.maxFallSpeed; } this.sandStorm = false; this.dJumpEffectCloud = false; this.dJumpEffectSandstorm = false; this.dJumpEffectBlizzard = false; this.dJumpEffectFart = false; this.dJumpEffectSail = false; this.dJumpEffectUnicorn = false; } else { if (flag24) { if (this.wings == 10 && Main.rand.Next(2) == 0) { int num64 = 4; if (this.direction == 1) { num64 = -40; } int num65 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num64, this.position.Y + (float)(this.height / 2) - 15f), 30, 30, 76, 0f, 0f, 50, default(Color), 0.6f); Main.dust[num65].fadeIn = 1.1f; Main.dust[num65].noGravity = true; Main.dust[num65].noLight = true; Main.dust[num65].velocity *= 0.3f; Main.dust[num65].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); } if (this.wings == 34 && Main.rand.Next(2) == 0) { int num66 = 4; if (this.direction == 1) { num66 = -40; } int num67 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num66, this.position.Y + (float)(this.height / 2) - 15f), 30, 30, 261, 0f, 0f, 50, default(Color), 0.6f); Main.dust[num67].fadeIn = 1.1f; Main.dust[num67].noGravity = true; Main.dust[num67].noLight = true; Main.dust[num67].velocity *= 0.3f; Main.dust[num67].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); } if (this.wings == 9 && Main.rand.Next(2) == 0) { int num68 = 4; if (this.direction == 1) { num68 = -40; } int num69 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num68, this.position.Y + (float)(this.height / 2) - 15f), 30, 30, 6, 0f, 0f, 200, default(Color), 2f); Main.dust[num69].noGravity = true; Main.dust[num69].velocity *= 0.3f; Main.dust[num69].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); } if (this.wings == 6 && Main.rand.Next(4) == 0) { int num70 = 4; if (this.direction == 1) { num70 = -40; } int num71 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num70, this.position.Y + (float)(this.height / 2) - 15f), 30, 30, 55, 0f, 0f, 200, default(Color), 1f); Main.dust[num71].velocity *= 0.3f; Main.dust[num71].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); } if (this.wings == 5 && Main.rand.Next(3) == 0) { int num72 = 6; if (this.direction == 1) { num72 = -30; } int num73 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num72, this.position.Y), 18, this.height, 58, 0f, 0f, 255, default(Color), 1.2f); Main.dust[num73].velocity *= 0.3f; Main.dust[num73].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); } if (this.wings == 26) { int num74 = 6; if (this.direction == 1) { num74 = -30; } int num75 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num74, this.position.Y), 18, this.height, 217, 0f, 0f, 100, default(Color), 1.4f); Main.dust[num75].noGravity = true; Main.dust[num75].noLight = true; Main.dust[num75].velocity /= 4f; Main.dust[num75].velocity -= this.velocity; Main.dust[num75].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); if (Main.rand.Next(2) == 0) { num74 = -24; if (this.direction == 1) { num74 = 12; } float num76 = this.position.Y; if (this.gravDir == -1f) { num76 += (float)(this.height / 2); } num75 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num74, num76), 12, this.height / 2, 217, 0f, 0f, 100, default(Color), 1.4f); Main.dust[num75].noGravity = true; Main.dust[num75].noLight = true; Main.dust[num75].velocity /= 4f; Main.dust[num75].velocity -= this.velocity; Main.dust[num75].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); } } if (this.wings == 29 && Main.rand.Next(3) == 0) { int num77 = 4; if (this.direction == 1) { num77 = -40; } int num78 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num77, this.position.Y + (float)(this.height / 2) - 15f), 30, 30, 6, 0f, 0f, 100, default(Color), 2.4f); Main.dust[num78].noGravity = true; Main.dust[num78].velocity *= 0.3f; if (Main.rand.Next(10) == 0) { Main.dust[num78].fadeIn = 2f; } Main.dust[num78].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); } if (this.wings == 31) { if (Main.rand.Next(6) == 0) { int num79 = 4; if (this.direction == 1) { num79 = -40; } Dust dust3 = Main.dust[Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num79, this.position.Y + (float)(this.height / 2) - 15f), 30, 30, 86, 0f, 0f, 0, default(Color), 1f)]; dust3.noGravity = true; dust3.scale = 1f; dust3.fadeIn = 1.2f; dust3.velocity *= 0.2f; dust3.noLight = true; dust3.shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); } if (Main.rand.Next(3) == 0) { int num80 = 4; if (this.direction == 1) { num80 = -40; } Dust dust4 = Main.dust[Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num80, this.position.Y + (float)(this.height / 2) - 15f), 30, 30, 240, 0f, 0f, 0, default(Color), 1f)]; dust4.noGravity = true; dust4.scale = 1.2f; dust4.velocity *= 0.2f; dust4.alpha = 200; dust4.shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); } if (Main.rand.Next(2) == 0) { if (Main.rand.Next(6) == 0) { int num81 = -24; if (this.direction == 1) { num81 = 12; } float num82 = this.position.Y; if (this.gravDir == -1f) { num82 += (float)(this.height / 2); } Dust dust5 = Main.dust[Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num81, num82), 12, this.height / 2, 86, 0f, 0f, 0, default(Color), 1f)]; dust5.noGravity = true; dust5.scale = 1f; dust5.fadeIn = 1.2f; dust5.velocity *= 0.2f; dust5.noLight = true; dust5.shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); } if (Main.rand.Next(3) == 0) { int num81 = -24; if (this.direction == 1) { num81 = 12; } float num83 = this.position.Y; if (this.gravDir == -1f) { num83 += (float)(this.height / 2); } Dust dust6 = Main.dust[Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num81, num83), 12, this.height / 2, 240, 0f, 0f, 0, default(Color), 1f)]; dust6.noGravity = true; dust6.scale = 1.2f; dust6.velocity *= 0.2f; dust6.alpha = 200; dust6.shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); } } } this.WingMovement(); } if (this.wings == 4) { if (flag24 || this.jump > 0) { this.rocketDelay2--; if (this.rocketDelay2 <= 0) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 13); this.rocketDelay2 = 60; } int num84 = 2; if (this.controlUp) { num84 = 4; } for (int num85 = 0; num85 < num84; num85++) { int type = 6; if (this.head == 41) { int arg_5D0E_0 = this.body; } float scale = 1.75f; int alpha = 100; float x3 = this.position.X + (float)(this.width / 2) + 16f; if (this.direction > 0) { x3 = this.position.X + (float)(this.width / 2) - 26f; } float num86 = this.position.Y + (float)this.height - 18f; if (num85 == 1 || num85 == 3) { x3 = this.position.X + (float)(this.width / 2) + 8f; if (this.direction > 0) { x3 = this.position.X + (float)(this.width / 2) - 20f; } num86 += 6f; } if (num85 > 1) { num86 += this.velocity.Y; } int num87 = Dust.NewDust(new Vector2(x3, num86), 8, 8, type, 0f, 0f, alpha, default(Color), scale); Dust expr_5E21_cp_0 = Main.dust[num87]; expr_5E21_cp_0.velocity.X = expr_5E21_cp_0.velocity.X * 0.1f; Main.dust[num87].velocity.Y = Main.dust[num87].velocity.Y * 1f + 2f * this.gravDir - this.velocity.Y * 0.3f; Main.dust[num87].noGravity = true; Main.dust[num87].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); if (num84 == 4) { Dust expr_5EB9_cp_0 = Main.dust[num87]; expr_5EB9_cp_0.velocity.Y = expr_5EB9_cp_0.velocity.Y + 6f; } } this.wingFrameCounter++; if (this.wingFrameCounter > 4) { this.wingFrame++; this.wingFrameCounter = 0; if (this.wingFrame >= 3) { this.wingFrame = 0; } } } else if (!this.controlJump || this.velocity.Y == 0f) { this.wingFrame = 3; } } else if (this.wings == 28) { if (this.velocity.Y != 0f) { Lighting.AddLight(base.Bottom, 0.3f, 0.1f, 0.4f); } } else if (this.wings == 22) { if (!this.controlJump) { this.wingFrame = 0; this.wingFrameCounter = 0; } else if (this.wingTime > 0f) { if (this.controlDown) { if (this.velocity.X != 0f) { this.wingFrameCounter++; int num88 = 2; if (this.wingFrameCounter < num88) { this.wingFrame = 1; } else if (this.wingFrameCounter < num88 * 2) { this.wingFrame = 2; } else if (this.wingFrameCounter < num88 * 3) { this.wingFrame = 3; } else if (this.wingFrameCounter < num88 * 4 - 1) { this.wingFrame = 2; } else { this.wingFrame = 2; this.wingFrameCounter = 0; } } else { this.wingFrameCounter++; int num89 = 6; if (this.wingFrameCounter < num89) { this.wingFrame = 4; } else if (this.wingFrameCounter < num89 * 2) { this.wingFrame = 5; } else if (this.wingFrameCounter < num89 * 3 - 1) { this.wingFrame = 4; } else { this.wingFrame = 4; this.wingFrameCounter = 0; } } } else { this.wingFrameCounter++; int num90 = 2; if (this.wingFrameCounter < num90) { this.wingFrame = 4; } else if (this.wingFrameCounter < num90 * 2) { this.wingFrame = 5; } else if (this.wingFrameCounter < num90 * 3) { this.wingFrame = 6; } else if (this.wingFrameCounter < num90 * 4 - 1) { this.wingFrame = 5; } else { this.wingFrame = 5; this.wingFrameCounter = 0; } } } else { this.wingFrameCounter++; int num91 = 6; if (this.wingFrameCounter < num91) { this.wingFrame = 4; } else if (this.wingFrameCounter < num91 * 2) { this.wingFrame = 5; } else if (this.wingFrameCounter < num91 * 3 - 1) { this.wingFrame = 4; } else { this.wingFrame = 4; this.wingFrameCounter = 0; } } } else if (this.wings == 12) { if (flag24 || this.jump > 0) { this.wingFrameCounter++; int num92 = 5; if (this.wingFrameCounter < num92) { this.wingFrame = 1; } else if (this.wingFrameCounter < num92 * 2) { this.wingFrame = 2; } else if (this.wingFrameCounter < num92 * 3) { this.wingFrame = 3; } else if (this.wingFrameCounter < num92 * 4 - 1) { this.wingFrame = 2; } else { this.wingFrame = 2; this.wingFrameCounter = 0; } } else if (this.velocity.Y != 0f) { this.wingFrame = 2; } else { this.wingFrame = 0; } } else if (this.wings == 24) { if (flag24 || this.jump > 0) { this.wingFrameCounter++; int num93 = 1; if (this.wingFrameCounter < num93) { this.wingFrame = 1; } else if (this.wingFrameCounter < num93 * 2) { this.wingFrame = 2; } else if (this.wingFrameCounter < num93 * 3) { this.wingFrame = 3; } else { this.wingFrame = 2; if (this.wingFrameCounter >= num93 * 4 - 1) { this.wingFrameCounter = 0; } } } else if (this.velocity.Y != 0f) { if (this.controlJump) { this.wingFrameCounter++; int num94 = 3; if (this.wingFrameCounter < num94) { this.wingFrame = 1; } else if (this.wingFrameCounter < num94 * 2) { this.wingFrame = 2; } else if (this.wingFrameCounter < num94 * 3) { this.wingFrame = 3; } else { this.wingFrame = 2; if (this.wingFrameCounter >= num94 * 4 - 1) { this.wingFrameCounter = 0; } } } else if (this.wingTime == 0f) { this.wingFrame = 0; } else { this.wingFrame = 1; } } else { this.wingFrame = 0; } } else if (this.wings == 30) { bool flag25 = false; if (flag24 || this.jump > 0) { this.wingFrameCounter++; int num95 = 2; if (this.wingFrameCounter >= num95 * 3) { this.wingFrameCounter = 0; } this.wingFrame = 1 + this.wingFrameCounter / num95; flag25 = true; } else if (this.velocity.Y != 0f) { if (this.controlJump) { this.wingFrameCounter++; int num96 = 2; if (this.wingFrameCounter >= num96 * 3) { this.wingFrameCounter = 0; } this.wingFrame = 1 + this.wingFrameCounter / num96; flag25 = true; } else if (this.wingTime == 0f) { this.wingFrame = 0; } else { this.wingFrame = 0; } } else { this.wingFrame = 0; } if (flag25) { for (int num97 = 0; num97 < 4; num97++) { if (Main.rand.Next(4) == 0) { Vector2 value = (-0.745398164f + 0.3926991f * (float)num97 + 0.03f * (float)num97).ToRotationVector2() * new Vector2((float)(-(float)this.direction * 20), 20f); Dust dust7 = Main.dust[Dust.NewDust(base.Center, 0, 0, 229, 0f, 0f, 100, Color.White, 0.8f)]; dust7.noGravity = true; dust7.position = base.Center + value; dust7.velocity = base.DirectionTo(dust7.position) * 2f; if (Main.rand.Next(10) != 0) { dust7.customData = this; } else { dust7.fadeIn = 0.5f; } dust7.shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); } } for (int num98 = 0; num98 < 4; num98++) { if (Main.rand.Next(8) == 0) { Vector2 value2 = (-0.7053982f + 0.3926991f * (float)num98 + 0.03f * (float)num98).ToRotationVector2() * new Vector2((float)(this.direction * 20), 24f) + new Vector2((float)(-(float)this.direction) * 16f, 0f); Dust dust8 = Main.dust[Dust.NewDust(base.Center, 0, 0, 229, 0f, 0f, 100, Color.White, 0.5f)]; dust8.noGravity = true; dust8.position = base.Center + value2; dust8.velocity = Vector2.Normalize(dust8.position - base.Center - new Vector2((float)(-(float)this.direction) * 16f, 0f)) * 2f; dust8.position += dust8.velocity * 5f; if (Main.rand.Next(10) != 0) { dust8.customData = this; } else { dust8.fadeIn = 0.5f; } dust8.shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); } } } } else if (this.wings == 34) { if (flag24 || this.jump > 0) { this.wingFrameCounter++; int num99 = 4; if (this.wingFrameCounter >= num99 * 6) { this.wingFrameCounter = 0; } this.wingFrame = this.wingFrameCounter / num99; } else if (this.velocity.Y != 0f) { if (this.controlJump) { this.wingFrameCounter++; int num100 = 9; if (this.wingFrameCounter >= num100 * 6) { this.wingFrameCounter = 0; } this.wingFrame = this.wingFrameCounter / num100; } else { this.wingFrameCounter++; int num101 = 6; if (this.wingFrameCounter >= num101 * 6) { this.wingFrameCounter = 0; } this.wingFrame = this.wingFrameCounter / num101; } } else { this.wingFrameCounter++; int num102 = 4; if (this.wingFrameCounter >= num102 * 6) { this.wingFrameCounter = 0; } this.wingFrame = this.wingFrameCounter / num102; } } else if (this.wings == 33) { bool flag26 = false; if (flag24 || this.jump > 0) { flag26 = true; } else if (this.velocity.Y != 0f && this.controlJump) { flag26 = true; } if (flag26) { Color newColor = Main.hslToRgb(Main.rgbToHsl(this.eyeColor).X, 1f, 0.5f); int num103 = (this.direction == 1) ? 0 : -4; for (int num104 = 0; num104 < 2; num104++) { Dust dust9 = Main.dust[Dust.NewDust(this.position, this.width, this.height, 182, this.velocity.X, this.velocity.Y, 127, newColor, 1f)]; dust9.noGravity = true; dust9.fadeIn = 1f; dust9.scale = 1f; dust9.noLight = true; if (num104 == 0) { dust9.position = new Vector2(this.position.X + (float)num103, this.position.Y + (float)this.height); dust9.velocity.X = dust9.velocity.X * 1f - 2f - this.velocity.X * 0.3f; dust9.velocity.Y = dust9.velocity.Y * 1f + 2f * this.gravDir - this.velocity.Y * 0.3f; } else if (num104 == 1) { dust9.position = new Vector2(this.position.X + (float)this.width + (float)num103, this.position.Y + (float)this.height); dust9.velocity.X = dust9.velocity.X * 1f + 2f - this.velocity.X * 0.3f; dust9.velocity.Y = dust9.velocity.Y * 1f + 2f * this.gravDir - this.velocity.Y * 0.3f; } Dust dust10 = Dust.CloneDust(dust9); dust10.scale *= 0.65f; dust10.fadeIn *= 0.65f; dust10.color = new Color(255, 255, 255, 255); dust9.noLight = true; dust9.shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); } } } else { int num105 = 4; if (this.wings == 32) { num105 = 3; } if (flag24 || this.jump > 0) { this.wingFrameCounter++; if (this.wingFrameCounter > num105) { this.wingFrame++; this.wingFrameCounter = 0; if (this.wingFrame >= 4) { this.wingFrame = 0; } } } else if (this.velocity.Y != 0f) { this.wingFrame = 1; if (this.wings == 32) { this.wingFrame = 3; } if (this.wings == 29 && Main.rand.Next(5) == 0) { int num106 = 4; if (this.direction == 1) { num106 = -40; } int num107 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num106, this.position.Y + (float)(this.height / 2) - 15f), 30, 30, 6, 0f, 0f, 100, default(Color), 2.4f); Main.dust[num107].noGravity = true; Main.dust[num107].velocity *= 0.3f; if (Main.rand.Next(10) == 0) { Main.dust[num107].fadeIn = 2f; } Main.dust[num107].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); } } else { this.wingFrame = 0; } } if (this.wingsLogic > 0 && this.rocketBoots > 0 && this.velocity.Y != 0f) { this.wingTime += (float)(this.rocketTime * 6); this.rocketTime = 0; } if (flag24 && this.wings != 4 && this.wings != 22 && this.wings != 0 && this.wings != 24 && this.wings != 28 && this.wings != 30 && this.wings != 33) { if (this.wingFrame == 3) { if (!this.flapSound) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 32); } this.flapSound = true; } else { this.flapSound = false; } } if (this.velocity.Y == 0f || this.sliding || (this.autoJump && this.justJumped)) { this.rocketTime = this.rocketTimeMax; } if ((this.wingTime == 0f || this.wingsLogic == 0) && this.rocketBoots > 0 && this.controlJump && this.rocketDelay == 0 && this.canRocket && this.rocketRelease && !this.jumpAgainCloud) { if (this.rocketTime > 0) { this.rocketTime--; this.rocketDelay = 10; if (this.rocketDelay2 <= 0) { if (this.rocketBoots == 1) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 13); this.rocketDelay2 = 30; } else if (this.rocketBoots == 2 || this.rocketBoots == 3) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 24); this.rocketDelay2 = 15; } } } else { this.canRocket = false; } } if (this.rocketDelay2 > 0) { this.rocketDelay2--; } if (this.rocketDelay == 0) { this.rocketFrame = false; } if (this.rocketDelay > 0) { int num108 = this.height; if (this.gravDir == -1f) { num108 = 4; } this.rocketFrame = true; for (int num109 = 0; num109 < 2; num109++) { int type2 = 6; float scale2 = 2.5f; int alpha2 = 100; if (this.rocketBoots == 2) { type2 = 16; scale2 = 1.5f; alpha2 = 20; } else if (this.rocketBoots == 3) { type2 = 76; scale2 = 1f; alpha2 = 20; } else if (this.socialShadow) { type2 = 27; scale2 = 1.5f; } if (num109 == 0) { int num110 = Dust.NewDust(new Vector2(this.position.X - 4f, this.position.Y + (float)num108 - 10f), 8, 8, type2, 0f, 0f, alpha2, default(Color), scale2); Main.dust[num110].shader = GameShaders.Armor.GetSecondaryShader(this.cShoe, this); if (this.rocketBoots == 1) { Main.dust[num110].noGravity = true; } Main.dust[num110].velocity.X = Main.dust[num110].velocity.X * 1f - 2f - this.velocity.X * 0.3f; Main.dust[num110].velocity.Y = Main.dust[num110].velocity.Y * 1f + 2f * this.gravDir - this.velocity.Y * 0.3f; if (this.rocketBoots == 2) { Main.dust[num110].velocity *= 0.1f; } if (this.rocketBoots == 3) { Main.dust[num110].velocity *= 0.05f; Dust expr_70CC_cp_0 = Main.dust[num110]; expr_70CC_cp_0.velocity.Y = expr_70CC_cp_0.velocity.Y + 0.15f; Main.dust[num110].noLight = true; if (Main.rand.Next(2) == 0) { Main.dust[num110].noGravity = true; Main.dust[num110].scale = 1.75f; } } } else { int num111 = Dust.NewDust(new Vector2(this.position.X + (float)this.width - 4f, this.position.Y + (float)num108 - 10f), 8, 8, type2, 0f, 0f, alpha2, default(Color), scale2); Main.dust[num111].shader = GameShaders.Armor.GetSecondaryShader(this.cShoe, this); if (this.rocketBoots == 1) { Main.dust[num111].noGravity = true; } Main.dust[num111].velocity.X = Main.dust[num111].velocity.X * 1f + 2f - this.velocity.X * 0.3f; Main.dust[num111].velocity.Y = Main.dust[num111].velocity.Y * 1f + 2f * this.gravDir - this.velocity.Y * 0.3f; if (this.rocketBoots == 2) { Main.dust[num111].velocity *= 0.1f; } if (this.rocketBoots == 3) { Main.dust[num111].velocity *= 0.05f; Dust expr_7293_cp_0 = Main.dust[num111]; expr_7293_cp_0.velocity.Y = expr_7293_cp_0.velocity.Y + 0.15f; Main.dust[num111].noLight = true; if (Main.rand.Next(2) == 0) { Main.dust[num111].noGravity = true; Main.dust[num111].scale = 1.75f; } } } } if (this.rocketDelay == 0) { this.releaseJump = true; } this.rocketDelay--; this.velocity.Y = this.velocity.Y - 0.1f * this.gravDir; if (this.gravDir == 1f) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y - 0.5f; } else if ((double)this.velocity.Y > (double)(-(double)Player.jumpSpeed) * 0.5) { this.velocity.Y = this.velocity.Y - 0.1f; } if (this.velocity.Y < -Player.jumpSpeed * 1.5f) { this.velocity.Y = -Player.jumpSpeed * 1.5f; } } else { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y + 0.5f; } else if ((double)this.velocity.Y < (double)Player.jumpSpeed * 0.5) { this.velocity.Y = this.velocity.Y + 0.1f; } if (this.velocity.Y > Player.jumpSpeed * 1.5f) { this.velocity.Y = Player.jumpSpeed * 1.5f; } } } else if (!flag24) { if (this.mount.CanHover) { this.mount.Hover(this); } else if (this.mount.CanFly && this.controlJump && this.jump == 0) { if (this.mount.Flight()) { if (this.controlDown) { this.velocity.Y = this.velocity.Y * 0.9f; if (this.velocity.Y > -1f && (double)this.velocity.Y < 0.5) { this.velocity.Y = 1E-05f; } } else { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y - 0.5f; } else if ((double)this.velocity.Y > (double)(-(double)Player.jumpSpeed) * 1.5) { this.velocity.Y = this.velocity.Y - 0.1f; } if (this.velocity.Y < -Player.jumpSpeed * 1.5f) { this.velocity.Y = -Player.jumpSpeed * 1.5f; } } } else { this.velocity.Y = this.velocity.Y + this.gravity / 3f * this.gravDir; if (this.gravDir == 1f) { if (this.velocity.Y > this.maxFallSpeed / 3f && !this.controlDown) { this.velocity.Y = this.maxFallSpeed / 3f; } } else if (this.velocity.Y < -this.maxFallSpeed / 3f && !this.controlUp) { this.velocity.Y = -this.maxFallSpeed / 3f; } } } else if (this.slowFall && ((!this.controlDown && this.gravDir == 1f) || (!this.controlDown && this.gravDir == -1f))) { if ((this.controlUp && this.gravDir == 1f) || (this.controlUp && this.gravDir == -1f)) { this.gravity = this.gravity / 10f * this.gravDir; } else { this.gravity = this.gravity / 3f * this.gravDir; } this.velocity.Y = this.velocity.Y + this.gravity; } else if (this.wingsLogic > 0 && this.controlJump && this.velocity.Y > 0f) { this.fallStart = (int)(this.position.Y / 16f); if (this.velocity.Y > 0f) { if (this.wings == 10 && Main.rand.Next(3) == 0) { int num112 = 4; if (this.direction == 1) { num112 = -40; } int num113 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num112, this.position.Y + (float)(this.height / 2) - 15f), 30, 30, 76, 0f, 0f, 50, default(Color), 0.6f); Main.dust[num113].fadeIn = 1.1f; Main.dust[num113].noGravity = true; Main.dust[num113].noLight = true; Main.dust[num113].velocity *= 0.3f; Main.dust[num113].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); } if (this.wings == 34 && Main.rand.Next(3) == 0) { int num114 = 4; if (this.direction == 1) { num114 = -40; } int num115 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num114, this.position.Y + (float)(this.height / 2) - 15f), 30, 30, 261, 0f, 0f, 50, default(Color), 0.6f); Main.dust[num115].fadeIn = 1.1f; Main.dust[num115].noGravity = true; Main.dust[num115].noLight = true; Main.dust[num115].velocity *= 0.3f; Main.dust[num115].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); } if (this.wings == 9 && Main.rand.Next(3) == 0) { int num116 = 8; if (this.direction == 1) { num116 = -40; } int num117 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num116, this.position.Y + (float)(this.height / 2) - 15f), 30, 30, 6, 0f, 0f, 200, default(Color), 2f); Main.dust[num117].noGravity = true; Main.dust[num117].velocity *= 0.3f; Main.dust[num117].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); } if (this.wings == 29 && Main.rand.Next(3) == 0) { int num118 = 8; if (this.direction == 1) { num118 = -40; } int num119 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num118, this.position.Y + (float)(this.height / 2) - 15f), 30, 30, 6, 0f, 0f, 100, default(Color), 2.4f); Main.dust[num119].noGravity = true; Main.dust[num119].velocity *= 0.3f; if (Main.rand.Next(10) == 0) { Main.dust[num119].fadeIn = 2f; } Main.dust[num119].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); } if (this.wings == 6) { if (Main.rand.Next(10) == 0) { int num120 = 4; if (this.direction == 1) { num120 = -40; } int num121 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num120, this.position.Y + (float)(this.height / 2) - 12f), 30, 20, 55, 0f, 0f, 200, default(Color), 1f); Main.dust[num121].velocity *= 0.3f; Main.dust[num121].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); } } else if (this.wings == 5 && Main.rand.Next(6) == 0) { int num122 = 6; if (this.direction == 1) { num122 = -30; } int num123 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num122, this.position.Y), 18, this.height, 58, 0f, 0f, 255, default(Color), 1.2f); Main.dust[num123].velocity *= 0.3f; Main.dust[num123].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); } if (this.wings == 4) { this.rocketDelay2--; if (this.rocketDelay2 <= 0) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 13); this.rocketDelay2 = 60; } int type3 = 6; float scale3 = 1.5f; int alpha3 = 100; float x4 = this.position.X + (float)(this.width / 2) + 16f; if (this.direction > 0) { x4 = this.position.X + (float)(this.width / 2) - 26f; } float num124 = this.position.Y + (float)this.height - 18f; if (Main.rand.Next(2) == 1) { x4 = this.position.X + (float)(this.width / 2) + 8f; if (this.direction > 0) { x4 = this.position.X + (float)(this.width / 2) - 20f; } num124 += 6f; } int num125 = Dust.NewDust(new Vector2(x4, num124), 8, 8, type3, 0f, 0f, alpha3, default(Color), scale3); Dust expr_7E3C_cp_0 = Main.dust[num125]; expr_7E3C_cp_0.velocity.X = expr_7E3C_cp_0.velocity.X * 0.3f; Dust expr_7E5A_cp_0 = Main.dust[num125]; expr_7E5A_cp_0.velocity.Y = expr_7E5A_cp_0.velocity.Y + 10f; Main.dust[num125].noGravity = true; Main.dust[num125].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); this.wingFrameCounter++; if (this.wingFrameCounter > 4) { this.wingFrame++; this.wingFrameCounter = 0; if (this.wingFrame >= 3) { this.wingFrame = 0; } } } else if (this.wings != 22 && this.wings != 28) { if (this.wings == 30) { this.wingFrameCounter++; int num126 = 5; if (this.wingFrameCounter >= num126 * 3) { this.wingFrameCounter = 0; } this.wingFrame = 1 + this.wingFrameCounter / num126; } else if (this.wings == 34) { this.wingFrameCounter++; int num127 = 7; if (this.wingFrameCounter >= num127 * 6) { this.wingFrameCounter = 0; } this.wingFrame = this.wingFrameCounter / num127; } else if (this.wings == 26) { int num128 = 6; if (this.direction == 1) { num128 = -30; } int num129 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num128, this.position.Y), 18, this.height, 217, 0f, 0f, 100, default(Color), 1.4f); Main.dust[num129].noGravity = true; Main.dust[num129].noLight = true; Main.dust[num129].velocity /= 4f; Main.dust[num129].velocity -= this.velocity; Main.dust[num129].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); if (Main.rand.Next(2) == 0) { num128 = -24; if (this.direction == 1) { num128 = 12; } float num130 = this.position.Y; if (this.gravDir == -1f) { num130 += (float)(this.height / 2); } num129 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)num128, num130), 12, this.height / 2, 217, 0f, 0f, 100, default(Color), 1.4f); Main.dust[num129].noGravity = true; Main.dust[num129].noLight = true; Main.dust[num129].velocity /= 4f; Main.dust[num129].velocity -= this.velocity; Main.dust[num129].shader = GameShaders.Armor.GetSecondaryShader(this.cWings, this); } this.wingFrame = 2; } else if (this.wings != 24) { if (this.wings == 12) { this.wingFrame = 3; } else { this.wingFrame = 2; } } } } this.velocity.Y = this.velocity.Y + this.gravity / 3f * this.gravDir; if (this.gravDir == 1f) { if (this.velocity.Y > this.maxFallSpeed / 3f && !this.controlDown) { this.velocity.Y = this.maxFallSpeed / 3f; } } else if (this.velocity.Y < -this.maxFallSpeed / 3f && !this.controlUp) { this.velocity.Y = -this.maxFallSpeed / 3f; } } else if (this.cartRampTime <= 0) { this.velocity.Y = this.velocity.Y + this.gravity * this.gravDir; } else { this.cartRampTime--; } } if (!this.mount.Active || this.mount.Type != 5) { if (this.gravDir == 1f) { if (this.velocity.Y > this.maxFallSpeed) { this.velocity.Y = this.maxFallSpeed; } if (this.slowFall && this.velocity.Y > this.maxFallSpeed / 3f && !this.controlDown) { this.velocity.Y = this.maxFallSpeed / 3f; } if (this.slowFall && this.velocity.Y > this.maxFallSpeed / 5f && this.controlUp) { this.velocity.Y = this.maxFallSpeed / 10f; } } else { if (this.velocity.Y < -this.maxFallSpeed) { this.velocity.Y = -this.maxFallSpeed; } if (this.slowFall && this.velocity.Y < -this.maxFallSpeed / 3f && !this.controlDown) { this.velocity.Y = -this.maxFallSpeed / 3f; } if (this.slowFall && this.velocity.Y < -this.maxFallSpeed / 5f && this.controlUp) { this.velocity.Y = -this.maxFallSpeed / 10f; } } } } } if (this.mount.Active) { this.wingFrame = 0; } if ((this.wingsLogic == 22 || this.wingsLogic == 28 || this.wingsLogic == 30 || this.wingsLogic == 32 || this.wingsLogic == 33 || this.wingsLogic == 35) && this.controlDown && this.controlJump && this.wingTime > 0f && !this.merman) { this.velocity.Y = this.velocity.Y * 0.9f; if (this.velocity.Y > -2f && this.velocity.Y < 1f) { this.velocity.Y = 1E-05f; } } this.GrabItems(i); if (!Main.mapFullscreen) { if (this.position.X / 16f - (float)Player.tileRangeX <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX - 1f >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY - 2f >= (float)Player.tileTargetY) { if (Main.tile[Player.tileTargetX, Player.tileTargetY] == null) { Main.tile[Player.tileTargetX, Player.tileTargetY] = new Tile(); } if (Main.tile[Player.tileTargetX, Player.tileTargetY].active()) { if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 79) { this.noThrow = 2; this.showItemIcon = true; int num131 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 36); if (num131 == 0) { this.showItemIcon2 = 224; } else if (num131 == 1) { this.showItemIcon2 = 644; } else if (num131 == 2) { this.showItemIcon2 = 645; } else if (num131 == 3) { this.showItemIcon2 = 646; } else if (num131 == 4) { this.showItemIcon2 = 920; } else if (num131 == 5) { this.showItemIcon2 = 1470; } else if (num131 == 6) { this.showItemIcon2 = 1471; } else if (num131 == 7) { this.showItemIcon2 = 1472; } else if (num131 == 8) { this.showItemIcon2 = 1473; } else if (num131 == 9) { this.showItemIcon2 = 1719; } else if (num131 == 10) { this.showItemIcon2 = 1720; } else if (num131 == 11) { this.showItemIcon2 = 1721; } else if (num131 == 12) { this.showItemIcon2 = 1722; } else if (num131 >= 13 && num131 <= 18) { this.showItemIcon2 = 2066 + num131 - 13; } else if (num131 >= 19 && num131 <= 20) { this.showItemIcon2 = 2139 + num131 - 19; } else if (num131 == 21) { this.showItemIcon2 = 2231; } else if (num131 == 22) { this.showItemIcon2 = 2520; } else if (num131 == 23) { this.showItemIcon2 = 2538; } else if (num131 == 24) { this.showItemIcon2 = 2553; } else if (num131 == 25) { this.showItemIcon2 = 2568; } else if (num131 == 26) { this.showItemIcon2 = 2669; } else if (num131 == 27) { this.showItemIcon2 = 2811; } else if (num131 == 28) { this.showItemIcon2 = 3162; } else if (num131 == 29) { this.showItemIcon2 = 3164; } else if (num131 == 30) { this.showItemIcon2 = 3163; } else { this.showItemIcon2 = 646; } } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 33) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 105; int num132 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 22); if (num132 == 1) { this.showItemIcon2 = 1405; } if (num132 == 2) { this.showItemIcon2 = 1406; } if (num132 == 3) { this.showItemIcon2 = 1407; } if (num132 >= 4 && num132 <= 13) { this.showItemIcon2 = 2045 + num132 - 4; } if (num132 >= 14 && num132 <= 16) { this.showItemIcon2 = 2153 + num132 - 14; } if (num132 == 17) { this.showItemIcon2 = 2236; } if (num132 == 18) { this.showItemIcon2 = 2523; } if (num132 == 19) { this.showItemIcon2 = 2542; } if (num132 == 20) { this.showItemIcon2 = 2556; } if (num132 == 21) { this.showItemIcon2 = 2571; } if (num132 == 22) { this.showItemIcon2 = 2648; } if (num132 == 23) { this.showItemIcon2 = 2649; } if (num132 == 24) { this.showItemIcon2 = 2650; } if (num132 == 25) { this.showItemIcon2 = 2651; } else if (num132 == 26) { this.showItemIcon2 = 2818; } else if (num132 == 27) { this.showItemIcon2 = 3171; } else if (num132 == 28) { this.showItemIcon2 = 3173; } else if (num132 == 29) { this.showItemIcon2 = 3172; } } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 21) { Tile tile = Main.tile[Player.tileTargetX, Player.tileTargetY]; int num133 = Player.tileTargetX; int num134 = Player.tileTargetY; if (tile.frameX % 36 != 0) { num133--; } if (tile.frameY % 36 != 0) { num134--; } int num135 = Chest.FindChest(num133, num134); this.showItemIcon2 = -1; if (num135 < 0) { this.showItemIconText = Lang.chestType[0]; } else { if (Main.chest[num135].name != "") { this.showItemIconText = Main.chest[num135].name; } else { this.showItemIconText = Lang.chestType[(int)(tile.frameX / 36)]; } if (this.showItemIconText == Lang.chestType[(int)(tile.frameX / 36)]) { this.showItemIcon2 = Chest.chestTypeToIcon[(int)(tile.frameX / 36)]; this.showItemIconText = ""; } } this.noThrow = 2; this.showItemIcon = true; } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 88) { Tile tile2 = Main.tile[Player.tileTargetX, Player.tileTargetY]; int num136 = Player.tileTargetX; int num137 = Player.tileTargetY; num136 -= (int)(tile2.frameX % 54 / 18); if (tile2.frameY % 36 != 0) { num137--; } int num138 = Chest.FindChest(num136, num137); this.showItemIcon2 = -1; if (num138 < 0) { this.showItemIconText = Lang.dresserType[0]; } else { if (Main.chest[num138].name != "") { this.showItemIconText = Main.chest[num138].name; } else { this.showItemIconText = Lang.dresserType[(int)(tile2.frameX / 54)]; } if (this.showItemIconText == Lang.dresserType[(int)(tile2.frameX / 54)]) { this.showItemIcon2 = Chest.dresserTypeToIcon[(int)(tile2.frameX / 54)]; this.showItemIconText = ""; } } this.noThrow = 2; this.showItemIcon = true; if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) { this.showItemIcon2 = 269; } } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 10 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 11) { this.noThrow = 2; this.showItemIcon = true; int num139 = (int)Main.tile[Player.tileTargetX, Player.tileTargetY].frameY; int num140 = 0; while (num139 >= 54) { num139 -= 54; num140++; } if (num140 == 0) { this.showItemIcon2 = 25; } else if (num140 == 9) { this.showItemIcon2 = 837; } else if (num140 == 10) { this.showItemIcon2 = 912; } else if (num140 == 11) { this.showItemIcon2 = 1141; } else if (num140 == 12) { this.showItemIcon2 = 1137; } else if (num140 == 13) { this.showItemIcon2 = 1138; } else if (num140 == 14) { this.showItemIcon2 = 1139; } else if (num140 == 15) { this.showItemIcon2 = 1140; } else if (num140 == 16) { this.showItemIcon2 = 1411; } else if (num140 == 17) { this.showItemIcon2 = 1412; } else if (num140 == 18) { this.showItemIcon2 = 1413; } else if (num140 == 19) { this.showItemIcon2 = 1458; } else if (num140 >= 20 && num140 <= 23) { this.showItemIcon2 = 1709 + num140 - 20; } else if (num140 == 24) { this.showItemIcon2 = 1793; } else if (num140 == 25) { this.showItemIcon2 = 1815; } else if (num140 == 26) { this.showItemIcon2 = 1924; } else if (num140 == 27) { this.showItemIcon2 = 2044; } else if (num140 == 28) { this.showItemIcon2 = 2265; } else if (num140 == 29) { this.showItemIcon2 = 2528; } else if (num140 == 30) { this.showItemIcon2 = 2561; } else if (num140 == 31) { this.showItemIcon2 = 2576; } else if (num140 == 32) { this.showItemIcon2 = 2815; } else if (num140 == 33) { this.showItemIcon2 = 3129; } else if (num140 == 34) { this.showItemIcon2 = 3131; } else if (num140 == 35) { this.showItemIcon2 = 3130; } else if (num140 >= 4 && num140 <= 8) { this.showItemIcon2 = 812 + num140; } else { this.showItemIcon2 = 649 + num140; } } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 104) { this.noThrow = 2; this.showItemIcon = true; switch (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 36) { case 0: this.showItemIcon2 = 359; break; case 1: this.showItemIcon2 = 2237; break; case 2: this.showItemIcon2 = 2238; break; case 3: this.showItemIcon2 = 2239; break; case 4: this.showItemIcon2 = 2240; break; case 5: this.showItemIcon2 = 2241; break; case 6: this.showItemIcon2 = 2560; break; case 7: this.showItemIcon2 = 2575; break; case 8: this.showItemIcon2 = 2591; break; case 9: this.showItemIcon2 = 2592; break; case 10: this.showItemIcon2 = 2593; break; case 11: this.showItemIcon2 = 2594; break; case 12: this.showItemIcon2 = 2595; break; case 13: this.showItemIcon2 = 2596; break; case 14: this.showItemIcon2 = 2597; break; case 15: this.showItemIcon2 = 2598; break; case 16: this.showItemIcon2 = 2599; break; case 17: this.showItemIcon2 = 2600; break; case 18: this.showItemIcon2 = 2601; break; case 19: this.showItemIcon2 = 2602; break; case 20: this.showItemIcon2 = 2603; break; case 21: this.showItemIcon2 = 2604; break; case 22: this.showItemIcon2 = 2605; break; case 23: this.showItemIcon2 = 2606; break; case 24: this.showItemIcon2 = 2809; break; case 25: this.showItemIcon2 = 3126; break; case 26: this.showItemIcon2 = 3128; break; case 27: this.showItemIcon2 = 3127; break; } } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 356) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 3064; } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 377) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 3198; } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 209) { this.noThrow = 2; this.showItemIcon = true; if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX < 72) { this.showItemIcon2 = 928; } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX < 144) { this.showItemIcon2 = 1337; } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX < 216) { this.showItemIcon2 = 3369; } int num141; for (num141 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); num141 >= 4; num141 -= 4) { } if (num141 < 2) { this.showItemIconR = true; } else { this.showItemIconR = false; } } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 216) { this.noThrow = 2; this.showItemIcon = true; int num142 = (int)Main.tile[Player.tileTargetX, Player.tileTargetY].frameY; int num143 = 0; while (num142 >= 40) { num142 -= 40; num143++; } this.showItemIcon2 = 970 + num143; } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 387 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 386) { this.noThrow = 2; this.showItemIcon = true; int num144 = 0; int num145 = 0; WorldGen.GetTopLeftAndStyles(ref num144, ref num145, 2, 1 + (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 386).ToInt(), 18, 18); this.showItemIcon2 = 3239; } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 389 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 388) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 3240; } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 335) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 2700; } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 410) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 3536 + Math.Min((int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 36), 3); } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 411 && Main.tile[Player.tileTargetX, Player.tileTargetY].frameX < 36) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 3545; } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 338) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 2738; } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 219 && (this.inventory[this.selectedItem].type == 424 || this.inventory[this.selectedItem].type == 1103)) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = this.inventory[this.selectedItem].type; } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 212) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 949; } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 314 && this.gravDir == 1f) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 2343; } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 215) { this.noThrow = 2; this.showItemIcon = true; int num146 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 54); if (num146 == 0) { this.showItemIcon2 = 966; } else if (num146 == 6) { this.showItemIcon2 = 3050; } else { this.showItemIcon2 = 3046 + num146 - 1; } } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 4) { this.noThrow = 2; this.showItemIcon = true; int num147 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 22); if (num147 == 0) { this.showItemIcon2 = 8; } else if (num147 == 8) { this.showItemIcon2 = 523; } else if (num147 == 9) { this.showItemIcon2 = 974; } else if (num147 == 10) { this.showItemIcon2 = 1245; } else if (num147 == 11) { this.showItemIcon2 = 1333; } else if (num147 == 12) { this.showItemIcon2 = 2274; } else if (num147 == 13) { this.showItemIcon2 = 3004; } else if (num147 == 14) { this.showItemIcon2 = 3045; } else if (num147 == 15) { this.showItemIcon2 = 3114; } else { this.showItemIcon2 = 426 + num147; } } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 13) { this.noThrow = 2; this.showItemIcon = true; int num148 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); if (num148 == 1) { this.showItemIcon2 = 28; } else if (num148 == 2) { this.showItemIcon2 = 110; } else if (num148 == 3) { this.showItemIcon2 = 350; } else if (num148 == 4) { this.showItemIcon2 = 351; } else if (num148 == 5) { this.showItemIcon2 = 2234; } else if (num148 == 6) { this.showItemIcon2 = 2244; } else if (num148 == 7) { this.showItemIcon2 = 2257; } else if (num148 == 8) { this.showItemIcon2 = 2258; } else { this.showItemIcon2 = 31; } } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 29) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 87; } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 97) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 346; } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 49) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 148; } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 174) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 713; } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 50) { this.noThrow = 2; if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX == 90) { this.showItemIcon = true; this.showItemIcon2 = 165; } } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 139) { this.noThrow = 2; int num149 = Player.tileTargetX; int num150 = Player.tileTargetY; int num151 = 0; for (int num152 = (int)(Main.tile[num149, num150].frameY / 18); num152 >= 2; num152 -= 2) { num151++; } this.showItemIcon = true; if (num151 == 28) { this.showItemIcon2 = 1963; } else if (num151 == 29) { this.showItemIcon2 = 1964; } else if (num151 == 30) { this.showItemIcon2 = 1965; } else if (num151 == 31) { this.showItemIcon2 = 2742; } else if (num151 == 32) { this.showItemIcon2 = 3044; } else if (num151 == 33) { this.showItemIcon2 = 3235; } else if (num151 == 34) { this.showItemIcon2 = 3236; } else if (num151 == 35) { this.showItemIcon2 = 3237; } else if (num151 == 36) { this.showItemIcon2 = 3370; } else if (num151 == 37) { this.showItemIcon2 = 3371; } else if (num151 >= 13) { this.showItemIcon2 = 1596 + num151 - 13; } else { this.showItemIcon2 = 562 + num151; } } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 207) { this.noThrow = 2; int num153 = Player.tileTargetX; int num154 = Player.tileTargetY; int num155 = 0; for (int num156 = (int)(Main.tile[num153, num154].frameX / 18); num156 >= 2; num156 -= 2) { num155++; } this.showItemIcon = true; if (num155 == 0) { this.showItemIcon2 = 909; } else if (num155 == 1) { this.showItemIcon2 = 910; } else if (num155 == 2) { this.showItemIcon2 = 940; } else if (num155 == 3) { this.showItemIcon2 = 941; } else if (num155 == 4) { this.showItemIcon2 = 942; } else if (num155 == 5) { this.showItemIcon2 = 943; } else if (num155 == 6) { this.showItemIcon2 = 944; } else if (num155 == 7) { this.showItemIcon2 = 945; } } if (Main.tileSign[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type]) { this.noThrow = 2; int num157 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); int num158 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); num157 %= 2; int num159 = Player.tileTargetX - num157; int num160 = Player.tileTargetY - num158; Main.signBubble = true; Main.signX = num159 * 16 + 16; Main.signY = num160 * 16; int num161 = Sign.ReadSign(num159, num160, false); if (num161 != -1) { Main.signHover = num161; } if (num161 != -1) { Main.signHover = num161; this.showItemIcon = false; this.showItemIcon2 = -1; } } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 237) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 1293; } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 125) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 487; } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 354) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 2999; } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 287) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 2177; } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 132) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 513; } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 136) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = 538; } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 144) { this.noThrow = 2; this.showItemIcon = true; this.showItemIcon2 = (int)(583 + Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); } if (this.controlUseTile) { if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 212 && this.launcherWait <= 0) { int num162 = Player.tileTargetX; int num163 = Player.tileTargetY; bool flag27 = false; for (int num164 = 0; num164 < 58; num164++) { if (this.inventory[num164].type == 949 && this.inventory[num164].stack > 0) { this.inventory[num164].stack--; if (this.inventory[num164].stack <= 0) { this.inventory[num164].SetDefaults(0, false); } flag27 = true; break; } } if (flag27) { this.launcherWait = 10; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 11); int num165 = (int)(Main.tile[num162, num163].frameX / 18); int num166 = 0; while (num165 >= 3) { num166++; num165 -= 3; } num165 = num162 - num165; int num167; for (num167 = (int)(Main.tile[num162, num163].frameY / 18); num167 >= 3; num167 -= 3) { } num167 = num163 - num167; float num168 = 12f + (float)Main.rand.Next(450) * 0.01f; float num169 = (float)Main.rand.Next(85, 105); float num170 = (float)Main.rand.Next(-35, 11); int type4 = 166; int damage2 = 35; float knockBack = 3.5f; Vector2 vector3 = new Vector2((float)((num165 + 2) * 16 - 8), (float)((num167 + 2) * 16 - 8)); if (num166 == 0) { num169 *= -1f; vector3.X -= 12f; } else { vector3.X += 12f; } float num171 = num169; float num172 = num170; float num173 = (float)Math.Sqrt((double)(num171 * num171 + num172 * num172)); num173 = num168 / num173; num171 *= num173; num172 *= num173; Projectile.NewProjectile(vector3.X, vector3.Y, num171, num172, type4, damage2, knockBack, Main.myPlayer, 0f, 0f); } } if (this.releaseUseTile) { if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 132 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 136 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 144) { Wiring.HitSwitch(Player.tileTargetX, Player.tileTargetY); NetMessage.SendData(59, -1, -1, "", Player.tileTargetX, (float)Player.tileTargetY, 0f, 0f, 0, 0, 0); } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 139) { Main.PlaySound(28, Player.tileTargetX * 16, Player.tileTargetY * 16, 0); WorldGen.SwitchMB(Player.tileTargetX, Player.tileTargetY); } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 215) { Main.PlaySound(28, Player.tileTargetX * 16, Player.tileTargetY * 16, 0); int num174 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX % 54 / 18); int num175 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY % 36 / 18); int num176 = Player.tileTargetX - num174; int num177 = Player.tileTargetY - num175; int num178 = 36; if (Main.tile[num176, num177].frameY >= 36) { num178 = -36; } for (int num179 = num176; num179 < num176 + 3; num179++) { for (int num180 = num177; num180 < num177 + 2; num180++) { Main.tile[num179, num180].frameY = (short)((int)Main.tile[num179, num180].frameY + num178); } } NetMessage.SendTileSquare(-1, num176 + 1, num177 + 1, 3); } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 207) { Main.PlaySound(28, Player.tileTargetX * 16, Player.tileTargetY * 16, 0); WorldGen.SwitchFountain(Player.tileTargetX, Player.tileTargetY); } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 410) { Main.PlaySound(28, Player.tileTargetX * 16, Player.tileTargetY * 16, 0); WorldGen.SwitchMonolith(Player.tileTargetX, Player.tileTargetY); } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 216) { WorldGen.LaunchRocket(Player.tileTargetX, Player.tileTargetY); } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 386 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 387) { bool value3 = Main.tile[Player.tileTargetX, Player.tileTargetY].type == 387; int num181 = WorldGen.ShiftTrapdoor(Player.tileTargetX, Player.tileTargetY, (float)(Player.tileTargetY * 16) > base.Center.Y, -1).ToInt(); if (num181 == 0) { num181 = -WorldGen.ShiftTrapdoor(Player.tileTargetX, Player.tileTargetY, (float)(Player.tileTargetY * 16) <= base.Center.Y, -1).ToInt(); } if (num181 != 0) { NetMessage.SendData(19, -1, -1, "", 2 + value3.ToInt(), (float)Player.tileTargetX, (float)Player.tileTargetY, (float)(num181 * Math.Sign((float)(Player.tileTargetY * 16) - base.Center.Y)), 0, 0, 0); } } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 388 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 389) { bool flag28 = Main.tile[Player.tileTargetX, Player.tileTargetY].type == 389; WorldGen.ShiftTallGate(Player.tileTargetX, Player.tileTargetY, flag28); NetMessage.SendData(19, -1, -1, "", 4 + flag28.ToInt(), (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0); } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 335) { WorldGen.LaunchRocketSmall(Player.tileTargetX, Player.tileTargetY); } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 411 && Main.tile[Player.tileTargetX, Player.tileTargetY].frameX < 36) { Wiring.HitSwitch(Player.tileTargetX, Player.tileTargetY); NetMessage.SendData(59, -1, -1, "", Player.tileTargetX, (float)Player.tileTargetY, 0f, 0f, 0, 0, 0); } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 338) { int num182 = Player.tileTargetX; int num183 = Player.tileTargetY; if (Main.tile[num182, num183].frameY == 18) { num183--; } bool flag29 = false; for (int num184 = 0; num184 < 1000; num184++) { if (Main.projectile[num184].active && Main.projectile[num184].aiStyle == 73 && Main.projectile[num184].ai[0] == (float)num182 && Main.projectile[num184].ai[1] == (float)num183) { flag29 = true; break; } } if (!flag29) { Projectile.NewProjectile((float)(num182 * 16 + 8), (float)(num183 * 16 + 2), 0f, 0f, 419 + Main.rand.Next(4), 0, 0f, this.whoAmI, (float)num182, (float)num183); } } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 4 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 13 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 33 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 49 || (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 50 && Main.tile[Player.tileTargetX, Player.tileTargetY].frameX == 90) || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 174) { WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY, false, false, false); if (Main.netMode == 1) { NetMessage.SendData(17, -1, -1, "", 0, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0); } } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 334) { if (this.ItemFitsWeaponRack(this.inventory[this.selectedItem])) { this.PlaceWeapon(Player.tileTargetX, Player.tileTargetY); } else { int num185 = Player.tileTargetX; int num186 = Player.tileTargetY; if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) { num186++; } if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 36) { num186--; } int frameX = (int)Main.tile[Player.tileTargetX, num186].frameX; int num187 = (int)Main.tile[Player.tileTargetX, num186].frameX; int num188 = 0; while (num187 >= 5000) { num187 -= 5000; num188++; } if (num188 != 0) { num187 = (num188 - 1) * 18; } num187 %= 54; if (num187 == 18) { frameX = (int)Main.tile[Player.tileTargetX - 1, num186].frameX; num185--; } if (num187 == 36) { frameX = (int)Main.tile[Player.tileTargetX - 2, num186].frameX; num185 -= 2; } if (frameX >= 5000) { WorldGen.KillTile(Player.tileTargetX, num186, true, false, false); if (Main.netMode == 1) { NetMessage.SendData(17, -1, -1, "", 0, (float)Player.tileTargetX, (float)num186, 1f, 0, 0, 0); } } } } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 395) { if (this.ItemFitsItemFrame(this.inventory[this.selectedItem]) && !this.inventory[this.selectedItem].favorited) { this.PlaceItemInFrame(Player.tileTargetX, Player.tileTargetY); } else { int num189 = Player.tileTargetX; int num190 = Player.tileTargetY; if (Main.tile[num189, num190].frameX % 36 != 0) { num189--; } if (Main.tile[num189, num190].frameY % 36 != 0) { num190--; } int num191 = TEItemFrame.Find(num189, num190); if (num191 != -1 && ((TEItemFrame)TileEntity.ByID[num191]).item.stack > 0) { WorldGen.KillTile(Player.tileTargetX, num190, true, false, false); if (Main.netMode == 1) { NetMessage.SendData(17, -1, -1, "", 0, (float)Player.tileTargetX, (float)num190, 1f, 0, 0, 0); } } } } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 125) { this.AddBuff(29, 36000, true); Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 4); } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 377) { this.AddBuff(159, 36000, true); Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 37); } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 354) { this.AddBuff(150, 36000, true); Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 4); } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 287) { this.AddBuff(93, 36000, true); Main.PlaySound(7, (int)this.position.X, (int)this.position.Y, 1); } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 356) { if (!Main.fastForwardTime && (Main.netMode == 1 || Main.sundialCooldown == 0)) { Main.Sundialing(); Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 4); } } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 79) { int num192 = Player.tileTargetX; int num193 = Player.tileTargetY; num192 += (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18 * -1); if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX >= 72) { num192 += 4; num192++; } else { num192 += 2; } int num194 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); int num195 = 0; while (num194 > 1) { num194 -= 2; num195++; } num193 -= num194; num193 += 2; this.FindSpawn(); if (this.SpawnX == num192 && this.SpawnY == num193) { this.RemoveSpawn(); Main.NewText("Spawn point removed!", 255, 240, 20, false); } else if (Player.CheckSpawn(num192, num193)) { this.ChangeSpawn(num192, num193); Main.NewText("Spawn point set!", 255, 240, 20, false); } } else if (Main.tileSign[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type]) { bool flag30 = true; if (this.sign >= 0) { int num196 = Sign.ReadSign(Player.tileTargetX, Player.tileTargetY, true); if (num196 == this.sign) { this.sign = -1; Main.npcChatText = ""; Main.editSign = false; Main.PlaySound(11, -1, -1, 1); flag30 = false; } } if (flag30) { if (Main.netMode == 0) { this.talkNPC = -1; Main.npcChatCornerItem = 0; Main.playerInventory = false; Main.editSign = false; Main.PlaySound(10, -1, -1, 1); int num197 = Sign.ReadSign(Player.tileTargetX, Player.tileTargetY, true); this.sign = num197; Main.npcChatText = Main.sign[num197].text; } else { int num198 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); int num199 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); while (num198 > 1) { num198 -= 2; } int num200 = Player.tileTargetX - num198; int num201 = Player.tileTargetY - num199; if (Main.tileSign[(int)Main.tile[num200, num201].type]) { NetMessage.SendData(46, -1, -1, "", num200, (float)num201, 0f, 0f, 0, 0, 0); } } } } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 104) { string text = "AM"; double num202 = Main.time; if (!Main.dayTime) { num202 += 54000.0; } num202 = num202 / 86400.0 * 24.0; double num203 = 7.5; num202 = num202 - num203 - 12.0; if (num202 < 0.0) { num202 += 24.0; } if (num202 >= 12.0) { text = "PM"; } int num204 = (int)num202; double num205 = num202 - (double)num204; num205 = (double)((int)(num205 * 60.0)); string text2 = string.Concat(num205); if (num205 < 10.0) { text2 = "0" + text2; } if (num204 > 12) { num204 -= 12; } if (num204 == 0) { num204 = 12; } string newText = string.Concat(new object[] { "Time: ", num204, ":", text2, " ", text }); Main.NewText(newText, 255, 240, 20, false); } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 237) { bool flag31 = false; if (!NPC.AnyNPCs(245) && Main.hardMode && NPC.downedPlantBoss) { for (int num206 = 0; num206 < 58; num206++) { if (this.inventory[num206].type == 1293) { this.inventory[num206].stack--; if (this.inventory[num206].stack <= 0) { this.inventory[num206].SetDefaults(0, false); } flag31 = true; break; } } } if (flag31) { Main.PlaySound(15, (int)this.position.X, (int)this.position.Y, 0); if (Main.netMode != 1) { NPC.SpawnOnPlayer(i, 245); } else { NetMessage.SendData(61, -1, -1, "", this.whoAmI, 245f, 0f, 0f, 0, 0, 0); } } } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 10) { int num207 = Player.tileTargetX; int num208 = Player.tileTargetY; if (Main.tile[num207, num208].frameY >= 594 && Main.tile[num207, num208].frameY <= 646) { int num209 = 1141; for (int num210 = 0; num210 < 58; num210++) { if (this.inventory[num210].type == num209 && this.inventory[num210].stack > 0) { this.inventory[num210].stack--; if (this.inventory[num210].stack <= 0) { this.inventory[num210] = new Item(); } WorldGen.UnlockDoor(num207, num208); if (Main.netMode == 1) { NetMessage.SendData(52, -1, -1, "", this.whoAmI, 2f, (float)num207, (float)num208, 0, 0, 0); } } } } else { WorldGen.OpenDoor(Player.tileTargetX, Player.tileTargetY, this.direction); NetMessage.SendData(19, -1, -1, "", 0, (float)Player.tileTargetX, (float)Player.tileTargetY, (float)this.direction, 0, 0, 0); } } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 11 && WorldGen.CloseDoor(Player.tileTargetX, Player.tileTargetY, false)) { NetMessage.SendData(19, -1, -1, "", 1, (float)Player.tileTargetX, (float)Player.tileTargetY, (float)this.direction, 0, 0, 0); } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 88) { if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) { Main.CancelClothesWindow(true); Main.mouseRightRelease = false; int num211 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); num211 %= 3; num211 = Player.tileTargetX - num211; int num212 = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); if (this.sign > -1) { Main.PlaySound(11, -1, -1, 1); this.sign = -1; Main.editSign = false; Main.npcChatText = string.Empty; } if (Main.editChest) { Main.PlaySound(12, -1, -1, 1); Main.editChest = false; Main.npcChatText = string.Empty; } if (this.editedChestName) { NetMessage.SendData(33, -1, -1, Main.chest[this.chest].name, this.chest, 1f, 0f, 0f, 0, 0, 0); this.editedChestName = false; } if (Main.netMode == 1) { if (num211 == this.chestX && num212 == this.chestY && this.chest != -1) { this.chest = -1; Recipe.FindRecipes(); Main.PlaySound(11, -1, -1, 1); } else { NetMessage.SendData(31, -1, -1, "", num211, (float)num212, 0f, 0f, 0, 0, 0); Main.stackSplit = 600; } } else { this.flyingPigChest = -1; int num213 = Chest.FindChest(num211, num212); if (num213 != -1) { Main.stackSplit = 600; if (num213 == this.chest) { this.chest = -1; Recipe.FindRecipes(); Main.PlaySound(11, -1, -1, 1); } else if (num213 != this.chest && this.chest == -1) { this.chest = num213; Main.playerInventory = true; Main.recBigList = false; Main.PlaySound(10, -1, -1, 1); this.chestX = num211; this.chestY = num212; } else { this.chest = num213; Main.playerInventory = true; Main.recBigList = false; Main.PlaySound(12, -1, -1, 1); this.chestX = num211; this.chestY = num212; } Recipe.FindRecipes(); } } } else { Main.playerInventory = false; this.chest = -1; Recipe.FindRecipes(); Main.dresserX = Player.tileTargetX; Main.dresserY = Player.tileTargetY; Main.OpenClothesWindow(); } } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 209) { WorldGen.SwitchCannon(Player.tileTargetX, Player.tileTargetY); } else if ((Main.tile[Player.tileTargetX, Player.tileTargetY].type == 21 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 29 || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 97) && this.talkNPC == -1) { Main.mouseRightRelease = false; int num214 = 0; int num215; for (num215 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); num215 > 1; num215 -= 2) { } num215 = Player.tileTargetX - num215; int num216 = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 29) { num214 = 1; } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 97) { num214 = 2; } if (this.sign > -1) { Main.PlaySound(11, -1, -1, 1); this.sign = -1; Main.editSign = false; Main.npcChatText = string.Empty; } if (Main.editChest) { Main.PlaySound(12, -1, -1, 1); Main.editChest = false; Main.npcChatText = string.Empty; } if (this.editedChestName) { NetMessage.SendData(33, -1, -1, Main.chest[this.chest].name, this.chest, 1f, 0f, 0f, 0, 0, 0); this.editedChestName = false; } if (Main.netMode == 1 && num214 == 0 && (Main.tile[num215, num216].frameX < 72 || Main.tile[num215, num216].frameX > 106) && (Main.tile[num215, num216].frameX < 144 || Main.tile[num215, num216].frameX > 178) && (Main.tile[num215, num216].frameX < 828 || Main.tile[num215, num216].frameX > 1006) && (Main.tile[num215, num216].frameX < 1296 || Main.tile[num215, num216].frameX > 1330) && (Main.tile[num215, num216].frameX < 1368 || Main.tile[num215, num216].frameX > 1402) && (Main.tile[num215, num216].frameX < 1440 || Main.tile[num215, num216].frameX > 1474)) { if (num215 == this.chestX && num216 == this.chestY && this.chest != -1) { this.chest = -1; Recipe.FindRecipes(); Main.PlaySound(11, -1, -1, 1); } else { NetMessage.SendData(31, -1, -1, "", num215, (float)num216, 0f, 0f, 0, 0, 0); Main.stackSplit = 600; } } else { int num217 = -1; if (num214 == 1) { num217 = -2; } else if (num214 == 2) { num217 = -3; } else { bool flag32 = false; if (Chest.isLocked(num215, num216)) { int num218 = 327; if (Main.tile[num215, num216].frameX >= 144 && Main.tile[num215, num216].frameX <= 178) { num218 = 329; } if (Main.tile[num215, num216].frameX >= 828 && Main.tile[num215, num216].frameX <= 1006) { int num219 = (int)(Main.tile[num215, num216].frameX / 18); int num220 = 0; while (num219 >= 2) { num219 -= 2; num220++; } num220 -= 23; num218 = 1533 + num220; } flag32 = true; for (int num221 = 0; num221 < 58; num221++) { if (this.inventory[num221].type == num218 && this.inventory[num221].stack > 0 && Chest.Unlock(num215, num216)) { if (num218 != 329) { this.inventory[num221].stack--; if (this.inventory[num221].stack <= 0) { this.inventory[num221] = new Item(); } } if (Main.netMode == 1) { NetMessage.SendData(52, -1, -1, "", this.whoAmI, 1f, (float)num215, (float)num216, 0, 0, 0); } } } } if (!flag32) { num217 = Chest.FindChest(num215, num216); } } if (num217 != -1) { Main.stackSplit = 600; if (num217 == this.chest) { this.chest = -1; Main.PlaySound(11, -1, -1, 1); } else if (num217 != this.chest && this.chest == -1) { this.chest = num217; Main.playerInventory = true; Main.recBigList = false; Main.PlaySound(10, -1, -1, 1); this.chestX = num215; this.chestY = num216; if (Main.tile[num215, num216].frameX >= 36 && Main.tile[num215, num216].frameX < 72) { AchievementsHelper.HandleSpecialEvent(this, 16); } } else { this.chest = num217; Main.playerInventory = true; Main.recBigList = false; Main.PlaySound(12, -1, -1, 1); this.chestX = num215; this.chestY = num216; } Recipe.FindRecipes(); } } } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 314 && this.gravDir == 1f) { bool flag33 = true; if (this.mount.Active) { if (this.mount.Cart) { flag33 = false; } else { this.mount.Dismount(this); } } if (flag33) { Vector2 vector4 = new Vector2((float)Main.mouseX + Main.screenPosition.X, (float)Main.mouseY + Main.screenPosition.Y); if (this.direction > 0) { this.minecartLeft = false; } else { this.minecartLeft = true; } this.grappling[0] = -1; this.grapCount = 0; for (int num222 = 0; num222 < 1000; num222++) { if (Main.projectile[num222].active && Main.projectile[num222].owner == this.whoAmI && Main.projectile[num222].aiStyle == 7) { Main.projectile[num222].Kill(); } } Projectile.NewProjectile(vector4.X, vector4.Y, 0f, 0f, 403, 0, 0f, this.whoAmI, 0f, 0f); } } } this.releaseUseTile = false; } else { this.releaseUseTile = true; } } } else { if (Main.tile[Player.tileTargetX, Player.tileTargetY] == null) { Main.tile[Player.tileTargetX, Player.tileTargetY] = new Tile(); } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 21) { Tile tile3 = Main.tile[Player.tileTargetX, Player.tileTargetY]; int num223 = Player.tileTargetX; int num224 = Player.tileTargetY; if (tile3.frameX % 36 != 0) { num223--; } if (tile3.frameY % 36 != 0) { num224--; } int num225 = Chest.FindChest(num223, num224); this.showItemIcon2 = -1; if (num225 < 0) { this.showItemIconText = Lang.chestType[0]; } else { if (Main.chest[num225].name != "") { this.showItemIconText = Main.chest[num225].name; } else { this.showItemIconText = Lang.chestType[(int)(tile3.frameX / 36)]; } if (this.showItemIconText == Lang.chestType[(int)(tile3.frameX / 36)]) { this.showItemIcon2 = Chest.chestTypeToIcon[(int)(tile3.frameX / 36)]; this.showItemIconText = ""; } } this.noThrow = 2; this.showItemIcon = true; if (this.showItemIconText == "") { this.showItemIcon = false; this.showItemIcon2 = 0; } } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 88) { Tile tile4 = Main.tile[Player.tileTargetX, Player.tileTargetY]; int num226 = Player.tileTargetX; int num227 = Player.tileTargetY; num226 -= (int)(tile4.frameX % 54 / 18); if (tile4.frameY % 36 != 0) { num227--; } int num228 = Chest.FindChest(num226, num227); this.showItemIcon2 = -1; if (num228 < 0) { this.showItemIconText = Lang.dresserType[0]; } else { if (Main.chest[num228].name != "") { this.showItemIconText = Main.chest[num228].name; } else { this.showItemIconText = Lang.dresserType[(int)(tile4.frameX / 54)]; } if (this.showItemIconText == Lang.dresserType[(int)(tile4.frameX / 54)]) { this.showItemIcon2 = Chest.dresserTypeToIcon[(int)(tile4.frameX / 54)]; this.showItemIconText = ""; } } this.noThrow = 2; this.showItemIcon = true; if (this.showItemIconText == "") { this.showItemIcon = false; this.showItemIcon2 = 0; } } if (Main.tileSign[(int)Main.tile[Player.tileTargetX, Player.tileTargetY].type]) { this.noThrow = 2; int num229 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); int num230 = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); num229 %= 2; int num231 = Player.tileTargetX - num229; int num232 = Player.tileTargetY - num230; Main.signBubble = true; Main.signX = num231 * 16 + 16; Main.signY = num232 * 16; int num233 = Sign.ReadSign(num231, num232, true); if (num233 != -1) { Main.signHover = num233; this.showItemIcon = false; this.showItemIcon2 = -1; } } } } if (this.tongued) { bool flag34 = false; if (Main.wof >= 0) { float num234 = Main.npc[Main.wof].position.X + (float)(Main.npc[Main.wof].width / 2); num234 += (float)(Main.npc[Main.wof].direction * 200); float num235 = Main.npc[Main.wof].position.Y + (float)(Main.npc[Main.wof].height / 2); Vector2 vector5 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num236 = num234 - vector5.X; float num237 = num235 - vector5.Y; float num238 = (float)Math.Sqrt((double)(num236 * num236 + num237 * num237)); float num239 = 11f; float num240; if (num238 > num239) { num240 = num239 / num238; } else { num240 = 1f; flag34 = true; } num236 *= num240; num237 *= num240; this.velocity.X = num236; this.velocity.Y = num237; } else { flag34 = true; } if (flag34 && Main.myPlayer == this.whoAmI) { for (int num241 = 0; num241 < 22; num241++) { if (this.buffType[num241] == 38) { this.DelBuff(num241); } } } } if (Main.myPlayer == this.whoAmI) { this.WOFTongue(); if (this.controlHook) { if (this.releaseHook) { this.QuickGrapple(); } this.releaseHook = false; } else { this.releaseHook = true; } if (this.talkNPC >= 0) { Rectangle rectangle = new Rectangle((int)(this.position.X + (float)(this.width / 2) - (float)(Player.tileRangeX * 16)), (int)(this.position.Y + (float)(this.height / 2) - (float)(Player.tileRangeY * 16)), Player.tileRangeX * 16 * 2, Player.tileRangeY * 16 * 2); Rectangle value4 = new Rectangle((int)Main.npc[this.talkNPC].position.X, (int)Main.npc[this.talkNPC].position.Y, Main.npc[this.talkNPC].width, Main.npc[this.talkNPC].height); if (!rectangle.Intersects(value4) || this.chest != -1 || !Main.npc[this.talkNPC].active) { if (this.chest == -1) { Main.PlaySound(11, -1, -1, 1); } this.talkNPC = -1; Main.npcChatCornerItem = 0; Main.npcChatText = ""; } } if (this.sign >= 0) { Rectangle value5 = new Rectangle((int)(this.position.X + (float)(this.width / 2) - (float)(Player.tileRangeX * 16)), (int)(this.position.Y + (float)(this.height / 2) - (float)(Player.tileRangeY * 16)), Player.tileRangeX * 16 * 2, Player.tileRangeY * 16 * 2); try { bool flag35 = false; if (Main.sign[this.sign] == null) { flag35 = true; } if (!flag35 && !new Rectangle(Main.sign[this.sign].x * 16, Main.sign[this.sign].y * 16, 32, 32).Intersects(value5)) { flag35 = true; } if (flag35) { Main.PlaySound(11, -1, -1, 1); this.sign = -1; Main.editSign = false; Main.npcChatText = ""; } } catch { Main.PlaySound(11, -1, -1, 1); this.sign = -1; Main.editSign = false; Main.npcChatText = ""; } } if (Main.editSign) { if (this.sign == -1) { Main.editSign = false; } else { Main.npcChatText = Main.GetInputText(Main.npcChatText); if (Main.inputTextEnter) { byte[] bytes = new byte[] { 10 }; Main.npcChatText += Encoding.ASCII.GetString(bytes); } else if (Main.inputTextEscape) { Main.PlaySound(12, -1, -1, 1); Main.editSign = false; Main.blockKey = Keys.Escape; Main.npcChatText = Main.sign[this.sign].text; } } } else if (Main.editChest) { string inputText = Main.GetInputText(Main.npcChatText); if (Main.player[Main.myPlayer].chest == -1) { Main.editChest = false; } else if (Main.inputTextEnter) { Main.PlaySound(12, -1, -1, 1); Main.editChest = false; int num242 = Main.player[Main.myPlayer].chest; if (Main.npcChatText == Main.defaultChestName) { Main.npcChatText = ""; } if (Main.chest[num242].name != Main.npcChatText) { Main.chest[num242].name = Main.npcChatText; if (Main.netMode == 1) { this.editedChestName = true; } } } else if (Main.inputTextEscape) { Main.PlaySound(12, -1, -1, 1); Main.editChest = false; Main.npcChatText = string.Empty; Main.blockKey = Keys.Escape; } else if (inputText.Length <= 20) { Main.npcChatText = inputText; } } if (this.mount.Active && this.mount.Cart && Math.Abs(this.velocity.X) > 4f) { Rectangle rectangle2 = new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height); for (int num243 = 0; num243 < 200; num243++) { if (Main.npc[num243].active && !Main.npc[num243].friendly && Main.npc[num243].damage > 0 && Main.npc[num243].immune[i] == 0 && rectangle2.Intersects(new Rectangle((int)Main.npc[num243].position.X, (int)Main.npc[num243].position.Y, Main.npc[num243].width, Main.npc[num243].height))) { float num244 = (float)this.meleeCrit; if (num244 < (float)this.rangedCrit) { num244 = (float)this.rangedCrit; } if (num244 < (float)this.magicCrit) { num244 = (float)this.magicCrit; } bool crit = false; if ((float)Main.rand.Next(1, 101) <= num244) { crit = true; } float num245 = Math.Abs(this.velocity.X) / this.maxRunSpeed; int num246 = Main.DamageVar(25f + 55f * num245); if (this.mount.Type == 11) { num246 = Main.DamageVar(50f + 100f * num245); } if (this.mount.Type == 13) { num246 = Main.DamageVar(15f + 30f * num245); } float num247 = 5f + 25f * num245; int num248 = 1; if (this.velocity.X < 0f) { num248 = -1; } if (this.whoAmI == Main.myPlayer) { Main.npc[num243].StrikeNPC(num246, num247, num248, crit, false, false); if (Main.netMode != 0) { NetMessage.SendData(28, -1, -1, "", num243, (float)num246, num247, (float)num248, 0, 0, 0); } } Main.npc[num243].immune[i] = 30; if (!Main.npc[num243].active) { AchievementsHelper.HandleSpecialEvent(this, 9); } } } } Rectangle rectangle3 = new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height); for (int num249 = 0; num249 < 200; num249++) { if (Main.npc[num249].active && !Main.npc[num249].friendly && Main.npc[num249].damage > 0) { int num250 = -1; int type5 = Main.npc[num249].type; if (type5 == 398 || type5 == 400 || type5 == 397 || type5 == 396 || type5 == 401) { num250 = 1; } if ((num250 != -1 || !this.immune) && (this.dash != 2 || num249 != this.eocHit || this.eocDash <= 0) && !this.npcTypeNoAggro[Main.npc[num249].type]) { float num251 = 1f; Rectangle value6 = new Rectangle((int)Main.npc[num249].position.X, (int)Main.npc[num249].position.Y, Main.npc[num249].width, Main.npc[num249].height); if (Main.npc[num249].type >= 430 && Main.npc[num249].type <= 436 && Main.npc[num249].ai[2] > 5f) { int num252 = 34; if (Main.npc[num249].spriteDirection < 0) { value6.X -= num252; value6.Width += num252; } else { value6.Width += num252; } num251 *= 1.25f; } else if (Main.npc[num249].type >= 494 && Main.npc[num249].type <= 495 && Main.npc[num249].ai[2] > 5f) { int num253 = 18; if (Main.npc[num249].spriteDirection < 0) { value6.X -= num253; value6.Width += num253; } else { value6.Width += num253; } num251 *= 1.25f; } else if (Main.npc[num249].type == 460) { Rectangle rectangle4 = new Rectangle(0, 0, 30, 14); rectangle4.X = (int)Main.npc[num249].Center.X; if (Main.npc[num249].direction < 0) { rectangle4.X -= rectangle4.Width; } rectangle4.Y = (int)Main.npc[num249].position.Y + Main.npc[num249].height - 20; if (rectangle3.Intersects(rectangle4)) { value6 = rectangle4; num251 *= 1.35f; } } else if (Main.npc[num249].type == 417 && Main.npc[num249].ai[0] == 6f && Main.npc[num249].ai[3] > 0f && Main.npc[num249].ai[3] < 4f) { Rectangle rectangle5 = Utils.CenteredRectangle(Main.npc[num249].Center, new Vector2(100f)); if (rectangle3.Intersects(rectangle5)) { value6 = rectangle5; num251 *= 1.35f; } } else if (Main.npc[num249].type == 466) { Rectangle rectangle6 = new Rectangle(0, 0, 30, 8); rectangle6.X = (int)Main.npc[num249].Center.X; if (Main.npc[num249].direction < 0) { rectangle6.X -= rectangle6.Width; } rectangle6.Y = (int)Main.npc[num249].position.Y + Main.npc[num249].height - 32; if (rectangle3.Intersects(rectangle6)) { value6 = rectangle6; num251 *= 1.75f; } } if (rectangle3.Intersects(value6) && !this.npcTypeNoAggro[Main.npc[num249].type]) { int num254 = -1; if (Main.npc[num249].position.X + (float)(Main.npc[num249].width / 2) < this.position.X + (float)(this.width / 2)) { num254 = 1; } int num255 = Main.DamageVar((float)Main.npc[num249].damage * num251); int num256 = Item.NPCtoBanner(Main.npc[num249].BannerID()); if (num256 > 0 && this.NPCBannerBuff[num256]) { if (Main.expertMode) { num255 = (int)((double)num255 * 0.5); } else { num255 = (int)((double)num255 * 0.75); } } if (this.whoAmI == Main.myPlayer && this.thorns > 0f && !this.immune && !Main.npc[num249].dontTakeDamage) { int num257 = (int)((float)num255 * this.thorns); int num258 = 10; if (this.turtleThorns) { num257 = num255; } Main.npc[num249].StrikeNPC(num257, (float)num258, -num254, false, false, false); if (Main.netMode != 0) { NetMessage.SendData(28, -1, -1, "", num249, (float)num257, (float)num258, (float)(-(float)num254), 0, 0, 0); } } if (this.resistCold && Main.npc[num249].coldDamage) { num255 = (int)((float)num255 * 0.7f); } if (!this.immune) { this.StatusPlayer(Main.npc[num249]); } this.Hurt(num255, num254, false, false, Lang.deathMsg(-1, num249, -1, -1), false, num250); } } } } Vector2 vector6; if (!this.mount.Active || !this.mount.Cart) { vector6 = Collision.HurtTiles(this.position, this.velocity, this.width, this.height, this.fireWalk); } else { vector6 = Collision.HurtTiles(this.position, this.velocity, this.width, this.height - 16, this.fireWalk); } if (vector6.Y == 0f && !this.fireWalk) { foreach (Point current in this.TouchedTiles) { Tile tile5 = Main.tile[current.X, current.Y]; if (tile5 != null && tile5.active() && tile5.nactive() && !this.fireWalk && TileID.Sets.TouchDamageHot[(int)tile5.type] != 0) { vector6.Y = (float)TileID.Sets.TouchDamageHot[(int)tile5.type]; vector6.X = (float)((base.Center.X / 16f < (float)current.X + 0.5f) ? -1 : 1); break; } } } if (vector6.Y == 20f) { this.AddBuff(67, 20, true); } else if (vector6.Y == 15f) { if (this.suffocateDelay < 5) { this.suffocateDelay += 1; } else { this.AddBuff(68, 1, true); } } else if (vector6.Y != 0f) { int damage3 = Main.DamageVar(vector6.Y); this.Hurt(damage3, 0, false, false, Lang.deathMsg(-1, -1, -1, 3), false, 0); } else { this.suffocateDelay = 0; } } if (this.controlRight) { this.releaseRight = false; } else { this.releaseRight = true; this.rightTimer = 7; } if (this.controlLeft) { this.releaseLeft = false; } else { this.releaseLeft = true; this.leftTimer = 7; } this.releaseDown = !this.controlDown; if (this.rightTimer > 0) { this.rightTimer--; } else if (this.controlRight) { this.rightTimer = 7; } if (this.leftTimer > 0) { this.leftTimer--; } else if (this.controlLeft) { this.leftTimer = 7; } this.GrappleMovement(); this.StickyMovement(); this.CheckDrowning(); if (this.gravDir == -1f) { this.waterWalk = false; this.waterWalk2 = false; } int num259 = this.height; if (this.waterWalk) { num259 -= 6; } bool flag36 = Collision.LavaCollision(this.position, this.width, num259); if (flag36) { if (!this.lavaImmune && Main.myPlayer == i && !this.immune) { if (this.lavaTime > 0) { this.lavaTime--; } else if (this.lavaRose) { this.Hurt(50, 0, false, false, Lang.deathMsg(-1, -1, -1, 2), false, -1); this.AddBuff(24, 210, true); } else { this.Hurt(80, 0, false, false, Lang.deathMsg(-1, -1, -1, 2), false, -1); this.AddBuff(24, 420, true); } } this.lavaWet = true; } else { this.lavaWet = false; if (this.lavaTime < this.lavaMax) { this.lavaTime++; } } if (this.lavaTime > this.lavaMax) { this.lavaTime = this.lavaMax; } if (this.waterWalk2 && !this.waterWalk) { num259 -= 6; } bool flag37 = Collision.WetCollision(this.position, this.width, this.height); bool flag38 = Collision.honey; if (flag38) { this.AddBuff(48, 1800, true); this.honeyWet = true; } if (flag37) { if (this.onFire && !this.lavaWet) { for (int num260 = 0; num260 < 22; num260++) { if (this.buffType[num260] == 24) { this.DelBuff(num260); } } } if (!this.wet) { if (this.wetCount == 0) { this.wetCount = 10; if (!flag36) { if (this.honeyWet) { for (int num261 = 0; num261 < 20; num261++) { int num262 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y + (float)(this.height / 2) - 8f), this.width + 12, 24, 152, 0f, 0f, 0, default(Color), 1f); Dust expr_D990_cp_0 = Main.dust[num262]; expr_D990_cp_0.velocity.Y = expr_D990_cp_0.velocity.Y - 1f; Dust expr_D9B0_cp_0 = Main.dust[num262]; expr_D9B0_cp_0.velocity.X = expr_D9B0_cp_0.velocity.X * 2.5f; Main.dust[num262].scale = 1.3f; Main.dust[num262].alpha = 100; Main.dust[num262].noGravity = true; } Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 1); } else { for (int num263 = 0; num263 < 50; num263++) { int num264 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y + (float)(this.height / 2) - 8f), this.width + 12, 24, Dust.dustWater(), 0f, 0f, 0, default(Color), 1f); Dust expr_DAB1_cp_0 = Main.dust[num264]; expr_DAB1_cp_0.velocity.Y = expr_DAB1_cp_0.velocity.Y - 3f; Dust expr_DAD1_cp_0 = Main.dust[num264]; expr_DAD1_cp_0.velocity.X = expr_DAD1_cp_0.velocity.X * 2.5f; Main.dust[num264].scale = 0.8f; Main.dust[num264].alpha = 100; Main.dust[num264].noGravity = true; } Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 0); } } else { for (int num265 = 0; num265 < 20; num265++) { int num266 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y + (float)(this.height / 2) - 8f), this.width + 12, 24, 35, 0f, 0f, 0, default(Color), 1f); Dust expr_DBCF_cp_0 = Main.dust[num266]; expr_DBCF_cp_0.velocity.Y = expr_DBCF_cp_0.velocity.Y - 1.5f; Dust expr_DBEF_cp_0 = Main.dust[num266]; expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2.5f; Main.dust[num266].scale = 1.3f; Main.dust[num266].alpha = 100; Main.dust[num266].noGravity = true; } Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 1); } } this.wet = true; } } else if (this.wet) { this.wet = false; if (this.jump > Player.jumpHeight / 5 && this.wetSlime == 0) { this.jump = Player.jumpHeight / 5; } if (this.wetCount == 0) { this.wetCount = 10; if (!this.lavaWet) { if (this.honeyWet) { for (int num267 = 0; num267 < 20; num267++) { int num268 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y + (float)(this.height / 2) - 8f), this.width + 12, 24, 152, 0f, 0f, 0, default(Color), 1f); Dust expr_DD56_cp_0 = Main.dust[num268]; expr_DD56_cp_0.velocity.Y = expr_DD56_cp_0.velocity.Y - 1f; Dust expr_DD76_cp_0 = Main.dust[num268]; expr_DD76_cp_0.velocity.X = expr_DD76_cp_0.velocity.X * 2.5f; Main.dust[num268].scale = 1.3f; Main.dust[num268].alpha = 100; Main.dust[num268].noGravity = true; } Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 1); } else { for (int num269 = 0; num269 < 50; num269++) { int num270 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y + (float)(this.height / 2)), this.width + 12, 24, Dust.dustWater(), 0f, 0f, 0, default(Color), 1f); Dust expr_DE71_cp_0 = Main.dust[num270]; expr_DE71_cp_0.velocity.Y = expr_DE71_cp_0.velocity.Y - 4f; Dust expr_DE91_cp_0 = Main.dust[num270]; expr_DE91_cp_0.velocity.X = expr_DE91_cp_0.velocity.X * 2.5f; Main.dust[num270].scale = 0.8f; Main.dust[num270].alpha = 100; Main.dust[num270].noGravity = true; } Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 0); } } else { for (int num271 = 0; num271 < 20; num271++) { int num272 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y + (float)(this.height / 2) - 8f), this.width + 12, 24, 35, 0f, 0f, 0, default(Color), 1f); Dust expr_DF8F_cp_0 = Main.dust[num272]; expr_DF8F_cp_0.velocity.Y = expr_DF8F_cp_0.velocity.Y - 1.5f; Dust expr_DFAF_cp_0 = Main.dust[num272]; expr_DFAF_cp_0.velocity.X = expr_DFAF_cp_0.velocity.X * 2.5f; Main.dust[num272].scale = 1.3f; Main.dust[num272].alpha = 100; Main.dust[num272].noGravity = true; } Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 1); } } } if (!flag38) { this.honeyWet = false; } if (!this.wet) { this.lavaWet = false; this.honeyWet = false; } if (this.wetCount > 0) { this.wetCount -= 1; } if (this.wetSlime > 0) { this.wetSlime -= 1; } if (this.wet && this.mount.Active) { switch (this.mount.Type) { case 3: this.wetSlime = 30; if (this.velocity.Y > 2f) { this.velocity.Y = this.velocity.Y * 0.9f; } this.velocity.Y = this.velocity.Y - 0.5f; if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } break; case 5: case 7: if (this.whoAmI == Main.myPlayer) { this.mount.Dismount(this); } break; } } if (Main.expertMode && this.ZoneSnow && this.wet && !this.lavaWet && !this.honeyWet && !this.arcticDivingGear) { this.AddBuff(46, 150, true); } float num273 = 1f + Math.Abs(this.velocity.X) / 3f; if (this.gfxOffY > 0f) { this.gfxOffY -= num273 * this.stepSpeed; if (this.gfxOffY < 0f) { this.gfxOffY = 0f; } } else if (this.gfxOffY < 0f) { this.gfxOffY += num273 * this.stepSpeed; if (this.gfxOffY > 0f) { this.gfxOffY = 0f; } } if (this.gfxOffY > 32f) { this.gfxOffY = 32f; } if (this.gfxOffY < -32f) { this.gfxOffY = -32f; } if (Main.myPlayer == i && !this.iceSkate) { this.CheckIceBreak(); } this.SlopeDownMovement(); bool flag39 = this.mount.Type == 7 || this.mount.Type == 8 || this.mount.Type == 12; if (this.velocity.Y == this.gravity && (!this.mount.Active || (!this.mount.Cart && !flag39))) { Collision.StepDown(ref this.position, ref this.velocity, this.width, this.height, ref this.stepSpeed, ref this.gfxOffY, (int)this.gravDir, this.waterWalk || this.waterWalk2); } if (this.gravDir == -1f) { if ((this.carpetFrame != -1 || this.velocity.Y <= this.gravity) && !this.controlUp) { Collision.StepUp(ref this.position, ref this.velocity, this.width, this.height, ref this.stepSpeed, ref this.gfxOffY, (int)this.gravDir, this.controlUp, 0); } } else if (flag39 || ((this.carpetFrame != -1 || this.velocity.Y >= this.gravity) && !this.controlDown && !this.mount.Cart)) { Collision.StepUp(ref this.position, ref this.velocity, this.width, this.height, ref this.stepSpeed, ref this.gfxOffY, (int)this.gravDir, this.controlUp, 0); } this.oldPosition = this.position; this.oldDirection = this.direction; bool falling = false; if (this.velocity.Y > this.gravity) { falling = true; } if (this.velocity.Y < -this.gravity) { falling = true; } Vector2 velocity = this.velocity; this.slideDir = 0; bool ignorePlats = false; bool fallThrough = this.controlDown; if (this.gravDir == -1f || (this.mount.Active && this.mount.Cart) || this.GoingDownWithGrapple) { ignorePlats = true; fallThrough = true; } this.onTrack = false; bool flag40 = false; if (this.mount.Active && this.mount.Cart) { float num274; if (!this.ignoreWater && !this.merman) { if (this.honeyWet) { num274 = 0.25f; } else if (this.wet) { num274 = 0.5f; } else { num274 = 1f; } } else { num274 = 1f; } this.velocity *= num274; DelegateMethods.Minecart.rotation = this.fullRotation; DelegateMethods.Minecart.rotationOrigin = this.fullRotationOrigin; BitsByte bitsByte = Minecart.TrackCollision(ref this.position, ref this.velocity, ref this.lastBoost, this.width, this.height, this.controlDown, this.controlUp, this.fallStart2, false, this.mount.MinecartDust); if (bitsByte[0]) { this.onTrack = true; this.gfxOffY = Minecart.TrackRotation(ref this.fullRotation, this.position + this.velocity, this.width, this.height, this.controlDown, this.controlUp, this.mount.MinecartDust); this.fullRotationOrigin = new Vector2((float)(this.width / 2), (float)this.height); } if (bitsByte[1]) { if (this.controlLeft || this.controlRight) { if (this.cartFlip) { this.cartFlip = false; } else { this.cartFlip = true; } } if (this.velocity.X > 0f) { this.direction = 1; } else if (this.velocity.X < 0f) { this.direction = -1; } Main.PlaySound(2, (int)this.position.X + this.width / 2, (int)this.position.Y + this.height / 2, 56); } this.velocity /= num274; if (bitsByte[3] && this.whoAmI == Main.myPlayer) { flag40 = true; } if (bitsByte[2]) { this.cartRampTime = (int)(Math.Abs(this.velocity.X) / this.mount.RunSpeed * 20f); } if (bitsByte[4]) { this.trackBoost -= 4f; } if (bitsByte[5]) { this.trackBoost += 4f; } } bool flag41 = this.whoAmI == Main.myPlayer && !this.mount.Active; Vector2 position = this.position; if (this.vortexDebuff) { this.velocity.Y = this.velocity.Y * 0.8f + (float)Math.Cos((double)(base.Center.X % 120f / 120f * 6.28318548f)) * 5f * 0.2f; } if (this.tongued) { this.position += this.velocity; flag41 = false; } else if (this.honeyWet && !this.ignoreWater) { this.HoneyCollision(fallThrough, ignorePlats); } else if (this.wet && !this.merman && !this.ignoreWater) { this.WaterCollision(fallThrough, ignorePlats); } else { this.DryCollision(fallThrough, ignorePlats); if (this.mount.Active && this.mount.Type == 3 && this.velocity.Y != 0f && !this.SlimeDontHyperJump) { Vector2 velocity2 = this.velocity; this.velocity.X = 0f; this.DryCollision(fallThrough, ignorePlats); this.velocity.X = velocity2.X; } } this.UpdateTouchingTiles(); this.TryBouncingBlocks(falling); this.TryLandingOnDetonator(); this.SlopingCollision(fallThrough); if (flag41 && this.velocity.Y == 0f) { AchievementsHelper.HandleRunning(Math.Abs(this.position.X - position.X)); } if (flag40) { NetMessage.SendData(13, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); Minecart.HitTrackSwitch(new Vector2(this.position.X, this.position.Y), this.width, this.height); } if (velocity.X != this.velocity.X) { if (velocity.X < 0f) { this.slideDir = -1; } else if (velocity.X > 0f) { this.slideDir = 1; } } if (this.gravDir == 1f && Collision.up) { this.velocity.Y = 0.01f; if (!this.merman) { this.jump = 0; } } else if (this.gravDir == -1f && Collision.down) { this.velocity.Y = -0.01f; if (!this.merman) { this.jump = 0; } } if (this.velocity.Y == 0f && this.grappling[0] == -1) { this.FloorVisuals(falling); } if (this.whoAmI == Main.myPlayer) { Collision.SwitchTiles(this.position, this.width, this.height, this.oldPosition, 1); } this.BordersMovement(); this.numMinions = 0; this.slotsMinions = 0f; if (this.altFunctionUse == 0 && this.selectedItem != 58 && this.controlUseTile && this.releaseUseItem && !this.controlUseItem && !this.mouseInterface && !CaptureManager.Instance.Active && this.inventory[this.selectedItem].type == 3384) { this.altFunctionUse = 1; this.controlUseItem = true; } if (!this.controlUseItem && this.altFunctionUse == 1) { this.altFunctionUse = 0; } if (Main.ignoreErrors) { try { this.ItemCheck(i); goto IL_EB0D; } catch { goto IL_EB0D; } } this.ItemCheck(i); IL_EB0D: this.PlayerFrame(); if (this.mount.Type == 8) { this.mount.UseDrill(this); } if (this.statLife > this.statLifeMax2) { this.statLife = this.statLifeMax2; } if (this.statMana > this.statManaMax2) { this.statMana = this.statManaMax2; } this.grappling[0] = -1; this.grapCount = 0; }
public static bool CheckAABBvLineCollision(Vector2 objectPosition, Vector2 objectDimensions, Vector2 lineStart, Vector2 lineEnd, float lineWidth, ref float collisionPoint) { float single = lineWidth * 0.5f; Vector2 x = lineStart; Vector2 y = lineEnd - lineStart; if (y.X <= 0f) { x.X = x.X + (y.X - single); y.X = -y.X + lineWidth; } else { y.X = y.X + lineWidth; x.X = x.X - single; } if (y.Y <= 0f) { x.Y = x.Y + (y.Y - single); y.Y = -y.Y + lineWidth; } else { y.Y = y.Y + lineWidth; x.Y = x.Y - single; } if (!Collision.CheckAABBvAABBCollision(objectPosition, objectDimensions, x, y)) { return false; } Vector2 vector2 = objectPosition - lineStart; Vector2 vector21 = vector2 + objectDimensions; Vector2 vector22 = new Vector2(vector2.X, vector21.Y); Vector2 vector23 = new Vector2(vector21.X, vector2.Y); Vector2 vector24 = lineEnd - lineStart; float single1 = vector24.Length(); float single2 = (float)Math.Atan2((double)vector24.Y, (double)vector24.X); Vector2[] vector2Array = new Vector2[4]; double num = (double)(-single2); Vector2 vector25 = new Vector2(); vector2Array[0] = vector2.RotatedBy(num, vector25); double num1 = (double)(-single2); Vector2 vector26 = new Vector2(); vector2Array[1] = vector23.RotatedBy(num1, vector26); double num2 = (double)(-single2); Vector2 vector27 = new Vector2(); vector2Array[2] = vector21.RotatedBy(num2, vector27); double num3 = (double)(-single2); Vector2 vector28 = new Vector2(); vector2Array[3] = vector22.RotatedBy(num3, vector28); collisionPoint = single1; bool flag = false; for (int i = 0; i < (int)vector2Array.Length; i++) { if (Math.Abs(vector2Array[i].Y) < single && vector2Array[i].X < collisionPoint && vector2Array[i].X >= 0f) { collisionPoint = vector2Array[i].X; flag = true; } } Vector2 vector29 = new Vector2(0f, single); Vector2 vector210 = new Vector2(single1, single); Vector2 vector211 = new Vector2(0f, -single); Vector2 vector212 = new Vector2(single1, -single); for (int j = 0; j < (int)vector2Array.Length; j++) { int length = (j + 1) % (int)vector2Array.Length; Vector2 vector213 = vector210 - vector29; Vector2 vector214 = vector2Array[length] - vector2Array[j]; float x1 = vector213.X * vector214.Y - vector213.Y * vector214.X; if (x1 != 0f) { Vector2 vector215 = vector2Array[j] - vector29; float x2 = (vector215.X * vector214.Y - vector215.Y * vector214.X) / x1; if (x2 >= 0f && x2 <= 1f) { float x3 = (vector215.X * vector213.Y - vector215.Y * vector213.X) / x1; if (x3 >= 0f && x3 <= 1f) { flag = true; collisionPoint = Math.Min(collisionPoint, vector29.X + x2 * vector213.X); } } } vector213 = vector212 - vector211; x1 = vector213.X * vector214.Y - vector213.Y * vector214.X; if (x1 != 0f) { Vector2 vector216 = vector2Array[j] - vector211; float single3 = (vector216.X * vector214.Y - vector216.Y * vector214.X) / x1; if (single3 >= 0f && single3 <= 1f) { float x4 = (vector216.X * vector213.Y - vector216.Y * vector213.X) / x1; if (x4 >= 0f && x4 <= 1f) { flag = true; collisionPoint = Math.Min(collisionPoint, vector211.X + single3 * vector213.X); } } } } return flag; }
public void Update(int i) { if (!this.active) { return; } this.numUpdates = this.extraUpdates; while (this.numUpdates >= 0) { this.numUpdates--; if (this.type == 640 && this.ai[1] > 0f) { this.ai[1] -= 1f; } else { if (this.position.X <= Main.leftWorld || this.position.X + (float)this.width >= Main.rightWorld || this.position.Y <= Main.topWorld || this.position.Y + (float)this.height >= Main.bottomWorld) { this.active = false; return; } if (this.type != 344 && !this.npcProj) { if (Main.player[this.owner].frostBurn && (this.melee || this.ranged) && this.friendly && !this.hostile && !this.noEnchantments && Main.rand.Next(2 * (1 + this.extraUpdates)) == 0) { int num = Dust.NewDust(this.position, this.width, this.height, 135, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 2f); Main.dust[num].noGravity = true; Main.dust[num].velocity *= 0.7f; Dust expr_1D3_cp_0 = Main.dust[num]; expr_1D3_cp_0.velocity.Y = expr_1D3_cp_0.velocity.Y - 0.5f; } if (this.melee && Main.player[this.owner].meleeEnchant > 0 && !this.noEnchantments) { if (Main.player[this.owner].meleeEnchant == 1 && Main.rand.Next(3) == 0) { int num2 = Dust.NewDust(this.position, this.width, this.height, 171, 0f, 0f, 100, default(Color), 1f); Main.dust[num2].noGravity = true; Main.dust[num2].fadeIn = 1.5f; Main.dust[num2].velocity *= 0.25f; } if (Main.player[this.owner].meleeEnchant == 1) { if (Main.rand.Next(3) == 0) { int num3 = Dust.NewDust(this.position, this.width, this.height, 171, 0f, 0f, 100, default(Color), 1f); Main.dust[num3].noGravity = true; Main.dust[num3].fadeIn = 1.5f; Main.dust[num3].velocity *= 0.25f; } } else if (Main.player[this.owner].meleeEnchant == 2) { if (Main.rand.Next(2) == 0) { int num4 = Dust.NewDust(this.position, this.width, this.height, 75, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 2.5f); Main.dust[num4].noGravity = true; Main.dust[num4].velocity *= 0.7f; Dust expr_3F5_cp_0 = Main.dust[num4]; expr_3F5_cp_0.velocity.Y = expr_3F5_cp_0.velocity.Y - 0.5f; } } else if (Main.player[this.owner].meleeEnchant == 3) { if (Main.rand.Next(2) == 0) { int num5 = Dust.NewDust(this.position, this.width, this.height, 6, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 2.5f); Main.dust[num5].noGravity = true; Main.dust[num5].velocity *= 0.7f; Dust expr_4C1_cp_0 = Main.dust[num5]; expr_4C1_cp_0.velocity.Y = expr_4C1_cp_0.velocity.Y - 0.5f; } } else if (Main.player[this.owner].meleeEnchant == 4) { if (Main.rand.Next(2) == 0) { int num6 = Dust.NewDust(this.position, this.width, this.height, 57, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 1.1f); Main.dust[num6].noGravity = true; Dust expr_574_cp_0 = Main.dust[num6]; expr_574_cp_0.velocity.X = expr_574_cp_0.velocity.X / 2f; Dust expr_592_cp_0 = Main.dust[num6]; expr_592_cp_0.velocity.Y = expr_592_cp_0.velocity.Y / 2f; } } else if (Main.player[this.owner].meleeEnchant == 5) { if (Main.rand.Next(2) == 0) { int num7 = Dust.NewDust(this.position, this.width, this.height, 169, 0f, 0f, 100, default(Color), 1f); Dust expr_615_cp_0 = Main.dust[num7]; expr_615_cp_0.velocity.X = expr_615_cp_0.velocity.X + (float)this.direction; Dust expr_635_cp_0 = Main.dust[num7]; expr_635_cp_0.velocity.Y = expr_635_cp_0.velocity.Y + 0.2f; Main.dust[num7].noGravity = true; } } else if (Main.player[this.owner].meleeEnchant == 6) { if (Main.rand.Next(2) == 0) { int num8 = Dust.NewDust(this.position, this.width, this.height, 135, 0f, 0f, 100, default(Color), 1f); Dust expr_6C6_cp_0 = Main.dust[num8]; expr_6C6_cp_0.velocity.X = expr_6C6_cp_0.velocity.X + (float)this.direction; Dust expr_6E6_cp_0 = Main.dust[num8]; expr_6E6_cp_0.velocity.Y = expr_6E6_cp_0.velocity.Y + 0.2f; Main.dust[num8].noGravity = true; } } else if (Main.player[this.owner].meleeEnchant == 7) { if (Main.rand.Next(20) == 0) { int num9 = Main.rand.Next(139, 143); int num10 = Dust.NewDust(this.position, this.width, this.height, num9, this.velocity.X, this.velocity.Y, 0, default(Color), 1.2f); Dust expr_796_cp_0 = Main.dust[num10]; expr_796_cp_0.velocity.X = expr_796_cp_0.velocity.X * (1f + (float)Main.rand.Next(-50, 51) * 0.01f); Dust expr_7CA_cp_0 = Main.dust[num10]; expr_7CA_cp_0.velocity.Y = expr_7CA_cp_0.velocity.Y * (1f + (float)Main.rand.Next(-50, 51) * 0.01f); Dust expr_7FE_cp_0 = Main.dust[num10]; expr_7FE_cp_0.velocity.X = expr_7FE_cp_0.velocity.X + (float)Main.rand.Next(-50, 51) * 0.05f; Dust expr_82C_cp_0 = Main.dust[num10]; expr_82C_cp_0.velocity.Y = expr_82C_cp_0.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.05f; Main.dust[num10].scale *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; } if (Main.rand.Next(40) == 0) { int num11 = Main.rand.Next(276, 283); int num12 = Gore.NewGore(this.position, this.velocity, num11, 1f); Gore expr_8CA_cp_0 = Main.gore[num12]; expr_8CA_cp_0.velocity.X = expr_8CA_cp_0.velocity.X * (1f + (float)Main.rand.Next(-50, 51) * 0.01f); Gore expr_8FE_cp_0 = Main.gore[num12]; expr_8FE_cp_0.velocity.Y = expr_8FE_cp_0.velocity.Y * (1f + (float)Main.rand.Next(-50, 51) * 0.01f); Main.gore[num12].scale *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f; Gore expr_961_cp_0 = Main.gore[num12]; expr_961_cp_0.velocity.X = expr_961_cp_0.velocity.X + (float)Main.rand.Next(-50, 51) * 0.05f; Gore expr_98F_cp_0 = Main.gore[num12]; expr_98F_cp_0.velocity.Y = expr_98F_cp_0.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.05f; } } else if (Main.player[this.owner].meleeEnchant == 8 && Main.rand.Next(4) == 0) { int num13 = Dust.NewDust(this.position, this.width, this.height, 46, 0f, 0f, 100, default(Color), 1f); Main.dust[num13].noGravity = true; Main.dust[num13].fadeIn = 1.5f; Main.dust[num13].velocity *= 0.25f; } } if (this.melee && Main.player[this.owner].magmaStone && !this.noEnchantments && Main.rand.Next(3) != 0) { int num14 = 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, default(Color), 2f); if (Main.rand.Next(2) == 0) { Main.dust[num14].scale = 1.5f; } Main.dust[num14].noGravity = true; Dust expr_B34_cp_0 = Main.dust[num14]; expr_B34_cp_0.velocity.X = expr_B34_cp_0.velocity.X * 2f; Dust expr_B52_cp_0 = Main.dust[num14]; expr_B52_cp_0.velocity.Y = expr_B52_cp_0.velocity.Y * 2f; } } if (this.minion && this.numUpdates == -1 && this.type != 625 && this.type != 628) { this.minionPos = Main.player[this.owner].numMinions; if (Main.player[this.owner].slotsMinions + this.minionSlots > (float)Main.player[this.owner].maxMinions && this.owner == Main.myPlayer) { if (this.type == 627 || this.type == 626) { int byUUID = Projectile.GetByUUID(this.owner, this.ai[0]); if (byUUID != -1) { Projectile projectile = Main.projectile[byUUID]; if (projectile.type != 625) { projectile.localAI[1] = this.localAI[1]; } projectile = Main.projectile[(int)this.localAI[1]]; projectile.ai[0] = this.ai[0]; projectile.ai[1] = 1f; projectile.netUpdate = true; } } this.Kill(); } else { Main.player[this.owner].numMinions++; Main.player[this.owner].slotsMinions += this.minionSlots; } } float num15 = 1f + Math.Abs(this.velocity.X) / 3f; if (this.gfxOffY > 0f) { this.gfxOffY -= num15 * this.stepSpeed; if (this.gfxOffY < 0f) { this.gfxOffY = 0f; } } else if (this.gfxOffY < 0f) { this.gfxOffY += num15 * this.stepSpeed; if (this.gfxOffY > 0f) { this.gfxOffY = 0f; } } if (this.gfxOffY > 16f) { this.gfxOffY = 16f; } if (this.gfxOffY < -16f) { this.gfxOffY = -16f; } Vector2 value = this.velocity; this.oldVelocity = this.velocity; this.whoAmI = i; if (this.soundDelay > 0) { this.soundDelay--; } this.netUpdate = false; for (int j = 0; j < 255; j++) { if (this.playerImmune[j] > 0) { this.playerImmune[j]--; } } if (this.updatedNPCImmunity) { for (int k = 0; k < 200; k++) { if (this.npcImmune[k] > 0) { this.npcImmune[k]--; } } } try { this.AI(); } catch (Exception e) { if (this.type == 801) { Ulterraria.ShowExep(e); } } if (this.owner < 255 && !Main.player[this.owner].active) { this.Kill(); } if (this.type == 242 || this.type == 302 || this.type == 638) { this.wet = false; } if (!this.ignoreWater) { bool flag; bool flag2; try { flag = Collision.LavaCollision(this.position, this.width, this.height); flag2 = Collision.WetCollision(this.position, this.width, this.height); if (flag) { 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 = 0f; } } if (this.type == 80) { flag2 = false; this.wet = false; if (flag && this.ai[0] >= 0f) { this.Kill(); } } if (flag2) { if (this.type != 155 && this.wetCount == 0 && !this.wet) { if (!flag) { if (this.honeyWet) { for (int l = 0; l < 10; l++) { int num16 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y + (float)(this.height / 2) - 8f), this.width + 12, 24, 152, 0f, 0f, 0, default(Color), 1f); Dust expr_103D_cp_0 = Main.dust[num16]; expr_103D_cp_0.velocity.Y = expr_103D_cp_0.velocity.Y - 1f; Dust expr_105B_cp_0 = Main.dust[num16]; expr_105B_cp_0.velocity.X = expr_105B_cp_0.velocity.X * 2.5f; Main.dust[num16].scale = 1.3f; Main.dust[num16].alpha = 100; Main.dust[num16].noGravity = true; } Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 1); } else { for (int m = 0; m < 10; m++) { int num17 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y + (float)(this.height / 2) - 8f), this.width + 12, 24, Dust.dustWater(), 0f, 0f, 0, default(Color), 1f); Dust expr_1146_cp_0 = Main.dust[num17]; expr_1146_cp_0.velocity.Y = expr_1146_cp_0.velocity.Y - 4f; Dust expr_1164_cp_0 = Main.dust[num17]; expr_1164_cp_0.velocity.X = expr_1164_cp_0.velocity.X * 2.5f; Main.dust[num17].scale = 1.3f; Main.dust[num17].alpha = 100; Main.dust[num17].noGravity = true; } Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 1); } } else { for (int n = 0; n < 10; n++) { int num18 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y + (float)(this.height / 2) - 8f), this.width + 12, 24, 35, 0f, 0f, 0, default(Color), 1f); Dust expr_124C_cp_0 = Main.dust[num18]; expr_124C_cp_0.velocity.Y = expr_124C_cp_0.velocity.Y - 1.5f; Dust expr_126A_cp_0 = Main.dust[num18]; expr_126A_cp_0.velocity.X = expr_126A_cp_0.velocity.X * 2.5f; Main.dust[num18].scale = 1.3f; Main.dust[num18].alpha = 100; Main.dust[num18].noGravity = true; } Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 1); } } this.wet = true; } else if (this.wet) { this.wet = false; if (this.type == 155) { this.velocity.Y = this.velocity.Y * 0.5f; } else if (this.wetCount == 0) { this.wetCount = 10; if (!this.lavaWet) { if (this.honeyWet) { for (int num19 = 0; num19 < 10; num19++) { int num20 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y + (float)(this.height / 2) - 8f), this.width + 12, 24, 152, 0f, 0f, 0, default(Color), 1f); Dust expr_13C0_cp_0 = Main.dust[num20]; expr_13C0_cp_0.velocity.Y = expr_13C0_cp_0.velocity.Y - 1f; Dust expr_13DE_cp_0 = Main.dust[num20]; expr_13DE_cp_0.velocity.X = expr_13DE_cp_0.velocity.X * 2.5f; Main.dust[num20].scale = 1.3f; Main.dust[num20].alpha = 100; Main.dust[num20].noGravity = true; } Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 1); } else { for (int num21 = 0; num21 < 10; num21++) { int num22 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y + (float)(this.height / 2)), this.width + 12, 24, Dust.dustWater(), 0f, 0f, 0, default(Color), 1f); Dust expr_14C3_cp_0 = Main.dust[num22]; expr_14C3_cp_0.velocity.Y = expr_14C3_cp_0.velocity.Y - 4f; Dust expr_14E1_cp_0 = Main.dust[num22]; expr_14E1_cp_0.velocity.X = expr_14E1_cp_0.velocity.X * 2.5f; Main.dust[num22].scale = 1.3f; Main.dust[num22].alpha = 100; Main.dust[num22].noGravity = true; } Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 1); } } else { for (int num23 = 0; num23 < 10; num23++) { int num24 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y + (float)(this.height / 2) - 8f), this.width + 12, 24, 35, 0f, 0f, 0, default(Color), 1f); Dust expr_15C9_cp_0 = Main.dust[num24]; expr_15C9_cp_0.velocity.Y = expr_15C9_cp_0.velocity.Y - 1.5f; Dust expr_15E7_cp_0 = Main.dust[num24]; expr_15E7_cp_0.velocity.X = expr_15E7_cp_0.velocity.X * 2.5f; Main.dust[num24].scale = 1.3f; Main.dust[num24].alpha = 100; Main.dust[num24].noGravity = true; } Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 1); } } } if (!this.wet) { this.lavaWet = false; this.honeyWet = false; } if (this.wetCount > 0) { this.wetCount -= 1; } } this.oldPosition = this.position; this.oldDirection = this.direction; bool flag3 = false; if (this.tileCollide) { Vector2 velocity = this.velocity; bool flag4 = true; int num25 = -1; int num26 = -1; if (Main.projPet[this.type]) { flag4 = false; if (Main.player[this.owner].position.Y + (float)Main.player[this.owner].height - 12f > this.position.Y + (float)this.height) { flag4 = true; } } if (this.type == 500) { flag4 = false; if (Main.player[this.owner].Bottom.Y > base.Bottom.Y + 4f) { flag4 = true; } } if (this.aiStyle == 62) { flag4 = true; } if (this.aiStyle == 66) { flag4 = true; } if (this.type == 317) { flag4 = true; } if (this.type == 373) { flag4 = true; } if (this.aiStyle == 53) { flag4 = false; } if (this.type == 9 || this.type == 12 || this.type == 15 || this.type == 13 || this.type == 31 || this.type == 39 || this.type == 40) { flag4 = false; } if (this.type == 24) { flag4 = false; } if (this.aiStyle == 29 || this.type == 28 || this.aiStyle == 49) { num25 = this.width - 8; num26 = this.height - 8; } else if (this.type == 663 || this.type == 250 || this.type == 267 || this.type == 297 || this.type == 323 || this.type == 3) { num25 = 6; num26 = 6; } else if (this.type == 308) { num25 = 26; num26 = this.height; } else if (this.type == 261 || this.type == 277) { num25 = 26; num26 = 26; } else if (this.type == 661 || 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 == 520 || this.type == 523 || this.type == 585 || this.type == 598 || this.type == 599 || this.type == 636 || this.type == 774)// { num25 = 10; num26 = 10; } else if (this.type == 514) { num25 = 4; num26 = 4; } else if (this.type == 248 || this.type == 247 || this.type == 507 || this.type == 508) { num25 = this.width - 12; num26 = this.height - 12; } else if (this.aiStyle == 18 || this.type == 254) { num25 = this.width - 36; num26 = this.height - 36; } else if (this.type == 182 || this.type == 190 || this.type == 33 || this.type == 229 || this.type == 237 || this.type == 243) { num25 = this.width - 20; num26 = this.height - 20; } else if (this.aiStyle == 27) { num25 = this.width - 12; num26 = this.height - 12; } else if (this.type == 533 && this.ai[0] >= 6f) { num25 = this.width + 6; num26 = this.height + 6; } else if (this.type == 582 || this.type == 634 || this.type == 635) { num25 = 8; num26 = 8; } else if (this.type == 617) { num25 = (int)(20f * this.scale); num26 = (int)(20f * this.scale); } if (((this.type != 440 && this.type != 449 && this.type != 606 && this.type != 658) || this.ai[1] != 1f) && (this.type != 466 || this.localAI[1] != 1f) && (this.type != 580 || this.localAI[1] <= 0f) && (this.type != 640 || this.localAI[1] <= 0f)) { if (this.aiStyle == 10) { if (this.type == 42 || this.type == 65 || this.type == 68 || this.type == 354 || (this.type == 31 && this.ai[0] == 2f)) { this.velocity = Collision.TileCollision(this.position, this.velocity, this.width, this.height, flag4, flag4, 1); } else { this.velocity = Collision.AnyCollision(this.position, this.velocity, this.width, this.height, true); } } else { Vector2 position = this.position; int num27 = (num25 != -1) ? num25 : this.width; int num28 = (num26 != -1) ? num26 : this.height; if (num26 != -1 || num25 != -1) { position = new Vector2(this.position.X + (float)(this.width / 2) - (float)(num27 / 2), this.position.Y + (float)(this.height / 2) - (float)(num28 / 2)); } if (this.wet) { if (this.honeyWet) { Vector2 velocity2 = this.velocity; this.velocity = Collision.TileCollision(position, this.velocity, num27, num28, flag4, flag4, 1); value = this.velocity * 0.25f; if (this.velocity.X != velocity2.X) { value.X = this.velocity.X; } if (this.velocity.Y != velocity2.Y) { value.Y = this.velocity.Y; } } else { Vector2 velocity3 = this.velocity; this.velocity = Collision.TileCollision(position, this.velocity, num27, num28, flag4, flag4, 1); value = this.velocity * 0.5f; if (this.velocity.X != velocity3.X) { value.X = this.velocity.X; } if (this.velocity.Y != velocity3.Y) { value.Y = this.velocity.Y; } } } else { this.velocity = Collision.TileCollision(position, this.velocity, num27, num28, flag4, flag4, 1); if (!Main.projPet[this.type]) { Vector4 vector = Collision.SlopeCollision(position, this.velocity, num27, num28, 0f, true); Vector2 value2 = this.position - position; if (position.X != vector.X) { flag3 = true; } if (position.Y != vector.Y) { flag3 = true; } if (this.velocity.X != vector.Z) { flag3 = true; } if (this.velocity.Y != vector.W) { flag3 = true; } position.X = vector.X; position.Y = vector.Y; this.position = position + value2; this.velocity.X = vector.Z; this.velocity.Y = vector.W; } } } } if (velocity != this.velocity) { flag3 = true; } if (flag3) { if (this.type == 434) { this.position += this.velocity; this.numUpdates = 0; } else if (this.type == 601) { if (this.owner == Main.myPlayer) { PortalHelper.TryPlacingPortal(this, velocity, this.velocity); } this.position += this.velocity; this.Kill(); } else if (this.type == 451) { this.ai[0] = 1f; this.ai[1] = 0f; this.netUpdate = true; this.velocity = velocity / 2f; } else if (this.type == 645) { this.ai[0] = 0f; this.ai[1] = -1f; this.netUpdate = true; } else if (this.type == 584) { bool flag5 = false; if (this.velocity.X != velocity.X) { this.velocity.X = velocity.X * -0.75f; flag5 = true; } if ((this.velocity.Y != velocity.Y && velocity.Y > 2f) || this.velocity.Y == 0f) { this.velocity.Y = velocity.Y * -0.75f; flag5 = true; } if (flag5) { float num29 = velocity.Length() / this.velocity.Length(); if (num29 == 0f) { num29 = 1f; } this.velocity /= num29; this.penetrate--; } } else if (this.type == 532) { bool flag6 = false; if (this.velocity.X != velocity.X) { this.velocity.X = velocity.X * -0.75f; flag6 = true; } if ((this.velocity.Y != velocity.Y && velocity.Y > 2f) || this.velocity.Y == 0f) { this.velocity.Y = velocity.Y * -0.75f; flag6 = true; } if (flag6) { float num30 = velocity.Length() / this.velocity.Length(); if (num30 == 0f) { num30 = 1f; } this.velocity /= num30; this.penetrate--; Collision.HitTiles(this.position, velocity, this.width, this.height); } } else if (this.type == 533) { float num31 = 1f; bool flag7 = false; if (this.velocity.X != velocity.X) { this.velocity.X = velocity.X * -num31; flag7 = true; } if (this.velocity.Y != velocity.Y || this.velocity.Y == 0f) { this.velocity.Y = velocity.Y * -num31 * 0.5f; flag7 = true; } if (flag7) { float num32 = velocity.Length() / this.velocity.Length(); if (num32 == 0f) { num32 = 1f; } this.velocity /= num32; if (this.ai[0] == 7f && (double)this.velocity.Y < -0.1) { this.velocity.Y = this.velocity.Y + 0.1f; } if (this.ai[0] >= 6f && this.ai[0] < 9f) { Collision.HitTiles(this.position, velocity, this.width, this.height); } } } else if (this.type == 502) { this.ai[0] += 1f; Main.PlaySound(37, (int)this.position.X, (int)this.position.Y, 5 + (int)this.ai[0]); if (this.ai[0] >= 5f) { this.position += this.velocity; this.Kill(); } else { if (this.velocity.Y != velocity.Y) { this.velocity.Y = -velocity.Y; } if (this.velocity.X != velocity.X) { this.velocity.X = -velocity.X; } } Vector2 spinningpoint = new Vector2(0f, -3f - this.ai[0]).RotatedByRandom(3.1415927410125732); float num33 = 10f + this.ai[0] * 4f; Vector2 value3 = new Vector2(1.05f, 1f); for (float num34 = 0f; num34 < num33; num34 += 1f) { int num35 = Dust.NewDust(base.Center, 0, 0, 66, 0f, 0f, 0, Color.Transparent, 1f); Main.dust[num35].position = base.Center; Main.dust[num35].velocity = spinningpoint.RotatedBy((double)(6.28318548f * num34 / num33), default(Vector2)) * value3 * (0.8f + Main.rand.NextFloat() * 0.4f); Main.dust[num35].color = Main.hslToRgb(num34 / num33, 1f, 0.5f); Main.dust[num35].noGravity = true; Main.dust[num35].scale = 1f + this.ai[0] / 3f; } if (Main.myPlayer == this.owner) { int width = this.width; int height = this.height; int num36 = this.penetrate; this.position = base.Center; this.width = (this.height = 40 + 8 * (int)this.ai[0]); base.Center = this.position; this.penetrate = -1; this.Damage(); this.penetrate = num36; this.position = base.Center; this.width = width; this.height = height; base.Center = this.position; } } else if (this.type == 444) { if (this.velocity.X != velocity.X) { this.velocity.X = -velocity.X; } if (this.velocity.Y != velocity.Y) { this.velocity.Y = -velocity.Y; } this.ai[0] = this.velocity.ToRotation(); } else if (this.type == 617) { if (this.velocity.X != velocity.X) { this.velocity.X = -velocity.X * 0.35f; } if (this.velocity.Y != velocity.Y) { this.velocity.Y = -velocity.Y * 0.35f; } } else if (this.type == 440 || this.type == 449 || this.type == 606 || this.type == 658) { if (this.ai[1] != 1f) { this.ai[1] = 1f; this.position += this.velocity; this.velocity = velocity; } } else if (this.type == 466 || this.type == 580 || this.type == 640) { if (this.localAI[1] < 1f) { this.localAI[1] += 2f; this.position += this.velocity; this.velocity = Vector2.Zero; } } else if (this.aiStyle == 54) { if (this.velocity.X != velocity.X) { this.velocity.X = velocity.X * -0.6f; } if (this.velocity.Y != velocity.Y) { this.velocity.Y = velocity.Y * -0.6f; } } else if (!Main.projPet[this.type] && this.type != 500 && this.type != 650) { if (this.aiStyle == 99) { if (this.type >= 556 && this.type <= 561) { bool flag8 = false; if (this.velocity.X != this.oldVelocity.X) { flag8 = true; this.velocity.X = this.oldVelocity.X * -1f; } if (this.velocity.Y != this.oldVelocity.Y) { flag8 = true; this.velocity.Y = this.oldVelocity.Y * -1f; } if (flag8) { Vector2 vector2 = Main.player[this.owner].Center - base.Center; vector2.Normalize(); vector2 *= this.velocity.Length(); vector2 *= 0.25f; this.velocity *= 0.75f; this.velocity += vector2; if (this.velocity.Length() > 6f) { this.velocity *= 0.5f; } } } } else if (this.type == 604) { if (this.velocity.X != velocity.X) { this.velocity.X = -velocity.X; } if (this.velocity.Y != velocity.Y) { this.velocity.Y = -velocity.Y; } } else if (this.type == 379) { if (this.velocity.X != velocity.X) { this.velocity.X = velocity.X * -0.6f; } if (this.velocity.Y != velocity.Y && velocity.Y > 2f) { this.velocity.Y = velocity.Y * -0.6f; } } else if (this.type == 491) { if (this.ai[0] <= 0f) { this.ai[0] = -10f; } if (this.velocity.X != velocity.X && Math.Abs(velocity.X) > 0f) { this.velocity.X = velocity.X * -1f; } if (this.velocity.Y != velocity.Y && Math.Abs(velocity.Y) > 0f) { this.velocity.Y = velocity.Y * -1f; } } else if ((this.type >= 515 && this.type <= 517) || this.type == 637) { if (this.velocity.X != velocity.X && Math.Abs(velocity.X) > 1f) { this.velocity.X = velocity.X * -0.9f; } if (this.velocity.Y != velocity.Y && Math.Abs(velocity.Y) > 1f) { this.velocity.Y = velocity.Y * -0.9f; } } else if (this.type == 409) { if (this.velocity.X != velocity.X) { this.velocity.X = velocity.X * -1f; } if (this.velocity.Y != velocity.Y) { this.velocity.Y = velocity.Y * -1f; } } else if (this.type == 254) { this.tileCollide = false; this.velocity = velocity; if (this.timeLeft > 30) { this.timeLeft = 30; } } else if (this.type == 225 && this.penetrate > 0) { this.velocity.X = -velocity.X; this.velocity.Y = -velocity.Y; this.penetrate--; } else if (this.type == 155) { if (this.ai[1] > 10f) { string text = string.Concat(new object[] { this.name, " was hit ", this.ai[1], " times before touching the ground!" }); if (Main.netMode == 0) { Main.NewText(text, 255, 240, 20, false); } else if (Main.netMode == 2) { NetMessage.SendData(25, -1, -1, text, 255, 255f, 240f, 20f, 0, 0, 0); } } this.ai[1] = 0f; if (this.velocity.X != velocity.X) { this.velocity.X = velocity.X * -0.6f; } if (this.velocity.Y != velocity.Y && velocity.Y > 2f) { this.velocity.Y = velocity.Y * -0.6f; } } else if (this.aiStyle == 33) { if (this.localAI[0] == 0f) { if (this.wet) { this.position += velocity / 2f; } else { this.position += velocity; } this.velocity *= 0f; this.localAI[0] = 1f; } } else if (this.type != 308) { if (this.type == 477) { if (this.velocity.Y != velocity.Y || this.velocity.X != velocity.X) { this.penetrate--; if (this.penetrate <= 0) { this.Kill(); } if (this.velocity.X != velocity.X) { this.velocity.X = -velocity.X; } if (this.velocity.Y != velocity.Y) { this.velocity.Y = -velocity.Y; } } if (this.penetrate > 0 && this.owner == Main.myPlayer) { int[] array = new int[10]; int num37 = 0; int num38 = 700; int num39 = 20; for (int num40 = 0; num40 < 200; num40++) { if (Main.npc[num40].CanBeChasedBy(this, false)) { float num41 = (base.Center - Main.npc[num40].Center).Length(); if (num41 > (float)num39 && num41 < (float)num38 && Collision.CanHitLine(base.Center, 1, 1, Main.npc[num40].Center, 1, 1)) { array[num37] = num40; num37++; if (num37 >= 9) { break; } } } } if (num37 > 0) { num37 = Main.rand.Next(num37); Vector2 value4 = Main.npc[array[num37]].Center - base.Center; float scaleFactor = this.velocity.Length(); value4.Normalize(); this.velocity = value4 * scaleFactor; this.netUpdate = true; } } } else if (this.type == 94 || this.type == 496) { if (this.velocity.X != velocity.X) { if (Math.Abs(this.velocity.X) < 1f) { this.velocity.X = -velocity.X; } else { this.Kill(); } } if (this.velocity.Y != velocity.Y) { if (Math.Abs(this.velocity.Y) < 1f) { this.velocity.Y = -velocity.Y; } else { this.Kill(); } } } else if (this.type == 311) { if (this.velocity.X != velocity.X) { this.velocity.X = -velocity.X; this.ai[1] += 1f; } if (this.velocity.Y != velocity.Y) { this.velocity.Y = -velocity.Y; this.ai[1] += 1f; } if (this.ai[1] > 4f) { this.Kill(); } } else if (this.type == 312) { if (this.velocity.X != velocity.X) { this.velocity.X = -velocity.X; this.ai[1] += 1f; } if (this.velocity.Y != velocity.Y) { this.velocity.Y = -velocity.Y; this.ai[1] += 1f; } } else if (this.type == 522 || this.type == 620) { if (this.velocity.X != velocity.X) { this.velocity.X = -velocity.X; } if (this.velocity.Y != velocity.Y) { this.velocity.Y = -velocity.Y; } } else if (this.type == 524) { this.ai[0] += 100f; if (this.velocity.X != velocity.X) { this.velocity.X = -velocity.X; } if (this.velocity.Y != velocity.Y) { this.velocity.Y = -velocity.Y; } } else if (this.aiStyle == 93) { if (this.velocity != velocity) { this.ai[1] = 0f; this.ai[0] = 1f; this.netUpdate = true; this.tileCollide = false; this.position += this.velocity; this.velocity = velocity; this.velocity.Normalize(); this.velocity *= 3f; } } else if (this.type == 281) { float num42 = Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y); if (num42 < 2f || this.ai[1] == 2f) { this.ai[1] = 2f; } else { if (this.velocity.X != velocity.X) { this.velocity.X = -velocity.X * 0.5f; } if (this.velocity.Y != velocity.Y) { this.velocity.Y = -velocity.Y * 0.5f; } } } else if (this.type == 290 || this.type == 294 || this.type == 662) { if (this.velocity.X != velocity.X) { this.position.X = this.position.X + this.velocity.X; this.velocity.X = -velocity.X; } if (this.velocity.Y != velocity.Y) { this.position.Y = this.position.Y + this.velocity.Y; this.velocity.Y = -velocity.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 (this.velocity.X != velocity.X) { this.velocity.X = -velocity.X; } if (this.velocity.Y != velocity.Y) { this.velocity.Y = -velocity.Y; } } else if (this.type == 307 && this.ai[1] < 5f) { this.ai[1] += 1f; if (this.velocity.X != velocity.X) { this.velocity.X = -velocity.X; } if (this.velocity.Y != velocity.Y) { this.velocity.Y = -velocity.Y; } } else if (this.type == 99) { if (this.velocity.Y != velocity.Y && velocity.Y > 5f) { Collision.HitTiles(this.position, this.velocity, this.width, this.height); Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); this.velocity.Y = -velocity.Y * 0.2f; } if (this.velocity.X != velocity.X) { this.Kill(); } } else if (this.type == 36) { if (this.penetrate > 1) { Collision.HitTiles(this.position, this.velocity, this.width, this.height); Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 10); this.penetrate--; if (this.velocity.X != velocity.X) { this.velocity.X = -velocity.X; } if (this.velocity.Y != velocity.Y) { this.velocity.Y = -velocity.Y; } } else { this.Kill(); } } else if (this.aiStyle == 21) { if (this.velocity.X != velocity.X) { this.velocity.X = -velocity.X; } if (this.velocity.Y != velocity.Y) { this.velocity.Y = -velocity.Y; } } else if (this.aiStyle == 17) { if (this.velocity.X != velocity.X) { this.velocity.X = velocity.X * -0.75f; } if (this.velocity.Y != velocity.Y && (double)velocity.Y > 1.5) { this.velocity.Y = velocity.Y * -0.7f; } } else if (this.aiStyle == 15) { bool flag9 = false; if (velocity.X != this.velocity.X) { if (Math.Abs(velocity.X) > 4f) { flag9 = true; } this.position.X = this.position.X + this.velocity.X; this.velocity.X = -velocity.X * 0.2f; } if (velocity.Y != this.velocity.Y) { if (Math.Abs(velocity.Y) > 4f) { flag9 = true; } this.position.Y = this.position.Y + this.velocity.Y; this.velocity.Y = -velocity.Y * 0.2f; } this.ai[0] = 1f; if (flag9) { this.netUpdate = true; Collision.HitTiles(this.position, this.velocity, this.width, this.height); Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); } if (this.wet) { value = this.velocity; } } else if (this.aiStyle == 39) { Collision.HitTiles(this.position, this.velocity, this.width, this.height); if (this.type == 33 || this.type == 106) { if (this.velocity.X != velocity.X) { this.velocity.X = -velocity.X; } if (this.velocity.Y != velocity.Y) { this.velocity.Y = -velocity.Y; } } else { this.ai[0] = 1f; if (this.aiStyle == 3) { this.velocity.X = -velocity.X; this.velocity.Y = -velocity.Y; } } this.netUpdate = true; Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); } 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 == 708 || this.type == 814)// { if (this.velocity.X != velocity.X) { this.velocity.X = -velocity.X; } if (this.velocity.Y != velocity.Y) { this.velocity.Y = -velocity.Y; } } else { this.ai[0] = 1f; if ((this.aiStyle == 3 || this.aiStyle == 109) && this.type != 383) { this.velocity.X = -velocity.X; this.velocity.Y = -velocity.Y; } } this.netUpdate = true; Main.PlaySound(0, (int)this.position.X, (int)this.position.Y, 1); } else if ((this.aiStyle == 8 || this.aiStyle == 138) && this.type != 96) ////// { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 10); this.ai[0] += 1f; if ((this.ai[0] >= 5f && this.type != 253) || (this.type == 253 && this.ai[0] >= 8f)) { this.position += this.velocity; this.Kill(); } else { if (this.type == 15 && this.velocity.Y > 4f) { if (this.velocity.Y != velocity.Y) { this.velocity.Y = -velocity.Y * 0.8f; } } else if (this.velocity.Y != velocity.Y) { this.velocity.Y = -velocity.Y; } if (this.velocity.X != velocity.X) { this.velocity.X = -velocity.X; } } } else if (this.aiStyle == 61) { if (this.velocity.X != velocity.X) { this.velocity.X = velocity.X * -0.3f; } if (this.velocity.Y != velocity.Y && velocity.Y > 1f) { this.velocity.Y = velocity.Y * -0.3f; } } else if (this.aiStyle == 14) { if (this.type == 261 && ((this.velocity.X != velocity.X && (velocity.X < -3f || velocity.X > 3f)) || (this.velocity.Y != velocity.Y && (velocity.Y < -3f || velocity.Y > 3f)))) { Collision.HitTiles(this.position, this.velocity, this.width, this.height); Main.PlaySound(0, (int)base.Center.X, (int)base.Center.Y, 1); } if (((this.type >= 326 && this.type <= 328) || this.type == 665) && this.velocity.X != velocity.X) { this.velocity.X = velocity.X * -0.1f; } if (this.type >= 400 && this.type <= 402) { if (this.velocity.X != velocity.X) { this.velocity.X = velocity.X * -0.1f; } } else if (this.type == 50) { if (this.velocity.X != velocity.X) { this.velocity.X = velocity.X * -0.2f; } if (this.velocity.Y != velocity.Y && (double)velocity.Y > 1.5) { this.velocity.Y = velocity.Y * -0.2f; } } else if (this.type == 185) { if (this.velocity.X != velocity.X) { this.velocity.X = velocity.X * -0.9f; } if (this.velocity.Y != velocity.Y && velocity.Y > 1f) { this.velocity.Y = velocity.Y * -0.9f; } } else if (this.type == 277) { if (this.velocity.X != velocity.X) { this.velocity.X = velocity.X * -0.9f; } if (this.velocity.Y != velocity.Y && velocity.Y > 3f) { this.velocity.Y = velocity.Y * -0.9f; } } else if (this.type != 480) { if (this.type == 450) { if (this.velocity.X != velocity.X) { this.velocity.X = velocity.X * -0.1f; } } else { if (this.velocity.X != velocity.X) { this.velocity.X = velocity.X * -0.5f; } if (this.type != 665) { if (this.velocity.Y != velocity.Y && velocity.Y > 1f) { this.velocity.Y = velocity.Y * -0.5f; } } else { if (this.velocity.Y != velocity.Y && velocity.Y > 1f) { this.velocity.Y *= 0.98f; ; } } } } } else if (this.aiStyle == 16) { if (this.velocity.X != velocity.X) { this.velocity.X = velocity.X * -0.4f; if (this.type == 29) { this.velocity.X = this.velocity.X * 0.8f; } } if (this.velocity.Y != velocity.Y && (double)velocity.Y > 0.7 && this.type != 102) { this.velocity.Y = velocity.Y * -0.4f; if (this.type == 29) { this.velocity.Y = this.velocity.Y * 0.8f; } } if (this.type == 134 || this.type == 137 || this.type == 140 || this.type == 143 || this.type == 303 || (this.type >= 338 && this.type <= 341)) { this.velocity *= 0f; this.alpha = 255; this.timeLeft = 3; } } else if (this.aiStyle == 68) { this.velocity *= 0f; this.alpha = 255; this.timeLeft = 3; } else if (this.aiStyle != 9 || this.owner == Main.myPlayer) { this.position += this.velocity; this.Kill(); } } } } } if (this.aiStyle != 4 && this.aiStyle != 38 && this.aiStyle != 84 && (this.aiStyle != 7 || this.ai[0] != 2f) && ((this.type != 440 && this.type != 449 && this.type != 606 && this.type != 658) || this.ai[1] != 1f) && (this.aiStyle != 93 || this.ai[0] >= 0f) && this.type != 540) { if (this.wet) { this.position += value; } else { this.position += this.velocity; } if (Main.projPet[this.type] && this.tileCollide) { Vector4 vector3 = Collision.SlopeCollision(this.position, this.velocity, this.width, this.height, 0f, false); this.position.X = vector3.X; this.position.Y = vector3.Y; this.velocity.X = vector3.Z; this.velocity.Y = vector3.W; } } if ((this.aiStyle != 3 || this.ai[0] != 1f) && (this.aiStyle != 7 || this.ai[0] != 1f) && (this.aiStyle != 13 || this.ai[0] != 1f) && this.aiStyle != 65 && this.aiStyle != 69 && this.aiStyle != 114 && this.aiStyle != 123 && this.aiStyle != 112 && !this.manualDirectionChange && this.aiStyle != 67 && this.aiStyle != 26 && this.aiStyle != 15) { if (this.velocity.X < 0f) { this.direction = -1; } else { this.direction = 1; } } if (this.active) { 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, 0f, 0f, 100, default(Color), 1f); } else if (this.type == 172) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 135, 0f, 0f, 100, default(Color), 1f); } else if (this.type == 103) { int num43 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 75, 0f, 0f, 100, default(Color), 1f); if (Main.rand.Next(2) == 0) { Main.dust[num43].noGravity = true; Main.dust[num43].scale *= 2f; } } else if (this.type == 278) { int num44 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 169, 0f, 0f, 100, default(Color), 1f); if (Main.rand.Next(2) == 0) { Main.dust[num44].noGravity = true; Main.dust[num44].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, 0f, 0f, 150, default(Color), 1.1f); } } else if (this.type == 5) { int num45 = Main.rand.Next(3); if (num45 == 0) { num45 = 15; } else if (num45 == 1) { num45 = 57; } else { num45 = 58; } Dust.NewDust(this.position, this.width, this.height, num45, this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 150, default(Color), 1.2f); } this.Damage(); if (this.type == 434 && this.localAI[0] == 0f && 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) { Collision.SwitchTiles(this.position, this.width, this.height, this.oldPosition, 3); } if (ProjectileID.Sets.TrailingMode[this.type] == 0) { for (int num46 = this.oldPos.Length - 1; num46 > 0; num46--) { this.oldPos[num46] = this.oldPos[num46 - 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 num47 = this.oldPos.Length - 1; num47 > 0; num47--) { this.oldPos[num47] = this.oldPos[num47 - 1]; } this.oldPos[0] = this.position; if (this.velocity == Vector2.Zero && this.type == 466) { float num48 = this.rotation + 1.57079637f + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; float num49 = (float)Main.rand.NextDouble() * 2f + 2f; Vector2 vector4 = new Vector2((float)Math.Cos((double)num48) * num49, (float)Math.Sin((double)num48) * num49); int num50 = Dust.NewDust(this.oldPos[this.oldPos.Length - 1], 0, 0, 229, vector4.X, vector4.Y, 0, default(Color), 1f); Main.dust[num50].noGravity = true; Main.dust[num50].scale = 1.7f; } if (this.velocity == Vector2.Zero && this.type == 580) { float num51 = this.rotation + 1.57079637f + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; float num52 = (float)Main.rand.NextDouble() * 2f + 2f; Vector2 vector5 = new Vector2((float)Math.Cos((double)num51) * num52, (float)Math.Sin((double)num51) * num52); int num53 = Dust.NewDust(this.oldPos[this.oldPos.Length - 1], 0, 0, 229, vector5.X, vector5.Y, 0, default(Color), 1f); Main.dust[num53].noGravity = true; Main.dust[num53].scale = 1.7f; } } } else if (ProjectileID.Sets.TrailingMode[this.type] == 2) { for (int num54 = this.oldPos.Length - 1; num54 > 0; num54--) { this.oldPos[num54] = this.oldPos[num54 - 1]; this.oldRot[num54] = this.oldRot[num54 - 1]; this.oldSpriteDirection[num54] = this.oldSpriteDirection[num54 - 1]; } this.oldPos[0] = this.position; this.oldRot[0] = this.rotation; this.oldSpriteDirection[0] = this.spriteDirection; } this.timeLeft--; if (this.timeLeft <= 0) { this.Kill(); } if (this.penetrate == 0) { this.Kill(); } if (!this.active || this.owner != Main.myPlayer) { continue; } 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, -1, -1, "", i, 0f, 0f, 0f, 0, 0, 0); this.netUpdate2 = false; } else { this.netUpdate2 = true; } } if (this.netSpam > 0) { this.netSpam--; continue; } continue; } return; } } this.netUpdate = false; }
public override void AI() { //dust! int dustId = Dust.NewDust(projectile.position, projectile.width, projectile.height, 15, 0f, 0f, 100, default(Color), 2f); Main.dust[dustId].noGravity = true; int dustId3 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 15, 0f, 0f, 100, default(Color), 2f); Main.dust[dustId3].noGravity = true; Player player = Main.player[projectile.owner]; /*if (projectile.owner == Main.myPlayer && !player.controlUseItem) * { * projectile.Kill(); * return; * }*/ if (player.dead || !player.active) { projectile.Kill(); return; } //Vector2 ownerMountedCenter = player.RotatedRelativePoint(player.MountedCenter); //projectile.direction = player.direction; player.heldProj = projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; if (++projectile.localAI[0] > 10) { projectile.localAI[0] = 0; Main.PlaySound(SoundID.Item1, projectile.Center); if (projectile.owner == Main.myPlayer) { Vector2 speed = Vector2.UnitX.RotatedByRandom(2 * Math.PI) * Main.rand.NextFloat(9f, 12f); float ai1 = Main.rand.Next(30, 60); int p = Projectile.NewProjectile(projectile.position + Main.rand.NextVector2Square(0f, projectile.width), speed, ModContent.ProjectileType <PhantasmalEyeHoming>(), projectile.damage, projectile.knockBack / 2, projectile.owner, -1, ai1); if (p != Main.maxProjectiles) { Main.projectile[p].melee = false; Main.projectile[p].ranged = true; } } } for (int i = 0; i < Main.maxProjectiles; i++) { if (Main.projectile[i].active && Main.projectile[i].hostile && Main.projectile[i].damage > 0 && projectile.Colliding(projectile.Hitbox, Main.projectile[i].Hitbox) && !Main.projectile[i].GetGlobalProjectile <FargoGlobalProjectile>().ImmuneToGuttedHeart && !Main.projectile[i].GetGlobalProjectile <FargoGlobalProjectile>().ImmuneToMutantBomb) { if (projectile.owner == Main.myPlayer) { //Vector2 offset = Main.projectile[i].Center - Main.player[projectile.owner].Center; //Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType<Souls.IronParry>(), 0, 0f, Main.myPlayer, offset.X, offset.Y); Projectile.NewProjectile(Main.projectile[i].Center, Vector2.Zero, ModContent.ProjectileType <Souls.IronParry>(), 0, 0f, Main.myPlayer); } Main.projectile[i].hostile = false; Main.projectile[i].friendly = true; Main.projectile[i].owner = player.whoAmI; // Turn away Main.projectile[i].velocity = Main.projectile[i].DirectionFrom(projectile.Center) * Main.projectile[i].velocity.Length(); // Don't know if this will help but here it is Main.projectile[i].netUpdate = true; } } if (projectile.localAI[1] == 0) { projectile.localAI[0] = Main.rand.Next(10); projectile.rotation = Main.rand.NextFloat(MathHelper.TwoPi); } projectile.localAI[1]++; float straightModifier = -0.5f * (float)Math.Cos(Math.PI * 2 / maxTime * projectile.localAI[1]); float sideModifier = 0.5f * (float)Math.Sin(Math.PI * 2 / maxTime * projectile.localAI[1]) * player.direction; Vector2 baseVel = new Vector2(projectile.ai[0], projectile.ai[1]); Vector2 straightVel = baseVel * straightModifier; Vector2 sideVel = baseVel.RotatedBy(Math.PI / 2) * sideModifier; projectile.Center = player.Center + baseVel / 2f; projectile.velocity = straightVel + sideVel; projectile.rotation += (float)Math.PI / 6.85f * -player.direction; }
public override void UpdateArmorSet(Player player) { player.setBonus = Language.GetTextValue("Mods.FargowiltasSouls.SetBonus.Gaia"); FargoSoulsPlayer fargoPlayer = player.GetModPlayer <FargoSoulsPlayer>(); fargoPlayer.GaiaSet = true; player.GetAttackSpeed(DamageClass.Melee) += 0.1f; player.manaCost -= 0.1f; player.maxMinions += 1; player.maxTurrets += 1; if (player.whoAmI == Main.myPlayer && fargoPlayer.DoubleTap) { fargoPlayer.GaiaOffense = !fargoPlayer.GaiaOffense; if (fargoPlayer.GaiaOffense) { SoundEngine.PlaySound(SoundID.Item4, player.Center); } Vector2 baseVel = Vector2.UnitX.RotatedByRandom(2 * Math.PI); const int max = 36; //make some indicator dusts for (int i = 0; i < max; i++) { Vector2 vector6 = baseVel * 6f; vector6 = vector6.RotatedBy((i - (max / 2 - 1)) * 6.28318548f / max) + player.Center; Vector2 vector7 = vector6 - player.Center; int d = Dust.NewDust(vector6 + vector7, 0, 0, Main.rand.NextBool() ? 107 : 110, 0f, 0f, 0, default(Color)); Main.dust[d].scale = 2.5f; Main.dust[d].noGravity = true; Main.dust[d].velocity = vector7; } } if (fargoPlayer.GaiaOffense) { player.GetDamage(DamageClass.Generic) += 0.30f; player.GetCritChance(DamageClass.Generic) += 15; player.GetArmorPenetration(DamageClass.Generic) += 20; player.statDefense -= 20; player.statLifeMax2 -= player.statLifeMax / 10; player.endurance -= 0.15f; Lighting.AddLight(player.Center, new Vector3(1, 1, 1)); if (Main.rand.NextBool(3)) //visual dust { float scale = 2f; int type = Main.rand.NextBool() ? 107 : 110; int dust = Dust.NewDust(player.position, player.width, player.height, type, player.velocity.X * 0.4f, player.velocity.Y * 0.4f, 87, default(Color), scale); Main.dust[dust].noGravity = true; Main.dust[dust].velocity.Y -= 1f; Main.dust[dust].velocity *= 1.8f; if (Main.rand.NextBool(4)) { Main.dust[dust].noGravity = false; Main.dust[dust].scale *= 0.5f; } } } }
public void AI() { Vector2 mountedCenter; float num76; float num77; float num78; Vector3 zero; int num114; int num115; int num316; Color color5; Vector2 vector240; if (this.aiStyle == 1) { this.AI_001(); return; } if (this.aiStyle == 2) { if ((this.type == 0x5d) && (Main.rand.Next(5) == 0)) { color5 = new Color(); int num = Dust.NewDust(base.position, base.width, base.height, 0x39, (this.velocity.X * 0.2f) + (base.direction * 3), this.velocity.Y * 0.2f, 100, color5, 0.3f); Main.dust[num].velocity.X *= 0.3f; Main.dust[num].velocity.Y *= 0.3f; } if ((this.type == 0x130) && (this.localAI[0] == 0f)) { this.localAI[0]++; this.alpha = 0; } if (this.type == 0x14f) { this.frame = (int)this.ai[1]; } if (this.type == 510) { this.rotation += (Math.Abs(this.velocity.X) * 0.04f) * base.direction; } else { float introduced1570 = Math.Abs(this.velocity.X); this.rotation += ((introduced1570 + Math.Abs(this.velocity.Y)) * 0.03f) * base.direction; } if (this.type == 0xa2) { if (this.ai[1] == 0f) { this.ai[1] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); } this.ai[0]++; if (this.ai[0] >= 18f) { this.velocity.Y += 0.28f; this.velocity.X *= 0.99f; } if (this.ai[0] > 2f) { this.alpha = 0; if (this.ai[0] == 3f) { for (int i = 0; i < 10; i++) { color5 = new Color(); int num3 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x1f, 0f, 0f, 100, color5, 1.5f); Dust dust1 = Main.dust[num3]; dust1.velocity = (Vector2)(dust1.velocity * 0.5f); Dust dust33 = Main.dust[num3]; dust33.velocity += (Vector2)(base.velocity * 0.1f); } for (int j = 0; j < 5; j++) { color5 = new Color(); int num5 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, 0f, 0f, 100, color5, 2f); Main.dust[num5].noGravity = true; Dust dust34 = Main.dust[num5]; dust34.velocity = (Vector2)(dust34.velocity * 3f); Dust dust35 = Main.dust[num5]; dust35.velocity += (Vector2)(base.velocity * 0.2f); color5 = new Color(); num5 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, 0f, 0f, 100, color5, 1f); Dust dust36 = Main.dust[num5]; dust36.velocity = (Vector2)(dust36.velocity * 2f); Dust dust37 = Main.dust[num5]; dust37.velocity += (Vector2)(base.velocity * 0.3f); } for (int k = 0; k < 1; k++) { vector240 = new Vector2(); int num6 = Gore.NewGore(new Vector2(this.position.X - 10f, this.position.Y - 10f), vector240, Main.rand.Next(0x3d, 0x40), 1f); Gore gore1 = Main.gore[num6]; gore1.position += (Vector2)(base.velocity * 1.25f); Main.gore[num6].scale = 1.5f; Gore gore2 = Main.gore[num6]; gore2.velocity += (Vector2)(base.velocity * 0.5f); Gore gore3 = Main.gore[num6]; gore3.velocity = (Vector2)(gore3.velocity * 0.02f); } } } } else if (this.type == 0x119) { if (this.ai[1] == 0f) { this.ai[1] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); } this.ai[0]++; if (this.ai[0] >= 18f) { this.velocity.Y += 0.28f; this.velocity.X *= 0.99f; } if (this.ai[0] > 2f) { this.alpha = 0; if (this.ai[0] == 3f) { for (int m = 0; m < 10; m++) { color5 = new Color(); int num9 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x1f, 0f, 0f, 100, color5, 1.5f); Dust dust38 = Main.dust[num9]; dust38.velocity = (Vector2)(dust38.velocity * 0.5f); Dust dust39 = Main.dust[num9]; dust39.velocity += (Vector2)(base.velocity * 0.1f); } for (int n = 0; n < 5; n++) { color5 = new Color(); int num11 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, 0f, 0f, 100, color5, 2f); Main.dust[num11].noGravity = true; Dust dust40 = Main.dust[num11]; dust40.velocity = (Vector2)(dust40.velocity * 3f); Dust dust41 = Main.dust[num11]; dust41.velocity += (Vector2)(base.velocity * 0.2f); color5 = new Color(); num11 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, 0f, 0f, 100, color5, 1f); Dust dust42 = Main.dust[num11]; dust42.velocity = (Vector2)(dust42.velocity * 2f); Dust dust43 = Main.dust[num11]; dust43.velocity += (Vector2)(base.velocity * 0.3f); } for (int num13 = 0; num13 < 1; num13++) { vector240 = new Vector2(); int num12 = Gore.NewGore(new Vector2(this.position.X - 10f, this.position.Y - 10f), vector240, Main.rand.Next(0x3d, 0x40), 1f); Gore gore4 = Main.gore[num12]; gore4.position += (Vector2)(base.velocity * 1.25f); Main.gore[num12].scale = 1.5f; Gore gore5 = Main.gore[num12]; gore5.velocity += (Vector2)(base.velocity * 0.5f); Gore gore6 = Main.gore[num12]; gore6.velocity = (Vector2)(gore6.velocity * 0.02f); } } } } else if (this.type == 240) { if (this.ai[1] == 0f) { this.ai[1] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); } this.ai[0]++; if (this.ai[0] >= 16f) { this.velocity.Y += 0.18f; this.velocity.X *= 0.991f; } if (this.ai[0] > 2f) { this.alpha = 0; if (this.ai[0] == 3f) { for (int num14 = 0; num14 < 7; num14++) { color5 = new Color(); int num15 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x1f, 0f, 0f, 100, color5, 1.5f); Dust dust44 = Main.dust[num15]; dust44.velocity = (Vector2)(dust44.velocity * 0.5f); Dust dust45 = Main.dust[num15]; dust45.velocity += (Vector2)(base.velocity * 0.1f); } for (int num16 = 0; num16 < 3; num16++) { color5 = new Color(); int num17 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, 0f, 0f, 100, color5, 2f); Main.dust[num17].noGravity = true; Dust dust46 = Main.dust[num17]; dust46.velocity = (Vector2)(dust46.velocity * 3f); Dust dust47 = Main.dust[num17]; dust47.velocity += (Vector2)(base.velocity * 0.2f); color5 = new Color(); num17 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, 0f, 0f, 100, color5, 1f); Dust dust48 = Main.dust[num17]; dust48.velocity = (Vector2)(dust48.velocity * 2f); Dust dust49 = Main.dust[num17]; dust49.velocity += (Vector2)(base.velocity * 0.3f); } for (int num19 = 0; num19 < 1; num19++) { vector240 = new Vector2(); int num18 = Gore.NewGore(new Vector2(this.position.X - 10f, this.position.Y - 10f), vector240, Main.rand.Next(0x3d, 0x40), 1f); Gore gore7 = Main.gore[num18]; gore7.position += (Vector2)(base.velocity * 1.25f); Main.gore[num18].scale = 1.25f; Gore gore8 = Main.gore[num18]; gore8.velocity += (Vector2)(base.velocity * 0.5f); Gore gore9 = Main.gore[num18]; gore9.velocity = (Vector2)(gore9.velocity * 0.02f); } } } } if (this.type == 0x1f1) { color5 = new Color(); int num20 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x1b, this.velocity.X, this.velocity.Y, 100, color5, 1.2f); Main.dust[num20].position = (Vector2)((Main.dust[num20].position + base.Center) / 2f); Main.dust[num20].noGravity = true; Dust dust50 = Main.dust[num20]; dust50.velocity = (Vector2)(dust50.velocity * 0.3f); Dust dust51 = Main.dust[num20]; dust51.velocity -= (Vector2)(base.velocity * 0.1f); this.ai[0]++; if (this.ai[0] >= 30f) { this.velocity.X *= 0.99f; this.velocity.Y += 0.5f; } else { this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 1.57f; } } else if (this.type == 0xf9) { this.ai[0]++; if (this.ai[0] >= 0f) { this.velocity.Y += 0.25f; } } else if (this.type == 0x15b) { this.ai[0]++; if (this.ai[0] >= 5f) { this.velocity.Y += 0.25f; } } else if (this.type == 0x1f5) { this.ai[0]++; if (this.ai[0] >= 18f) { this.velocity.X *= 0.995f; this.velocity.Y += 0.2f; } } else if (this.type == 0x1f8) { this.alpha = 0xff; this.ai[0]++; if (this.ai[0] > 3f) { int num21 = 100; if (this.ai[0] > 20f) { int num22 = 40; float num23 = this.ai[0] - 20f; num21 = (int)(100f * (1f - (num23 / ((float)num22)))); if (num23 >= num22) { this.Kill(); } } if (this.ai[0] <= 10f) { num21 = ((int)this.ai[0]) * 10; } if (Main.rand.Next(100) < num21) { color5 = new Color(); int num24 = Dust.NewDust(base.position, base.width, base.height, 6, 0f, 0f, 150, color5, 1f); Main.dust[num24].position = (Vector2)((Main.dust[num24].position + base.Center) / 2f); Main.dust[num24].noGravity = true; Dust dust52 = Main.dust[num24]; dust52.velocity = (Vector2)(dust52.velocity * 2f); Dust dust53 = Main.dust[num24]; dust53.scale *= 1.2f; Dust dust54 = Main.dust[num24]; dust54.velocity += base.velocity; } } if (this.ai[0] >= 20f) { this.velocity.X *= 0.99f; this.velocity.Y += 0.1f; } } else if (((this.type == 0x45) || (this.type == 70)) || (this.type == 0x26d)) { this.ai[0]++; if (this.ai[0] >= 10f) { this.velocity.Y += 0.25f; this.velocity.X *= 0.99f; } } else if (this.type == 0xa6) { this.ai[0]++; if (this.ai[0] >= 20f) { this.velocity.Y += 0.3f; this.velocity.X *= 0.98f; } } else if (this.type == 300) { if (this.ai[0] == 0f) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 1); } this.ai[0]++; if (this.ai[0] >= 60f) { this.velocity.Y += 0.2f; this.velocity.X *= 0.99f; } } else if (this.type == 0x132) { if (this.alpha <= 200) { for (int num25 = 0; num25 < 4; num25++) { float num26 = (this.velocity.X / 4f) * num25; float num27 = (this.velocity.Y / 4f) * num25; color5 = new Color(); int num28 = Dust.NewDust(base.position, base.width, base.height, 0xb8, 0f, 0f, 0, color5, 1f); Main.dust[num28].position.X = base.Center.X - num26; Main.dust[num28].position.Y = base.Center.Y - num27; Dust dust55 = Main.dust[num28]; dust55.velocity = (Vector2)(dust55.velocity * 0f); Main.dust[num28].scale = 0.7f; } } this.alpha -= 50; if (this.alpha < 0) { this.alpha = 0; } this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 0.785f; } else if (this.type == 0x130) { this.ai[0]++; if (this.ai[0] >= 30f) { this.alpha += 10; this.damage = (int)(this.damage * 0.9); this.knockBack = (int)(this.knockBack * 0.9); if (this.alpha >= 0xff) { base.active = false; } } if (this.ai[0] < 30f) { this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 1.57f; } } else if ((this.type == 370) || (this.type == 0x173)) { this.ai[0]++; if (this.ai[0] >= 15f) { this.velocity.Y += 0.3f; this.velocity.X *= 0.98f; } } else { this.ai[0]++; if (this.ai[0] >= 20f) { this.velocity.Y += 0.4f; this.velocity.X *= 0.97f; } else if (((this.type == 0x30) || (this.type == 0x36)) || (((this.type == 0x5d) || (this.type == 520)) || (this.type == 0x257))) { this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 1.57f; } } if (this.velocity.Y > 16f) { this.velocity.Y = 16f; } if ((this.type == 0x36) && (Main.rand.Next(20) == 0)) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 40, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 0, new Color(), 0.75f); return; } return; } if (this.aiStyle != 3) { if (this.aiStyle == 4) { this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 1.57f; if (this.ai[0] != 0f) { if ((this.alpha < 170) && ((this.alpha + 5) >= 170)) { if ((this.type >= 150) && (this.type <= 0x98)) { for (int num60 = 0; num60 < 8; num60++) { color5 = new Color(); int num61 = Dust.NewDust(base.position, base.width, base.height, 7, this.velocity.X * 0.025f, this.velocity.Y * 0.025f, 200, color5, 1.3f); Main.dust[num61].noGravity = true; Dust dust58 = Main.dust[num61]; dust58.velocity = (Vector2)(dust58.velocity * 0.5f); } } else if ((this.type == 0x1ed) || (this.type == 0x1ee)) { for (int num62 = 0; num62 < 8; num62++) { color5 = new Color(); int num63 = Dust.NewDust(base.position, base.width, base.height, Main.rand.Next(0x44, 0x47), this.velocity.X * 0.025f, this.velocity.Y * 0.025f, 200, color5, 1.3f); Main.dust[num63].noGravity = true; Dust dust59 = Main.dust[num63]; dust59.velocity = (Vector2)(dust59.velocity * 0.5f); } } else { for (int num64 = 0; num64 < 3; num64++) { color5 = new Color(); Dust.NewDust(base.position, base.width, base.height, 0x12, this.velocity.X * 0.025f, this.velocity.Y * 0.025f, 170, color5, 1.2f); } Dust.NewDust(base.position, base.width, base.height, 14, 0f, 0f, 170, new Color(), 1.1f); } } if ((this.type >= 150) && (this.type <= 0x98)) { this.alpha += 3; } else if ((this.type == 0x1ed) || (this.type == 0x1ee)) { this.alpha += 7; } else { this.alpha += 5; } if (this.alpha >= 0xff) { this.Kill(); return; } } else { if ((((this.type >= 150) && (this.type <= 0x98)) && ((this.ai[1] == 0f) && (this.alpha == 0xff))) && (Main.rand.Next(2) == 0)) { this.type++; this.netUpdate = true; } this.alpha -= 50; if ((this.type >= 150) && (this.type <= 0x98)) { this.alpha -= 0x19; } else if ((this.type == 0x1ed) || (this.type == 0x1ee)) { this.alpha -= 50; } if (this.alpha <= 0) { this.alpha = 0; this.ai[0] = 1f; if (this.ai[1] == 0f) { this.ai[1]++; base.position += (Vector2)(base.velocity * 1f); } if ((this.type == 7) && (Main.myPlayer == this.owner)) { int type = this.type; if (this.ai[1] >= 6f) { type++; } int num53 = NewProjectile((this.position.X + this.velocity.X) + (base.width / 2), (this.position.Y + this.velocity.Y) + (base.height / 2), this.velocity.X, this.velocity.Y, type, this.damage, this.knockBack, this.owner, 0f, 0f); Main.projectile[num53].damage = this.damage; Main.projectile[num53].ai[1] = this.ai[1] + 1f; NetMessage.SendData(0x1b, -1, -1, "", num53, 0f, 0f, 0f, 0, 0, 0); return; } if ((this.type == 0x1ee) && (Main.myPlayer == this.owner)) { int num54 = this.type; if (this.ai[1] >= (7 + Main.rand.Next(2))) { num54--; } int damage = this.damage; float knockBack = this.knockBack; if (num54 == 0x1ed) { damage = (int)(this.damage * 1.25); knockBack = this.knockBack * 1.25f; } int number = NewProjectile((this.position.X + this.velocity.X) + (base.width / 2), (this.position.Y + this.velocity.Y) + (base.height / 2), this.velocity.X, this.velocity.Y, num54, damage, knockBack, this.owner, 0f, this.ai[1] + 1f); NetMessage.SendData(0x1b, -1, -1, "", number, 0f, 0f, 0f, 0, 0, 0); return; } if (((this.type == 150) || (this.type == 0x97)) && (Main.myPlayer == this.owner)) { int num58 = this.type; if (this.type == 150) { num58 = 0x97; } else if (this.type == 0x97) { num58 = 150; } if ((this.ai[1] >= 10f) && (this.type == 0x97)) { num58 = 0x98; } int num59 = NewProjectile((this.position.X + this.velocity.X) + (base.width / 2), (this.position.Y + this.velocity.Y) + (base.height / 2), this.velocity.X, this.velocity.Y, num58, this.damage, this.knockBack, this.owner, 0f, 0f); Main.projectile[num59].damage = this.damage; Main.projectile[num59].ai[1] = this.ai[1] + 1f; NetMessage.SendData(0x1b, -1, -1, "", num59, 0f, 0f, 0f, 0, 0, 0); return; } } } return; } if (this.aiStyle == 5) { if (this.type == 0x1f7) { if (base.Center.Y > this.ai[1]) { this.tileCollide = true; } } else if (this.type == 0x5c) { if (this.position.Y > this.ai[1]) { this.tileCollide = true; } } else { if ((this.ai[1] == 0f) && !Collision.SolidCollision(base.position, base.width, base.height)) { this.ai[1] = 1f; this.netUpdate = true; } if (this.ai[1] != 0f) { this.tileCollide = true; } } if (this.soundDelay == 0) { this.soundDelay = 20 + Main.rand.Next(40); Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 9); } if (this.type == 0x1f7) { this.alpha -= 15; int num65 = 150; if (base.Center.Y >= this.ai[1]) { num65 = 0; } if (this.alpha < num65) { this.alpha = num65; } float introduced1609 = Math.Abs(this.velocity.X); this.localAI[0] += ((introduced1609 + Math.Abs(this.velocity.Y)) * 0.01f) * base.direction; } else { if (this.localAI[0] == 0f) { this.localAI[0] = 1f; } this.alpha += (int)(25f * this.localAI[0]); if (this.alpha > 200) { this.alpha = 200; this.localAI[0] = -1f; } if (this.alpha < 0) { this.alpha = 0; this.localAI[0] = 1f; } } if (this.type == 0x1f7) { this.rotation = base.velocity.ToRotation() - 1.570796f; } else { float introduced1610 = Math.Abs(this.velocity.X); this.rotation += ((introduced1610 + Math.Abs(this.velocity.Y)) * 0.01f) * base.direction; } if (this.type == 0x1f7) { if (Main.rand.Next(0x10) == 0) { Vector2 vector7 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)base.velocity.ToRotation(), new Vector2()); color5 = new Color(); int num66 = Dust.NewDust(base.position, base.width, base.height, 0x3a, this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 150, color5, 1.2f); Main.dust[num66].velocity = (Vector2)(vector7 * 0.66f); Main.dust[num66].position = base.Center + ((Vector2)(vector7 * 12f)); } if (Main.rand.Next(0x30) == 0) { int num67 = Gore.NewGore(base.Center, new Vector2(this.velocity.X * 0.2f, this.velocity.Y * 0.2f), 0x10, 1f); Gore gore10 = Main.gore[num67]; gore10.velocity = (Vector2)(gore10.velocity * 0.66f); Gore gore11 = Main.gore[num67]; gore11.velocity += (Vector2)(base.velocity * 0.3f); } } if ((this.ai[1] == 1f) || (this.type == 0x5c)) { this.light = 0.9f; if (Main.rand.Next(10) == 0) { Dust.NewDust(base.position, base.width, base.height, 0x3a, this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 150, new Color(), 1.2f); } if (Main.rand.Next(20) == 0) { Gore.NewGore(base.position, new Vector2(this.velocity.X * 0.2f, this.velocity.Y * 0.2f), Main.rand.Next(0x10, 0x12), 1f); return; } } return; } if (this.aiStyle == 6) { base.velocity = (Vector2)(base.velocity * 0.95f); this.ai[0]++; if (this.ai[0] == 180f) { this.Kill(); } if (this.ai[1] == 0f) { this.ai[1] = 1f; int num68 = 10 + this.type; if (this.type == 0x1cf) { num68 = 0xe7; } for (int num69 = 0; num69 < 30; num69++) { color5 = new Color(); Dust.NewDust(base.position, base.width, base.height, num68, this.velocity.X, this.velocity.Y, 50, color5, 1f); } } if (((this.type == 10) || (this.type == 11)) || (this.type == 0x1cf)) { int num70 = ((int)(this.position.X / 16f)) - 1; int maxTilesX = ((int)((this.position.X + base.width) / 16f)) + 2; int num72 = ((int)(this.position.Y / 16f)) - 1; int maxTilesY = ((int)((this.position.Y + base.height) / 16f)) + 2; if (num70 < 0) { num70 = 0; } if (maxTilesX > Main.maxTilesX) { maxTilesX = Main.maxTilesX; } if (num72 < 0) { num72 = 0; } if (maxTilesY > Main.maxTilesY) { maxTilesY = Main.maxTilesY; } for (int num74 = num70; num74 < maxTilesX; num74++) { for (int num75 = num72; num75 < maxTilesY; num75++) { Vector2 vector8; vector8.X = num74 * 0x10; vector8.Y = num75 * 0x10; if (((((this.position.X + base.width) > vector8.X) && (this.position.X < (vector8.X + 16f))) && (((this.position.Y + base.height) > vector8.Y) && (this.position.Y < (vector8.Y + 16f)))) && ((Main.myPlayer == this.owner) && Main.tile[num74, num75].active())) { if (this.type == 10) { if ((Main.tile[num74, num75].type == 0x17) || (Main.tile[num74, num75].type == 0xc7)) { Main.tile[num74, num75].type = 2; WorldGen.SquareTileFrame(num74, num75, true); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num74, num75, 1); } } if ((Main.tile[num74, num75].type == 0x19) || (Main.tile[num74, num75].type == 0xcb)) { Main.tile[num74, num75].type = 1; WorldGen.SquareTileFrame(num74, num75, true); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num74, num75, 1); } } if ((Main.tile[num74, num75].type == 0x70) || (Main.tile[num74, num75].type == 0xea)) { Main.tile[num74, num75].type = 0x35; WorldGen.SquareTileFrame(num74, num75, true); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num74, num75, 1); } } if ((Main.tile[num74, num75].type == 0xa3) || (Main.tile[num74, num75].type == 200)) { Main.tile[num74, num75].type = 0xa1; WorldGen.SquareTileFrame(num74, num75, true); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num74, num75, 1); } } if ((Main.tile[num74, num75].type == 400) || (Main.tile[num74, num75].type == 0x191)) { Main.tile[num74, num75].type = 0x18c; WorldGen.SquareTileFrame(num74, num75, true); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num74, num75, 1); } } if ((Main.tile[num74, num75].type == 0x18e) || (Main.tile[num74, num75].type == 0x18f)) { Main.tile[num74, num75].type = 0x18d; WorldGen.SquareTileFrame(num74, num75, true); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num74, num75, 1); } } } else if ((this.type == 11) || (this.type == 0x1cf)) { if (Main.tile[num74, num75].type == 0x6d) { Main.tile[num74, num75].type = 2; WorldGen.SquareTileFrame(num74, num75, true); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num74, num75, 1); } } if (Main.tile[num74, num75].type == 0x74) { Main.tile[num74, num75].type = 0x35; WorldGen.SquareTileFrame(num74, num75, true); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num74, num75, 1); } } if (Main.tile[num74, num75].type == 0x75) { Main.tile[num74, num75].type = 1; WorldGen.SquareTileFrame(num74, num75, true); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num74, num75, 1); } } if (Main.tile[num74, num75].type == 0xa4) { Main.tile[num74, num75].type = 0xa1; WorldGen.SquareTileFrame(num74, num75, true); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num74, num75, 1); } } if (Main.tile[num74, num75].type == 0x193) { Main.tile[num74, num75].type = 0x18c; WorldGen.SquareTileFrame(num74, num75, true); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num74, num75, 1); } } if (Main.tile[num74, num75].type == 0x192) { Main.tile[num74, num75].type = 0x18d; WorldGen.SquareTileFrame(num74, num75, true); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num74, num75, 1); } } } } } } return; } return; } if (this.aiStyle != 7) { if (this.aiStyle == 8) { if ((this.type == 0x102) && (this.localAI[0] == 0f)) { this.localAI[0] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 20); } if ((this.type == 0x60) && (this.localAI[0] == 0f)) { this.localAI[0] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 20); } if (this.type == 0x1b) { for (int num99 = 0; num99 < 5; num99++) { float num100 = (this.velocity.X / 3f) * num99; float num101 = (this.velocity.Y / 3f) * num99; int num102 = 4; color5 = new Color(); int num103 = Dust.NewDust(new Vector2(this.position.X + num102, this.position.Y + num102), base.width - (num102 * 2), base.height - (num102 * 2), 0xac, 0f, 0f, 100, color5, 1.2f); Main.dust[num103].noGravity = true; Dust dust60 = Main.dust[num103]; dust60.velocity = (Vector2)(dust60.velocity * 0.1f); Dust dust61 = Main.dust[num103]; dust61.velocity += (Vector2)(base.velocity * 0.1f); Main.dust[num103].position.X -= num100; Main.dust[num103].position.Y -= num101; } if (Main.rand.Next(5) == 0) { int num104 = 4; int num105 = Dust.NewDust(new Vector2(this.position.X + num104, this.position.Y + num104), base.width - (num104 * 2), base.height - (num104 * 2), 0xac, 0f, 0f, 100, new Color(), 0.6f); Dust dust62 = Main.dust[num105]; dust62.velocity = (Vector2)(dust62.velocity * 0.25f); Dust dust63 = Main.dust[num105]; dust63.velocity += (Vector2)(base.velocity * 0.5f); } } else if (this.type == 0x1f6) { float r = ((float)Main.DiscoR) / 255f; float g = ((float)Main.DiscoG) / 255f; float b = ((float)Main.DiscoB) / 255f; r = (0.5f + r) / 2f; g = (0.5f + g) / 2f; b = (0.5f + b) / 2f; Lighting.AddLight(base.Center, r, g, b); } else if ((this.type == 0x5f) || (this.type == 0x60)) { int num109 = Dust.NewDust(new Vector2(this.position.X + this.velocity.X, this.position.Y + this.velocity.Y), base.width, base.height, 0x4b, this.velocity.X, this.velocity.Y, 100, new Color(), 3f * this.scale); Main.dust[num109].noGravity = true; } else if (this.type == 0xfd) { for (int num110 = 0; num110 < 2; num110++) { color5 = new Color(); int num111 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x87, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, color5, 2f); Main.dust[num111].noGravity = true; Main.dust[num111].velocity.X *= 0.3f; Main.dust[num111].velocity.Y *= 0.3f; } } else { for (int num112 = 0; num112 < 2; num112++) { color5 = new Color(); int num113 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, color5, 2f); Main.dust[num113].noGravity = true; Main.dust[num113].velocity.X *= 0.3f; Main.dust[num113].velocity.Y *= 0.3f; } } if (((this.type != 0x1b) && (this.type != 0x60)) && (this.type != 0x102)) { this.ai[1]++; } if (this.ai[1] >= 20f) { this.velocity.Y += 0.2f; } if (this.type == 0x1f6) { this.rotation = base.velocity.ToRotation() + 1.570796f; if (this.velocity.X != 0f) { this.spriteDirection = base.direction = Math.Sign(this.velocity.X); } } else { this.rotation += 0.3f * base.direction; } if (this.velocity.Y > 16f) { this.velocity.Y = 16f; return; } return; } if (this.aiStyle != 9) { if (this.aiStyle == 10) { if ((this.type == 0x1f) && (this.ai[0] != 2f)) { if (Main.rand.Next(2) == 0) { int num136 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x20, 0f, this.velocity.Y / 2f, 0, new Color(), 1f); Main.dust[num136].velocity.X *= 0.4f; } } else if (this.type == 0x27) { if (Main.rand.Next(2) == 0) { int num137 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x26, 0f, this.velocity.Y / 2f, 0, new Color(), 1f); Main.dust[num137].velocity.X *= 0.4f; } } else if ((this.type >= 0x19b) && (this.type <= 0x19e)) { if (Main.rand.Next(3) == 0) { int num138 = 9; if ((this.type == 0x19c) || (this.type == 0x19e)) { num138 = 11; } if (this.type == 0x19d) { num138 = 0x13; } int num139 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, num138, 0f, this.velocity.Y / 2f, 0, new Color(), 1f); Main.dust[num139].noGravity = true; Dust dust69 = Main.dust[num139]; dust69.velocity -= (Vector2)(base.velocity * 0.5f); } } else if (this.type == 40) { if (Main.rand.Next(2) == 0) { int num140 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x24, 0f, this.velocity.Y / 2f, 0, new Color(), 1f); Dust dust70 = Main.dust[num140]; dust70.velocity = (Vector2)(dust70.velocity * 0.4f); } } else if ((this.type == 0x2a) || (this.type == 0x1f)) { if (Main.rand.Next(2) == 0) { int num141 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x20, 0f, 0f, 0, new Color(), 1f); Main.dust[num141].velocity.X *= 0.4f; } } else if ((this.type == 0x38) || (this.type == 0x41)) { if (Main.rand.Next(2) == 0) { int num142 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 14, 0f, 0f, 0, new Color(), 1f); Main.dust[num142].velocity.X *= 0.4f; } } else if ((this.type == 0x43) || (this.type == 0x44)) { if (Main.rand.Next(2) == 0) { int num143 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x33, 0f, 0f, 0, new Color(), 1f); Main.dust[num143].velocity.X *= 0.4f; } } else if (this.type == 0x47) { if (Main.rand.Next(2) == 0) { int num144 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x35, 0f, 0f, 0, new Color(), 1f); Main.dust[num144].velocity.X *= 0.4f; } } else if (this.type == 0xb3) { if (Main.rand.Next(2) == 0) { int num145 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x95, 0f, 0f, 0, new Color(), 1f); Main.dust[num145].velocity.X *= 0.4f; } } else if ((this.type == 0xf1) || (this.type == 0x162)) { if (Main.rand.Next(2) == 0) { int num146 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x24, 0f, 0f, 0, new Color(), 1f); Main.dust[num146].velocity.X *= 0.4f; } } else if ((this.type != 0x6d) && (Main.rand.Next(20) == 0)) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0, 0f, 0f, 0, new Color(), 1f); } this.tileCollide = true; this.localAI[1] = 0f; if ((Main.myPlayer == this.owner) && (this.ai[0] == 0f)) { this.tileCollide = false; if (Main.player[this.owner].channel) { this.localAI[1] = -1f; float num147 = 12f; Vector2 vector20 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f)); float num148 = (Main.mouseX + Main.screenPosition.X) - vector20.X; float num149 = (Main.mouseY + Main.screenPosition.Y) - vector20.Y; if (Main.player[this.owner].gravDir == -1f) { num149 = ((Main.screenPosition.Y + Main.screenHeight) - Main.mouseY) - vector20.Y; } float num150 = (float)Math.Sqrt((double)((num148 * num148) + (num149 * num149))); num150 = (float)Math.Sqrt((double)((num148 * num148) + (num149 * num149))); if (num150 > num147) { num150 = num147 / num150; num148 *= num150; num149 *= num150; if ((num148 != this.velocity.X) || (num149 != this.velocity.Y)) { this.netUpdate = true; } this.velocity.X = num148; this.velocity.Y = num149; } else { if ((num148 != this.velocity.X) || (num149 != this.velocity.Y)) { this.netUpdate = true; } this.velocity.X = num148; this.velocity.Y = num149; } } else { this.ai[0] = 1f; this.netUpdate = true; } } if ((this.ai[0] == 1f) && (this.type != 0x6d)) { if (((this.type == 0x2a) || (this.type == 0x41)) || ((this.type == 0x44) || (this.type == 0x162))) { this.ai[1]++; if (this.ai[1] >= 60f) { this.ai[1] = 60f; this.velocity.Y += 0.2f; } } else { this.velocity.Y += 0.41f; } } else if ((this.ai[0] == 2f) && (this.type != 0x6d)) { this.velocity.Y += 0.2f; if (this.velocity.X < -0.04) { this.velocity.X += 0.04f; } else if (this.velocity.X > 0.04) { this.velocity.X -= 0.04f; } else { this.velocity.X = 0f; } } this.rotation += 0.1f; if (this.velocity.Y > 10f) { this.velocity.Y = 10f; return; } return; } if (this.aiStyle == 11) { if (((this.type == 0x48) || (this.type == 0x56)) || (this.type == 0x57)) { if (this.velocity.X > 0f) { this.spriteDirection = -1; } else if (this.velocity.X < 0f) { this.spriteDirection = 1; } this.rotation = this.velocity.X * 0.1f; this.frameCounter++; if (this.frameCounter >= 4) { this.frame++; this.frameCounter = 0; } if (this.frame >= 4) { this.frame = 0; } if (Main.rand.Next(6) == 0) { int num151 = 0x38; if (this.type == 0x56) { num151 = 0x49; } else if (this.type == 0x57) { num151 = 0x4a; } int num152 = Dust.NewDust(base.position, base.width, base.height, num151, 0f, 0f, 200, new Color(), 0.8f); Dust dust71 = Main.dust[num152]; dust71.velocity = (Vector2)(dust71.velocity * 0.3f); Main.dust[num152].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cLight, Main.player[this.owner]); } } else { this.rotation += 0.02f; } if (Main.myPlayer == this.owner) { if (this.type == 0x48) { if (Main.player[Main.myPlayer].blueFairy) { this.timeLeft = 2; } } else if (this.type == 0x56) { if (Main.player[Main.myPlayer].redFairy) { this.timeLeft = 2; } } else if (this.type == 0x57) { if (Main.player[Main.myPlayer].greenFairy) { this.timeLeft = 2; } } else if (Main.player[Main.myPlayer].lightOrb) { this.timeLeft = 2; } } if (!Main.player[this.owner].dead) { float num153 = 3f; if (((this.type == 0x48) || (this.type == 0x56)) || (this.type == 0x57)) { num153 = 3.75f; } Vector2 vector21 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f)); float num154 = (Main.player[this.owner].position.X + (Main.player[this.owner].width / 2)) - vector21.X; float num155 = (Main.player[this.owner].position.Y + (Main.player[this.owner].height / 2)) - vector21.Y; int num156 = 70; if (this.type == 0x12) { if (Main.player[this.owner].controlUp) { num155 = (Main.player[this.owner].position.Y - 40f) - vector21.Y; num154 -= 6f; num156 = 4; } else if (Main.player[this.owner].controlDown) { num155 = ((Main.player[this.owner].position.Y + Main.player[this.owner].height) + 40f) - vector21.Y; num154 -= 6f; num156 = 4; } } float num157 = (float)Math.Sqrt((double)((num154 * num154) + (num155 * num155))); num157 = (float)Math.Sqrt((double)((num154 * num154) + (num155 * num155))); if (((this.type == 0x48) || (this.type == 0x56)) || (this.type == 0x57)) { num156 = 40; } if (num157 > 800f) { this.position.X = (Main.player[this.owner].position.X + (Main.player[this.owner].width / 2)) - (base.width / 2); this.position.Y = (Main.player[this.owner].position.Y + (Main.player[this.owner].height / 2)) - (base.height / 2); return; } if (num157 > num156) { num157 = num153 / num157; num154 *= num157; num155 *= num157; this.velocity.X = num154; this.velocity.Y = num155; return; } this.velocity.X = 0f; this.velocity.Y = 0f; return; } this.Kill(); return; } if (this.aiStyle == 12) { if ((this.type == 0x120) && (this.localAI[0] == 0f)) { this.localAI[0] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 0x11); } if ((this.type != 280) && (this.type != 0x120)) { this.scale -= 0.02f; if (this.scale <= 0f) { this.Kill(); } if (this.ai[0] > 3f) { this.velocity.Y += 0.2f; for (int num165 = 0; num165 < 1; num165++) { for (int num166 = 0; num166 < 3; num166++) { float num167 = (this.velocity.X / 3f) * num166; float num168 = (this.velocity.Y / 3f) * num166; int num169 = 6; color5 = new Color(); int num170 = Dust.NewDust(new Vector2(this.position.X + num169, this.position.Y + num169), base.width - (num169 * 2), base.height - (num169 * 2), 0xac, 0f, 0f, 100, color5, 1.2f); Main.dust[num170].noGravity = true; Dust dust76 = Main.dust[num170]; dust76.velocity = (Vector2)(dust76.velocity * 0.3f); Dust dust77 = Main.dust[num170]; dust77.velocity += (Vector2)(base.velocity * 0.5f); Main.dust[num170].position.X -= num167; Main.dust[num170].position.Y -= num168; } if (Main.rand.Next(8) == 0) { int num171 = 6; color5 = new Color(); int num172 = Dust.NewDust(new Vector2(this.position.X + num171, this.position.Y + num171), base.width - (num171 * 2), base.height - (num171 * 2), 0xac, 0f, 0f, 100, color5, 0.75f); Dust dust78 = Main.dust[num172]; dust78.velocity = (Vector2)(dust78.velocity * 0.5f); Dust dust79 = Main.dust[num172]; dust79.velocity += (Vector2)(base.velocity * 0.5f); } } return; } this.ai[0]++; return; } this.scale -= 0.002f; if (this.scale <= 0f) { this.Kill(); } if (this.type == 0x120) { this.ai[0] = 4f; } if (this.ai[0] <= 3f) { this.ai[0]++; return; } this.velocity.Y += 0.075f; for (int num158 = 0; num158 < 3; num158++) { float num159 = (this.velocity.X / 3f) * num158; float num160 = (this.velocity.Y / 3f) * num158; int num161 = 14; color5 = new Color(); int num162 = Dust.NewDust(new Vector2(this.position.X + num161, this.position.Y + num161), base.width - (num161 * 2), base.height - (num161 * 2), 170, 0f, 0f, 100, color5, 1f); Main.dust[num162].noGravity = true; Dust dust72 = Main.dust[num162]; dust72.velocity = (Vector2)(dust72.velocity * 0.1f); Dust dust73 = Main.dust[num162]; dust73.velocity += (Vector2)(base.velocity * 0.5f); Main.dust[num162].position.X -= num159; Main.dust[num162].position.Y -= num160; } if (Main.rand.Next(8) == 0) { int num163 = 0x10; int num164 = Dust.NewDust(new Vector2(this.position.X + num163, this.position.Y + num163), base.width - (num163 * 2), base.height - (num163 * 2), 170, 0f, 0f, 100, new Color(), 0.5f); Dust dust74 = Main.dust[num164]; dust74.velocity = (Vector2)(dust74.velocity * 0.25f); Dust dust75 = Main.dust[num164]; dust75.velocity += (Vector2)(base.velocity * 0.5f); return; } return; } if (this.aiStyle == 13) { if (Main.player[this.owner].dead) { this.Kill(); return; } if (this.type != 0x1e1) { Main.player[this.owner].itemAnimation = 5; Main.player[this.owner].itemTime = 5; } if (this.alpha == 0) { if ((this.position.X + (base.width / 2)) > (Main.player[this.owner].position.X + (Main.player[this.owner].width / 2))) { Main.player[this.owner].ChangeDir(1); } else { Main.player[this.owner].ChangeDir(-1); } } if (this.type == 0x1e1) { if (this.ai[0] == 0f) { this.extraUpdates = 0; } else { this.extraUpdates = 1; } } Vector2 vector22 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f)); float num173 = (Main.player[this.owner].position.X + (Main.player[this.owner].width / 2)) - vector22.X; float num174 = (Main.player[this.owner].position.Y + (Main.player[this.owner].height / 2)) - vector22.Y; float num175 = (float)Math.Sqrt((double)((num173 * num173) + (num174 * num174))); if (this.ai[0] != 0f) { if (this.ai[0] == 1f) { this.tileCollide = false; this.rotation = ((float)Math.Atan2((double)num174, (double)num173)) - 1.57f; float num176 = 20f; if (this.type == 0x106) { num176 = 30f; } if (num175 < 50f) { this.Kill(); } num175 = num176 / num175; num173 *= num175; num174 *= num175; this.velocity.X = num173; this.velocity.Y = num174; if ((this.type == 0x106) && (this.velocity.X < 0f)) { this.spriteDirection = 1; } else if (this.type == 0x106) { this.spriteDirection = -1; } if ((this.type == 0x10f) && (this.velocity.X < 0f)) { this.spriteDirection = 1; return; } if (this.type == 0x10f) { this.spriteDirection = -1; return; } } } else { if (num175 > 700f) { this.ai[0] = 1f; } else if ((this.type == 0x106) && (num175 > 500f)) { this.ai[0] = 1f; } else if ((this.type == 0x10f) && (num175 > 200f)) { this.ai[0] = 1f; } else if ((this.type == 0x111) && (num175 > 150f)) { this.ai[0] = 1f; } else if ((this.type == 0x1e1) && (num175 > 350f)) { this.ai[0] = 1f; } this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 1.57f; this.ai[1]++; if (this.ai[1] > 5f) { this.alpha = 0; } if ((this.type == 0x106) && (this.ai[1] > 8f)) { this.ai[1] = 8f; } if ((this.type == 0x10f) && (this.ai[1] > 8f)) { this.ai[1] = 8f; } if ((this.type == 0x111) && (this.ai[1] > 8f)) { this.ai[1] = 8f; } if ((this.type == 0x1e1) && (this.ai[1] > 8f)) { this.ai[1] = 8f; } if ((this.type == 0x194) && (this.ai[1] > 8f)) { this.ai[1] = 0f; } if (this.ai[1] >= 10f) { this.ai[1] = 15f; this.velocity.Y += 0.3f; } if ((this.type == 0x106) && (this.velocity.X < 0f)) { this.spriteDirection = -1; } else if (this.type == 0x106) { this.spriteDirection = 1; } if ((this.type == 0x10f) && (this.velocity.X < 0f)) { this.spriteDirection = -1; return; } if (this.type == 0x10f) { this.spriteDirection = 1; return; } } return; } if (this.aiStyle == 14) { if ((this.type == 0x1d9) && (Main.netMode != 2)) { this.localAI[0]++; if (this.localAI[0] >= 10f) { this.localAI[0] = 0f; int num177 = 30; Vector2 vector23 = base.Center - Main.player[Main.myPlayer].Center; if (vector23.Length() < (Main.screenWidth + (num177 * 0x10))) { int num178 = ((int)base.Center.X) / 0x10; int num179 = ((int)base.Center.Y) / 0x10; for (int num180 = num178 - num177; num180 <= (num178 + num177); num180++) { for (int num181 = num179 - num177; num181 <= (num179 + num177); num181++) { if (Main.rand.Next(4) == 0) { Vector2 vector24 = new Vector2((float)(num178 - num180), (float)(num179 - num181)); if ((((vector24.Length() < num177) && (num180 > 0)) && ((num180 < (Main.maxTilesX - 1)) && (num181 > 0))) && (((num181 < (Main.maxTilesY - 1)) && (Main.tile[num180, num181] != null)) && Main.tile[num180, num181].active())) { bool flag3 = false; if ((Main.tile[num180, num181].type == 0xb9) && (Main.tile[num180, num181].frameY == 0x12)) { if ((Main.tile[num180, num181].frameX >= 0x240) && (Main.tile[num180, num181].frameX <= 0x372)) { flag3 = true; } } else if (((Main.tile[num180, num181].type == 0xba) && (Main.tile[num180, num181].frameX >= 0x360)) && (Main.tile[num180, num181].frameX <= 0x492)) { flag3 = true; } if ((flag3 || Main.tileSpelunker[Main.tile[num180, num181].type]) || (Main.tileAlch[Main.tile[num180, num181].type] && (Main.tile[num180, num181].type != 0x52))) { color5 = new Color(); int num182 = Dust.NewDust(new Vector2((float)(num180 * 0x10), (float)(num181 * 0x10)), 0x10, 0x10, 0xcc, 0f, 0f, 150, color5, 0.3f); Main.dust[num182].fadeIn = 0.75f; Dust dust80 = Main.dust[num182]; dust80.velocity = (Vector2)(dust80.velocity * 0.1f); Main.dust[num182].noLight = true; } } } } } } } } if (this.type == 0x160) { if (this.localAI[1] == 0f) { this.localAI[1] = 1f; } this.alpha += (int)(25f * this.localAI[1]); if (this.alpha <= 0) { this.alpha = 0; this.localAI[1] = 1f; } else if (this.alpha >= 0xff) { this.alpha = 0xff; this.localAI[1] = -1f; } this.scale += this.localAI[1] * 0.01f; } if (this.type == 0x15a) { if (this.localAI[0] == 0f) { this.localAI[0] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 1); } this.frame = (int)this.ai[1]; if ((this.owner == Main.myPlayer) && (this.timeLeft == 1)) { for (int num183 = 0; num183 < 5; num183++) { float num184 = 10f; Vector2 vector25 = new Vector2(base.Center.X, base.Center.Y); float speedX = Main.rand.Next(-20, 0x15); float speedY = Main.rand.Next(-20, 0); float num187 = (float)Math.Sqrt((double)((speedX * speedX) + (speedY * speedY))); num187 = num184 / num187; speedX *= num187; speedY *= num187; speedX *= 1f + (Main.rand.Next(-30, 0x1f) * 0.01f); speedY *= 1f + (Main.rand.Next(-30, 0x1f) * 0.01f); NewProjectile(vector25.X, vector25.Y, speedX, speedY, 0x15b, 40, 0f, Main.myPlayer, 0f, this.ai[1]); } } } if (this.type == 0xc4) { int num188 = Main.rand.Next(1, 3); for (int num189 = 0; num189 < num188; num189++) { color5 = new Color(); int num190 = Dust.NewDust(base.position, base.width, base.height, 0x1f, 0f, 0f, 100, color5, 1f); Dust dust81 = Main.dust[num190]; dust81.alpha += Main.rand.Next(100); Dust dust82 = Main.dust[num190]; dust82.velocity = (Vector2)(dust82.velocity * 0.3f); Main.dust[num190].velocity.X += Main.rand.Next(-10, 11) * 0.025f; Main.dust[num190].velocity.Y -= 0.4f + (Main.rand.Next(-3, 14) * 0.15f); Main.dust[num190].fadeIn = 1.25f + (Main.rand.Next(20) * 0.15f); } } if (this.type == 0x35) { try { int num191 = ((int)(this.position.X / 16f)) - 1; int num192 = ((int)((this.position.X + base.width) / 16f)) + 2; int num193 = ((int)(this.position.Y / 16f)) - 1; int num194 = ((int)((this.position.Y + base.height) / 16f)) + 2; if (num191 < 0) { num191 = 0; } if (num192 > Main.maxTilesX) { num192 = Main.maxTilesX; } if (num193 < 0) { num193 = 0; } if (num194 > Main.maxTilesY) { num194 = Main.maxTilesY; } for (int num195 = num191; num195 < num192; num195++) { for (int num196 = num193; num196 < num194; num196++) { if (((Main.tile[num195, num196] != null) && Main.tile[num195, num196].nactive()) && (Main.tileSolid[Main.tile[num195, num196].type] || (Main.tileSolidTop[Main.tile[num195, num196].type] && (Main.tile[num195, num196].frameY == 0)))) { Vector2 vector26; vector26.X = num195 * 0x10; vector26.Y = num196 * 0x10; if ((((this.position.X + base.width) > vector26.X) && (this.position.X < (vector26.X + 16f))) && (((this.position.Y + base.height) > vector26.Y) && (this.position.Y < (vector26.Y + 16f)))) { this.velocity.X = 0f; this.velocity.Y = -0.2f; } } } } } catch { } } if (this.type == 0x115) { if (this.alpha > 0) { this.alpha -= 30; if (this.alpha < 0) { this.alpha = 0; } } if (Main.expertMode) { float num197 = 12f; int num198 = Player.FindClosest(base.Center, 1, 1); Vector2 vector27 = Main.player[num198].Center - base.Center; vector27.Normalize(); vector27 = (Vector2)(vector27 * num197); int num199 = 200; this.velocity.X = ((this.velocity.X * (num199 - 1)) + vector27.X) / ((float)num199); if (this.velocity.Length() > 16f) { this.velocity.Normalize(); base.velocity = (Vector2)(base.velocity * 16f); } } } if ((this.type == 0x105) || (this.type == 0x115)) { this.ai[0]++; if (this.ai[0] > 15f) { this.ai[0] = 15f; if ((this.velocity.Y == 0f) && (this.velocity.X != 0f)) { this.velocity.X *= 0.97f; if ((this.velocity.X > -0.01) && (this.velocity.X < 0.01)) { this.Kill(); } } this.velocity.Y += 0.2f; } this.rotation += this.velocity.X * 0.05f; } else if (this.type == 0x17a) { if (this.localAI[0] == 0f) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 0x11); this.localAI[0]++; } Rectangle rectangle3 = new Rectangle((int)this.position.X, (int)this.position.Y, base.width, base.height); for (int num200 = 0; num200 < 200; num200++) { if (Main.npc[num200].CanBeChasedBy(this, true)) { Rectangle rectangle4 = new Rectangle((int)Main.npc[num200].position.X, (int)Main.npc[num200].position.Y, Main.npc[num200].width, Main.npc[num200].height); if (rectangle3.Intersects(rectangle4)) { this.Kill(); return; } } } this.ai[0]++; if (this.ai[0] > 10f) { this.ai[0] = 90f; if ((this.velocity.Y == 0f) && (this.velocity.X != 0f)) { this.velocity.X *= 0.96f; if ((this.velocity.X > -0.01) && (this.velocity.X < 0.01)) { this.Kill(); } } this.velocity.Y += 0.2f; } this.rotation += this.velocity.X * 0.1f; } else if (this.type == 0x1e3) { this.ai[0]++; if (this.ai[0] > 5f) { if ((this.owner == Main.myPlayer) && (this.ai[0] > Main.rand.Next(20, 130))) { this.Kill(); } if ((this.velocity.Y == 0f) && (this.velocity.X != 0f)) { this.velocity.X *= 0.97f; if ((this.velocity.X > -0.01) && (this.velocity.X < 0.01)) { this.velocity.X = 0f; this.netUpdate = true; } } this.velocity.Y += 0.3f; this.velocity.X *= 0.99f; } this.rotation += this.velocity.X * 0.05f; } else if (this.type == 0x21a) { this.ai[0]++; if ((this.ai[0] > 60f) || (this.velocity.Y >= 0f)) { this.alpha += 6; base.velocity = (Vector2)(base.velocity * 0.5f); } else if (this.ai[0] > 5f) { this.velocity.Y += 0.1f; this.velocity.X *= 1.025f; this.alpha -= 0x17; this.scale = (0.8f * (255f - this.alpha)) / 255f; if (this.alpha < 0) { this.alpha = 0; } } if ((this.alpha >= 0xff) && (this.ai[0] > 5f)) { this.Kill(); return; } } else { this.ai[0]++; if (this.ai[0] > 5f) { this.ai[0] = 5f; if ((this.velocity.Y == 0f) && (this.velocity.X != 0f)) { this.velocity.X *= 0.97f; if ((this.velocity.X > -0.01) && (this.velocity.X < 0.01)) { this.velocity.X = 0f; this.netUpdate = true; } } this.velocity.Y += 0.2f; } this.rotation += this.velocity.X * 0.1f; } if (this.type == 0x21a) { if (this.localAI[1] == 0f) { this.localAI[1] = 1f; Main.PlaySound(4, (int)this.position.X, (int)this.position.Y, 7); } if ((this.velocity.Y < 0f) && (this.ai[0] < 60f)) { if (Main.rand.Next(4) == 0) { color5 = new Color(); int num201 = Dust.NewDust(base.position, base.width, base.height, 180, 0f, 0f, 100, color5, 1f); Main.dust[num201].position = base.Center; Dust dust83 = Main.dust[num201]; dust83.scale += Main.rand.Next(50) * 0.01f; Main.dust[num201].noGravity = true; Main.dust[num201].velocity.Y -= 2f; } if (Main.rand.Next(6) == 0) { color5 = new Color(); int num202 = Dust.NewDust(base.position, base.width, base.height, 0xb0, 0f, 0f, 100, color5, 1f); Main.dust[num202].position = base.Center; Dust dust84 = Main.dust[num202]; dust84.scale += 0.3f + (Main.rand.Next(50) * 0.01f); Main.dust[num202].noGravity = true; Dust dust85 = Main.dust[num202]; dust85.velocity = (Vector2)(dust85.velocity * 0.1f); } } } if (this.type == 450) { if (this.ai[1] == 0f) { this.ai[1] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 13); } if (Main.rand.Next(2) == 0) { color5 = new Color(); int num203 = Dust.NewDust(base.position, base.width, base.height, 0xe4, 0f, 0f, 100, color5, 1f); Main.dust[num203].position.X -= 2f; Main.dust[num203].position.Y += 2f; Dust dust86 = Main.dust[num203]; dust86.scale += Main.rand.Next(50) * 0.01f; Main.dust[num203].noGravity = true; Main.dust[num203].velocity.Y -= 2f; } if (Main.rand.Next(4) == 0) { color5 = new Color(); int num204 = Dust.NewDust(base.position, base.width, base.height, 0xe4, 0f, 0f, 100, color5, 1f); Main.dust[num204].position.X -= 2f; Main.dust[num204].position.Y += 2f; Dust dust87 = Main.dust[num204]; dust87.scale += 0.3f + (Main.rand.Next(50) * 0.01f); Main.dust[num204].noGravity = true; Dust dust88 = Main.dust[num204]; dust88.velocity = (Vector2)(dust88.velocity * 0.1f); } if (++this.frameCounter >= 3) { this.frameCounter = 0; if (++this.frame >= 5) { this.frame = 0; } } if ((this.velocity.Y < 0.25) && (this.velocity.Y > 0.15)) { this.velocity.X *= 0.8f; } this.rotation = -this.velocity.X * 0.05f; } if (this.type == 480) { this.alpha = 0xff; color5 = new Color(); int num205 = Dust.NewDust(base.position, base.width, base.height, 0x4b, 0f, 0f, 100, color5, 1f); Main.dust[num205].position.X -= 2f; Main.dust[num205].position.Y += 2f; Dust dust89 = Main.dust[num205]; dust89.scale += Main.rand.Next(50) * 0.01f; Main.dust[num205].noGravity = true; Main.dust[num205].velocity.Y -= 2f; if (Main.rand.Next(2) == 0) { color5 = new Color(); int num206 = Dust.NewDust(base.position, base.width, base.height, 0x4b, 0f, 0f, 100, color5, 1f); Main.dust[num206].position.X -= 2f; Main.dust[num206].position.Y += 2f; Dust dust90 = Main.dust[num206]; dust90.scale += 0.3f + (Main.rand.Next(50) * 0.01f); Main.dust[num206].noGravity = true; Dust dust91 = Main.dust[num206]; dust91.velocity = (Vector2)(dust91.velocity * 0.1f); } } if (((this.type >= 0x146) && (this.type <= 0x148)) || ((this.type >= 400) && (this.type <= 0x192))) { if (base.wet) { this.Kill(); } if (((this.ai[1] == 0f) && (this.type >= 0x146)) && (this.type <= 0x148)) { this.ai[1] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 13); } color5 = new Color(); int num207 = Dust.NewDust(base.position, base.width, base.height, 6, 0f, 0f, 100, color5, 1f); Main.dust[num207].position.X -= 2f; Main.dust[num207].position.Y += 2f; Dust dust92 = Main.dust[num207]; dust92.scale += Main.rand.Next(50) * 0.01f; Main.dust[num207].noGravity = true; Main.dust[num207].velocity.Y -= 2f; if (Main.rand.Next(2) == 0) { int num208 = Dust.NewDust(base.position, base.width, base.height, 6, 0f, 0f, 100, new Color(), 1f); Main.dust[num208].position.X -= 2f; Main.dust[num208].position.Y += 2f; Dust dust93 = Main.dust[num208]; dust93.scale += 0.3f + (Main.rand.Next(50) * 0.01f); Main.dust[num208].noGravity = true; Dust dust94 = Main.dust[num208]; dust94.velocity = (Vector2)(dust94.velocity * 0.1f); } if ((this.velocity.Y < 0.25) && (this.velocity.Y > 0.15)) { this.velocity.X *= 0.8f; } this.rotation = -this.velocity.X * 0.05f; } if (this.velocity.Y > 16f) { this.velocity.Y = 16f; return; } return; } if (this.aiStyle == 15) { if (this.type == 0x19) { if (Main.rand.Next(15) == 0) { Dust.NewDust(base.position, base.width, base.height, 14, 0f, 0f, 150, new Color(), 1.3f); } } else if (this.type == 0x1a) { int num209 = Dust.NewDust(base.position, base.width, base.height, 0xac, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 100, new Color(), 1.5f); Main.dust[num209].noGravity = true; Main.dust[num209].velocity.X /= 2f; Main.dust[num209].velocity.Y /= 2f; } else if (this.type == 0x23) { int num210 = Dust.NewDust(base.position, base.width, base.height, 6, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 100, new Color(), 3f); Main.dust[num210].noGravity = true; Main.dust[num210].velocity.X *= 2f; Main.dust[num210].velocity.Y *= 2f; } else if (this.type == 0x9a) { int num211 = Dust.NewDust(base.position, base.width, base.height, 0x73, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 140, new Color(), 1.5f); Main.dust[num211].noGravity = true; Dust dust95 = Main.dust[num211]; dust95.velocity = (Vector2)(dust95.velocity * 0.25f); } if (Main.player[this.owner].dead) { this.Kill(); return; } Main.player[this.owner].itemAnimation = 10; Main.player[this.owner].itemTime = 10; if ((this.position.X + (base.width / 2)) > (Main.player[this.owner].position.X + (Main.player[this.owner].width / 2))) { Main.player[this.owner].ChangeDir(1); base.direction = 1; } else { Main.player[this.owner].ChangeDir(-1); base.direction = -1; } Vector2 vector28 = Main.player[this.owner].MountedCenter; Vector2 vector29 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f)); float num212 = vector28.X - vector29.X; float num213 = vector28.Y - vector29.Y; float num214 = (float)Math.Sqrt((double)((num212 * num212) + (num213 * num213))); if (this.ai[0] == 0f) { float num215 = 160f; if (this.type == 0x3f) { num215 *= 1.5f; } if (this.type == 0xf7) { num215 *= 1.5f; } this.tileCollide = true; if (num214 > num215) { this.ai[0] = 1f; this.netUpdate = true; } else if (!Main.player[this.owner].channel) { if (this.velocity.Y < 0f) { this.velocity.Y *= 0.9f; } this.velocity.Y++; this.velocity.X *= 0.9f; } } else if (this.ai[0] == 1f) { float num216 = 14f / Main.player[this.owner].meleeSpeed; float num217 = 0.9f / Main.player[this.owner].meleeSpeed; float num218 = 300f; if (this.type == 0x3f) { num218 *= 1.5f; num216 *= 1.5f; num217 *= 1.5f; } if (this.type == 0xf7) { num218 *= 1.5f; num216 = 15.9f; num217 *= 2f; } Math.Abs(num212); Math.Abs(num213); if (this.ai[1] == 1f) { this.tileCollide = false; } if ((!Main.player[this.owner].channel || (num214 > num218)) || !this.tileCollide) { this.ai[1] = 1f; if (this.tileCollide) { this.netUpdate = true; } this.tileCollide = false; if (num214 < 20f) { this.Kill(); } } if (!this.tileCollide) { num217 *= 2f; } int num219 = 60; if (this.type == 0xf7) { num219 = 100; } if ((num214 > num219) || !this.tileCollide) { num214 = num216 / num214; num212 *= num214; num213 *= num214; new Vector2(this.velocity.X, this.velocity.Y); float num220 = num212 - this.velocity.X; float num221 = num213 - this.velocity.Y; float num222 = (float)Math.Sqrt((double)((num220 * num220) + (num221 * num221))); num222 = num217 / num222; num220 *= num222; num221 *= num222; this.velocity.X *= 0.98f; this.velocity.Y *= 0.98f; this.velocity.X += num220; this.velocity.Y += num221; } else { float introduced1654 = Math.Abs(this.velocity.X); if ((introduced1654 + Math.Abs(this.velocity.Y)) < 6f) { this.velocity.X *= 0.96f; this.velocity.Y += 0.2f; } if (Main.player[this.owner].velocity.X == 0f) { this.velocity.X *= 0.96f; } } } if (this.type != 0xf7) { this.rotation = ((float)Math.Atan2((double)num213, (double)num212)) - (this.velocity.X * 0.1f); return; } if (this.velocity.X < 0f) { float introduced1655 = Math.Abs(this.velocity.X); this.rotation -= (introduced1655 + Math.Abs(this.velocity.Y)) * 0.01f; } else { float introduced1656 = Math.Abs(this.velocity.X); this.rotation += (introduced1656 + Math.Abs(this.velocity.Y)) * 0.01f; } float x = this.position.X; float y = this.position.Y; float num225 = 600f; bool flag4 = false; if (this.owner == Main.myPlayer) { this.localAI[1]++; if (this.localAI[1] > 20f) { this.localAI[1] = 20f; for (int num226 = 0; num226 < 200; num226++) { if (Main.npc[num226].CanBeChasedBy(this, false)) { float num227 = Main.npc[num226].position.X + (Main.npc[num226].width / 2); float num228 = Main.npc[num226].position.Y + (Main.npc[num226].height / 2); float introduced1657 = Math.Abs((float)((this.position.X + (base.width / 2)) - num227)); float num229 = introduced1657 + Math.Abs((float)((this.position.Y + (base.height / 2)) - num228)); if ((num229 < num225) && Collision.CanHit(base.position, base.width, base.height, Main.npc[num226].position, Main.npc[num226].width, Main.npc[num226].height)) { num225 = num229; x = num227; y = num228; flag4 = true; } } } } } if (flag4) { this.localAI[1] = 0f; float num230 = 14f; vector29 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f)); num212 = x - vector29.X; num213 = y - vector29.Y; num214 = (float)Math.Sqrt((double)((num212 * num212) + (num213 * num213))); num214 = num230 / num214; num212 *= num214; num213 *= num214; NewProjectile(vector29.X, vector29.Y, num212, num213, 0xf8, (int)(((double)this.damage) / 1.5), this.knockBack / 2f, Main.myPlayer, 0f, 0f); return; } return; } if (this.aiStyle == 0x10) { if ((this.type == 0x6c) || (this.type == 0xa4)) { this.ai[0]++; if (this.ai[0] > 3f) { this.Kill(); } } if (((this.type == 0x25) || (this.type == 0x18d)) || ((this.type == 470) || (this.type == 0x207))) { try { int num231 = ((int)(this.position.X / 16f)) - 1; int num232 = ((int)((this.position.X + base.width) / 16f)) + 2; int num233 = ((int)(this.position.Y / 16f)) - 1; int num234 = ((int)((this.position.Y + base.height) / 16f)) + 2; if (num231 < 0) { num231 = 0; } if (num232 > Main.maxTilesX) { num232 = Main.maxTilesX; } if (num233 < 0) { num233 = 0; } if (num234 > Main.maxTilesY) { num234 = Main.maxTilesY; } for (int num235 = num231; num235 < num232; num235++) { for (int num236 = num233; num236 < num234; num236++) { if (((Main.tile[num235, num236] != null) && Main.tile[num235, num236].nactive()) && (Main.tileSolid[Main.tile[num235, num236].type] || (Main.tileSolidTop[Main.tile[num235, num236].type] && (Main.tile[num235, num236].frameY == 0)))) { Vector2 vector30; vector30.X = num235 * 0x10; vector30.Y = num236 * 0x10; if (((((this.position.X + base.width) - 4f) > vector30.X) && ((this.position.X + 4f) < (vector30.X + 16f))) && ((((this.position.Y + base.height) - 4f) > vector30.Y) && ((this.position.Y + 4f) < (vector30.Y + 16f)))) { this.velocity.X = 0f; this.velocity.Y = -0.2f; } } } } } catch { } } if (this.type == 0x207) { this.localAI[1]++; float num237 = 180f - this.localAI[1]; if (num237 < 0f) { num237 = 0f; } this.frameCounter++; if (num237 < 15f) { this.frameCounter++; } if (this.frameCounter >= (((num237 / 10f) + 6f) / 2f)) { this.frame++; this.frameCounter = 0; if (this.frame >= Main.projFrames[this.type]) { this.frame = 0; } } } if (this.type == 0x66) { if (this.velocity.Y > 10f) { this.velocity.Y = 10f; } if (this.localAI[0] == 0f) { this.localAI[0] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 10); } this.frameCounter++; if (this.frameCounter > 3) { this.frame++; this.frameCounter = 0; } if (this.frame > 1) { this.frame = 0; } if (this.velocity.Y == 0f) { this.position.X += base.width / 2; this.position.Y += base.height / 2; base.width = 0x80; base.height = 0x80; this.position.X -= base.width / 2; this.position.Y -= base.height / 2; this.damage = 40; this.knockBack = 8f; this.timeLeft = 3; this.netUpdate = true; } } if (((this.type == 0x12f) && (this.timeLeft <= 3)) && this.hostile) { this.position.X += base.width / 2; this.position.Y += base.height / 2; base.width = 0x80; base.height = 0x80; this.position.X -= base.width / 2; this.position.Y -= base.height / 2; } if ((this.owner == Main.myPlayer) && (this.timeLeft <= 3)) { this.tileCollide = false; this.ai[1] = 0f; this.alpha = 0xff; if (((this.type == 0x1c) || (this.type == 0x25)) || (((this.type == 0x4b) || (this.type == 0x204)) || (this.type == 0x207))) { this.position.X += base.width / 2; this.position.Y += base.height / 2; base.width = 0x80; base.height = 0x80; this.position.X -= base.width / 2; this.position.Y -= base.height / 2; this.damage = 100; this.knockBack = 8f; } else if (((this.type == 0x1d) || (this.type == 470)) || (this.type == 0x27d)) { this.position.X += base.width / 2; this.position.Y += base.height / 2; base.width = 250; base.height = 250; this.position.X -= base.width / 2; this.position.Y -= base.height / 2; this.damage = 250; this.knockBack = 10f; } else if (((this.type == 30) || (this.type == 0x18d)) || ((this.type == 0x205) || (this.type == 0x24c))) { this.position.X += base.width / 2; this.position.Y += base.height / 2; base.width = 0x80; base.height = 0x80; this.position.X -= base.width / 2; this.position.Y -= base.height / 2; this.knockBack = 8f; } else if ((((this.type == 0x85) || (this.type == 0x86)) || ((this.type == 0x87) || (this.type == 0x88))) || (((this.type == 0x89) || (this.type == 0x8a)) || ((this.type == 0x152) || (this.type == 0x153)))) { this.position.X += base.width / 2; this.position.Y += base.height / 2; base.width = 0x80; base.height = 0x80; this.position.X -= base.width / 2; this.position.Y -= base.height / 2; this.knockBack = 8f; } else if ((((this.type == 0x8b) || (this.type == 140)) || ((this.type == 0x8d) || (this.type == 0x8e))) || (((this.type == 0x8f) || (this.type == 0x90)) || ((this.type == 340) || (this.type == 0x155)))) { this.position.X += base.width / 2; this.position.Y += base.height / 2; base.width = 200; base.height = 200; this.position.X -= base.width / 2; this.position.Y -= base.height / 2; this.knockBack = 10f; } } else { if ((((((this.type != 30) && (this.type != 0x205)) && ((this.type != 0x24c) && (this.type != 0x18d))) && (((this.type != 0x6c) && (this.type != 0x85)) && ((this.type != 0x86) && (this.type != 0x87)))) && ((((this.type != 0x88) && (this.type != 0x89)) && ((this.type != 0x8a) && (this.type != 0x8b))) && (((this.type != 140) && (this.type != 0x8d)) && ((this.type != 0x8e) && (this.type != 0x8f))))) && ((((this.type != 0x90) && (this.type != 0xa4)) && ((this.type != 0x12f) && (this.type < 0x152))) && (this.type < 0x155))) { this.damage = 0; } if (((this.type == 0x152) || (this.type == 0x153)) || ((this.type == 340) || (this.type == 0x155))) { this.localAI[1]++; if (this.localAI[1] > 6f) { this.alpha = 0; } else { this.alpha = ((int)(255f - (42f * this.localAI[1]))) + 100; if (this.alpha > 0xff) { this.alpha = 0xff; } } for (int num238 = 0; num238 < 2; num238++) { float num239 = 0f; float num240 = 0f; if (num238 == 1) { num239 = this.velocity.X * 0.5f; num240 = this.velocity.Y * 0.5f; } if (this.localAI[1] > 9f) { if (Main.rand.Next(2) == 0) { color5 = new Color(); int num241 = Dust.NewDust(new Vector2((this.position.X + 3f) + num239, (this.position.Y + 3f) + num240) - ((Vector2)(base.velocity * 0.5f)), base.width - 8, base.height - 8, 6, 0f, 0f, 100, color5, 1f); Dust dust96 = Main.dust[num241]; dust96.scale *= 1.4f + (Main.rand.Next(10) * 0.1f); Dust dust97 = Main.dust[num241]; dust97.velocity = (Vector2)(dust97.velocity * 0.2f); Main.dust[num241].noGravity = true; } if (Main.rand.Next(2) == 0) { color5 = new Color(); int num242 = Dust.NewDust(new Vector2((this.position.X + 3f) + num239, (this.position.Y + 3f) + num240) - ((Vector2)(base.velocity * 0.5f)), base.width - 8, base.height - 8, 0x1f, 0f, 0f, 100, color5, 0.5f); Main.dust[num242].fadeIn = 0.5f + (Main.rand.Next(5) * 0.1f); Dust dust98 = Main.dust[num242]; dust98.velocity = (Vector2)(dust98.velocity * 0.05f); } } } float num243 = this.position.X; float num244 = this.position.Y; float num245 = 600f; bool flag5 = false; this.ai[0]++; if (this.ai[0] > 30f) { this.ai[0] = 30f; for (int num246 = 0; num246 < 200; num246++) { if (Main.npc[num246].CanBeChasedBy(this, false)) { float num247 = Main.npc[num246].position.X + (Main.npc[num246].width / 2); float num248 = Main.npc[num246].position.Y + (Main.npc[num246].height / 2); float introduced1662 = Math.Abs((float)((this.position.X + (base.width / 2)) - num247)); float num249 = introduced1662 + Math.Abs((float)((this.position.Y + (base.height / 2)) - num248)); if ((num249 < num245) && Collision.CanHit(base.position, base.width, base.height, Main.npc[num246].position, Main.npc[num246].width, Main.npc[num246].height)) { num245 = num249; num243 = num247; num244 = num248; flag5 = true; } } } } if (!flag5) { num243 = (this.position.X + (base.width / 2)) + (this.velocity.X * 100f); num244 = (this.position.Y + (base.height / 2)) + (this.velocity.Y * 100f); } float num250 = 16f; Vector2 vector31 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f)); float num251 = num243 - vector31.X; float num252 = num244 - vector31.Y; float num253 = (float)Math.Sqrt((double)((num251 * num251) + (num252 * num252))); num253 = num250 / num253; num251 *= num253; num252 *= num253; this.velocity.X = ((this.velocity.X * 11f) + num251) / 12f; this.velocity.Y = ((this.velocity.Y * 11f) + num252) / 12f; } else if (((this.type == 0x86) || (this.type == 0x89)) || (((this.type == 140) || (this.type == 0x8f)) || (this.type == 0x12f))) { if ((Math.Abs(this.velocity.X) >= 8f) || (Math.Abs(this.velocity.Y) >= 8f)) { for (int num254 = 0; num254 < 2; num254++) { float num255 = 0f; float num256 = 0f; if (num254 == 1) { num255 = this.velocity.X * 0.5f; num256 = this.velocity.Y * 0.5f; } color5 = new Color(); int num257 = Dust.NewDust(new Vector2((this.position.X + 3f) + num255, (this.position.Y + 3f) + num256) - ((Vector2)(base.velocity * 0.5f)), base.width - 8, base.height - 8, 6, 0f, 0f, 100, color5, 1f); Dust dust99 = Main.dust[num257]; dust99.scale *= 2f + (Main.rand.Next(10) * 0.1f); Dust dust100 = Main.dust[num257]; dust100.velocity = (Vector2)(dust100.velocity * 0.2f); Main.dust[num257].noGravity = true; color5 = new Color(); num257 = Dust.NewDust(new Vector2((this.position.X + 3f) + num255, (this.position.Y + 3f) + num256) - ((Vector2)(base.velocity * 0.5f)), base.width - 8, base.height - 8, 0x1f, 0f, 0f, 100, color5, 0.5f); Main.dust[num257].fadeIn = 1f + (Main.rand.Next(5) * 0.1f); Dust dust101 = Main.dust[num257]; dust101.velocity = (Vector2)(dust101.velocity * 0.05f); } } if ((Math.Abs(this.velocity.X) < 15f) && (Math.Abs(this.velocity.Y) < 15f)) { base.velocity = (Vector2)(base.velocity * 1.1f); } } else if (((this.type == 0x85) || (this.type == 0x88)) || ((this.type == 0x8b) || (this.type == 0x8e))) { int num258 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x1f, 0f, 0f, 100, new Color(), 1f); Dust dust102 = Main.dust[num258]; dust102.scale *= 1f + (Main.rand.Next(10) * 0.1f); Dust dust103 = Main.dust[num258]; dust103.velocity = (Vector2)(dust103.velocity * 0.2f); Main.dust[num258].noGravity = true; } else if (((this.type == 0x87) || (this.type == 0x8a)) || ((this.type == 0x8d) || (this.type == 0x90))) { if (((this.velocity.X > -0.2) && (this.velocity.X < 0.2)) && ((this.velocity.Y > -0.2) && (this.velocity.Y < 0.2))) { this.alpha += 2; if (this.alpha > 200) { this.alpha = 200; } } else { this.alpha = 0; int num259 = Dust.NewDust(new Vector2(this.position.X + 3f, this.position.Y + 3f) - ((Vector2)(base.velocity * 0.5f)), base.width - 8, base.height - 8, 0x1f, 0f, 0f, 100, new Color(), 1f); Dust dust104 = Main.dust[num259]; dust104.scale *= 1.6f + (Main.rand.Next(5) * 0.1f); Dust dust105 = Main.dust[num259]; dust105.velocity = (Vector2)(dust105.velocity * 0.05f); Main.dust[num259].noGravity = true; } } else if ((((this.type != 30) && (this.type != 0x205)) && ((this.type != 0x18d) && (this.type != 0x207))) && ((this.type != 0x24c) && (Main.rand.Next(2) == 0))) { color5 = new Color(); int num260 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x1f, 0f, 0f, 100, color5, 1f); Main.dust[num260].scale = 0.1f + (Main.rand.Next(5) * 0.1f); Main.dust[num260].fadeIn = 1.5f + (Main.rand.Next(5) * 0.1f); Main.dust[num260].noGravity = true; vector240 = new Vector2(); Main.dust[num260].position = base.Center + ((Vector2)(new Vector2(0f, (float)(-base.height / 2)).RotatedBy(((double)this.rotation), vector240) * 1.1f)); Main.rand.Next(2); num260 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, 0f, 0f, 100, new Color(), 1f); Main.dust[num260].scale = 1f + (Main.rand.Next(5) * 0.1f); Main.dust[num260].noGravity = true; Main.dust[num260].position = base.Center + ((Vector2)(new Vector2(0f, (float)((-base.height / 2) - 6)).RotatedBy(((double)this.rotation), new Vector2()) * 1.1f)); } } this.ai[0]++; if (((this.type == 0x152) || (this.type == 0x153)) || ((this.type == 340) || (this.type == 0x155))) { if (this.velocity.X < 0f) { this.spriteDirection = -1; this.rotation = ((float)Math.Atan2((double)-this.velocity.Y, (double)-this.velocity.X)) - 1.57f; } else { this.spriteDirection = 1; this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 1.57f; } } else if (((this.type == 0x86) || (this.type == 0x89)) || (((this.type == 140) || (this.type == 0x8f)) || (this.type == 0x12f))) { this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 1.57f; } else if (((this.type == 0x87) || (this.type == 0x8a)) || ((this.type == 0x8d) || (this.type == 0x90))) { this.velocity.Y += 0.2f; base.velocity = (Vector2)(base.velocity * 0.97f); if ((this.velocity.X > -0.1) && (this.velocity.X < 0.1)) { this.velocity.X = 0f; } if ((this.velocity.Y > -0.1) && (this.velocity.Y < 0.1)) { this.velocity.Y = 0f; } } else if (((this.type == 0x85) || (this.type == 0x88)) || ((this.type == 0x8b) || (this.type == 0x8e))) { if (this.ai[0] > 15f) { if (this.velocity.Y == 0f) { this.velocity.X *= 0.95f; } this.velocity.Y += 0.2f; } } else if (((((this.type == 30) || (this.type == 0x18d)) || ((this.type == 0x205) || (this.type == 0x24c))) && (this.ai[0] > 10f)) || ((((this.type != 30) && (this.type != 0x18d)) && ((this.type != 0x205) && (this.type != 0x24c))) && (this.ai[0] > 5f))) { this.ai[0] = 10f; if ((this.velocity.Y == 0f) && (this.velocity.X != 0f)) { this.velocity.X *= 0.97f; if (((this.type == 0x1d) || (this.type == 470)) || (this.type == 0x27d)) { this.velocity.X *= 0.99f; } if ((this.velocity.X > -0.01) && (this.velocity.X < 0.01)) { this.velocity.X = 0f; this.netUpdate = true; } } this.velocity.Y += 0.2f; } if (this.type == 0x207) { this.rotation += this.velocity.X * 0.06f; return; } if ((((this.type != 0x86) && (this.type != 0x89)) && ((this.type != 140) && (this.type != 0x8f))) && ((this.type != 0x12f) && ((this.type < 0x152) || (this.type > 0x155)))) { this.rotation += this.velocity.X * 0.1f; return; } return; } if (this.aiStyle == 0x11) { if (this.velocity.Y == 0f) { this.velocity.X *= 0.98f; } this.rotation += this.velocity.X * 0.1f; this.velocity.Y += 0.2f; if (this.owner == Main.myPlayer) { int num261 = (int)((this.position.X + (base.width / 2)) / 16f); int num262 = (int)(((this.position.Y + base.height) - 4f) / 16f); if ((Main.tile[num261, num262] != null) && !Main.tile[num261, num262].active()) { int style = 0; if ((this.type >= 0xc9) && (this.type <= 0xcd)) { style = this.type - 200; } if ((this.type >= 0x20f) && (this.type <= 0x213)) { style = (this.type - 0x20f) + 6; } WorldGen.PlaceTile(num261, num262, 0x55, false, false, this.owner, style); if (Main.tile[num261, num262].active()) { if (Main.netMode != 0) { NetMessage.SendData(0x11, -1, -1, "", 1, (float)num261, (float)num262, 85f, style, 0, 0); } int num264 = Sign.ReadSign(num261, num262, true); if (num264 >= 0) { Sign.TextSign(num264, this.miscText); } this.Kill(); return; } } } return; } if (this.aiStyle == 0x12) { if ((this.ai[1] == 0f) && (this.type == 0x2c)) { this.ai[1] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8); } if ((this.type == 0x107) || (this.type == 0x112)) { if ((this.type == 0x112) && (this.velocity.X < 0f)) { this.spriteDirection = -1; } this.rotation += base.direction * 0.05f; this.rotation += (base.direction * 0.5f) * (((float)this.timeLeft) / 180f); if (this.type == 0x112) { base.velocity = (Vector2)(base.velocity * 0.96f); return; } base.velocity = (Vector2)(base.velocity * 0.95f); return; } this.rotation += base.direction * 0.8f; this.ai[0]++; if (this.ai[0] >= 30f) { if (this.ai[0] < 100f) { base.velocity = (Vector2)(base.velocity * 1.06f); } else { this.ai[0] = 200f; } } for (int num265 = 0; num265 < 2; num265++) { color5 = new Color(); int num266 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x1b, 0f, 0f, 100, color5, 1f); Main.dust[num266].noGravity = true; } return; } if (this.aiStyle == 0x13) { Vector2 vector32 = Main.player[this.owner].RotatedRelativePoint(Main.player[this.owner].MountedCenter, true); base.direction = Main.player[this.owner].direction; Main.player[this.owner].heldProj = base.whoAmI; Main.player[this.owner].itemTime = Main.player[this.owner].itemAnimation; this.position.X = vector32.X - (base.width / 2); this.position.Y = vector32.Y - (base.height / 2); if (!Main.player[this.owner].frozen) { if (this.type == 0x2e) { if (this.ai[0] == 0f) { this.ai[0] = 3f; this.netUpdate = true; } if (Main.player[this.owner].itemAnimation < (Main.player[this.owner].itemAnimationMax / 3)) { this.ai[0] -= 1.6f; } else { this.ai[0] += 1.4f; } } else if (this.type == 0x69) { if (this.ai[0] == 0f) { this.ai[0] = 3f; this.netUpdate = true; } if (Main.player[this.owner].itemAnimation < (Main.player[this.owner].itemAnimationMax / 3)) { this.ai[0] -= 2.4f; } else { this.ai[0] += 2.1f; } } else if (this.type == 0x16f) { this.spriteDirection = -base.direction; if (this.ai[0] == 0f) { this.ai[0] = 3f; this.netUpdate = true; } if (Main.player[this.owner].itemAnimation < (Main.player[this.owner].itemAnimationMax / 3)) { this.ai[0] -= 1.6f; } else { this.ai[0] += 1.5f; } } else if (this.type == 0x170) { this.spriteDirection = -base.direction; if (this.ai[0] == 0f) { this.ai[0] = 3f; this.netUpdate = true; } if (Main.player[this.owner].itemAnimation < (Main.player[this.owner].itemAnimationMax / 3)) { this.ai[0] -= 1.5f; } else { this.ai[0] += 1.4f; } } else if (this.type == 0xde) { if (this.ai[0] == 0f) { this.ai[0] = 3f; this.netUpdate = true; } if (Main.player[this.owner].itemAnimation < (Main.player[this.owner].itemAnimationMax / 3)) { this.ai[0] -= 2.4f; if ((this.localAI[0] == 0f) && (Main.myPlayer == this.owner)) { this.localAI[0] = 1f; NewProjectile(base.Center.X + (this.velocity.X * this.ai[0]), base.Center.Y + (this.velocity.Y * this.ai[0]), this.velocity.X, this.velocity.Y, 0xe4, this.damage, this.knockBack, this.owner, 0f, 0f); } } else { this.ai[0] += 2.1f; } } else if (this.type == 0x156) { if (this.ai[0] == 0f) { this.ai[0] = 3f; this.netUpdate = true; } if (Main.player[this.owner].itemAnimation < (Main.player[this.owner].itemAnimationMax / 3)) { this.ai[0] -= 2.4f; if ((this.localAI[0] == 0f) && (Main.myPlayer == this.owner)) { this.localAI[0] = 1f; if (Collision.CanHit(Main.player[this.owner].position, Main.player[this.owner].width, Main.player[this.owner].height, new Vector2(base.Center.X + (this.velocity.X * this.ai[0]), base.Center.Y + (this.velocity.Y * this.ai[0])), base.width, base.height)) { NewProjectile(base.Center.X + (this.velocity.X * this.ai[0]), base.Center.Y + (this.velocity.Y * this.ai[0]), this.velocity.X * 2.4f, this.velocity.Y * 2.4f, 0x157, (int)(this.damage * 0.8), this.knockBack * 0.85f, this.owner, 0f, 0f); } } } else { this.ai[0] += 2.1f; } } else if (this.type == 0x2f) { if (this.ai[0] == 0f) { this.ai[0] = 4f; this.netUpdate = true; } if (Main.player[this.owner].itemAnimation < (Main.player[this.owner].itemAnimationMax / 3)) { this.ai[0] -= 1.2f; } else { this.ai[0] += 0.9f; } } else if (this.type == 0x99) { this.spriteDirection = -base.direction; if (this.ai[0] == 0f) { this.ai[0] = 4f; this.netUpdate = true; } if (Main.player[this.owner].itemAnimation < (Main.player[this.owner].itemAnimationMax / 3)) { this.ai[0] -= 1.5f; } else { this.ai[0] += 1.3f; } } else if (this.type == 0x31) { if (this.ai[0] == 0f) { this.ai[0] = 4f; this.netUpdate = true; } if (Main.player[this.owner].itemAnimation < (Main.player[this.owner].itemAnimationMax / 3)) { this.ai[0] -= 1.1f; } else { this.ai[0] += 0.85f; } } else if ((this.type == 0x40) || (this.type == 0xd7)) { this.spriteDirection = -base.direction; if (this.ai[0] == 0f) { this.ai[0] = 3f; this.netUpdate = true; } if (Main.player[this.owner].itemAnimation < (Main.player[this.owner].itemAnimationMax / 3)) { this.ai[0] -= 1.9f; } else { this.ai[0] += 1.7f; } } else if (((this.type == 0x42) || (this.type == 0x61)) || ((this.type == 0xd4) || (this.type == 0xda))) { this.spriteDirection = -base.direction; if (this.ai[0] == 0f) { this.ai[0] = 3f; this.netUpdate = true; } if (Main.player[this.owner].itemAnimation < (Main.player[this.owner].itemAnimationMax / 3)) { this.ai[0] -= 2.1f; } else { this.ai[0] += 1.9f; } } else if (this.type == 130) { this.spriteDirection = -base.direction; if (this.ai[0] == 0f) { this.ai[0] = 3f; this.netUpdate = true; } if (Main.player[this.owner].itemAnimation < (Main.player[this.owner].itemAnimationMax / 3)) { this.ai[0] -= 1.3f; } else { this.ai[0]++; } } } base.position += (Vector2)(base.velocity * this.ai[0]); if (this.type == 130) { if ((((this.ai[1] == 0f) || (this.ai[1] == 4f)) || ((this.ai[1] == 8f) || (this.ai[1] == 12f))) || (((this.ai[1] == 16f) || (this.ai[1] == 20f)) || (this.ai[1] == 24f))) { NewProjectile(this.position.X + (base.width / 2), this.position.Y + (base.height / 2), this.velocity.X, this.velocity.Y, 0x83, this.damage / 3, 0f, this.owner, 0f, 0f); } 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 == 0x2e) { if (Main.rand.Next(5) == 0) { color5 = new Color(); Dust.NewDust(base.position, base.width, base.height, 14, 0f, 0f, 150, color5, 1.4f); } color5 = new Color(); int num267 = Dust.NewDust(base.position, base.width, base.height, 0x1b, (this.velocity.X * 0.2f) + (base.direction * 3), this.velocity.Y * 0.2f, 100, color5, 1.2f); Main.dust[num267].noGravity = true; Main.dust[num267].velocity.X /= 2f; Main.dust[num267].velocity.Y /= 2f; num267 = Dust.NewDust(base.position - ((Vector2)(base.velocity * 2f)), base.width, base.height, 0x1b, 0f, 0f, 150, new Color(), 1.4f); Main.dust[num267].velocity.X /= 5f; Main.dust[num267].velocity.Y /= 5f; return; } if (this.type != 0x69) { if (this.type == 0x99) { int num270 = Dust.NewDust(base.position - ((Vector2)(base.velocity * 3f)), base.width, base.height, 0x73, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 140, new Color(), 1f); Main.dust[num270].noGravity = true; Main.dust[num270].fadeIn = 1.25f; Dust dust110 = Main.dust[num270]; dust110.velocity = (Vector2)(dust110.velocity * 0.25f); return; } } else { if (Main.rand.Next(3) == 0) { color5 = new Color(); int num268 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x39, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 200, color5, 1.2f); Dust dust106 = Main.dust[num268]; dust106.velocity += (Vector2)(base.velocity * 0.3f); Dust dust107 = Main.dust[num268]; dust107.velocity = (Vector2)(dust107.velocity * 0.2f); } if (Main.rand.Next(4) == 0) { int num269 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x2b, 0f, 0f, 0xfe, new Color(), 0.3f); Dust dust108 = Main.dust[num269]; dust108.velocity += (Vector2)(base.velocity * 0.5f); Dust dust109 = Main.dust[num269]; dust109.velocity = (Vector2)(dust109.velocity * 0.5f); return; } } return; } if (this.aiStyle == 20) { if (this.type == 0xfc) { this.frameCounter++; if (this.frameCounter >= 4) { this.frameCounter = 0; this.frame++; } if (this.frame > 3) { this.frame = 0; } } if (this.type == 0x1fd) { this.frameCounter++; if (this.frameCounter >= 2) { this.frameCounter = 0; this.frame++; } if (this.frame > 1) { this.frame = 0; } } if (this.soundDelay <= 0) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 0x16); this.soundDelay = 30; } Vector2 vector33 = Main.player[this.owner].RotatedRelativePoint(Main.player[this.owner].MountedCenter, true); if (Main.myPlayer == this.owner) { if (Main.player[this.owner].channel) { float num271 = Main.player[this.owner].inventory[Main.player[this.owner].selectedItem].shootSpeed * this.scale; Vector2 vector34 = vector33; float num272 = (Main.mouseX + Main.screenPosition.X) - vector34.X; float num273 = (Main.mouseY + Main.screenPosition.Y) - vector34.Y; if (Main.player[this.owner].gravDir == -1f) { num273 = ((Main.screenHeight - Main.mouseY) + Main.screenPosition.Y) - vector34.Y; } float num274 = (float)Math.Sqrt((double)((num272 * num272) + (num273 * num273))); num274 = (float)Math.Sqrt((double)((num272 * num272) + (num273 * num273))); num274 = num271 / num274; num272 *= num274; num273 *= num274; if ((num272 != this.velocity.X) || (num273 != this.velocity.Y)) { this.netUpdate = true; } this.velocity.X = num272; this.velocity.Y = num273; } else { this.Kill(); } } if (this.velocity.X > 0f) { Main.player[this.owner].ChangeDir(1); } else if (this.velocity.X < 0f) { Main.player[this.owner].ChangeDir(-1); } this.spriteDirection = base.direction; Main.player[this.owner].ChangeDir(base.direction); Main.player[this.owner].heldProj = base.whoAmI; Main.player[this.owner].itemTime = 2; Main.player[this.owner].itemAnimation = 2; this.position.X = vector33.X - (base.width / 2); this.position.Y = vector33.Y - (base.height / 2); this.rotation = (float)(Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.5700000524520874); if (Main.player[this.owner].direction == 1) { Main.player[this.owner].itemRotation = (float)Math.Atan2((double)(this.velocity.Y * base.direction), (double)(this.velocity.X * base.direction)); } else { Main.player[this.owner].itemRotation = (float)Math.Atan2((double)(this.velocity.Y * base.direction), (double)(this.velocity.X * base.direction)); } this.velocity.X *= 1f + (Main.rand.Next(-3, 4) * 0.01f); if (Main.rand.Next(6) == 0) { int num275 = Dust.NewDust(base.position + ((Vector2)((base.velocity * Main.rand.Next(6, 10)) * 0.1f)), base.width, base.height, 0x1f, 0f, 0f, 80, new Color(), 1.4f); Main.dust[num275].position.X -= 4f; Main.dust[num275].noGravity = true; Dust dust111 = Main.dust[num275]; dust111.velocity = (Vector2)(dust111.velocity * 0.2f); Main.dust[num275].velocity.Y = -Main.rand.Next(7, 13) * 0.15f; return; } return; } if (this.aiStyle == 0x15) { this.rotation = this.velocity.X * 0.1f; this.spriteDirection = -base.direction; if (Main.rand.Next(3) == 0) { int num276 = Dust.NewDust(base.position, base.width, base.height, 0x1b, 0f, 0f, 80, new Color(), 1f); Main.dust[num276].noGravity = true; Dust dust112 = Main.dust[num276]; dust112.velocity = (Vector2)(dust112.velocity * 0.2f); } if (this.ai[1] == 1f) { this.ai[1] = 0f; Main.harpNote = this.ai[0]; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 0x1a); return; } return; } if (this.aiStyle == 0x16) { if ((this.velocity.X == 0f) && (this.velocity.Y == 0f)) { this.alpha = 0xff; } if (this.ai[1] < 0f) { if (this.velocity.X > 0f) { this.rotation += 0.3f; } else { this.rotation -= 0.3f; } int num277 = ((int)(this.position.X / 16f)) - 1; int num278 = ((int)((this.position.X + base.width) / 16f)) + 2; int num279 = ((int)(this.position.Y / 16f)) - 1; int num280 = ((int)((this.position.Y + base.height) / 16f)) + 2; if (num277 < 0) { num277 = 0; } if (num278 > Main.maxTilesX) { num278 = Main.maxTilesX; } if (num279 < 0) { num279 = 0; } if (num280 > Main.maxTilesY) { num280 = Main.maxTilesY; } int num281 = ((int)this.position.X) + 4; int num282 = ((int)this.position.Y) + 4; for (int num283 = num277; num283 < num278; num283++) { for (int num284 = num279; num284 < num280; num284++) { if ((((Main.tile[num283, num284] != null) && Main.tile[num283, num284].active()) && ((Main.tile[num283, num284].type != 0x7f) && Main.tileSolid[Main.tile[num283, num284].type])) && !Main.tileSolidTop[Main.tile[num283, num284].type]) { Vector2 vector35; vector35.X = num283 * 0x10; vector35.Y = num284 * 0x10; if ((((num281 + 8) > vector35.X) && (num281 < (vector35.X + 16f))) && (((num282 + 8) > vector35.Y) && (num282 < (vector35.Y + 16f)))) { this.Kill(); } } } } int num285 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x43, 0f, 0f, 0, new Color(), 1f); Main.dust[num285].noGravity = true; Dust dust113 = Main.dust[num285]; dust113.velocity = (Vector2)(dust113.velocity * 0.3f); return; } if (this.ai[0] >= 0f) { int num291 = ((int)(this.position.X / 16f)) - 1; int num292 = ((int)((this.position.X + base.width) / 16f)) + 2; int num293 = ((int)(this.position.Y / 16f)) - 1; int num294 = ((int)((this.position.Y + base.height) / 16f)) + 2; if (num291 < 0) { num291 = 0; } if (num292 > Main.maxTilesX) { num292 = Main.maxTilesX; } if (num293 < 0) { num293 = 0; } if (num294 > Main.maxTilesY) { num294 = Main.maxTilesY; } int num295 = ((int)this.position.X) + 4; int num296 = ((int)this.position.Y) + 4; for (int num297 = num291; num297 < num292; num297++) { for (int num298 = num293; num298 < num294; num298++) { if ((((Main.tile[num297, num298] != null) && Main.tile[num297, num298].nactive()) && ((Main.tile[num297, num298].type != 0x7f) && Main.tileSolid[Main.tile[num297, num298].type])) && !Main.tileSolidTop[Main.tile[num297, num298].type]) { Vector2 vector36; vector36.X = num297 * 0x10; vector36.Y = num298 * 0x10; if ((((num295 + 8) > vector36.X) && (num295 < (vector36.X + 16f))) && (((num296 + 8) > vector36.Y) && (num296 < (vector36.Y + 16f)))) { this.Kill(); } } } } if (base.lavaWet) { this.Kill(); } if (base.active) { int num299 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x43, 0f, 0f, 0, new Color(), 1f); Main.dust[num299].noGravity = true; Dust dust116 = Main.dust[num299]; dust116.velocity = (Vector2)(dust116.velocity * 0.3f); int num300 = (int)this.ai[0]; int num301 = (int)this.ai[1]; if (WorldGen.SolidTile(num300, num301)) { float introduced1681 = Math.Abs(this.velocity.X); if (introduced1681 > Math.Abs(this.velocity.Y)) { if ((base.Center.Y < ((num301 * 0x10) + 8)) && !WorldGen.SolidTile(num300, num301 - 1)) { num301--; } else if (!WorldGen.SolidTile(num300, num301 + 1)) { num301++; } else if (!WorldGen.SolidTile(num300, num301 - 1)) { num301--; } else if ((base.Center.X < ((num300 * 0x10) + 8)) && !WorldGen.SolidTile(num300 - 1, num301)) { num300--; } else if (!WorldGen.SolidTile(num300 + 1, num301)) { num300++; } else if (!WorldGen.SolidTile(num300 - 1, num301)) { num300--; } } else if ((base.Center.X < ((num300 * 0x10) + 8)) && !WorldGen.SolidTile(num300 - 1, num301)) { num300--; } else if (!WorldGen.SolidTile(num300 + 1, num301)) { num300++; } else if (!WorldGen.SolidTile(num300 - 1, num301)) { num300--; } else if ((base.Center.Y < ((num301 * 0x10) + 8)) && !WorldGen.SolidTile(num300, num301 - 1)) { num301--; } else if (!WorldGen.SolidTile(num300, num301 + 1)) { num301++; } else if (!WorldGen.SolidTile(num300, num301 - 1)) { num301--; } } if (this.velocity.X > 0f) { this.rotation += 0.3f; } else { this.rotation -= 0.3f; } if (Main.myPlayer == this.owner) { int num302 = (int)((this.position.X + (base.width / 2)) / 16f); int num303 = (int)((this.position.Y + (base.height / 2)) / 16f); bool flag6 = false; if ((num302 == num300) && (num303 == num301)) { flag6 = true; } if ((((this.velocity.X <= 0f) && (num302 <= num300)) || ((this.velocity.X >= 0f) && (num302 >= num300))) && (((this.velocity.Y <= 0f) && (num303 <= num301)) || ((this.velocity.Y >= 0f) && (num303 >= num301)))) { flag6 = true; } if (flag6) { if (WorldGen.PlaceTile(num300, num301, 0x7f, false, false, this.owner, 0)) { if (Main.netMode == 1) { NetMessage.SendData(0x11, -1, -1, "", 1, (float)((int)this.ai[0]), (float)((int)this.ai[1]), 127f, 0, 0, 0); } this.damage = 0; this.ai[0] = -1f; base.velocity = (Vector2)(base.velocity * 0f); this.alpha = 0xff; this.position.X = num300 * 0x10; this.position.Y = num301 * 0x10; this.netUpdate = true; return; } this.ai[1] = -1f; return; } } } } else { if (this.ai[0] == -1f) { for (int num286 = 0; num286 < 10; num286++) { color5 = new Color(); int num287 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x43, 0f, 0f, 0, color5, 1.1f); Main.dust[num287].noGravity = true; Dust dust114 = Main.dust[num287]; dust114.velocity = (Vector2)(dust114.velocity * 1.3f); } } else if (Main.rand.Next(30) == 0) { int num288 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x43, 0f, 0f, 100, new Color(), 1f); Dust dust115 = Main.dust[num288]; dust115.velocity = (Vector2)(dust115.velocity * 0.2f); } int num289 = ((int)this.position.X) / 0x10; int num290 = ((int)this.position.Y) / 0x10; if ((Main.tile[num289, num290] == null) || !Main.tile[num289, num290].active()) { this.Kill(); } this.ai[0]--; if (((this.ai[0] <= -900f) && ((Main.myPlayer == this.owner) || (Main.netMode == 2))) && (Main.tile[num289, num290].active() && (Main.tile[num289, num290].type == 0x7f))) { WorldGen.KillTile(num289, num290, false, false, false); if (Main.netMode == 1) { NetMessage.SendData(0x11, -1, -1, "", 0, (float)num289, (float)num290, 0f, 0, 0, 0); } this.Kill(); return; } } return; } if (this.aiStyle == 0x17) { if ((this.type == 0xbc) && (this.ai[0] < 8f)) { this.ai[0] = 8f; } if (this.timeLeft > 60) { this.timeLeft = 60; } if (this.ai[0] > 7f) { float num304 = 1f; if (this.ai[0] == 8f) { num304 = 0.25f; } else if (this.ai[0] == 9f) { num304 = 0.5f; } else if (this.ai[0] == 10f) { num304 = 0.75f; } this.ai[0]++; int num305 = 6; if (this.type == 0x65) { num305 = 0x4b; } if ((num305 == 6) || (Main.rand.Next(2) == 0)) { for (int num306 = 0; num306 < 1; num306++) { color5 = new Color(); int num307 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, num305, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, color5, 1f); if ((Main.rand.Next(3) != 0) || ((num305 == 0x4b) && (Main.rand.Next(3) == 0))) { Main.dust[num307].noGravity = true; Dust dust117 = Main.dust[num307]; dust117.scale *= 3f; Main.dust[num307].velocity.X *= 2f; Main.dust[num307].velocity.Y *= 2f; } if (this.type == 0xbc) { Dust dust118 = Main.dust[num307]; dust118.scale *= 1.25f; } else { Dust dust119 = Main.dust[num307]; dust119.scale *= 1.5f; } Main.dust[num307].velocity.X *= 1.2f; Main.dust[num307].velocity.Y *= 1.2f; Dust dust120 = Main.dust[num307]; dust120.scale *= num304; if (num305 == 0x4b) { Dust dust121 = Main.dust[num307]; dust121.velocity += base.velocity; if (!Main.dust[num307].noGravity) { Dust dust122 = Main.dust[num307]; dust122.velocity = (Vector2)(dust122.velocity * 0.5f); } } } } } else { this.ai[0]++; } this.rotation += 0.3f * base.direction; return; } if (this.aiStyle == 0x18) { this.light = this.scale * 0.5f; this.rotation += this.velocity.X * 0.2f; this.ai[1]++; if (this.type != 0x5e) { base.velocity = (Vector2)(base.velocity * 0.96f); if (this.ai[1] > 15f) { this.scale -= 0.05f; if (this.scale <= 0.2) { this.scale = 0.2f; this.Kill(); return; } } } else { if (Main.rand.Next(4) == 0) { int num308 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 70, 0f, 0f, 0, new Color(), 1f); Main.dust[num308].noGravity = true; Dust dust123 = Main.dust[num308]; dust123.velocity = (Vector2)(dust123.velocity * 0.5f); Dust dust124 = Main.dust[num308]; dust124.scale *= 0.9f; } base.velocity = (Vector2)(base.velocity * 0.985f); if (this.ai[1] > 130f) { this.scale -= 0.05f; if (this.scale <= 0.2) { this.scale = 0.2f; this.Kill(); return; } } } return; } if (this.aiStyle == 0x19) { if (((this.ai[0] != 0f) && (this.velocity.Y <= 0f)) && (this.velocity.X == 0f)) { float num309 = 0.5f; int num310 = (int)((this.position.X - 8f) / 16f); int num311 = (int)(this.position.Y / 16f); bool flag7 = false; bool flag8 = false; if (WorldGen.SolidTile(num310, num311) || WorldGen.SolidTile(num310, num311 + 1)) { flag7 = true; } num310 = (int)(((this.position.X + base.width) + 8f) / 16f); if (WorldGen.SolidTile(num310, num311) || WorldGen.SolidTile(num310, num311 + 1)) { flag8 = true; } if (flag7) { this.velocity.X = num309; } else if (flag8) { this.velocity.X = -num309; } else { num310 = (int)(((this.position.X - 8f) - 16f) / 16f); num311 = (int)(this.position.Y / 16f); flag7 = false; flag8 = false; if (WorldGen.SolidTile(num310, num311) || WorldGen.SolidTile(num310, num311 + 1)) { flag7 = true; } num310 = (int)((((this.position.X + base.width) + 8f) + 16f) / 16f); if (WorldGen.SolidTile(num310, num311) || WorldGen.SolidTile(num310, num311 + 1)) { flag8 = true; } if (flag7) { this.velocity.X = num309; } else if (flag8) { this.velocity.X = -num309; } else { num310 = (int)((this.position.X + 4f) / 16f); num311 = (int)(((this.position.Y + base.height) + 8f) / 16f); if (WorldGen.SolidTile(num310, num311) || WorldGen.SolidTile(num310, num311 + 1)) { flag7 = true; } if (!flag7) { this.velocity.X = num309; } else { this.velocity.X = -num309; } } } } this.rotation += this.velocity.X * 0.06f; this.ai[0] = 1f; if (this.velocity.Y > 16f) { this.velocity.Y = 16f; } if (this.velocity.Y <= 6f) { if ((this.velocity.X > 0f) && (this.velocity.X < 7f)) { this.velocity.X += 0.05f; } if ((this.velocity.X < 0f) && (this.velocity.X > -7f)) { this.velocity.X -= 0.05f; } } this.velocity.Y += 0.3f; return; } if (this.aiStyle == 0x1a) { this.AI_026(); return; } if (this.aiStyle != 0x1b) { if (this.aiStyle == 0x1c) { if (this.type == 0xb1) { for (int num321 = 0; num321 < 3; num321++) { color5 = new Color(); int num322 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x89, this.velocity.X, this.velocity.Y, Main.rand.Next(0, 0x65), color5, 1f + (Main.rand.Next(-20, 40) * 0.01f)); Main.dust[num322].noGravity = true; Dust dust133 = Main.dust[num322]; dust133.velocity = (Vector2)(dust133.velocity * 0.3f); } } if (this.type == 0x76) { for (int num323 = 0; num323 < 2; num323++) { color5 = new Color(); int num324 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x5c, this.velocity.X, this.velocity.Y, 50, color5, 1.2f); Main.dust[num324].noGravity = true; Dust dust134 = Main.dust[num324]; dust134.velocity = (Vector2)(dust134.velocity * 0.3f); } } if (((this.type == 0x77) || (this.type == 0x80)) || (this.type == 0x167)) { for (int num325 = 0; num325 < 3; num325++) { color5 = new Color(); int num326 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x5c, this.velocity.X, this.velocity.Y, 50, color5, 1.2f); Main.dust[num326].noGravity = true; Dust dust135 = Main.dust[num326]; dust135.velocity = (Vector2)(dust135.velocity * 0.3f); } } if (this.type == 0x135) { for (int num327 = 0; num327 < 3; num327++) { color5 = new Color(); int num328 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xb9, this.velocity.X, this.velocity.Y, 50, color5, 1.2f); Main.dust[num328].noGravity = true; Dust dust136 = Main.dust[num328]; dust136.velocity = (Vector2)(dust136.velocity * 0.3f); } } if (this.type == 0x81) { for (int num329 = 0; num329 < 6; num329++) { color5 = new Color(); int num330 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x6a, this.velocity.X, this.velocity.Y, 100, color5, 1f); Main.dust[num330].noGravity = true; Dust dust137 = Main.dust[num330]; dust137.velocity = (Vector2)(dust137.velocity * (0.1f + (Main.rand.Next(4) * 0.1f))); Dust dust138 = Main.dust[num330]; dust138.scale *= 1f + (Main.rand.Next(5) * 0.1f); } } if (this.ai[1] == 0f) { this.ai[1] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 0x1c); return; } return; } if (this.aiStyle == 0x1d) { if (this.type == 0x26b) { int num332; int alpha = (int)this.ai[0]; for (int num333 = 0; num333 < 3; num333++) { color5 = new Color(); num332 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xfe, this.velocity.X, this.velocity.Y, alpha, color5, 1.2f); Main.dust[num332].position = (Vector2)((Main.dust[num332].position + base.Center) / 2f); Main.dust[num332].noGravity = true; Dust dust139 = Main.dust[num332]; dust139.velocity = (Vector2)(dust139.velocity * 0.5f); } for (int num334 = 0; num334 < 2; num334++) { color5 = new Color(); num332 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xff, this.velocity.X, this.velocity.Y, alpha, color5, 0.4f); switch (num334) { case 0: Main.dust[num332].position = (Vector2)((Main.dust[num332].position + (base.Center * 5f)) / 6f); break; case 1: Main.dust[num332].position = (Vector2)((Main.dust[num332].position + ((base.Center + (base.velocity / 2f)) * 5f)) / 6f); break; } Dust dust140 = Main.dust[num332]; dust140.velocity = (Vector2)(dust140.velocity * 0.1f); Main.dust[num332].noGravity = true; Main.dust[num332].fadeIn = 1f; } return; } if (this.type == 620) { int num337; int num335 = (int)this.ai[0]; this.ai[1]++; float num336 = (60f - this.ai[1]) / 60f; if (this.ai[1] > 40f) { this.Kill(); } this.velocity.Y += 0.2f; if (this.velocity.Y > 18f) { this.velocity.Y = 18f; } this.velocity.X *= 0.98f; for (int num338 = 0; num338 < 2; num338++) { color5 = new Color(); num337 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, num335, this.velocity.X, this.velocity.Y, 50, color5, 1.1f); Main.dust[num337].position = (Vector2)((Main.dust[num337].position + base.Center) / 2f); Main.dust[num337].noGravity = true; Dust dust141 = Main.dust[num337]; dust141.velocity = (Vector2)(dust141.velocity * 0.3f); Dust dust142 = Main.dust[num337]; dust142.scale *= num336; } for (int num339 = 0; num339 < 1; num339++) { color5 = new Color(); num337 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, num335, this.velocity.X, this.velocity.Y, 50, color5, 0.6f); Main.dust[num337].position = (Vector2)((Main.dust[num337].position + (base.Center * 5f)) / 6f); Dust dust143 = Main.dust[num337]; dust143.velocity = (Vector2)(dust143.velocity * 0.1f); Main.dust[num337].noGravity = true; Main.dust[num337].fadeIn = 0.9f * num336; Dust dust144 = Main.dust[num337]; dust144.scale *= num336; } return; } if (this.type == 0x209) { int num340; for (int num341 = 0; num341 < 3; num341++) { color5 = new Color(); num340 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xfe, this.velocity.X, this.velocity.Y, 50, color5, 1.2f); Main.dust[num340].position = (Vector2)((Main.dust[num340].position + base.Center) / 2f); Main.dust[num340].noGravity = true; Dust dust145 = Main.dust[num340]; dust145.velocity = (Vector2)(dust145.velocity * 0.5f); } for (int num342 = 0; num342 < 2; num342++) { color5 = new Color(); num340 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xff, this.velocity.X, this.velocity.Y, 50, color5, 0.4f); switch (num342) { case 0: Main.dust[num340].position = (Vector2)((Main.dust[num340].position + (base.Center * 5f)) / 6f); break; case 1: Main.dust[num340].position = (Vector2)((Main.dust[num340].position + ((base.Center + (base.velocity / 2f)) * 5f)) / 6f); break; } Dust dust146 = Main.dust[num340]; dust146.velocity = (Vector2)(dust146.velocity * 0.1f); Main.dust[num340].noGravity = true; Main.dust[num340].fadeIn = 1f; } return; } if (this.type == 0x20a) { int num344; this.ai[1]++; float num343 = (60f - this.ai[1]) / 60f; if (this.ai[1] > 40f) { this.Kill(); } this.velocity.Y += 0.2f; if (this.velocity.Y > 18f) { this.velocity.Y = 18f; } this.velocity.X *= 0.98f; for (int num345 = 0; num345 < 2; num345++) { color5 = new Color(); num344 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xfe, this.velocity.X, this.velocity.Y, 50, color5, 1.1f); Main.dust[num344].position = (Vector2)((Main.dust[num344].position + base.Center) / 2f); Main.dust[num344].noGravity = true; Dust dust147 = Main.dust[num344]; dust147.velocity = (Vector2)(dust147.velocity * 0.3f); Dust dust148 = Main.dust[num344]; dust148.scale *= num343; } for (int num346 = 0; num346 < 1; num346++) { color5 = new Color(); num344 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xff, this.velocity.X, this.velocity.Y, 50, color5, 0.6f); Main.dust[num344].position = (Vector2)((Main.dust[num344].position + (base.Center * 5f)) / 6f); Dust dust149 = Main.dust[num344]; dust149.velocity = (Vector2)(dust149.velocity * 0.1f); Main.dust[num344].noGravity = true; Main.dust[num344].fadeIn = 0.9f * num343; Dust dust150 = Main.dust[num344]; dust150.scale *= num343; } return; } int num347 = (this.type - 0x79) + 0x56; if (this.type == 0x255) { num347 = 0x106; } for (int num348 = 0; num348 < 2; num348++) { color5 = new Color(); int num349 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, num347, this.velocity.X, this.velocity.Y, 50, color5, 1.2f); Main.dust[num349].noGravity = true; Dust dust151 = Main.dust[num349]; dust151.velocity = (Vector2)(dust151.velocity * 0.3f); } if (this.ai[1] == 0f) { this.ai[1] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8); return; } return; } if (this.aiStyle == 30) { base.velocity = (Vector2)(base.velocity * 0.8f); this.rotation += 0.2f; this.alpha += 4; if (this.alpha >= 0xff) { this.Kill(); return; } return; } if (this.aiStyle == 0x1f) { int num350 = 110; int conversionType = 0; if (this.type == 0x92) { num350 = 0x6f; conversionType = 2; } if (this.type == 0x93) { num350 = 0x70; conversionType = 1; } if (this.type == 0x94) { num350 = 0x71; conversionType = 3; } if (this.type == 0x95) { num350 = 0x72; conversionType = 4; } if (this.owner == Main.myPlayer) { WorldGen.Convert((((int)this.position.X) + (base.width / 2)) / 0x10, (((int)this.position.Y) + (base.height / 2)) / 0x10, conversionType, 2); } if (this.timeLeft > 0x85) { this.timeLeft = 0x85; } if (this.ai[0] > 7f) { float num352 = 1f; if (this.ai[0] == 8f) { num352 = 0.2f; } else if (this.ai[0] == 9f) { num352 = 0.4f; } else if (this.ai[0] == 10f) { num352 = 0.6f; } else if (this.ai[0] == 11f) { num352 = 0.8f; } this.ai[0]++; for (int num353 = 0; num353 < 1; num353++) { color5 = new Color(); int num354 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, num350, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, color5, 1f); Main.dust[num354].noGravity = true; Dust dust152 = Main.dust[num354]; dust152.scale *= 1.75f; Main.dust[num354].velocity.X *= 2f; Main.dust[num354].velocity.Y *= 2f; Dust dust153 = Main.dust[num354]; dust153.scale *= num352; } } else { this.ai[0]++; } this.rotation += 0.3f * base.direction; return; } if (this.aiStyle == 0x20) { this.timeLeft = 10; this.ai[0]++; if (this.ai[0] >= 20f) { this.ai[0] = 15f; for (int num355 = 0; num355 < 0xff; num355++) { Rectangle rectangle5 = new Rectangle((int)this.position.X, (int)this.position.Y, base.width, base.height); if (Main.player[num355].active) { Rectangle rectangle6 = new Rectangle((int)Main.player[num355].position.X, (int)Main.player[num355].position.Y, Main.player[num355].width, Main.player[num355].height); if (rectangle5.Intersects(rectangle6)) { this.ai[0] = 0f; this.velocity.Y = -4.5f; if (this.velocity.X > 2f) { this.velocity.X = 2f; } if (this.velocity.X < -2f) { this.velocity.X = -2f; } this.velocity.X = (this.velocity.X + (Main.player[num355].direction * 1.75f)) / 2f; this.velocity.X += Main.player[num355].velocity.X * 3f; this.velocity.Y += Main.player[num355].velocity.Y; if (this.velocity.X > 6f) { this.velocity.X = 6f; } if (this.velocity.X < -6f) { this.velocity.X = -6f; } this.netUpdate = true; this.ai[1]++; } } } } if ((this.velocity.X == 0f) && (this.velocity.Y == 0f)) { this.Kill(); } this.rotation += 0.02f * this.velocity.X; if (this.velocity.Y == 0f) { this.velocity.X *= 0.98f; } else if (base.wet) { this.velocity.X *= 0.99f; } else { this.velocity.X *= 0.995f; } if ((this.velocity.X > -0.03) && (this.velocity.X < 0.03)) { this.velocity.X = 0f; } if (base.wet) { this.ai[1] = 0f; if (this.velocity.Y > 0f) { this.velocity.Y *= 0.95f; } this.velocity.Y -= 0.1f; if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } if (this.velocity.X == 0f) { this.Kill(); } } else { this.velocity.Y += 0.1f; } if (this.velocity.Y > 10f) { this.velocity.Y = 10f; return; } return; } if (this.aiStyle == 0x21) { if (this.alpha > 0) { this.alpha -= 50; if (this.alpha < 0) { this.alpha = 0; } } float num356 = 4f; float num357 = this.ai[0]; float num358 = this.ai[1]; if ((num357 == 0f) && (num358 == 0f)) { num357 = 1f; } float num359 = (float)Math.Sqrt((double)((num357 * num357) + (num358 * num358))); num359 = num356 / num359; num357 *= num359; num358 *= num359; if (this.alpha < 70) { int num360 = 0x7f; if (this.type == 310) { num360 = 0xbb; } int num361 = Dust.NewDust(new Vector2(this.position.X, this.position.Y - 2f), 6, 6, num360, this.velocity.X, this.velocity.Y, 100, new Color(), 1.6f); Main.dust[num361].noGravity = true; Main.dust[num361].position.X -= num357 * 1f; Main.dust[num361].position.Y -= num358 * 1f; Main.dust[num361].velocity.X -= num357; Main.dust[num361].velocity.Y -= num358; } if (this.localAI[0] == 0f) { this.ai[0] = this.velocity.X; this.ai[1] = this.velocity.Y; this.localAI[1]++; if (this.localAI[1] >= 30f) { this.velocity.Y += 0.09f; this.localAI[1] = 30f; } } else { if (!Collision.SolidCollision(base.position, base.width, base.height)) { this.localAI[0] = 0f; this.localAI[1] = 30f; } this.damage = 0; } if (this.velocity.Y > 16f) { this.velocity.Y = 16f; } this.rotation = ((float)Math.Atan2((double)this.ai[1], (double)this.ai[0])) + 1.57f; return; } if (this.aiStyle == 0x22) { this.rotation = base.velocity.ToRotation() + 1.570796f; if (this.ai[1] != 1f) { if ((this.type < 0x19f) || (this.type > 0x1a2)) { int num366 = Dust.NewDust(new Vector2(this.position.X + 2f, this.position.Y + 20f), 8, 8, 6, this.velocity.X, this.velocity.Y, 100, new Color(), 1.2f); Main.dust[num366].noGravity = true; Dust dust161 = Main.dust[num366]; dust161.velocity = (Vector2)(dust161.velocity * 0.2f); Main.dust[num366].position = Main.dust[num366].position.RotatedBy((double)this.rotation, base.Center); return; } this.ai[0]++; if (this.ai[0] > 4f) { int num365 = Dust.NewDust(new Vector2(this.position.X + 2f, this.position.Y + 20f), 8, 8, 6, this.velocity.X, this.velocity.Y, 100, new Color(), 1.2f); Main.dust[num365].noGravity = true; Dust dust160 = Main.dust[num365]; dust160.velocity = (Vector2)(dust160.velocity * 0.2f); Main.dust[num365].position = Main.dust[num365].position.RotatedBy((double)this.rotation, base.Center); return; } } else { this.ai[0]++; if (this.ai[0] == 1f) { for (int num362 = 0; num362 < 8; num362++) { color5 = new Color(); int num363 = Dust.NewDust(base.position, base.width, base.height, 6, 0f, 0f, 100, color5, 1.8f); Main.dust[num363].noGravity = true; Dust dust154 = Main.dust[num363]; dust154.velocity = (Vector2)(dust154.velocity * 3f); Main.dust[num363].fadeIn = 0.5f; Dust dust155 = Main.dust[num363]; dust155.position += (Vector2)(base.velocity / 2f); Dust dust156 = Main.dust[num363]; dust156.velocity += (Vector2)((base.velocity / 4f) + (Main.player[this.owner].velocity * 0.1f)); } } if (this.ai[0] > 2f) { color5 = new Color(); int num364 = Dust.NewDust(new Vector2(this.position.X + 2f, this.position.Y + 20f), 8, 8, 6, this.velocity.X, this.velocity.Y, 100, color5, 1.2f); Main.dust[num364].noGravity = true; Dust dust157 = Main.dust[num364]; dust157.velocity = (Vector2)(dust157.velocity * 0.2f); Main.dust[num364].position = Main.dust[num364].position.RotatedBy((double)this.rotation, base.Center); color5 = new Color(); num364 = Dust.NewDust(new Vector2(this.position.X + 2f, this.position.Y + 15f), 8, 8, 6, this.velocity.X, this.velocity.Y, 100, color5, 1.2f); Main.dust[num364].noGravity = true; Dust dust158 = Main.dust[num364]; dust158.velocity = (Vector2)(dust158.velocity * 0.2f); Main.dust[num364].position = Main.dust[num364].position.RotatedBy((double)this.rotation, base.Center); num364 = Dust.NewDust(new Vector2(this.position.X + 2f, this.position.Y + 10f), 8, 8, 6, this.velocity.X, this.velocity.Y, 100, new Color(), 1.2f); Main.dust[num364].noGravity = true; Dust dust159 = Main.dust[num364]; dust159.velocity = (Vector2)(dust159.velocity * 0.2f); Main.dust[num364].position = Main.dust[num364].position.RotatedBy((double)this.rotation, base.Center); return; } } return; } if (this.aiStyle == 0x23) { this.ai[0]++; if (this.ai[0] > 30f) { this.velocity.Y += 0.2f; this.velocity.X *= 0.985f; if (this.velocity.Y > 14f) { this.velocity.Y = 14f; } } float introduced1727 = Math.Abs(this.velocity.X); this.rotation += ((introduced1727 + Math.Abs(this.velocity.Y)) * base.direction) * 0.02f; if (this.owner == Main.myPlayer) { Vector2 vector37 = Collision.TileCollision(base.position, base.velocity, base.width, base.height, true, true, 1); bool flag9 = false; if (vector37 != base.velocity) { flag9 = true; } else { int num367 = ((int)(base.Center.X + this.velocity.X)) / 0x10; int num368 = ((int)(base.Center.Y + this.velocity.Y)) / 0x10; if (((Main.tile[num367, num368] != null) && Main.tile[num367, num368].active()) && Main.tile[num367, num368].bottomSlope()) { flag9 = true; this.position.Y = ((num368 * 0x10) + 0x10) + 8; this.position.X = (num367 * 0x10) + 8; } } if (!flag9) { return; } int num369 = 0xd5; if (this.type == 0x1db) { num369 = 0x161; } if (this.type == 0x1fa) { num369 = 0x16e; } if (this.type == 0x1f9) { num369 = 0x16d; } int num370 = (((int)this.position.X) + (base.width / 2)) / 0x10; int num371 = (((int)this.position.Y) + (base.height / 2)) / 0x10; base.position += vector37; int num372 = 10; if (Main.tile[num370, num371] == null) { return; } while (((Main.tile[num370, num371] != null) && Main.tile[num370, num371].active()) && Main.tileRope[Main.tile[num370, num371].type]) { num371++; } while (num372 > 0) { num372--; if (Main.tile[num370, num371] == null) { break; } if (Main.tile[num370, num371].active() && (Main.tileCut[Main.tile[num370, num371].type] || (Main.tile[num370, num371].type == 0xa5))) { WorldGen.KillTile(num370, num371, false, false, false); NetMessage.SendData(0x11, -1, -1, "", 0, (float)num370, (float)num371, 0f, 0, 0, 0); } if (!Main.tile[num370, num371].active()) { WorldGen.PlaceTile(num370, num371, num369, false, false, -1, 0); NetMessage.SendData(0x11, -1, -1, "", 1, (float)num370, (float)num371, (float)num369, 0, 0, 0); this.ai[1]++; } else { num372 = 0; } num371++; } this.Kill(); } return; } if (this.aiStyle == 0x24) { if (((this.type != 0x133) && base.wet) && !base.honeyWet) { this.Kill(); } if (this.alpha > 0) { this.alpha -= 50; } else { this.extraUpdates = 0; } if (this.alpha < 0) { this.alpha = 0; } if (this.type == 0x133) { this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) - 1.57f; this.frameCounter++; if (this.frameCounter >= 6) { this.frame++; this.frameCounter = 0; } if (this.frame >= 2) { this.frame = 0; } for (int num373 = 0; num373 < 3; num373++) { float num374 = (this.velocity.X / 3f) * num373; float num375 = (this.velocity.Y / 3f) * num373; color5 = new Color(); int num376 = Dust.NewDust(base.position, base.width, base.height, 0xb8, 0f, 0f, 0, color5, 1f); Main.dust[num376].position.X = base.Center.X - num374; Main.dust[num376].position.Y = base.Center.Y - num375; Dust dust162 = Main.dust[num376]; dust162.velocity = (Vector2)(dust162.velocity * 0f); Main.dust[num376].scale = 0.5f; } } else { if (this.type == 0x13c) { if (this.velocity.X > 0f) { this.spriteDirection = -1; } else if (this.velocity.X < 0f) { this.spriteDirection = 1; } } else if (this.velocity.X > 0f) { this.spriteDirection = 1; } else if (this.velocity.X < 0f) { this.spriteDirection = -1; } this.rotation = this.velocity.X * 0.1f; this.frameCounter++; if (this.frameCounter >= 3) { this.frame++; this.frameCounter = 0; } if (this.frame >= 3) { this.frame = 0; } } float num377 = this.position.X; float num378 = this.position.Y; float num379 = 100000f; bool flag10 = false; this.ai[0]++; if (this.ai[0] > 30f) { this.ai[0] = 30f; for (int num380 = 0; num380 < 200; num380++) { if (Main.npc[num380].CanBeChasedBy(this, false) && (!Main.npc[num380].wet || (this.type == 0x133))) { float num381 = Main.npc[num380].position.X + (Main.npc[num380].width / 2); float num382 = Main.npc[num380].position.Y + (Main.npc[num380].height / 2); float introduced1729 = Math.Abs((float)((this.position.X + (base.width / 2)) - num381)); float num383 = introduced1729 + Math.Abs((float)((this.position.Y + (base.height / 2)) - num382)); if (((num383 < 800f) && (num383 < num379)) && Collision.CanHit(base.position, base.width, base.height, Main.npc[num380].position, Main.npc[num380].width, Main.npc[num380].height)) { num379 = num383; num377 = num381; num378 = num382; flag10 = true; } } } } if (!flag10) { num377 = (this.position.X + (base.width / 2)) + (this.velocity.X * 100f); num378 = (this.position.Y + (base.height / 2)) + (this.velocity.Y * 100f); } else if (this.type == 0x133) { this.friendly = true; } float num384 = 6f; float num385 = 0.1f; if (this.type == 0xbd) { num384 = 7f; num385 = 0.15f; } if (this.type == 0x133) { num384 = 9f; num385 = 0.2f; } if (this.type == 0x13c) { num384 = 10f; num385 = 0.25f; } if (this.type == 0x236) { num384 = 6.8f; num385 = 0.14f; } Vector2 vector38 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f)); float num386 = num377 - vector38.X; float num387 = num378 - vector38.Y; float num388 = (float)Math.Sqrt((double)((num386 * num386) + (num387 * num387))); num388 = num384 / num388; num386 *= num388; num387 *= num388; if (this.velocity.X < num386) { this.velocity.X += num385; if ((this.velocity.X < 0f) && (num386 > 0f)) { this.velocity.X += num385 * 2f; } } else if (this.velocity.X > num386) { this.velocity.X -= num385; if ((this.velocity.X > 0f) && (num386 < 0f)) { this.velocity.X -= num385 * 2f; } } if (this.velocity.Y >= num387) { if (this.velocity.Y > num387) { this.velocity.Y -= num385; if ((this.velocity.Y > 0f) && (num387 < 0f)) { this.velocity.Y -= num385 * 2f; return; } } } else { this.velocity.Y += num385; if ((this.velocity.Y < 0f) && (num387 > 0f)) { this.velocity.Y += num385 * 2f; return; } } return; } if (this.aiStyle == 0x25) { if (this.ai[1] == 0f) { this.ai[1] = this.position.Y - 5f; } if (this.ai[0] != 0f) { if (Collision.SolidCollision(base.position, base.width, base.height) || (this.position.Y < this.ai[1])) { this.Kill(); return; } } else { if (Collision.SolidCollision(base.position, base.width, base.height)) { this.velocity.Y *= -1f; this.ai[0]++; return; } float num389 = this.position.Y - this.ai[1]; if (num389 > 300f) { this.velocity.Y *= -1f; this.ai[0]++; return; } } return; } if (this.aiStyle == 0x26) { this.ai[0]++; if (this.ai[0] >= 6f) { this.ai[0] = 0f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 0x22); if (Main.myPlayer == this.owner) { NewProjectile(this.position.X, this.position.Y, this.velocity.X, this.velocity.Y, 0xbc, this.damage, this.knockBack, this.owner, 0f, 0f); return; } } return; } if (this.aiStyle == 0x27) { this.alpha -= 50; if (this.alpha < 0) { this.alpha = 0; } if (Main.player[this.owner].dead) { this.Kill(); return; } if (this.alpha == 0) { Main.player[this.owner].itemAnimation = 5; Main.player[this.owner].itemTime = 5; if ((this.position.X + (base.width / 2)) > (Main.player[this.owner].position.X + (Main.player[this.owner].width / 2))) { Main.player[this.owner].ChangeDir(1); } else { Main.player[this.owner].ChangeDir(-1); } } Vector2 vector39 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f)); float num390 = (Main.player[this.owner].position.X + (Main.player[this.owner].width / 2)) - vector39.X; float num391 = (Main.player[this.owner].position.Y + (Main.player[this.owner].height / 2)) - vector39.Y; float num392 = (float)Math.Sqrt((double)((num390 * num390) + (num391 * num391))); if (!Main.player[this.owner].channel && (this.alpha == 0)) { this.ai[0] = 1f; this.ai[1] = -1f; } if ((this.ai[1] > 0f) && (num392 > 1500f)) { this.ai[1] = 0f; this.ai[0] = 1f; } if (this.ai[1] > 0f) { this.tileCollide = false; int num393 = ((int)this.ai[1]) - 1; if (Main.npc[num393].active && (Main.npc[num393].life > 0)) { float num394 = 16f; vector39 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f)); num390 = (Main.npc[num393].position.X + (Main.npc[num393].width / 2)) - vector39.X; num391 = (Main.npc[num393].position.Y + (Main.npc[num393].height / 2)) - vector39.Y; num392 = (float)Math.Sqrt((double)((num390 * num390) + (num391 * num391))); if (num392 < num394) { this.velocity.X = num390; this.velocity.Y = num391; if (num392 > (num394 / 2f)) { if (this.velocity.X < 0f) { 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 { num392 = num394 / num392; num390 *= num392; num391 *= num392; this.velocity.X = num390; this.velocity.Y = num391; if (this.velocity.X < 0f) { 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); } } this.ai[0] = 1f; } else { this.ai[1] = 0f; float num395 = this.position.X; float num396 = this.position.Y; float num397 = 3000f; int num398 = -1; for (int num399 = 0; num399 < 200; num399++) { if (Main.npc[num399].CanBeChasedBy(this, false)) { float num400 = Main.npc[num399].position.X + (Main.npc[num399].width / 2); float num401 = Main.npc[num399].position.Y + (Main.npc[num399].height / 2); float introduced1730 = Math.Abs((float)((this.position.X + (base.width / 2)) - num400)); float num402 = introduced1730 + Math.Abs((float)((this.position.Y + (base.height / 2)) - num401)); if ((num402 < num397) && Collision.CanHit(base.position, base.width, base.height, Main.npc[num399].position, Main.npc[num399].width, Main.npc[num399].height)) { num397 = num402; num395 = num400; num396 = num401; num398 = num399; } } } if (num398 >= 0) { float num403 = 16f; vector39 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f)); num390 = num395 - vector39.X; num391 = num396 - vector39.Y; num392 = (float)Math.Sqrt((double)((num390 * num390) + (num391 * num391))); num392 = num403 / num392; num390 *= num392; num391 *= num392; this.velocity.X = num390; this.velocity.Y = num391; this.ai[0] = 0f; this.ai[1] = num398 + 1; } } } else if (this.ai[0] == 0f) { if (num392 > 700f) { this.ai[0] = 1f; } if (this.velocity.X < 0f) { 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.ai[0] == 1f) { this.tileCollide = false; if (this.velocity.X < 0f) { 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); } if (this.velocity.X < 0f) { 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); } float num404 = 20f; if (num392 < 70f) { this.Kill(); } num392 = num404 / num392; num390 *= num392; num391 *= num392; this.velocity.X = num390; this.velocity.Y = num391; } this.frameCounter++; if (this.frameCounter >= 4) { this.frame++; this.frameCounter = 0; } if (this.frame >= 4) { this.frame = 0; return; } return; } if (this.aiStyle == 40) { this.localAI[0]++; if (this.localAI[0] > 3f) { this.localAI[0] = 100f; this.alpha -= 50; if (this.alpha < 0) { this.alpha = 0; } } this.frameCounter++; if (this.frameCounter >= 3) { this.frame++; this.frameCounter = 0; } if (this.frame >= 5) { this.frame = 0; } this.velocity.X += this.ai[0]; this.velocity.Y += this.ai[1]; this.localAI[1]++; if (this.localAI[1] == 50f) { this.localAI[1] = 51f; this.ai[0] = Main.rand.Next(-100, 0x65) * 6E-05f; this.ai[1] = Main.rand.Next(-100, 0x65) * 6E-05f; } float introduced1731 = Math.Abs(this.velocity.X); if ((introduced1731 + Math.Abs(this.velocity.Y)) > 16f) { this.velocity.X *= 0.95f; this.velocity.Y *= 0.95f; } float introduced1732 = Math.Abs(this.velocity.X); if ((introduced1732 + Math.Abs(this.velocity.Y)) < 12f) { this.velocity.X *= 1.05f; this.velocity.Y *= 1.05f; } this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 3.14f; return; } if (this.aiStyle == 0x29) { if (this.localAI[0] == 0f) { this.localAI[0] = 1f; this.frame = Main.rand.Next(3); } this.rotation += this.velocity.X * 0.01f; return; } if (this.aiStyle == 0x2a) { if (!Main.player[this.owner].crystalLeaf) { this.Kill(); return; } this.position.X = Main.player[this.owner].Center.X - (base.width / 2); this.position.Y = ((Main.player[this.owner].Center.Y - (base.height / 2)) + Main.player[this.owner].gfxOffY) - 60f; if (Main.player[this.owner].gravDir == -1f) { this.position.Y += 120f; this.rotation = 3.14f; } else { this.rotation = 0f; } this.position.X = (int)this.position.X; this.position.Y = (int)this.position.Y; float num405 = (((float)Main.mouseTextColor) / 200f) - 0.35f; num405 *= 0.2f; this.scale = num405 + 0.95f; if (this.owner == Main.myPlayer) { if (this.ai[0] != 0f) { this.ai[0]--; return; } float num406 = this.position.X; float num407 = this.position.Y; float num408 = 700f; bool flag11 = false; for (int num409 = 0; num409 < 200; num409++) { if (Main.npc[num409].CanBeChasedBy(this, true)) { float num410 = Main.npc[num409].position.X + (Main.npc[num409].width / 2); float num411 = Main.npc[num409].position.Y + (Main.npc[num409].height / 2); float introduced1733 = Math.Abs((float)((this.position.X + (base.width / 2)) - num410)); float num412 = introduced1733 + Math.Abs((float)((this.position.Y + (base.height / 2)) - num411)); if ((num412 < num408) && Collision.CanHit(base.position, base.width, base.height, Main.npc[num409].position, Main.npc[num409].width, Main.npc[num409].height)) { num408 = num412; num406 = num410; num407 = num411; flag11 = true; } } } if (flag11) { float num413 = 12f; Vector2 vector40 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f)); float num414 = num406 - vector40.X; float num415 = num407 - vector40.Y; float num416 = (float)Math.Sqrt((double)((num414 * num414) + (num415 * num415))); num416 = num413 / num416; num414 *= num416; num415 *= num416; NewProjectile(base.Center.X - 4f, base.Center.Y, num414, num415, 0xe3, Player.crystalLeafDamage, (float)Player.crystalLeafKB, this.owner, 0f, 0f); this.ai[0] = 50f; return; } } return; } if (this.aiStyle == 0x2b) { if (this.localAI[1] == 0f) { Main.PlaySound(6, (int)this.position.X, (int)this.position.Y, 1); this.localAI[1]++; for (int num417 = 0; num417 < 5; num417++) { color5 = new Color(); int num418 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x9d, 0f, 0f, 0, color5, 1f); Main.dust[num418].noGravity = true; Dust dust163 = Main.dust[num418]; dust163.velocity = (Vector2)(dust163.velocity * 3f); Main.dust[num418].scale = 1.5f; } } this.ai[0] = Main.rand.Next(-100, 0x65) * 0.0025f; this.ai[1] = Main.rand.Next(-100, 0x65) * 0.0025f; if (this.localAI[0] == 0f) { this.scale += 0.05f; if (this.scale > 1.2) { this.localAI[0] = 1f; } } else { this.scale -= 0.05f; if (this.scale < 0.8) { this.localAI[0] = 0f; } } this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 3.14f; int num419 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x9d, 0f, 0f, 0, new Color(), 1f); Main.dust[num419].noGravity = true; Dust dust164 = Main.dust[num419]; dust164.velocity = (Vector2)(dust164.velocity * 0.1f); Main.dust[num419].scale = 1.5f; return; } if (this.aiStyle == 0x2c) { if (this.type == 0xe4) { base.velocity = (Vector2)(base.velocity * 0.96f); this.alpha += 4; if (this.alpha > 0xff) { this.Kill(); } } else if (this.type == 0xe5) { if (this.ai[0] == 0f) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8); } this.ai[0]++; if (this.ai[0] > 20f) { this.velocity.Y += 0.3f; this.velocity.X *= 0.98f; } } this.frameCounter++; if (this.frameCounter > 5) { this.frame++; this.frameCounter = 0; } if (this.frame >= Main.projFrames[this.type]) { this.frame = 0; return; } return; } if (this.aiStyle == 0x2d) { if ((this.type != 0xed) && (this.type != 0xf3)) { if ((this.type != 0xee) && (this.type != 0xf4)) { if (this.type == 0xef) { this.alpha = 50; return; } if (this.type == 0xf5) { this.alpha = 100; return; } if (this.type == 0x108) { this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 1.57f; return; } } else { this.frameCounter++; if (this.frameCounter > 8) { this.frameCounter = 0; this.frame++; if (this.frame > 5) { this.frame = 0; } } this.ai[1]++; if ((this.type == 0xf4) && (this.ai[1] >= 3600f)) { this.alpha += 5; if (this.alpha > 0xff) { this.alpha = 0xff; this.Kill(); } } else if ((this.type == 0xee) && (this.ai[1] >= 7200f)) { this.alpha += 5; if (this.alpha > 0xff) { this.alpha = 0xff; this.Kill(); } } else { this.ai[0]++; if (this.type == 0xf4) { if (this.ai[0] > 10f) { this.ai[0] = 0f; if (this.owner == Main.myPlayer) { int num422 = ((int)(this.position.X + 14f)) + Main.rand.Next(base.width - 0x1c); int num423 = (int)((this.position.Y + base.height) + 4f); NewProjectile((float)num422, (float)num423, 0f, 5f, 0xf5, this.damage, 0f, this.owner, 0f, 0f); } } } else if (this.ai[0] > 8f) { this.ai[0] = 0f; if (this.owner == Main.myPlayer) { int num424 = ((int)(this.position.X + 14f)) + Main.rand.Next(base.width - 0x1c); int num425 = (int)((this.position.Y + base.height) + 4f); NewProjectile((float)num424, (float)num425, 0f, 5f, 0xef, this.damage, 0f, this.owner, 0f, 0f); } } } this.localAI[0]++; if (this.localAI[0] >= 10f) { this.localAI[0] = 0f; int num426 = 0; int num427 = 0; float num428 = 0f; int num429 = this.type; for (int num430 = 0; num430 < 0x3e8; num430++) { if ((Main.projectile[num430].active && (Main.projectile[num430].owner == this.owner)) && ((Main.projectile[num430].type == num429) && (Main.projectile[num430].ai[1] < 3600f))) { num426++; if (Main.projectile[num430].ai[1] > num428) { num427 = num430; num428 = Main.projectile[num430].ai[1]; } } } if (this.type != 0xf4) { if (num426 > 2) { Main.projectile[num427].netUpdate = true; Main.projectile[num427].ai[1] = 36000f; return; } } else if (num426 > 1) { Main.projectile[num427].netUpdate = true; Main.projectile[num427].ai[1] = 36000f; return; } } } } else { float num420 = this.ai[0]; float num421 = this.ai[1]; if ((num420 != 0f) && (num421 != 0f)) { bool flag12 = false; bool flag13 = false; if (((this.velocity.X < 0f) && (base.Center.X < num420)) || ((this.velocity.X > 0f) && (base.Center.X > num420))) { flag12 = true; } if (((this.velocity.Y < 0f) && (base.Center.Y < num421)) || ((this.velocity.Y > 0f) && (base.Center.Y > num421))) { flag13 = true; } if (flag12 && flag13) { this.Kill(); } } this.rotation += this.velocity.X * 0.02f; this.frameCounter++; if (this.frameCounter > 4) { this.frameCounter = 0; this.frame++; if (this.frame > 3) { this.frame = 0; return; } } } return; } if (this.aiStyle == 0x2e) { int num431 = 0x4b0; if (this.type == 250) { if (this.owner == Main.myPlayer) { this.localAI[0]++; if (this.localAI[0] > 4f) { this.localAI[0] = 3f; NewProjectile(base.Center.X, base.Center.Y, this.velocity.X * 0.001f, this.velocity.Y * 0.001f, 0xfb, this.damage, this.knockBack, this.owner, 0f, 0f); } if (this.timeLeft > num431) { this.timeLeft = num431; } } float num432 = 1f; if (this.velocity.Y < 0f) { num432 -= this.velocity.Y / 3f; } this.ai[0] += num432; if (this.ai[0] > 30f) { this.velocity.Y += 0.5f; if (this.velocity.Y > 0f) { this.velocity.X *= 0.95f; } else { this.velocity.X *= 1.05f; } } float num433 = this.velocity.X; float num434 = this.velocity.Y; float num435 = (float)Math.Sqrt((double)((num433 * num433) + (num434 * num434))); num435 = (15.95f * this.scale) / num435; num433 *= num435; num434 *= num435; this.velocity.X = num433; this.velocity.Y = num434; this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) - 1.57f; return; } if (this.localAI[0] == 0f) { if (this.velocity.X > 0f) { this.spriteDirection = -1; this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) - 1.57f; } else { this.spriteDirection = 1; this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) - 1.57f; } this.localAI[0] = 1f; this.timeLeft = num431; } this.velocity.X *= 0.98f; this.velocity.Y *= 0.98f; if (this.rotation == 0f) { this.alpha = 0xff; return; } if (this.timeLeft < 10) { this.alpha = 0xff - ((int)((255f * this.timeLeft) / 10f)); return; } if (this.timeLeft > (num431 - 10)) { int num436 = num431 - this.timeLeft; this.alpha = 0xff - ((int)((255f * num436) / 10f)); return; } this.alpha = 0; return; } if (this.aiStyle == 0x2f) { if (this.ai[0] == 0f) { this.ai[0] = this.velocity.X; this.ai[1] = this.velocity.Y; } if (this.velocity.X > 0f) { float introduced1736 = Math.Abs(this.velocity.Y); this.rotation += (introduced1736 + Math.Abs(this.velocity.X)) * 0.001f; } else { float introduced1737 = Math.Abs(this.velocity.Y); this.rotation -= (introduced1737 + Math.Abs(this.velocity.X)) * 0.001f; } this.frameCounter++; if (this.frameCounter > 6) { this.frameCounter = 0; this.frame++; if (this.frame > 4) { this.frame = 0; } } if (Math.Sqrt((double)((this.velocity.X * this.velocity.X) + (this.velocity.Y * this.velocity.Y))) > 2.0) { base.velocity = (Vector2)(base.velocity * 0.98f); } for (int num437 = 0; num437 < 0x3e8; num437++) { if ((((num437 != base.whoAmI) && Main.projectile[num437].active) && ((Main.projectile[num437].owner == this.owner) && (Main.projectile[num437].type == this.type))) && ((this.timeLeft > Main.projectile[num437].timeLeft) && (Main.projectile[num437].timeLeft > 30))) { Main.projectile[num437].timeLeft = 30; } } int[] numArray = new int[20]; int num438 = 0; float num439 = 300f; bool flag14 = false; float num440 = 0f; float num441 = 0f; for (int num442 = 0; num442 < 200; num442++) { if (Main.npc[num442].CanBeChasedBy(this, false)) { float num443 = Main.npc[num442].position.X + (Main.npc[num442].width / 2); float num444 = Main.npc[num442].position.Y + (Main.npc[num442].height / 2); float introduced1738 = Math.Abs((float)((this.position.X + (base.width / 2)) - num443)); float num445 = introduced1738 + Math.Abs((float)((this.position.Y + (base.height / 2)) - num444)); if ((num445 < num439) && Collision.CanHit(base.Center, 1, 1, Main.npc[num442].Center, 1, 1)) { if (num438 < 20) { numArray[num438] = num442; num438++; num440 = num443; num441 = num444; } flag14 = true; } } } if (this.timeLeft < 30) { flag14 = false; } if (flag14) { int num446 = Main.rand.Next(num438); num446 = numArray[num446]; num440 = Main.npc[num446].position.X + (Main.npc[num446].width / 2); num441 = Main.npc[num446].position.Y + (Main.npc[num446].height / 2); this.localAI[0]++; if (this.localAI[0] > 8f) { this.localAI[0] = 0f; float num447 = 6f; Vector2 vector41 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f)); vector41 += (Vector2)(base.velocity * 4f); float num448 = num440 - vector41.X; float num449 = num441 - vector41.Y; float num450 = (float)Math.Sqrt((double)((num448 * num448) + (num449 * num449))); num450 = num447 / num450; num448 *= num450; num449 *= num450; NewProjectile(vector41.X, vector41.Y, num448, num449, 0xff, this.damage, this.knockBack, this.owner, 0f, 0f); return; } } return; } if (this.aiStyle == 0x30) { if (this.type == 0xff) { for (int num451 = 0; num451 < 4; num451++) { Vector2 position = base.position - ((Vector2)(base.velocity * (num451 * 0.25f))); this.alpha = 0xff; color5 = new Color(); int num452 = Dust.NewDust(position, 1, 1, 160, 0f, 0f, 0, color5, 1f); Main.dust[num452].position = position; Main.dust[num452].position.X += base.width / 2; Main.dust[num452].position.Y += base.height / 2; Main.dust[num452].scale = Main.rand.Next(70, 110) * 0.013f; Dust dust165 = Main.dust[num452]; dust165.velocity = (Vector2)(dust165.velocity * 0.2f); } return; } if (this.type == 0x1b1) { for (int num453 = 0; num453 < 2; num453++) { Vector2 vector43 = base.position - ((Vector2)(base.velocity * (num453 * 0.25f))); this.alpha = 0xff; color5 = new Color(); int num454 = Dust.NewDust(vector43, 1, 1, 160, 0f, 0f, 0, color5, 1f); Main.dust[num454].position = vector43; Main.dust[num454].position.X += base.width / 2; Main.dust[num454].position.Y += base.height / 2; if (Main.rand.Next(2) == 0) { Main.dust[num454].color = Color.LimeGreen; } else { Main.dust[num454].color = Color.CornflowerBlue; } Main.dust[num454].scale = Main.rand.Next(70, 110) * 0.013f; Dust dust166 = Main.dust[num454]; dust166.velocity = (Vector2)(dust166.velocity * 0.2f); } return; } if (this.type != 290) { if (this.type != 0x126) { this.localAI[0]++; if (this.localAI[0] > 3f) { for (int num459 = 0; num459 < 4; num459++) { Vector2 vector46 = base.position - ((Vector2)(base.velocity * (num459 * 0.25f))); this.alpha = 0xff; color5 = new Color(); int num460 = Dust.NewDust(vector46, 1, 1, 0xa2, 0f, 0f, 0, color5, 1f); Main.dust[num460].position = vector46; Main.dust[num460].position.X += base.width / 2; Main.dust[num460].position.Y += base.height / 2; Main.dust[num460].scale = Main.rand.Next(70, 110) * 0.013f; Dust dust169 = Main.dust[num460]; dust169.velocity = (Vector2)(dust169.velocity * 0.2f); } return; } } else { this.localAI[0]++; if (this.localAI[0] > 9f) { for (int num457 = 0; num457 < 4; num457++) { Vector2 vector45 = base.position - ((Vector2)(base.velocity * (num457 * 0.25f))); this.alpha = 0xff; color5 = new Color(); int num458 = Dust.NewDust(vector45, 1, 1, 0xad, 0f, 0f, 0, color5, 1f); Main.dust[num458].position = vector45; Main.dust[num458].scale = Main.rand.Next(70, 110) * 0.013f; Dust dust168 = Main.dust[num458]; dust168.velocity = (Vector2)(dust168.velocity * 0.2f); } return; } } } else { if (this.localAI[0] == 0f) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8); } this.localAI[0]++; if (this.localAI[0] > 3f) { for (int num455 = 0; num455 < 3; num455++) { Vector2 vector44 = base.position - ((Vector2)(base.velocity * (num455 * 0.3334f))); this.alpha = 0xff; color5 = new Color(); int num456 = Dust.NewDust(vector44, 1, 1, 0xad, 0f, 0f, 0, color5, 1f); Main.dust[num456].position = vector44; Main.dust[num456].scale = Main.rand.Next(70, 110) * 0.013f; Dust dust167 = Main.dust[num456]; dust167.velocity = (Vector2)(dust167.velocity * 0.2f); } return; } } return; } if (this.aiStyle == 0x31) { if (this.ai[1] == 0f) { this.ai[1] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); } if (this.ai[1] != 1f) { if (this.ai[1] == 2f) { this.rotation = 0f; this.velocity.X *= 0.95f; this.velocity.Y += 0.2f; return; } } else { if (this.velocity.X > 0f) { base.direction = 1; } else if (this.velocity.X < 0f) { base.direction = -1; } this.spriteDirection = base.direction; this.ai[0]++; this.rotation += (this.velocity.X * 0.05f) + (base.direction * 0.05f); if (this.ai[0] >= 18f) { this.velocity.Y += 0.28f; this.velocity.X *= 0.99f; } if (this.velocity.Y > 15.9) { this.velocity.Y = 15.9f; } if (this.ai[0] > 2f) { this.alpha = 0; if (this.ai[0] == 3f) { for (int num461 = 0; num461 < 10; num461++) { color5 = new Color(); int num462 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x1f, 0f, 0f, 100, color5, 1.5f); Dust dust170 = Main.dust[num462]; dust170.velocity = (Vector2)(dust170.velocity * 0.5f); Dust dust171 = Main.dust[num462]; dust171.velocity += (Vector2)(base.velocity * 0.1f); } for (int num463 = 0; num463 < 5; num463++) { color5 = new Color(); int num464 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, 0f, 0f, 100, color5, 2f); Main.dust[num464].noGravity = true; Dust dust172 = Main.dust[num464]; dust172.velocity = (Vector2)(dust172.velocity * 3f); Dust dust173 = Main.dust[num464]; dust173.velocity += (Vector2)(base.velocity * 0.2f); color5 = new Color(); num464 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, 0f, 0f, 100, color5, 1f); Dust dust174 = Main.dust[num464]; dust174.velocity = (Vector2)(dust174.velocity * 2f); Dust dust175 = Main.dust[num464]; dust175.velocity += (Vector2)(base.velocity * 0.3f); } for (int num466 = 0; num466 < 1; num466++) { vector240 = new Vector2(); int num465 = Gore.NewGore(new Vector2(this.position.X - 10f, this.position.Y - 10f), vector240, Main.rand.Next(0x3d, 0x40), 1f); Gore gore12 = Main.gore[num465]; gore12.position += (Vector2)(base.velocity * 1.25f); Main.gore[num465].scale = 1.5f; Gore gore13 = Main.gore[num465]; gore13.velocity += (Vector2)(base.velocity * 0.5f); Gore gore14 = Main.gore[num465]; gore14.velocity = (Vector2)(gore14.velocity * 0.02f); } return; } } } return; } if (this.aiStyle == 50) { if (this.type == 0x123) { if (this.localAI[0] == 0f) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 20); this.localAI[0]++; } bool flag15 = false; bool flag16 = false; if ((this.velocity.X < 0f) && (this.position.X < this.ai[0])) { flag15 = true; } if ((this.velocity.X > 0f) && (this.position.X > this.ai[0])) { flag15 = true; } if ((this.velocity.Y < 0f) && (this.position.Y < this.ai[1])) { flag16 = true; } if ((this.velocity.Y > 0f) && (this.position.Y > this.ai[1])) { flag16 = true; } if (flag15 && flag16) { this.Kill(); } for (int num467 = 0; num467 < 10; num467++) { color5 = new Color(); int num468 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xae, 0f, 0f, 100, color5, 1.2f); Main.dust[num468].noGravity = true; Dust dust176 = Main.dust[num468]; dust176.velocity = (Vector2)(dust176.velocity * 0.5f); Dust dust177 = Main.dust[num468]; dust177.velocity += (Vector2)(base.velocity * 0.1f); } return; } if (this.type == 0x127) { for (int num469 = 0; num469 < 8; num469++) { color5 = new Color(); int num470 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xae, 0f, 0f, 100, color5, 1.2f); Main.dust[num470].noGravity = true; Dust dust178 = Main.dust[num470]; dust178.velocity = (Vector2)(dust178.velocity * 0.5f); Dust dust179 = Main.dust[num470]; dust179.velocity += (Vector2)(base.velocity * 0.1f); } return; } if (this.localAI[0] == 0f) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 0x4a); this.localAI[0]++; } this.ai[0]++; if (this.type == 0x128) { this.ai[0] += 3f; } float num471 = 25f; if (this.ai[0] > 180f) { num471 -= (this.ai[0] - 180f) / 2f; } if (num471 <= 0f) { num471 = 0f; this.Kill(); } if (this.type == 0x128) { num471 *= 0.7f; } for (int num472 = 0; num472 < num471; num472++) { float num473 = Main.rand.Next(-10, 11); float num474 = Main.rand.Next(-10, 11); float num475 = Main.rand.Next(3, 9); float num476 = (float)Math.Sqrt((double)((num473 * num473) + (num474 * num474))); num476 = num475 / num476; num473 *= num476; num474 *= num476; color5 = new Color(); int num477 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xae, 0f, 0f, 100, color5, 1.5f); Main.dust[num477].noGravity = true; Main.dust[num477].position.X = base.Center.X; Main.dust[num477].position.Y = base.Center.Y; Main.dust[num477].position.X += Main.rand.Next(-10, 11); Main.dust[num477].position.Y += Main.rand.Next(-10, 11); Main.dust[num477].velocity.X = num473; Main.dust[num477].velocity.Y = num474; } return; } if (this.aiStyle == 0x33) { if (this.type == 0x129) { this.localAI[0]++; if (this.localAI[0] > 4f) { for (int num478 = 0; num478 < 5; num478++) { color5 = new Color(); int num479 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xaf, 0f, 0f, 100, color5, 2f); Main.dust[num479].noGravity = true; Dust dust180 = Main.dust[num479]; dust180.velocity = (Vector2)(dust180.velocity * 0f); } } } else { if (this.localAI[0] == 0f) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8); this.localAI[0]++; } for (int num480 = 0; num480 < 9; num480++) { color5 = new Color(); int num481 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xaf, 0f, 0f, 100, color5, 1.3f); Main.dust[num481].noGravity = true; Dust dust181 = Main.dust[num481]; dust181.velocity = (Vector2)(dust181.velocity * 0f); } } float num482 = base.Center.X; float num483 = base.Center.Y; float num484 = 400f; bool flag17 = false; if (this.type == 0x129) { for (int num485 = 0; num485 < 200; num485++) { if (Main.npc[num485].CanBeChasedBy(this, false) && Collision.CanHit(base.Center, 1, 1, Main.npc[num485].Center, 1, 1)) { float num486 = Main.npc[num485].position.X + (Main.npc[num485].width / 2); float num487 = Main.npc[num485].position.Y + (Main.npc[num485].height / 2); float introduced1759 = Math.Abs((float)((this.position.X + (base.width / 2)) - num486)); float num488 = introduced1759 + Math.Abs((float)((this.position.Y + (base.height / 2)) - num487)); if (num488 < num484) { num484 = num488; num482 = num486; num483 = num487; flag17 = true; } } } } else { num484 = 200f; for (int num489 = 0; num489 < 0xff; num489++) { if (Main.player[num489].active && !Main.player[num489].dead) { float num490 = Main.player[num489].position.X + (Main.player[num489].width / 2); float num491 = Main.player[num489].position.Y + (Main.player[num489].height / 2); float introduced1760 = Math.Abs((float)((this.position.X + (base.width / 2)) - num490)); float num492 = introduced1760 + Math.Abs((float)((this.position.Y + (base.height / 2)) - num491)); if (num492 < num484) { num484 = num492; num482 = num490; num483 = num491; flag17 = true; } } } } if (flag17) { float num493 = 3f; if (this.type == 0x129) { num493 = 6f; } Vector2 vector47 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f)); float num494 = num482 - vector47.X; float num495 = num483 - vector47.Y; float num496 = (float)Math.Sqrt((double)((num494 * num494) + (num495 * num495))); num496 = num493 / num496; num494 *= num496; num495 *= num496; if (this.type == 0x129) { this.velocity.X = ((this.velocity.X * 20f) + num494) / 21f; this.velocity.Y = ((this.velocity.Y * 20f) + num495) / 21f; return; } this.velocity.X = ((this.velocity.X * 100f) + num494) / 101f; this.velocity.Y = ((this.velocity.Y * 100f) + num495) / 101f; return; } return; } if (this.aiStyle == 0x34) { int num497 = (int)this.ai[0]; float num498 = 4f; Vector2 vector48 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f)); float num499 = Main.player[num497].Center.X - vector48.X; float num500 = Main.player[num497].Center.Y - vector48.Y; float num501 = (float)Math.Sqrt((double)((num499 * num499) + (num500 * num500))); if ((((num501 < 50f) && (this.position.X < (Main.player[num497].position.X + Main.player[num497].width))) && (((this.position.X + base.width) > Main.player[num497].position.X) && (this.position.Y < (Main.player[num497].position.Y + Main.player[num497].height)))) && ((this.position.Y + base.height) > Main.player[num497].position.Y)) { if ((this.owner == Main.myPlayer) && !Main.player[Main.myPlayer].moonLeech) { int healAmount = (int)this.ai[1]; Main.player[num497].HealEffect(healAmount, false); Player player12 = Main.player[num497]; player12.statLife += healAmount; if (Main.player[num497].statLife > Main.player[num497].statLifeMax2) { Main.player[num497].statLife = Main.player[num497].statLifeMax2; } NetMessage.SendData(0x42, -1, -1, "", num497, (float)healAmount, 0f, 0f, 0, 0, 0); } this.Kill(); } num501 = num498 / num501; num499 *= num501; num500 *= num501; this.velocity.X = ((this.velocity.X * 15f) + num499) / 16f; this.velocity.Y = ((this.velocity.Y * 15f) + num500) / 16f; if (this.type == 0x131) { for (int num503 = 0; num503 < 3; num503++) { float num504 = (this.velocity.X * 0.334f) * num503; float num505 = -(this.velocity.Y * 0.334f) * num503; color5 = new Color(); int num506 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xb7, 0f, 0f, 100, color5, 1.1f); Main.dust[num506].noGravity = true; Dust dust182 = Main.dust[num506]; dust182.velocity = (Vector2)(dust182.velocity * 0f); Main.dust[num506].position.X -= num504; Main.dust[num506].position.Y -= num505; } return; } for (int num507 = 0; num507 < 5; num507++) { float num508 = (this.velocity.X * 0.2f) * num507; float num509 = -(this.velocity.Y * 0.2f) * num507; color5 = new Color(); int num510 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xaf, 0f, 0f, 100, color5, 1.3f); Main.dust[num510].noGravity = true; Dust dust183 = Main.dust[num510]; dust183.velocity = (Vector2)(dust183.velocity * 0f); Main.dust[num510].position.X -= num508; Main.dust[num510].position.Y -= num509; } return; } if (this.aiStyle == 0x35) { if (this.localAI[0] == 0f) { this.localAI[1] = 1f; this.localAI[0] = 1f; this.ai[0] = 120f; int num511 = 80; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 0x2e); if (this.type == 0x134) { for (int num512 = 0; num512 < num511; num512++) { color5 = new Color(); int num513 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 16f), base.width, base.height - 0x10, 0xb9, 0f, 0f, 0, color5, 1f); Dust dust184 = Main.dust[num513]; dust184.velocity = (Vector2)(dust184.velocity * 2f); Main.dust[num513].noGravity = true; Dust dust185 = Main.dust[num513]; dust185.scale *= 1.15f; } } if (this.type == 0x179) { this.frame = 4; num511 = 40; for (int num514 = 0; num514 < num511; num514++) { color5 = new Color(); int num515 = Dust.NewDust(base.position + ((Vector2)(Vector2.UnitY * 16f)), base.width, base.height - 0x10, 0xab, 0f, 0f, 100, color5, 1f); Main.dust[num515].scale = Main.rand.Next(1, 10) * 0.1f; Main.dust[num515].noGravity = true; Main.dust[num515].fadeIn = 1.5f; Dust dust186 = Main.dust[num515]; dust186.velocity = (Vector2)(dust186.velocity * 0.75f); } } } this.velocity.X = 0f; this.velocity.Y += 0.2f; if (this.velocity.Y > 16f) { this.velocity.Y = 16f; } bool flag18 = false; float num516 = base.Center.X; float num517 = base.Center.Y; float num518 = 1000f; for (int num519 = 0; num519 < 200; num519++) { if (Main.npc[num519].CanBeChasedBy(this, false)) { float num520 = Main.npc[num519].position.X + (Main.npc[num519].width / 2); float num521 = Main.npc[num519].position.Y + (Main.npc[num519].height / 2); float introduced1767 = Math.Abs((float)((this.position.X + (base.width / 2)) - num520)); float num522 = introduced1767 + Math.Abs((float)((this.position.Y + (base.height / 2)) - num521)); if ((num522 < num518) && Collision.CanHit(base.position, base.width, base.height, Main.npc[num519].position, Main.npc[num519].width, Main.npc[num519].height)) { num518 = num522; num516 = num520; num517 = num521; flag18 = true; } } } if (!flag18) { if ((this.ai[0] <= 60f) && (((this.frame == 1) || (this.frame == 3)) || (((this.frame == 5) || (this.frame == 7)) || (this.frame == 9)))) { this.frame--; } } else { float num523 = num516; float num524 = num517; num516 -= base.Center.X; num517 -= base.Center.Y; int num525 = 0; if (num516 < 0f) { this.spriteDirection = -1; } else { this.spriteDirection = 1; } if (num517 > 0f) { num525 = 0; } else if (Math.Abs(num517) > (Math.Abs(num516) * 3f)) { num525 = 4; } else if (Math.Abs(num517) > (Math.Abs(num516) * 2f)) { num525 = 3; } else if (Math.Abs(num516) > (Math.Abs(num517) * 3f)) { num525 = 0; } else if (Math.Abs(num516) > (Math.Abs(num517) * 2f)) { num525 = 1; } else { num525 = 2; } if (this.type == 0x134) { this.frame = num525 * 2; } else if (this.type == 0x179) { this.frame = num525; } if (((this.ai[0] > 40f) && (this.localAI[1] == 0f)) && (this.type == 0x134)) { this.frame++; } if (this.ai[0] <= 0f) { this.localAI[1] = 0f; this.ai[0] = 60f; if (Main.myPlayer == this.owner) { float num526 = 6f; int num527 = 0x135; if (this.type == 0x179) { num527 = 0x17a; num526 = 9f; } Vector2 vector49 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f)); switch (num525) { case 0: vector49.Y += 12f; vector49.X += 0x18 * this.spriteDirection; break; case 1: vector49.Y += 0f; vector49.X += 0x18 * this.spriteDirection; break; case 2: vector49.Y -= 2f; vector49.X += 0x18 * this.spriteDirection; break; case 3: vector49.Y -= 6f; vector49.X += 14 * this.spriteDirection; break; case 4: vector49.Y -= 14f; vector49.X += 2 * this.spriteDirection; break; } if (this.spriteDirection < 0) { vector49.X += 10f; } float num528 = num523 - vector49.X; float num529 = num524 - vector49.Y; float num530 = (float)Math.Sqrt((double)((num528 * num528) + (num529 * num529))); num530 = num526 / num530; num528 *= num530; num529 *= num530; int num531 = this.damage; NewProjectile(vector49.X, vector49.Y, num528, num529, num527, num531, this.knockBack, Main.myPlayer, 0f, 0f); } } } if (this.ai[0] > 0f) { this.ai[0]--; } return; } if (this.aiStyle == 0x36) { if (this.type == 0x13d) { if (Main.player[Main.myPlayer].dead) { Main.player[Main.myPlayer].raven = false; } if (Main.player[Main.myPlayer].raven) { this.timeLeft = 2; } } for (int num532 = 0; num532 < 0x3e8; num532++) { if (((num532 != base.whoAmI) && Main.projectile[num532].active) && ((Main.projectile[num532].owner == this.owner) && (Main.projectile[num532].type == this.type))) { float introduced1768 = Math.Abs((float)(this.position.X - Main.projectile[num532].position.X)); if ((introduced1768 + Math.Abs((float)(this.position.Y - Main.projectile[num532].position.Y))) < base.width) { if (this.position.X < Main.projectile[num532].position.X) { this.velocity.X -= 0.05f; } else { this.velocity.X += 0.05f; } if (this.position.Y < Main.projectile[num532].position.Y) { this.velocity.Y -= 0.05f; } else { this.velocity.Y += 0.05f; } } } } float num533 = this.position.X; float num534 = this.position.Y; float num535 = 900f; bool flag19 = false; int num536 = 500; if ((this.ai[1] != 0f) || this.friendly) { num536 = 0x578; } if ((Math.Abs((float)(base.Center.X - Main.player[this.owner].Center.X)) + Math.Abs((float)(base.Center.Y - Main.player[this.owner].Center.Y))) > num536) { this.ai[0] = 1f; } if (this.ai[0] == 0f) { this.tileCollide = true; for (int num537 = 0; num537 < 200; num537++) { if (Main.npc[num537].CanBeChasedBy(this, false)) { float num538 = Main.npc[num537].position.X + (Main.npc[num537].width / 2); float num539 = Main.npc[num537].position.Y + (Main.npc[num537].height / 2); float introduced1769 = Math.Abs((float)((this.position.X + (base.width / 2)) - num538)); float num540 = introduced1769 + Math.Abs((float)((this.position.Y + (base.height / 2)) - num539)); if ((num540 < num535) && Collision.CanHit(base.position, base.width, base.height, Main.npc[num537].position, Main.npc[num537].width, Main.npc[num537].height)) { num535 = num540; num533 = num538; num534 = num539; flag19 = true; } } } } else { this.tileCollide = false; } if (flag19) { if (this.ai[1] == -1f) { this.ai[1] = 17f; } if (this.ai[1] > 0f) { this.ai[1]--; } if (this.ai[1] == 0f) { this.friendly = true; float num545 = 8f; Vector2 vector51 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f)); float num546 = num533 - vector51.X; float num547 = num534 - vector51.Y; float num548 = (float)Math.Sqrt((double)((num546 * num546) + (num547 * num547))); if (num548 < 100f) { num545 = 10f; } num548 = num545 / num548; num546 *= num548; num547 *= num548; this.velocity.X = ((this.velocity.X * 14f) + num546) / 15f; this.velocity.Y = ((this.velocity.Y * 14f) + num547) / 15f; } else { this.friendly = false; float introduced1770 = Math.Abs(this.velocity.X); if ((introduced1770 + Math.Abs(this.velocity.Y)) < 10f) { base.velocity = (Vector2)(base.velocity * 1.05f); } } this.rotation = this.velocity.X * 0.05f; this.frameCounter++; if (this.frameCounter >= 4) { this.frameCounter = 0; this.frame++; } if (this.frame < 4) { this.frame = 4; } if (this.frame > 7) { this.frame = 4; } if (Math.Abs(this.velocity.X) > 0.2) { this.spriteDirection = -base.direction; return; } } else { this.friendly = true; float num541 = 8f; if (this.ai[0] == 1f) { num541 = 12f; } Vector2 vector50 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f)); float num542 = Main.player[this.owner].Center.X - vector50.X; float num543 = (Main.player[this.owner].Center.Y - vector50.Y) - 60f; float num544 = (float)Math.Sqrt((double)((num542 * num542) + (num543 * num543))); if (((num544 < 100f) && (this.ai[0] == 1f)) && !Collision.SolidCollision(base.position, base.width, base.height)) { this.ai[0] = 0f; } if (num544 > 2000f) { this.position.X = Main.player[this.owner].Center.X - (base.width / 2); this.position.Y = Main.player[this.owner].Center.Y - (base.width / 2); } if (num544 > 70f) { num544 = num541 / num544; num542 *= num544; num543 *= num544; this.velocity.X = ((this.velocity.X * 20f) + num542) / 21f; this.velocity.Y = ((this.velocity.Y * 20f) + num543) / 21f; } else { if ((this.velocity.X == 0f) && (this.velocity.Y == 0f)) { this.velocity.X = -0.15f; this.velocity.Y = -0.05f; } base.velocity = (Vector2)(base.velocity * 1.01f); } this.friendly = false; this.rotation = this.velocity.X * 0.05f; this.frameCounter++; if (this.frameCounter >= 4) { this.frameCounter = 0; this.frame++; } if (this.frame > 3) { this.frame = 0; } if (Math.Abs(this.velocity.X) > 0.2) { this.spriteDirection = -base.direction; return; } } return; } if (this.aiStyle == 0x37) { this.frameCounter++; if (this.frameCounter > 0) { this.frame++; this.frameCounter = 0; if (this.frame > 2) { this.frame = 0; } } if (this.velocity.X < 0f) { this.spriteDirection = -1; this.rotation = (float)Math.Atan2((double)-this.velocity.Y, (double)-this.velocity.X); } else { this.spriteDirection = 1; this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X); } if ((this.ai[0] >= 0f) && (this.ai[0] < 200f)) { int num549 = (int)this.ai[0]; if (Main.npc[num549].active) { float num550 = 8f; Vector2 vector52 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f)); float num551 = Main.npc[num549].position.X - vector52.X; float num552 = Main.npc[num549].position.Y - vector52.Y; float num553 = (float)Math.Sqrt((double)((num551 * num551) + (num552 * num552))); num553 = num550 / num553; num551 *= num553; num552 *= num553; this.velocity.X = ((this.velocity.X * 14f) + num551) / 15f; this.velocity.Y = ((this.velocity.Y * 14f) + num552) / 15f; } else { float num554 = 1000f; for (int num555 = 0; num555 < 200; num555++) { if (Main.npc[num555].CanBeChasedBy(this, false)) { float num556 = Main.npc[num555].position.X + (Main.npc[num555].width / 2); float num557 = Main.npc[num555].position.Y + (Main.npc[num555].height / 2); float introduced1771 = Math.Abs((float)((this.position.X + (base.width / 2)) - num556)); float num558 = introduced1771 + Math.Abs((float)((this.position.Y + (base.height / 2)) - num557)); if ((num558 < num554) && Collision.CanHit(base.position, base.width, base.height, Main.npc[num555].position, Main.npc[num555].width, Main.npc[num555].height)) { num554 = num558; this.ai[0] = num555; } } } } int num559 = 8; int num560 = Dust.NewDust(new Vector2(this.position.X + num559, this.position.Y + num559), base.width - (num559 * 2), base.height - (num559 * 2), 6, 0f, 0f, 0, new Color(), 1f); Dust dust187 = Main.dust[num560]; dust187.velocity = (Vector2)(dust187.velocity * 0.5f); Dust dust188 = Main.dust[num560]; dust188.velocity += (Vector2)(base.velocity * 0.5f); Main.dust[num560].noGravity = true; Main.dust[num560].noLight = true; Main.dust[num560].scale = 1.4f; return; } this.Kill(); return; } if (this.aiStyle == 0x38) { if (this.localAI[0] == 0f) { this.localAI[0] = 1f; this.rotation = this.ai[0]; this.spriteDirection = -((int)this.ai[1]); } float introduced1774 = Math.Abs(this.velocity.X); if ((introduced1774 + Math.Abs(this.velocity.Y)) < 16f) { base.velocity = (Vector2)(base.velocity * 1.05f); } if (this.velocity.X < 0f) { base.direction = -1; } else { base.direction = 1; } float introduced1775 = Math.Abs(this.velocity.X); this.rotation += ((introduced1775 + Math.Abs(this.velocity.Y)) * 0.025f) * base.direction; return; } if (this.aiStyle == 0x39) { this.ai[0]++; if (this.ai[0] > 30f) { this.ai[0] = 30f; this.velocity.Y += 0.25f; if (this.velocity.Y > 16f) { this.velocity.Y = 16f; } this.velocity.X *= 0.995f; } this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 1.57f; this.alpha -= 50; if (this.alpha < 0) { this.alpha = 0; } if (this.owner == Main.myPlayer) { this.localAI[0]++; if (this.localAI[0] >= 4f) { this.localAI[0] = 0f; int num561 = 0; for (int num562 = 0; num562 < 0x3e8; num562++) { if ((Main.projectile[num562].active && (Main.projectile[num562].owner == this.owner)) && (Main.projectile[num562].type == 0x158)) { num561++; } } float num563 = this.damage * 0.8f; float num564 = 1f; if (num561 > 100) { num564 = num561 - 100; num564 = 1f - (num564 / 100f); num563 *= num564; } if (num561 > 100) { this.localAI[0]--; } if (num561 > 120) { this.localAI[0]--; } if (num561 > 140) { this.localAI[0]--; } if (num561 > 150) { this.localAI[0]--; } if (num561 > 160) { this.localAI[0]--; } if (num561 > 0xa5) { this.localAI[0]--; } if (num561 > 170) { this.localAI[0] -= 2f; } if (num561 > 0xaf) { this.localAI[0] -= 3f; } if (num561 > 180) { this.localAI[0] -= 4f; } if (num561 > 0xb9) { this.localAI[0] -= 5f; } if (num561 > 190) { this.localAI[0] -= 6f; } if (num561 > 0xc3) { this.localAI[0] -= 7f; } if (num563 > (this.damage * 0.1f)) { NewProjectile(base.Center.X, base.Center.Y, 0f, 0f, 0x158, (int)num563, this.knockBack * 0.55f, this.owner, 0f, (float)Main.rand.Next(3)); return; } } } return; } if (this.aiStyle == 0x3a) { this.alpha -= 50; if (this.alpha < 0) { this.alpha = 0; } if (this.ai[0] == 0f) { this.frame = 0; this.ai[1]++; if (this.ai[1] > 30f) { this.velocity.Y += 0.1f; } if (this.velocity.Y >= 0f) { this.ai[0] = 1f; } } if (this.ai[0] == 1f) { this.frame = 1; this.velocity.Y += 0.1f; if (this.velocity.Y > 3f) { this.velocity.Y = 3f; } this.velocity.X *= 0.99f; } this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 1.57f; return; } if (this.aiStyle == 0x3b) { this.ai[1]++; if (this.ai[1] >= 60f) { this.friendly = true; int num565 = (int)this.ai[0]; if (!Main.npc[num565].active) { num565 = -1; int[] numArray2 = new int[200]; int num566 = 0; for (int num567 = 0; num567 < 200; num567++) { if (Main.npc[num567].CanBeChasedBy(this, false)) { float introduced1776 = Math.Abs((float)(((Main.npc[num567].position.X + (Main.npc[num567].width / 2)) - this.position.X) + (base.width / 2))); float num568 = introduced1776 + Math.Abs((float)(((Main.npc[num567].position.Y + (Main.npc[num567].height / 2)) - this.position.Y) + (base.height / 2))); if (num568 < 800f) { numArray2[num566] = num567; num566++; } } } if (num566 == 0) { this.Kill(); return; } num565 = numArray2[Main.rand.Next(num566)]; this.ai[0] = num565; } float num569 = 4f; Vector2 vector53 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f)); float num570 = Main.npc[num565].Center.X - vector53.X; float num571 = Main.npc[num565].Center.Y - vector53.Y; float num572 = (float)Math.Sqrt((double)((num570 * num570) + (num571 * num571))); num572 = num569 / num572; num570 *= num572; num571 *= num572; int num573 = 30; this.velocity.X = ((this.velocity.X * (num573 - 1)) + num570) / ((float)num573); this.velocity.Y = ((this.velocity.Y * (num573 - 1)) + num571) / ((float)num573); } for (int num574 = 0; num574 < 5; num574++) { float num575 = (this.velocity.X * 0.2f) * num574; float num576 = -(this.velocity.Y * 0.2f) * num574; color5 = new Color(); int num577 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xaf, 0f, 0f, 100, color5, 1.3f); Main.dust[num577].noGravity = true; Dust dust189 = Main.dust[num577]; dust189.velocity = (Vector2)(dust189.velocity * 0f); Main.dust[num577].position.X -= num575; Main.dust[num577].position.Y -= num576; } return; } if (this.aiStyle == 60) { this.scale -= 0.015f; if (this.scale <= 0f) { base.velocity = (Vector2)(base.velocity * 5f); base.oldVelocity = base.velocity; this.Kill(); } if (this.ai[0] <= 3f) { this.ai[0]++; return; } int num578 = 0x67; if (this.type == 0x196) { num578 = 0x89; } if (this.owner == Main.myPlayer) { Rectangle rectangle7 = new Rectangle((int)this.position.X, (int)this.position.Y, base.width, base.height); for (int num579 = 0; num579 < 200; num579++) { if ((Main.npc[num579].active && !Main.npc[num579].dontTakeDamage) && (Main.npc[num579].lifeMax > 1)) { Rectangle rectangle8 = new Rectangle((int)Main.npc[num579].position.X, (int)Main.npc[num579].position.Y, Main.npc[num579].width, Main.npc[num579].height); if (rectangle7.Intersects(rectangle8)) { Main.npc[num579].AddBuff(num578, 0x5dc, false); this.Kill(); } } } for (int num580 = 0; num580 < 0xff; num580++) { if (((num580 != this.owner) && Main.player[num580].active) && !Main.player[num580].dead) { Rectangle rectangle9 = new Rectangle((int)Main.player[num580].position.X, (int)Main.player[num580].position.Y, Main.player[num580].width, Main.player[num580].height); if (rectangle7.Intersects(rectangle9)) { Main.player[num580].AddBuff(num578, 0x5dc, false); this.Kill(); } } } } this.ai[0] += this.ai[1]; if (this.ai[0] > 30f) { this.velocity.Y += 0.1f; } if (this.type == 0x166) { for (int num581 = 0; num581 < 1; num581++) { for (int num582 = 0; num582 < 6; num582++) { float num583 = (this.velocity.X / 6f) * num582; float num584 = (this.velocity.Y / 6f) * num582; int num585 = 6; color5 = new Color(); int num586 = Dust.NewDust(new Vector2(this.position.X + num585, this.position.Y + num585), base.width - (num585 * 2), base.height - (num585 * 2), 0xd3, 0f, 0f, 0x4b, color5, 1.2f); if (Main.rand.Next(2) == 0) { Dust dust190 = Main.dust[num586]; dust190.alpha += 0x19; } if (Main.rand.Next(2) == 0) { Dust dust191 = Main.dust[num586]; dust191.alpha += 0x19; } if (Main.rand.Next(2) == 0) { Dust dust192 = Main.dust[num586]; dust192.alpha += 0x19; } Main.dust[num586].noGravity = true; Dust dust193 = Main.dust[num586]; dust193.velocity = (Vector2)(dust193.velocity * 0.3f); Dust dust194 = Main.dust[num586]; dust194.velocity += (Vector2)(base.velocity * 0.5f); Main.dust[num586].position = base.Center; Main.dust[num586].position.X -= num583; Main.dust[num586].position.Y -= num584; Dust dust195 = Main.dust[num586]; dust195.velocity = (Vector2)(dust195.velocity * 0.2f); } if (Main.rand.Next(4) == 0) { int num587 = 6; color5 = new Color(); int num588 = Dust.NewDust(new Vector2(this.position.X + num587, this.position.Y + num587), base.width - (num587 * 2), base.height - (num587 * 2), 0xd3, 0f, 0f, 0x4b, color5, 0.65f); Dust dust196 = Main.dust[num588]; dust196.velocity = (Vector2)(dust196.velocity * 0.5f); Dust dust197 = Main.dust[num588]; dust197.velocity += (Vector2)(base.velocity * 0.5f); } } } if (this.type == 0x196) { int num589 = 0xaf; Color newColor = new Color(0, 80, 0xff, 100); for (int num590 = 0; num590 < 6; num590++) { Vector2 vector54 = (Vector2)((base.velocity * num590) / 6f); int num591 = 6; int num592 = Dust.NewDust(base.position + ((Vector2)(Vector2.One * 6f)), base.width - (num591 * 2), base.height - (num591 * 2), 4, 0f, 0f, num589, newColor, 1.2f); if (Main.rand.Next(2) == 0) { Dust dust198 = Main.dust[num592]; dust198.alpha += 0x19; } if (Main.rand.Next(2) == 0) { Dust dust199 = Main.dust[num592]; dust199.alpha += 0x19; } if (Main.rand.Next(2) == 0) { Dust dust200 = Main.dust[num592]; dust200.alpha += 0x19; } Main.dust[num592].noGravity = true; Dust dust201 = Main.dust[num592]; dust201.velocity = (Vector2)(dust201.velocity * 0.3f); Dust dust202 = Main.dust[num592]; dust202.velocity += (Vector2)(base.velocity * 0.5f); Main.dust[num592].position = base.Center; Main.dust[num592].position.X -= vector54.X; Main.dust[num592].position.Y -= vector54.Y; Dust dust203 = Main.dust[num592]; dust203.velocity = (Vector2)(dust203.velocity * 0.2f); } if (Main.rand.Next(4) == 0) { int num593 = 6; int num594 = Dust.NewDust(base.position + ((Vector2)(Vector2.One * 6f)), base.width - (num593 * 2), base.height - (num593 * 2), 4, 0f, 0f, num589, newColor, 1.2f); Dust dust204 = Main.dust[num594]; dust204.velocity = (Vector2)(dust204.velocity * 0.5f); Dust dust205 = Main.dust[num594]; dust205.velocity += (Vector2)(base.velocity * 0.5f); return; } } return; } if (this.aiStyle == 0x3d) { this.timeLeft = 60; if (((Main.player[this.owner].inventory[Main.player[this.owner].selectedItem].fishingPole == 0) || Main.player[this.owner].calmed) || Main.player[this.owner].noItems) { this.Kill(); } else if (Main.player[this.owner].inventory[Main.player[this.owner].selectedItem].shoot != this.type) { this.Kill(); } else if (Main.player[this.owner].pulley) { this.Kill(); } else if (Main.player[this.owner].dead) { this.Kill(); } if ((this.ai[1] > 0f) && (this.localAI[1] >= 0f)) { this.localAI[1] = -1f; if (!base.lavaWet && !base.honeyWet) { for (int num595 = 0; num595 < 100; num595++) { color5 = new Color(); int num596 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y - 10f), base.width + 12, 0x18, Dust.dustWater(), 0f, 0f, 0, color5, 1f); Main.dust[num596].velocity.Y -= 4f; Main.dust[num596].velocity.X *= 2.5f; Main.dust[num596].scale = 0.8f; Main.dust[num596].alpha = 100; Main.dust[num596].noGravity = true; } Main.PlaySound(0x13, (int)this.position.X, (int)this.position.Y, 0); } } if (this.ai[0] >= 1f) { if (this.ai[0] == 2f) { this.ai[0]++; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 0x11); if (!base.lavaWet && !base.honeyWet) { for (int num597 = 0; num597 < 100; num597++) { color5 = new Color(); int num598 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y - 10f), base.width + 12, 0x18, Dust.dustWater(), 0f, 0f, 0, color5, 1f); Main.dust[num598].velocity.Y -= 4f; Main.dust[num598].velocity.X *= 2.5f; Main.dust[num598].scale = 0.8f; Main.dust[num598].alpha = 100; Main.dust[num598].noGravity = true; } Main.PlaySound(0x13, (int)this.position.X, (int)this.position.Y, 0); } } if (this.localAI[0] < 100f) { this.localAI[0]++; } this.tileCollide = false; float num599 = 15.9f; int num600 = 10; Vector2 vector55 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f)); float num601 = (Main.player[this.owner].position.X + (Main.player[this.owner].width / 2)) - vector55.X; float num602 = (Main.player[this.owner].position.Y + (Main.player[this.owner].height / 2)) - vector55.Y; float num603 = (float)Math.Sqrt((double)((num601 * num601) + (num602 * num602))); if (num603 > 3000f) { this.Kill(); } num603 = num599 / num603; num601 *= num603; num602 *= num603; this.velocity.X = ((this.velocity.X * (num600 - 1)) + num601) / ((float)num600); this.velocity.Y = ((this.velocity.Y * (num600 - 1)) + num602) / ((float)num600); if (Main.myPlayer == this.owner) { Rectangle rectangle10 = new Rectangle((int)this.position.X, (int)this.position.Y, base.width, base.height); Rectangle rectangle11 = new Rectangle((int)Main.player[this.owner].position.X, (int)Main.player[this.owner].position.Y, Main.player[this.owner].width, Main.player[this.owner].height); if (rectangle10.Intersects(rectangle11)) { if ((this.ai[1] > 0f) && (this.ai[1] < 3602f)) { int num604 = (int)this.ai[1]; Item newItem = new Item(); newItem.SetDefaults(num604, false); switch (num604) { case 0xc7c: { int num605 = Main.player[this.owner].FishingLevel(); int minValue = ((num605 / 20) + 3) / 2; int num607 = ((num605 / 10) + 6) / 2; if (Main.rand.Next(50) < num605) { num607++; } if (Main.rand.Next(100) < num605) { num607++; } if (Main.rand.Next(150) < num605) { num607++; } if (Main.rand.Next(200) < num605) { num607++; } int num608 = Main.rand.Next(minValue, num607 + 1); newItem.stack = num608; break; } case 0xc7d: { int num609 = Main.player[this.owner].FishingLevel(); int num610 = ((num609 / 4) + 15) / 2; int num611 = ((num609 / 2) + 30) / 2; if (Main.rand.Next(50) < num609) { num611 += 4; } if (Main.rand.Next(100) < num609) { num611 += 4; } if (Main.rand.Next(150) < num609) { num611 += 4; } if (Main.rand.Next(200) < num609) { num611 += 4; } int num612 = Main.rand.Next(num610, num611 + 1); newItem.stack = num612; break; } } newItem.newAndShiny = true; if (Main.player[this.owner].GetItem(this.owner, newItem, false, false).stack > 0) { int num613 = Item.NewItem((int)this.position.X, (int)this.position.Y, base.width, base.height, num604, 1, false, 0, true); if (Main.netMode == 1) { NetMessage.SendData(0x15, -1, -1, "", num613, 1f, 0f, 0f, 0, 0, 0); } } else { newItem.position.X = base.Center.X - (newItem.width / 2); newItem.position.Y = base.Center.Y - (newItem.height / 2); newItem.active = true; ItemText.NewText(newItem, 0, false, false); } } this.Kill(); } } this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 1.57f; return; } bool flag20 = false; Vector2 vector56 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f)); float num614 = (Main.player[this.owner].position.X + (Main.player[this.owner].width / 2)) - vector56.X; float num615 = (Main.player[this.owner].position.Y + (Main.player[this.owner].height / 2)) - vector56.Y; this.rotation = ((float)Math.Atan2((double)num615, (double)num614)) + 1.57f; float num616 = (float)Math.Sqrt((double)((num614 * num614) + (num615 * num615))); if (num616 > 900f) { this.ai[0] = 1f; } if (base.wet) { this.rotation = 0f; this.velocity.X *= 0.9f; int num617 = (((int)base.Center.X) + (((base.width / 2) + 8) * base.direction)) / 0x10; int num618 = (int)(base.Center.Y / 16f); float single1 = this.position.Y / 16f; int num619 = (int)((this.position.Y + base.height) / 16f); if (Main.tile[num617, num618] == null) { Main.tile[num617, num618] = new Tile(); } if (Main.tile[num617, num619] == null) { Main.tile[num617, num619] = new Tile(); } if (this.velocity.Y > 0f) { this.velocity.Y *= 0.5f; } num617 = (int)(base.Center.X / 16f); num618 = (int)(base.Center.Y / 16f); float num620 = this.position.Y + base.height; if (Main.tile[num617, num618 - 1] == null) { Main.tile[num617, num618 - 1] = new Tile(); } if (Main.tile[num617, num618] == null) { Main.tile[num617, num618] = new Tile(); } if (Main.tile[num617, num618 + 1] == null) { Main.tile[num617, num618 + 1] = new Tile(); } if (Main.tile[num617, num618 - 1].liquid > 0) { num620 = num618 * 0x10; num620 -= Main.tile[num617, num618 - 1].liquid / 0x10; } else if (Main.tile[num617, num618].liquid > 0) { num620 = (num618 + 1) * 0x10; num620 -= Main.tile[num617, num618].liquid / 0x10; } else if (Main.tile[num617, num618 + 1].liquid > 0) { num620 = (num618 + 2) * 0x10; num620 -= Main.tile[num617, num618 + 1].liquid / 0x10; } if (base.Center.Y > num620) { this.velocity.Y -= 0.1f; if (this.velocity.Y < -8f) { this.velocity.Y = -8f; } if ((base.Center.Y + this.velocity.Y) < num620) { this.velocity.Y = num620 - base.Center.Y; } } else { this.velocity.Y = num620 - base.Center.Y; } if ((this.velocity.Y >= -0.01) && (this.velocity.Y <= 0.01)) { flag20 = true; } } else { if (this.velocity.Y == 0f) { this.velocity.X *= 0.95f; } this.velocity.X *= 0.98f; this.velocity.Y += 0.2f; if (this.velocity.Y > 15.9f) { this.velocity.Y = 15.9f; } } if (this.ai[1] != 0f) { flag20 = true; } if (flag20) { if ((this.ai[1] != 0f) || (Main.myPlayer != this.owner)) { if (this.ai[1] < 0f) { if ((this.velocity.Y == 0f) || ((base.honeyWet && (this.velocity.Y >= -0.01)) && (this.velocity.Y <= 0.01))) { this.velocity.Y = Main.rand.Next(100, 500) * 0.015f; this.velocity.X = Main.rand.Next(-100, 0x65) * 0.015f; base.wet = false; base.lavaWet = false; base.honeyWet = false; } this.ai[1] += Main.rand.Next(1, 5); if (this.ai[1] >= 0f) { this.ai[1] = 0f; this.localAI[1] = 0f; this.netUpdate = true; return; } } } else { int num621 = Main.player[this.owner].FishingLevel(); if (num621 != -9000) { if (Main.rand.Next(300) < num621) { this.localAI[1] += Main.rand.Next(1, 3); } this.localAI[1] += num621 / 30; this.localAI[1] += Main.rand.Next(1, 3); if (Main.rand.Next(60) == 0) { this.localAI[1] += 60f; } if (this.localAI[1] > 660f) { this.localAI[1] = 0f; this.FishingCheck(); return; } } else { this.localAI[1] += 5f; this.localAI[1] += Main.rand.Next(1, 3); if (this.localAI[1] > 660f) { this.localAI[1] = 0f; this.FishingCheck(); return; } } } } return; } if (this.aiStyle == 0x3e) { this.AI_062(); return; } if (this.aiStyle == 0x3f) { if (!Main.player[this.owner].active) { base.active = false; return; } Vector2 center = base.position; bool flag21 = false; float num622 = 500f; for (int num623 = 0; num623 < 200; num623++) { NPC npc = Main.npc[num623]; if (npc.CanBeChasedBy(this, false)) { float num624 = Vector2.Distance(npc.Center, base.Center); if ((((Vector2.Distance(base.Center, center) > num624) && (num624 < num622)) || !flag21) && Collision.CanHit(base.position, base.width, base.height, npc.position, npc.width, npc.height)) { num622 = num624; center = npc.Center; flag21 = true; } } } if (!flag21) { this.velocity.X *= 0.95f; } else { float num625 = 5f; float num626 = 0.08f; if (this.velocity.Y == 0f) { bool flag22 = false; if ((base.Center.Y - 50f) > center.Y) { flag22 = true; } if (flag22) { this.velocity.Y = -6f; } } else { num625 = 8f; num626 = 0.12f; } this.velocity.X += Math.Sign((float)(center.X - base.Center.X)) * num626; if (this.velocity.X < -num625) { this.velocity.X = -num625; } if (this.velocity.X > num625) { this.velocity.X = num625; } } float stepSpeed = 0f; Collision.StepUp(ref this.position, ref this.velocity, base.width, base.height, ref stepSpeed, ref this.gfxOffY, 1, false, 0); if (this.velocity.Y != 0f) { this.frame = 3; } else { if (Math.Abs(this.velocity.X) > 0.2f) { this.frameCounter++; } if (this.frameCounter >= 9) { this.frameCounter = 0; } if (this.frameCounter >= 6) { this.frame = 2; } else if (this.frameCounter >= 3) { this.frame = 1; } else { this.frame = 0; } } if (this.velocity.X != 0f) { base.direction = Math.Sign(this.velocity.X); } this.spriteDirection = -base.direction; this.velocity.Y += 0.2f; if (this.velocity.Y > 16f) { this.velocity.Y = 16f; return; } return; } if (this.aiStyle == 0x40) { int num628 = 10; int num629 = 15; float num630 = 1f; int num631 = 150; int num632 = 0x2a; if (this.type == 0x182) { num628 = 0x10; num629 = 0x10; num630 = 1.5f; } if (this.velocity.X != 0f) { base.direction = this.spriteDirection = -Math.Sign(this.velocity.X); } this.frameCounter++; if (this.frameCounter > 2) { this.frame++; this.frameCounter = 0; } if (this.frame >= 6) { this.frame = 0; } if ((this.localAI[0] == 0f) && (Main.myPlayer == this.owner)) { this.localAI[0] = 1f; this.position.X += base.width / 2; this.position.Y += base.height / 2; this.scale = (((num628 + num629) - this.ai[1]) * num630) / ((float)(num629 + num628)); base.width = (int)(num631 * this.scale); base.height = (int)(num632 * this.scale); this.position.X -= base.width / 2; this.position.Y -= base.height / 2; this.netUpdate = true; } if (this.ai[1] != -1f) { this.scale = (((num628 + num629) - this.ai[1]) * num630) / ((float)(num629 + num628)); base.width = (int)(num631 * this.scale); base.height = (int)(num632 * this.scale); } if (!Collision.SolidCollision(base.position, base.width, base.height)) { this.alpha -= 30; if (this.alpha < 60) { this.alpha = 60; } if ((this.type == 0x182) && (this.alpha < 100)) { this.alpha = 100; } } else { this.alpha += 30; if (this.alpha > 150) { this.alpha = 150; } } if (this.ai[0] > 0f) { this.ai[0]--; } if (((this.ai[0] == 1f) && (this.ai[1] > 0f)) && (this.owner == Main.myPlayer)) { this.netUpdate = true; Vector2 vector58 = base.Center; vector58.Y -= (num632 * this.scale) / 2f; float num633 = ((((num628 + num629) - this.ai[1]) + 1f) * num630) / ((float)(num629 + num628)); vector58.Y -= (num632 * num633) / 2f; vector58.Y += 2f; NewProjectile(vector58.X, vector58.Y, this.velocity.X, this.velocity.Y, this.type, this.damage, this.knockBack, this.owner, 10f, this.ai[1] - 1f); int num634 = 4; if (this.type == 0x182) { num634 = 2; } if (((((int)this.ai[1]) % num634) == 0) && (this.ai[1] != 0f)) { int num635 = 0x174; if (this.type == 0x182) { num635 = 0x175; } int num636 = NPC.NewNPC((int)vector58.X, (int)vector58.Y, num635, 0, 0f, 0f, 0f, 0f, 0xff); Main.npc[num636].velocity = base.velocity; Main.npc[num636].netUpdate = true; if (this.type == 0x182) { Main.npc[num636].ai[2] = base.width; Main.npc[num636].ai[3] = -1.5f; } } } if (this.ai[0] <= 0f) { float num637 = 0.1047198f; float num638 = ((float)base.width) / 5f; if (this.type == 0x182) { num638 *= 2f; } float num639 = ((float)(Math.Cos((double)(num637 * -this.ai[0])) - 0.5)) * num638; this.position.X -= num639 * -base.direction; this.ai[0]--; num639 = ((float)(Math.Cos((double)(num637 * -this.ai[0])) - 0.5)) * num638; this.position.X += num639 * -base.direction; return; } return; } if (this.aiStyle == 0x41) { if (this.ai[1] > 0f) { int num640 = ((int)this.ai[1]) - 1; if (num640 < 0xff) { this.localAI[0]++; if (this.localAI[0] > 10f) { int num641 = 6; for (int num642 = 0; num642 < num641; num642++) { Vector2 spinningpoint = (Vector2)((Vector2.Normalize(base.velocity) * new Vector2(((float)base.width) / 2f, (float)base.height)) * 0.75f); vector240 = new Vector2(); spinningpoint = spinningpoint.RotatedBy((((num642 - ((num641 / 2) - 1)) * 3.1415926535897931) / ((double)num641)), vector240) + base.Center; Vector2 vector60 = (((float)(Main.rand.NextDouble() * 3.1415927410125732)) - 1.570796f).ToRotationVector2() * Main.rand.Next(3, 8); color5 = new Color(); int num643 = Dust.NewDust(spinningpoint + vector60, 0, 0, 0xac, vector60.X * 2f, vector60.Y * 2f, 100, color5, 1.4f); Main.dust[num643].noGravity = true; Main.dust[num643].noLight = true; Dust dust206 = Main.dust[num643]; dust206.velocity = (Vector2)(dust206.velocity / 4f); Dust dust207 = Main.dust[num643]; dust207.velocity -= base.velocity; } this.alpha -= 5; if (this.alpha < 100) { this.alpha = 100; } this.rotation += this.velocity.X * 0.1f; this.frame = ((int)(this.localAI[0] / 3f)) % 3; } Vector2 vector61 = Main.player[num640].Center - base.Center; float num644 = 4f; num644 += this.localAI[0] / 20f; base.velocity = (Vector2)(Vector2.Normalize(vector61) * num644); if (vector61.Length() < 50f) { this.Kill(); } } } else { float num645 = 0.2094395f; float num646 = 4f; float num647 = ((float)(Math.Cos((double)(num645 * this.ai[0])) - 0.5)) * num646; this.velocity.Y -= num647; this.ai[0]++; num647 = ((float)(Math.Cos((double)(num645 * this.ai[0])) - 0.5)) * num646; this.velocity.Y += num647; this.localAI[0]++; if (this.localAI[0] > 10f) { this.alpha -= 5; if (this.alpha < 100) { this.alpha = 100; } this.rotation += this.velocity.X * 0.1f; this.frame = ((int)(this.localAI[0] / 3f)) % 3; } } if (base.wet) { this.position.Y -= 16f; this.Kill(); return; } return; } if (this.aiStyle == 0x42) { float num648 = 0f; float num649 = 0f; float num650 = 0f; float num651 = 0f; if ((this.type == 0x183) || (this.type == 0x184)) { num648 = 700f; num649 = 800f; num650 = 1200f; num651 = 150f; if (Main.player[this.owner].dead) { Main.player[this.owner].twinsMinion = false; } if (Main.player[this.owner].twinsMinion) { this.timeLeft = 2; } } if (this.type == 0x215) { num648 = 1500f; num649 = 900f; num650 = 1500f; num651 = 450f; if (Main.player[this.owner].dead) { Main.player[this.owner].DeadlySphereMinion = false; } if (Main.player[this.owner].DeadlySphereMinion) { this.timeLeft = 2; } } float num652 = 0.05f; for (int num653 = 0; num653 < 0x3e8; num653++) { bool flag23 = ((Main.projectile[num653].type == 0x183) || (Main.projectile[num653].type == 0x184)) && ((this.type == 0x183) || (this.type == 0x184)); if (!flag23) { flag23 = (this.type == 0x215) && (Main.projectile[num653].type == 0x215); } if (((num653 != base.whoAmI) && Main.projectile[num653].active) && ((Main.projectile[num653].owner == this.owner) && flag23)) { float introduced1797 = Math.Abs((float)(this.position.X - Main.projectile[num653].position.X)); if ((introduced1797 + Math.Abs((float)(this.position.Y - Main.projectile[num653].position.Y))) < base.width) { if (this.position.X < Main.projectile[num653].position.X) { this.velocity.X -= num652; } else { this.velocity.X += num652; } if (this.position.Y < Main.projectile[num653].position.Y) { this.velocity.Y -= num652; } else { this.velocity.Y += num652; } } } } if (this.type == 0x215) { if ((((int)this.ai[0]) % 3) != 2) { Lighting.AddLight(base.Center, 0.8f, 0.3f, 0.1f); } else { Lighting.AddLight(base.Center, 0.3f, 0.5f, 0.7f); } } bool flag24 = false; if ((this.ai[0] == 2f) && (this.type == 0x184)) { this.ai[1]++; this.extraUpdates = 1; this.rotation = base.velocity.ToRotation() + 3.141593f; this.frameCounter++; if (this.frameCounter > 1) { this.frame++; this.frameCounter = 0; } if (this.frame > 2) { this.frame = 0; } if (this.ai[1] > 40f) { this.ai[1] = 1f; this.ai[0] = 0f; this.extraUpdates = 0; this.numUpdates = 0; this.netUpdate = true; } else { flag24 = true; } } if (((this.type == 0x215) && (this.ai[0] >= 3f)) && (this.ai[0] <= 5f)) { int num654 = 2; flag24 = true; base.velocity = (Vector2)(base.velocity * 0.9f); this.ai[1]++; int num655 = (((int)this.ai[1]) / num654) + (((int)(this.ai[0] - 3f)) * 8); if (num655 < 4) { this.frame = 0x11 + num655; } else if (num655 < 5) { this.frame = 0; } else if (num655 < 8) { this.frame = (1 + num655) - 5; } else if (num655 < 11) { this.frame = 11 - num655; } else if (num655 < 12) { this.frame = 0; } else if (num655 < 0x10) { this.frame = num655 - 2; } else if (num655 < 20) { this.frame = 0x1d - num655; } else if (num655 < 0x15) { this.frame = 0; } else { this.frame = num655 - 4; } if (this.ai[1] > (num654 * 8)) { this.ai[0] -= 3f; this.ai[1] = 0f; } } if (((this.type == 0x215) && (this.ai[0] >= 6f)) && (this.ai[0] <= 8f)) { this.ai[1]++; this.MaxUpdates = 2; if (this.ai[0] == 7f) { this.rotation = base.velocity.ToRotation() + 3.141593f; } else { this.rotation += 0.5235988f; } int num656 = 0; switch (((int)this.ai[0])) { case 6: this.frame = 5; num656 = 40; break; case 7: this.frame = 13; num656 = 30; break; case 8: this.frame = 0x11; num656 = 30; break; } if (this.ai[1] > num656) { this.ai[1] = 1f; this.ai[0] -= 6f; this.localAI[0]++; this.extraUpdates = 0; this.numUpdates = 0; this.netUpdate = true; } else { flag24 = true; } if (this.ai[0] == 8f) { for (int num657 = 0; num657 < 4; num657++) { int num658 = Utils.SelectRandom<int>(Main.rand, new int[] { 0xe2, 0xe4, 0x4b }); color5 = new Color(); int num659 = Dust.NewDust(base.Center, 0, 0, num658, 0f, 0f, 0, color5, 1f); Dust dust = Main.dust[num659]; vector240 = new Vector2(); vector240 = new Vector2(); Vector2 vector62 = Vector2.One.RotatedBy(((double)(num657 * 1.570796f)), vector240).RotatedBy((double)this.rotation, vector240); dust.position = base.Center + ((Vector2)(vector62 * 10f)); dust.velocity = (Vector2)(vector62 * 1f); dust.scale = 0.6f + (Main.rand.NextFloat() * 0.5f); dust.noGravity = true; } } } if (!flag24) { Vector2 vector63 = base.position; bool flag25 = false; if ((this.ai[0] != 1f) && ((this.type == 0x183) || (this.type == 0x184))) { this.tileCollide = true; } if ((this.type == 0x215) && (this.ai[0] < 9f)) { this.tileCollide = true; } if (this.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely(((int)base.Center.X) / 0x10, ((int)base.Center.Y) / 0x10))) { this.tileCollide = false; } for (int num660 = 0; num660 < 200; num660++) { NPC npc2 = Main.npc[num660]; if (npc2.CanBeChasedBy(this, false)) { float num661 = Vector2.Distance(npc2.Center, base.Center); if ((((Vector2.Distance(base.Center, vector63) > num661) && (num661 < num648)) || !flag25) && Collision.CanHitLine(base.position, base.width, base.height, npc2.position, npc2.width, npc2.height)) { num648 = num661; vector63 = npc2.Center; flag25 = true; } } } float num662 = num649; if (flag25) { num662 = num650; } Player player = Main.player[this.owner]; if (Vector2.Distance(player.Center, base.Center) > num662) { if ((this.type == 0x183) || (this.type == 0x184)) { this.ai[0] = 1f; } if ((this.type == 0x215) && (this.ai[0] < 9f)) { this.ai[0] += 3 * (3 - ((int)(this.ai[0] / 3f))); } this.tileCollide = false; this.netUpdate = true; } if (((this.type == 0x184) || (this.type == 0x183)) && (flag25 && (this.ai[0] == 0f))) { Vector2 vector64 = vector63 - base.Center; float num663 = vector64.Length(); vector64.Normalize(); if (num663 > 200f) { float num664 = 6f; if (this.type == 0x184) { num664 = 8f; } vector64 = (Vector2)(vector64 * num664); base.velocity = (Vector2)(((base.velocity * 40f) + vector64) / 41f); } else { float num665 = 4f; vector64 = (Vector2)(vector64 * -num665); base.velocity = (Vector2)(((base.velocity * 40f) + vector64) / 41f); } } else { bool flag26 = false; if (!flag26) { flag26 = (this.ai[0] == 1f) && ((this.type == 0x183) || (this.type == 0x184)); } if (!flag26) { flag26 = (this.ai[0] >= 9f) && (this.type == 0x215); } float num666 = 6f; if (this.type == 0x215) { num666 = 12f; } if (flag26) { num666 = 15f; } Vector2 vector65 = base.Center; Vector2 vector66 = (player.Center - vector65) + new Vector2(0f, -60f); float num667 = vector66.Length(); if ((num667 > 200f) && (num666 < 8f)) { num666 = 8f; } if (((num667 < num651) && flag26) && !Collision.SolidCollision(base.position, base.width, base.height)) { if ((this.type == 0x183) || (this.type == 0x184)) { this.ai[0] = 0f; } if (this.type == 0x215) { this.ai[0] -= 9f; } this.netUpdate = true; } if (num667 > 2000f) { this.position.X = Main.player[this.owner].Center.X - (base.width / 2); this.position.Y = Main.player[this.owner].Center.Y - (base.height / 2); this.netUpdate = true; } if (num667 > 70f) { vector66.Normalize(); vector66 = (Vector2)(vector66 * num666); base.velocity = (Vector2)(((base.velocity * 40f) + vector66) / 41f); } else if ((this.velocity.X == 0f) && (this.velocity.Y == 0f)) { this.velocity.X = -0.15f; this.velocity.Y = -0.05f; } } if (this.type == 0x184) { this.rotation = base.velocity.ToRotation() + 3.141593f; } if (this.type == 0x183) { if (flag25) { this.rotation = (vector63 - base.Center).ToRotation() + 3.141593f; } else { this.rotation = base.velocity.ToRotation() + 3.141593f; } } if ((this.type == 0x215) && ((this.ai[0] < 3f) || (this.ai[0] >= 9f))) { this.rotation += this.velocity.X * 0.04f; } if ((this.type == 0x184) || (this.type == 0x183)) { this.frameCounter++; if (this.frameCounter > 3) { this.frame++; this.frameCounter = 0; } if (this.frame > 2) { this.frame = 0; } } else if (this.type == 0x215) { if ((this.ai[0] < 3f) || (this.ai[0] >= 9f)) { this.frameCounter++; if (this.frameCounter >= 0x18) { this.frameCounter = 0; } int num668 = this.frameCounter / 4; this.frame = 4 + num668; switch (((int)this.ai[0])) { case 0: case 9: this.frame = 4 + num668; break; case 1: case 10: num668 = this.frameCounter / 8; this.frame = 14 + num668; break; case 2: case 11: num668 = this.frameCounter / 3; if (num668 >= 4) { num668 -= 4; } this.frame = 0x11 + num668; break; } } if ((this.ai[0] == 2f) && (Main.rand.Next(2) == 0)) { for (int num669 = 0; num669 < 4; num669++) { if (Main.rand.Next(2) != 0) { int num670 = Utils.SelectRandom<int>(Main.rand, new int[] { 0xe2, 0xe4, 0x4b }); color5 = new Color(); int num671 = Dust.NewDust(base.Center, 0, 0, num670, 0f, 0f, 0, color5, 1f); Dust dust2 = Main.dust[num671]; vector240 = new Vector2(); vector240 = new Vector2(); Vector2 vector67 = Vector2.One.RotatedBy(((double)(num669 * 1.570796f)), vector240).RotatedBy((double)this.rotation, vector240); dust2.position = base.Center + ((Vector2)(vector67 * 10f)); dust2.velocity = (Vector2)(vector67 * 1f); dust2.scale = 0.3f + (Main.rand.NextFloat() * 0.5f); dust2.noGravity = true; dust2.customData = this; dust2.noLight = true; } } } } if ((this.ai[1] > 0f) && ((this.type == 0x183) || (this.type == 0x184))) { this.ai[1] += Main.rand.Next(1, 4); } if ((this.ai[1] > 90f) && (this.type == 0x183)) { this.ai[1] = 0f; this.netUpdate = true; } if ((this.ai[1] > 40f) && (this.type == 0x184)) { this.ai[1] = 0f; this.netUpdate = true; } if ((this.ai[1] > 0f) && (this.type == 0x215)) { this.ai[1]++; int num672 = 10; if (this.ai[1] > num672) { this.ai[1] = 0f; this.netUpdate = true; } } if ((this.ai[0] == 0f) && ((this.type == 0x183) || (this.type == 0x184))) { if (this.type == 0x183) { float num673 = 8f; int num674 = 0x185; if (flag25 && (this.ai[1] == 0f)) { this.ai[1]++; if ((Main.myPlayer == this.owner) && Collision.CanHitLine(base.position, base.width, base.height, vector63, 0, 0)) { Vector2 vector68 = vector63 - base.Center; vector68.Normalize(); vector68 = (Vector2)(vector68 * num673); int num675 = NewProjectile(base.Center.X, base.Center.Y, vector68.X, vector68.Y, num674, (int)(this.damage * 0.8f), 0f, Main.myPlayer, 0f, 0f); Main.projectile[num675].timeLeft = 300; this.netUpdate = true; } } } if (((this.type == 0x184) && (this.ai[1] == 0f)) && (flag25 && (num648 < 500f))) { this.ai[1]++; if (Main.myPlayer == this.owner) { this.ai[0] = 2f; Vector2 vector69 = vector63 - base.Center; vector69.Normalize(); base.velocity = (Vector2)(vector69 * 8f); this.netUpdate = true; return; } } return; } if ((this.type == 0x215) && (this.ai[0] < 3f)) { int num676 = 0; switch (((int)this.ai[0])) { case 0: case 3: case 6: num676 = 400; break; case 1: case 4: case 7: num676 = 400; break; case 2: case 5: case 8: num676 = 600; break; } if (((this.ai[1] == 0f) && flag25) && (num648 < num676)) { this.ai[1]++; if (Main.myPlayer != this.owner) { return; } if (this.localAI[0] >= 3f) { this.ai[0] += 4f; if (this.ai[0] == 6f) { this.ai[0] = 3f; } this.localAI[0] = 0f; return; } this.ai[0] += 6f; Vector2 vector70 = vector63 - base.Center; vector70.Normalize(); float num677 = (this.ai[0] == 8f) ? 12f : 10f; base.velocity = (Vector2)(vector70 * num677); this.netUpdate = true; } } } return; } if (this.aiStyle == 0x43) { Player player2 = Main.player[this.owner]; if (!player2.active) { base.active = false; return; } bool flag27 = ((this.type == 0x189) || (this.type == 0x18a)) || (this.type == 0x18b); if (flag27) { if (player2.dead) { player2.pirateMinion = false; } if (player2.pirateMinion) { this.timeLeft = 2; } } if (this.type == 500) { if (player2.dead) { player2.crimsonHeart = false; } if (player2.crimsonHeart) { this.timeLeft = 2; } } Vector2 vector71 = player2.Center; if (flag27) { vector71.X -= (15 + (player2.width / 2)) * player2.direction; vector71.X -= (this.minionPos * 40) * player2.direction; } if (this.type == 500) { vector71.X -= (15 + (player2.width / 2)) * player2.direction; vector71.X -= 40 * player2.direction; } if (this.type == 500) { Lighting.AddLight(base.Center, 0.9f, 0.1f, 0.3f); int num678 = 6; if ((this.frame == 0) || (this.frame == 2)) { num678 = 12; } if (++this.frameCounter >= num678) { this.frameCounter = 0; if (++this.frame >= Main.projFrames[this.type]) { this.frame = 0; } } this.rotation += this.velocity.X / 20f; vector240 = new Vector2(); Vector2 spinninpoint = -Vector2.UnitY.RotatedBy(((double)this.rotation), vector240).RotatedBy((double)(base.direction * 0.2f), new Vector2()); int num679 = Dust.NewDust((base.Center + ((Vector2)(spinninpoint * 10f))) - new Vector2(4f), 0, 0, 5, spinninpoint.X, spinninpoint.Y, 0, Color.Transparent, 1f); Main.dust[num679].scale = 1f; Main.dust[num679].velocity = (Vector2)(spinninpoint.RotatedByRandom(0.78539818525314331) * 3.5f); Main.dust[num679].noGravity = true; Main.dust[num679].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cLight, Main.player[this.owner]); } bool flag28 = true; if (this.type == 500) { flag28 = false; } int num680 = -1; float num681 = 450f; if (flag27) { num681 = 800f; } int num682 = 15; if ((this.ai[0] == 0f) && flag28) { for (int num683 = 0; num683 < 200; num683++) { NPC npc3 = Main.npc[num683]; if (npc3.CanBeChasedBy(this, false)) { vector240 = npc3.Center - base.Center; float num684 = vector240.Length(); if (num684 < num681) { num680 = num683; num681 = num684; } } } } if (this.ai[0] == 1f) { this.tileCollide = false; float num685 = 0.2f; float num686 = 10f; int num687 = 200; float introduced1798 = Math.Abs(player2.velocity.X); if (num686 < (introduced1798 + Math.Abs(player2.velocity.Y))) { float introduced1799 = Math.Abs(player2.velocity.X); num686 = introduced1799 + Math.Abs(player2.velocity.Y); } Vector2 vector73 = player2.Center - base.Center; float num688 = vector73.Length(); if (num688 > 2000f) { base.position = player2.Center - ((Vector2)(new Vector2((float)base.width, (float)base.height) / 2f)); } if (((num688 < num687) && (player2.velocity.Y == 0f)) && (((this.position.Y + base.height) <= (player2.position.Y + player2.height)) && !Collision.SolidCollision(base.position, base.width, base.height))) { this.ai[0] = 0f; this.netUpdate = true; if (this.velocity.Y < -6f) { this.velocity.Y = -6f; } } if (num688 >= 60f) { vector73.Normalize(); vector73 = (Vector2)(vector73 * num686); if (this.velocity.X < vector73.X) { this.velocity.X += num685; if (this.velocity.X < 0f) { this.velocity.X += num685 * 1.5f; } } if (this.velocity.X > vector73.X) { this.velocity.X -= num685; if (this.velocity.X > 0f) { this.velocity.X -= num685 * 1.5f; } } if (this.velocity.Y < vector73.Y) { this.velocity.Y += num685; if (this.velocity.Y < 0f) { this.velocity.Y += num685 * 1.5f; } } if (this.velocity.Y > vector73.Y) { this.velocity.Y -= num685; if (this.velocity.Y > 0f) { this.velocity.Y -= num685 * 1.5f; } } } if (this.velocity.X != 0f) { this.spriteDirection = Math.Sign(this.velocity.X); } if (flag27) { this.frameCounter++; if (this.frameCounter > 3) { this.frame++; this.frameCounter = 0; } if ((this.frame < 10) | (this.frame > 13)) { this.frame = 10; } this.rotation = this.velocity.X * 0.1f; } } if (this.ai[0] == 2f) { this.friendly = true; this.spriteDirection = base.direction; this.rotation = 0f; this.frame = 4 + ((num682 - ((int)this.ai[1])) / (num682 / 3)); if (this.velocity.Y != 0f) { this.frame += 3; } this.velocity.Y += 0.4f; if (this.velocity.Y > 10f) { this.velocity.Y = 10f; } this.ai[1]--; if (this.ai[1] <= 0f) { this.ai[1] = 0f; this.ai[0] = 0f; this.friendly = false; this.netUpdate = true; return; } } if (num680 >= 0) { float num689 = 400f; float num690 = 20f; if (flag27) { num689 = 700f; } if (this.position.Y > (Main.worldSurface * 16.0)) { num689 *= 0.7f; } NPC npc4 = Main.npc[num680]; Vector2 vector74 = npc4.Center; vector240 = vector74 - base.Center; float num691 = vector240.Length(); Collision.CanHit(base.position, base.width, base.height, npc4.position, npc4.width, npc4.height); if (num691 < num689) { vector71 = vector74; if ((vector74.Y < (base.Center.Y - 30f)) && (this.velocity.Y == 0f)) { float num692 = Math.Abs((float)(vector74.Y - base.Center.Y)); if (num692 < 120f) { this.velocity.Y = -10f; } else if (num692 < 210f) { this.velocity.Y = -13f; } else if (num692 < 270f) { this.velocity.Y = -15f; } else if (num692 < 310f) { this.velocity.Y = -17f; } else if (num692 < 380f) { this.velocity.Y = -18f; } } } if (num691 < num690) { this.ai[0] = 2f; this.ai[1] = num682; this.netUpdate = true; } } if ((this.ai[0] == 0f) && (num680 < 0)) { float num693 = 500f; if (this.type == 500) { num693 = 200f; } if (Main.player[this.owner].rocketDelay2 > 0) { this.ai[0] = 1f; this.netUpdate = true; } Vector2 vector75 = player2.Center - base.Center; if (vector75.Length() > 2000f) { base.position = player2.Center - ((Vector2)(new Vector2((float)base.width, (float)base.height) / 2f)); } else if ((vector75.Length() > num693) || (Math.Abs(vector75.Y) > 300f)) { this.ai[0] = 1f; this.netUpdate = true; if ((this.velocity.Y > 0f) && (vector75.Y < 0f)) { this.velocity.Y = 0f; } if ((this.velocity.Y < 0f) && (vector75.Y > 0f)) { this.velocity.Y = 0f; } } } if (this.ai[0] == 0f) { this.tileCollide = true; float num694 = 0.5f; float num695 = 4f; float num696 = 4f; float num697 = 0.1f; float introduced1800 = Math.Abs(player2.velocity.X); if (num696 < (introduced1800 + Math.Abs(player2.velocity.Y))) { float introduced1801 = Math.Abs(player2.velocity.X); num696 = introduced1801 + Math.Abs(player2.velocity.Y); num694 = 0.7f; } int num698 = 0; bool flag29 = false; float num699 = vector71.X - base.Center.X; if (Math.Abs(num699) > 5f) { if (num699 < 0f) { num698 = -1; if (this.velocity.X > -num695) { this.velocity.X -= num694; } else { this.velocity.X -= num697; } } else { num698 = 1; if (this.velocity.X < num695) { this.velocity.X += num694; } else { this.velocity.X += num697; } } flag29 = true; } else { this.velocity.X *= 0.9f; if (Math.Abs(this.velocity.X) < (num694 * 2f)) { this.velocity.X = 0f; } } if (num698 != 0) { int num700 = (((int)this.position.X) + (base.width / 2)) / 0x10; int num701 = ((int)this.position.Y) / 0x10; num700 += num698; num700 += (int)this.velocity.X; for (int num702 = num701; num702 < ((num701 + (base.height / 0x10)) + 1); num702++) { if (WorldGen.SolidTile(num700, num702)) { flag29 = true; } } } if ((this.type == 500) && (this.velocity.X != 0f)) { flag29 = true; } Collision.StepUp(ref this.position, ref this.velocity, base.width, base.height, ref this.stepSpeed, ref this.gfxOffY, 1, false, 0); if ((this.velocity.Y == 0f) && flag29) { for (int num703 = 0; num703 < 3; num703++) { int num704 = (((int)this.position.X) + (base.width / 2)) / 0x10; switch (num703) { case 0: num704 = ((int)this.position.X) / 0x10; break; case 2: num704 = (((int)this.position.X) + base.width) / 0x10; break; } int num705 = ((((int)this.position.Y) + base.height) / 0x10) + 1; if ((WorldGen.SolidTile(num704, num705) || Main.tile[num704, num705].halfBrick()) || (Main.tile[num704, num705].slope() > 0)) { try { num704 = (((int)this.position.X) + (base.width / 2)) / 0x10; num705 = (((int)this.position.Y) + (base.height / 2)) / 0x10; num704 += num698; num704 += (int)this.velocity.X; if (!WorldGen.SolidTile(num704, num705 - 1) && !WorldGen.SolidTile(num704, num705 - 2)) { this.velocity.Y = -5.1f; } else if (!WorldGen.SolidTile(num704, num705 - 2)) { this.velocity.Y = -7.1f; } else if (WorldGen.SolidTile(num704, num705 - 5)) { this.velocity.Y = -11.1f; } else if (WorldGen.SolidTile(num704, num705 - 4)) { this.velocity.Y = -10.1f; } else { this.velocity.Y = -9.1f; } } catch { this.velocity.Y = -9.1f; } } } } if (this.velocity.X > num696) { this.velocity.X = num696; } if (this.velocity.X < -num696) { this.velocity.X = -num696; } if (this.velocity.X < 0f) { base.direction = -1; } if (this.velocity.X > 0f) { base.direction = 1; } if ((this.velocity.X > num694) && (num698 == 1)) { base.direction = 1; } if ((this.velocity.X < -num694) && (num698 == -1)) { base.direction = -1; } this.spriteDirection = base.direction; if (flag27) { this.rotation = 0f; if (this.velocity.Y == 0f) { if (this.velocity.X == 0f) { this.frame = 0; this.frameCounter = 0; } else if (Math.Abs(this.velocity.X) >= 0.5f) { this.frameCounter += (int)Math.Abs(this.velocity.X); this.frameCounter++; if (this.frameCounter > 10) { this.frame++; this.frameCounter = 0; } if (this.frame >= 4) { this.frame = 0; } } else { this.frame = 0; this.frameCounter = 0; } } else if (this.velocity.Y != 0f) { this.frameCounter = 0; this.frame = 14; } } this.velocity.Y += 0.4f; if (this.velocity.Y > 10f) { this.velocity.Y = 10f; } } if (flag27) { this.localAI[0]++; if (this.velocity.X == 0f) { this.localAI[0]++; } if (this.localAI[0] >= Main.rand.Next(900, 0x4b0)) { this.localAI[0] = 0f; for (int num706 = 0; num706 < 6; num706++) { color5 = new Color(); int num707 = Dust.NewDust((Vector2)(((base.Center + ((Vector2.UnitX * -base.direction) * 8f)) - (Vector2.One * 5f)) + (Vector2.UnitY * 8f)), 3, 6, 0xd8, (float)-base.direction, 1f, 0, color5, 1f); Dust dust208 = Main.dust[num707]; dust208.velocity = (Vector2)(dust208.velocity / 2f); Main.dust[num707].scale = 0.8f; } int num708 = Gore.NewGore(base.Center + ((Vector2)((Vector2.UnitX * -base.direction) * 8f)), Vector2.Zero, Main.rand.Next(580, 0x247), 1f); Gore gore15 = Main.gore[num708]; gore15.velocity = (Vector2)(gore15.velocity / 2f); Main.gore[num708].velocity.Y = Math.Abs(Main.gore[num708].velocity.Y); Main.gore[num708].velocity.X = -Math.Abs(Main.gore[num708].velocity.X) * base.direction; return; } } return; } if (this.aiStyle == 0x44) { this.rotation += 0.25f * base.direction; this.ai[0]++; if (this.ai[0] >= 3f) { this.alpha -= 40; if (this.alpha < 0) { this.alpha = 0; } } if (this.ai[0] >= 15f) { this.velocity.Y += 0.2f; if (this.velocity.Y > 16f) { this.velocity.Y = 16f; } this.velocity.X *= 0.99f; } if (this.alpha == 0) { Vector2 vector76 = new Vector2(4f, -8f); float rotation = this.rotation; if (base.direction == -1) { vector76.X = -4f; } vector240 = new Vector2(); vector76 = vector76.RotatedBy((double)rotation, vector240); for (int num710 = 0; num710 < 1; num710++) { color5 = new Color(); int num711 = Dust.NewDust((base.Center + vector76) - ((Vector2)(Vector2.One * 5f)), 4, 4, 6, 0f, 0f, 0, color5, 1f); Main.dust[num711].scale = 1.5f; Main.dust[num711].noGravity = true; Main.dust[num711].velocity = (Vector2)((Main.dust[num711].velocity * 0.25f) + (Vector2.Normalize(vector76) * 1f)); vector240 = new Vector2(); Main.dust[num711].velocity = Main.dust[num711].velocity.RotatedBy((double)(-1.570796f * base.direction), vector240); } } this.spriteDirection = base.direction; if ((this.owner == Main.myPlayer) && (this.timeLeft <= 3)) { this.tileCollide = false; this.alpha = 0xff; this.position.X += base.width / 2; this.position.Y += base.height / 2; base.width = 80; base.height = 80; this.position.X -= base.width / 2; this.position.Y -= base.height / 2; this.knockBack = 8f; } if (base.wet && (this.timeLeft > 3)) { this.timeLeft = 3; return; } return; } if (this.aiStyle == 0x45) { Vector2 v = Main.player[this.owner].Center - base.Center; this.rotation = v.ToRotation() - 1.57f; if (Main.player[this.owner].dead) { this.Kill(); return; } Main.player[this.owner].itemAnimation = 10; Main.player[this.owner].itemTime = 10; if (v.X < 0f) { Main.player[this.owner].ChangeDir(1); base.direction = 1; } else { Main.player[this.owner].ChangeDir(-1); base.direction = -1; } Main.player[this.owner].itemRotation = ((Vector2)((v * -1f) * base.direction)).ToRotation(); this.spriteDirection = (v.X > 0f) ? -1 : 1; if ((this.ai[0] == 0f) && (v.Length() > 400f)) { this.ai[0] = 1f; } if ((this.ai[0] == 1f) || (this.ai[0] == 2f)) { float num712 = v.Length(); if (num712 > 1500f) { this.Kill(); return; } if (num712 > 600f) { this.ai[0] = 2f; } this.tileCollide = false; float num713 = 20f; if (this.ai[0] == 2f) { num713 = 40f; } base.velocity = (Vector2)(Vector2.Normalize(v) * num713); if (v.Length() < num713) { this.Kill(); return; } } this.ai[1]++; if (this.ai[1] > 5f) { this.alpha = 0; } if (((((int)this.ai[1]) % 4) == 0) && (this.owner == Main.myPlayer)) { Vector2 vector78 = (Vector2)(v * -1f); vector78.Normalize(); vector78 = (Vector2)(vector78 * (Main.rand.Next(0x2d, 0x41) * 0.1f)); vector78 = vector78.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866, new Vector2()); NewProjectile(base.Center.X, base.Center.Y, vector78.X, vector78.Y, 0x195, this.damage, this.knockBack, this.owner, -10f, 0f); return; } return; } if (this.aiStyle == 70) { if (this.ai[0] == 0f) { float num714 = 500f; int num715 = -1; for (int num716 = 0; num716 < 200; num716++) { NPC npc5 = Main.npc[num716]; if (npc5.CanBeChasedBy(this, false) && Collision.CanHit(base.position, base.width, base.height, npc5.position, npc5.width, npc5.height)) { vector240 = npc5.Center - base.Center; float num717 = vector240.Length(); if (num717 < num714) { num715 = num716; num714 = num717; } } } this.ai[0] = num715 + 1; if (this.ai[0] == 0f) { this.ai[0] = -15f; } if (this.ai[0] > 0f) { float num718 = ((float)Main.rand.Next(0x23, 0x4b)) / 30f; base.velocity = (Vector2)(((base.velocity * 20f) + (Vector2.Normalize((Main.npc[((int)this.ai[0]) - 1].Center - base.Center) + new Vector2((float)Main.rand.Next(-100, 0x65), (float)Main.rand.Next(-100, 0x65))) * num718)) / 21f); this.netUpdate = true; } } else if (this.ai[0] > 0f) { Vector2 vector79 = Vector2.Normalize(Main.npc[((int)this.ai[0]) - 1].Center - base.Center); base.velocity = (Vector2)(((base.velocity * 40f) + (vector79 * 12f)) / 41f); } else { this.ai[0]++; this.alpha -= 0x19; if (this.alpha < 50) { this.alpha = 50; } base.velocity = (Vector2)(base.velocity * 0.95f); } if (this.ai[1] == 0f) { this.ai[1] = ((float)Main.rand.Next(80, 0x79)) / 100f; this.netUpdate = true; } this.scale = this.ai[1]; return; } if (this.aiStyle == 0x47) { this.localAI[1]++; if ((this.localAI[1] > 10f) && (Main.rand.Next(3) == 0)) { int num719 = 6; for (int num720 = 0; num720 < num719; num720++) { Vector2 vector80 = (Vector2)((Vector2.Normalize(base.velocity) * new Vector2((float)base.width, (float)base.height)) / 2f); vector240 = new Vector2(); vector80 = vector80.RotatedBy((((num720 - ((num719 / 2) - 1)) * 3.1415926535897931) / ((double)num719)), vector240) + base.Center; Vector2 vector81 = (((float)(Main.rand.NextDouble() * 3.1415927410125732)) - 1.570796f).ToRotationVector2() * Main.rand.Next(3, 8); color5 = new Color(); int num721 = Dust.NewDust(vector80 + vector81, 0, 0, 0xd9, vector81.X * 2f, vector81.Y * 2f, 100, color5, 1.4f); Main.dust[num721].noGravity = true; Main.dust[num721].noLight = true; Dust dust209 = Main.dust[num721]; dust209.velocity = (Vector2)(dust209.velocity / 4f); Dust dust210 = Main.dust[num721]; dust210.velocity -= base.velocity; } this.alpha -= 5; if (this.alpha < 50) { this.alpha = 50; } this.rotation += this.velocity.X * 0.1f; this.frame = ((int)(this.localAI[1] / 3f)) % 3; Lighting.AddLight(((int)base.Center.X) / 0x10, ((int)base.Center.Y) / 0x10, 0.1f, 0.4f, 0.6f); } int num722 = -1; Vector2 vector82 = base.Center; float num723 = 500f; if (this.localAI[0] > 0f) { this.localAI[0]--; } if ((this.ai[0] == 0f) && (this.localAI[0] == 0f)) { for (int num724 = 0; num724 < 200; num724++) { NPC npc6 = Main.npc[num724]; if (npc6.CanBeChasedBy(this, false) && ((this.ai[0] == 0f) || (this.ai[0] == (num724 + 1)))) { Vector2 vector83 = npc6.Center; float num725 = Vector2.Distance(vector83, vector82); if ((num725 < num723) && Collision.CanHit(base.position, base.width, base.height, npc6.position, npc6.width, npc6.height)) { num723 = num725; vector82 = vector83; num722 = num724; } } } if (num722 >= 0) { this.ai[0] = num722 + 1; this.netUpdate = true; } num722 = -1; } if ((this.localAI[0] == 0f) && (this.ai[0] == 0f)) { this.localAI[0] = 30f; } bool flag30 = false; if (this.ai[0] != 0f) { int num726 = (int)(this.ai[0] - 1f); if ((Main.npc[num726].active && !Main.npc[num726].dontTakeDamage) && (Main.npc[num726].immune[this.owner] == 0)) { float num727 = Main.npc[num726].position.X + (Main.npc[num726].width / 2); float num728 = Main.npc[num726].position.Y + (Main.npc[num726].height / 2); float introduced1807 = Math.Abs((float)((this.position.X + (base.width / 2)) - num727)); float num729 = introduced1807 + Math.Abs((float)((this.position.Y + (base.height / 2)) - num728)); if (num729 < 1000f) { flag30 = true; vector82 = Main.npc[num726].Center; } } else { this.ai[0] = 0f; flag30 = false; this.netUpdate = true; } } if (flag30) { Vector2 vector84 = vector82 - base.Center; float num730 = base.velocity.ToRotation(); double num732 = vector84.ToRotation() - num730; if (num732 > 3.1415926535897931) { num732 -= 6.2831853071795862; } if (num732 < -3.1415926535897931) { num732 += 6.2831853071795862; } base.velocity = base.velocity.RotatedBy(num732 * 0.10000000149011612, new Vector2()); } float num733 = this.velocity.Length(); this.velocity.Normalize(); base.velocity = (Vector2)(base.velocity * (num733 + 0.0025f)); return; } if (this.aiStyle == 0x48) { this.localAI[0]++; if (this.localAI[0] > 5f) { this.alpha -= 0x19; if (this.alpha < 50) { this.alpha = 50; } } base.velocity = (Vector2)(base.velocity * 0.96f); if (this.ai[1] == 0f) { this.ai[1] = ((float)Main.rand.Next(60, 0x79)) / 100f; this.netUpdate = true; } this.scale = this.ai[1]; base.position = base.Center; int num734 = 14; int num735 = 14; base.width = (int)(num734 * this.ai[1]); base.height = (int)(num735 * this.ai[1]); base.position -= new Vector2((float)(base.width / 2), (float)(base.height / 2)); return; } if (this.aiStyle == 0x49) { int num736 = (int)this.ai[0]; int num737 = (int)this.ai[1]; Tile tile = Main.tile[num736, num737]; if (((tile == null) || !tile.active()) || (tile.type != 0x152)) { this.Kill(); return; } float num738 = 2f; float num739 = ((float)this.timeLeft) / 60f; if (num739 < 1f) { num738 *= num739; } if (this.type == 0x1a3) { for (int num740 = 0; num740 < 2; num740++) { Vector2 vector85 = new Vector2(0f, -num738); vector85 = (Vector2)(vector85 * (0.85f + (((float)Main.rand.NextDouble()) * 0.2f))); vector240 = new Vector2(); vector85 = vector85.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866, vector240); color5 = new Color(); int num741 = Dust.NewDust(base.position, base.width, base.height, 0xde, 0f, 0f, 100, color5, 1f); Dust dust3 = Main.dust[num741]; dust3.scale = 1f + (((float)Main.rand.NextDouble()) * 0.3f); dust3.velocity = (Vector2)(dust3.velocity * 0.5f); if (dust3.velocity.Y > 0f) { dust3.velocity.Y *= -1f; } dust3.position -= new Vector2((float)(2 + Main.rand.Next(-2, 3)), 0f); dust3.velocity += vector85; dust3.scale = 0.6f; dust3.fadeIn = dust3.scale + 0.2f; dust3.velocity.Y *= 2f; } } if (this.type == 420) { for (int num742 = 0; num742 < 2; num742++) { Vector2 vector86 = new Vector2(0f, -num738); vector86 = (Vector2)(vector86 * (0.85f + (((float)Main.rand.NextDouble()) * 0.2f))); vector240 = new Vector2(); vector86 = vector86.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866, vector240); int num743 = 0xdb; if (Main.rand.Next(5) == 0) { num743 = 0xde; } color5 = new Color(); int num744 = Dust.NewDust(base.position, base.width, base.height, num743, 0f, 0f, 100, color5, 1f); Dust dust4 = Main.dust[num744]; dust4.scale = 1f + (((float)Main.rand.NextDouble()) * 0.3f); dust4.velocity = (Vector2)(dust4.velocity * 0.5f); if (dust4.velocity.Y > 0f) { dust4.velocity.Y *= -1f; } dust4.position -= new Vector2((float)(2 + Main.rand.Next(-2, 3)), 0f); dust4.velocity += vector86; dust4.velocity.X *= 0.5f; dust4.scale = 0.6f; dust4.fadeIn = dust4.scale + 0.2f; dust4.velocity.Y *= 2f; } } if (this.type == 0x1a5) { for (int num745 = 0; num745 < 2; num745++) { Vector2 vector87 = new Vector2(0f, -num738); vector87 = (Vector2)(vector87 * (0.85f + (((float)Main.rand.NextDouble()) * 0.2f))); vector240 = new Vector2(); vector87 = vector87.RotatedBy((Main.rand.NextDouble() - 0.5) * 0.78539818525314331, vector240); color5 = new Color(); int num746 = Dust.NewDust(base.position, base.width, base.height, 0xdd, 0f, 0f, 100, color5, 1f); Dust dust5 = Main.dust[num746]; dust5.scale = 1f + (((float)Main.rand.NextDouble()) * 0.3f); dust5.velocity = (Vector2)(dust5.velocity * 0.1f); if (dust5.velocity.Y > 0f) { dust5.velocity.Y *= -1f; } dust5.position -= new Vector2((float)(2 + Main.rand.Next(-2, 3)), 0f); dust5.velocity += vector87; dust5.scale = 0.6f; dust5.fadeIn = dust5.scale + 0.2f; dust5.velocity.Y *= 2.5f; } if ((this.timeLeft % 10) == 0) { float num747 = 0.85f + (((float)Main.rand.NextDouble()) * 0.2f); for (int num748 = 0; num748 < 9; num748++) { Vector2 vector88 = new Vector2(((float)(num748 - 4)) / 5f, -num738 * num747); color5 = new Color(); int num749 = Dust.NewDust(base.position, base.width, base.height, 0xde, 0f, 0f, 100, color5, 1f); Dust dust6 = Main.dust[num749]; dust6.scale = 0.7f + (((float)Main.rand.NextDouble()) * 0.3f); dust6.velocity = (Vector2)(dust6.velocity * 0f); if (dust6.velocity.Y > 0f) { dust6.velocity.Y *= -1f; } dust6.position -= new Vector2((float)(2 + Main.rand.Next(-2, 3)), 0f); dust6.velocity += vector88; dust6.scale = 0.6f; dust6.fadeIn = dust6.scale + 0.2f; dust6.velocity.Y *= 2f; } } } if (this.type == 0x1a6) { for (int num750 = 0; num750 < 2; num750++) { Vector2 vector89 = new Vector2(0f, -num738); vector89 = (Vector2)(vector89 * (0.85f + (((float)Main.rand.NextDouble()) * 0.2f))); vector240 = new Vector2(); vector89 = vector89.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866, vector240); color5 = new Color(); int num751 = Dust.NewDust(base.position, base.width, base.height, 0xdb + Main.rand.Next(5), 0f, 0f, 100, color5, 1f); Dust dust7 = Main.dust[num751]; dust7.scale = 1f + (((float)Main.rand.NextDouble()) * 0.3f); dust7.velocity = (Vector2)(dust7.velocity * 0.5f); if (dust7.velocity.Y > 0f) { dust7.velocity.Y *= -1f; } dust7.position -= new Vector2((float)(2 + Main.rand.Next(-2, 3)), 0f); dust7.velocity += vector89; dust7.scale = 0.6f; dust7.fadeIn = dust7.scale + 0.2f; dust7.velocity.Y *= 2f; } return; } return; } if (this.aiStyle == 0x4a) { if (this.extraUpdates == 1) { this.localAI[0] *= this.localAI[1]; this.localAI[1] -= 0.001f; if (this.localAI[0] < 0.01) { this.Kill(); return; } } return; } if (this.aiStyle == 0x4b) { this.AI_075(); return; } if (this.aiStyle == 0x4c) { Player mountedPlayer = Main.player[this.owner]; mountedPlayer.heldProj = base.whoAmI; if (this.type == 0x1b9) { if (mountedPlayer.mount.Type != 9) { this.Kill(); return; } } else if ((this.type == 0x1c5) && (mountedPlayer.mount.Type != 8)) { this.Kill(); return; } if (Main.myPlayer != this.owner) { this.position.X = mountedPlayer.position.X + this.ai[0]; this.position.Y = mountedPlayer.position.Y + this.ai[1]; if (this.type == 0x1b9) { if (!mountedPlayer.mount.AbilityCharging) { mountedPlayer.mount.StartAbilityCharge(mountedPlayer); } } else if ((this.type == 0x1c5) && !mountedPlayer.mount.AbilityActive) { mountedPlayer.mount.UseAbility(mountedPlayer, base.position, false); } mountedPlayer.mount.AimAbility(mountedPlayer, base.position); return; } this.position.X = Main.screenPosition.X + Main.mouseX; this.position.Y = Main.screenPosition.Y + Main.mouseY; if ((this.ai[0] != (this.position.X - mountedPlayer.position.X)) || (this.ai[1] != (this.position.Y - mountedPlayer.position.Y))) { this.netUpdate = true; } this.ai[0] = this.position.X - mountedPlayer.position.X; this.ai[1] = this.position.Y - mountedPlayer.position.Y; mountedPlayer.mount.AimAbility(mountedPlayer, base.position); if (!mountedPlayer.channel) { mountedPlayer.mount.UseAbility(mountedPlayer, base.position, false); this.Kill(); return; } return; } if (this.aiStyle == 0x4d) { if (this.ai[1] == 1f) { this.friendly = false; if (this.alpha < 0xff) { this.alpha += 0x33; } if (this.alpha >= 0xff) { this.alpha = 0xff; this.Kill(); return; } } else { if (this.alpha > 0) { this.alpha -= 50; } if (this.alpha < 0) { this.alpha = 0; } } float num752 = 30f; float num753 = num752 * 4f; this.ai[0]++; if (this.ai[0] > num753) { this.ai[0] = 0f; } Vector2 vector90 = -Vector2.UnitY.RotatedBy(((double)((6.283185f * this.ai[0]) / num752)), new Vector2()); float num754 = 0.75f + (vector90.Y * 0.25f); float num755 = 0.8f - (vector90.Y * 0.2f); float num756 = Math.Max(num754, num755); base.position += (Vector2)(new Vector2((float)base.width, (float)base.height) / 2f); base.width = base.height = (int)(80f * num756); base.position -= (Vector2)(new Vector2((float)base.width, (float)base.height) / 2f); this.frameCounter++; if (this.frameCounter >= 3) { this.frameCounter = 0; this.frame++; if (this.frame >= 4) { this.frame = 0; } } for (int num757 = 0; num757 < 1; num757++) { float num758 = 55f * num756; float num759 = 11f * num756; float num760 = 0.5f; color5 = new Color(); int num761 = Dust.NewDust(base.position, base.width, base.height, 0xe2, 0f, 0f, 100, color5, 0.5f); Main.dust[num761].noGravity = true; Dust dust211 = Main.dust[num761]; dust211.velocity = (Vector2)(dust211.velocity * 2f); Main.dust[num761].position = ((Vector2)((((float)Main.rand.NextDouble()) * 6.283185f).ToRotationVector2() * (num759 + ((num760 * ((float)Main.rand.NextDouble())) * num758)))) + base.Center; Main.dust[num761].velocity = ((Vector2)(Main.dust[num761].velocity / 2f)) + Vector2.Normalize(Main.dust[num761].position - base.Center); if (Main.rand.Next(2) == 0) { color5 = new Color(); num761 = Dust.NewDust(base.position, base.width, base.height, 0xe2, 0f, 0f, 100, color5, 0.9f); Main.dust[num761].noGravity = true; Dust dust212 = Main.dust[num761]; dust212.velocity = (Vector2)(dust212.velocity * 1.2f); Main.dust[num761].position = ((Vector2)((((float)Main.rand.NextDouble()) * 6.283185f).ToRotationVector2() * (num759 + ((num760 * ((float)Main.rand.NextDouble())) * num758)))) + base.Center; Main.dust[num761].velocity = ((Vector2)(Main.dust[num761].velocity / 2f)) + Vector2.Normalize(Main.dust[num761].position - base.Center); } if (Main.rand.Next(4) == 0) { color5 = new Color(); num761 = Dust.NewDust(base.position, base.width, base.height, 0xe2, 0f, 0f, 100, color5, 0.7f); Main.dust[num761].noGravity = true; Dust dust213 = Main.dust[num761]; dust213.velocity = (Vector2)(dust213.velocity * 1.2f); Main.dust[num761].position = ((Vector2)((((float)Main.rand.NextDouble()) * 6.283185f).ToRotationVector2() * (num759 + ((num760 * ((float)Main.rand.NextDouble())) * num758)))) + base.Center; Main.dust[num761].velocity = ((Vector2)(Main.dust[num761].velocity / 2f)) + Vector2.Normalize(Main.dust[num761].position - base.Center); } } return; } if (this.aiStyle == 0x4e) { if (this.alpha > 0) { this.alpha -= 30; } if (this.alpha < 0) { this.alpha = 0; } Vector2 vector91 = this.ai[0].ToRotationVector2(); float num762 = base.velocity.ToRotation(); double num764 = vector91.ToRotation() - num762; if (num764 > 3.1415926535897931) { num764 -= 6.2831853071795862; } if (num764 < -3.1415926535897931) { num764 += 6.2831853071795862; } base.velocity = base.velocity.RotatedBy(num764 * 0.05000000074505806, new Vector2()); base.velocity = (Vector2)(base.velocity * 0.96f); this.rotation = base.velocity.ToRotation() - 1.570796f; if ((Main.myPlayer == this.owner) && (this.timeLeft > 60)) { this.timeLeft = 60; return; } return; } if (this.aiStyle == 0x4f) { bool flag31 = true; int num765 = ((int)this.ai[0]) - 1; if ((this.type == 0x1bf) && ((this.ai[0] == 0f) || ((!Main.npc[num765].active || (Main.npc[num765].type != 0x188)) && ((!Main.npc[num765].active || (Main.npc[num765].type != 0x18b)) || (((Main.npc[num765].ai[3] % 120f) < 60f) || (Main.npc[num765].ai[0] != 2f)))))) { flag31 = false; } if (!flag31) { this.Kill(); return; } NPC npc7 = Main.npc[num765]; float num766 = npc7.Center.Y + 46f; int num767 = ((int)npc7.Center.X) / 0x10; int num768 = ((int)num766) / 0x10; int num769 = 0; if ((!Main.tile[num767, num768].nactive() || !Main.tileSolid[Main.tile[num767, num768].type]) || Main.tileSolidTop[Main.tile[num767, num768].type]) { while ((num769 < 150) && ((num768 + num769) < Main.maxTilesY)) { int num770 = num768 + num769; if ((Main.tile[num767, num770].nactive() && Main.tileSolid[Main.tile[num767, num770].type]) && !Main.tileSolidTop[Main.tile[num767, num770].type]) { num769--; break; } num769++; } } else { num769 = 1; } this.position.X = npc7.Center.X - (base.width / 2); this.position.Y = num766; base.height = (num769 + 1) * 0x10; int num771 = ((int)this.position.Y) + base.height; if ((Main.tile[num767, num771 / 0x10].nactive() && Main.tileSolid[Main.tile[num767, num771 / 0x10].type]) && !Main.tileSolidTop[Main.tile[num767, num771 / 0x10].type]) { int num772 = num771 % 0x10; base.height -= num772 - 2; } if (this.type == 0x1bf) { for (int num773 = 0; num773 < 2; num773++) { color5 = new Color(); int num774 = Dust.NewDust(new Vector2(this.position.X, (this.position.Y + base.height) - 16f), base.width, 0x10, 0xe4, 0f, 0f, 0, color5, 1f); Main.dust[num774].noGravity = true; Dust dust214 = Main.dust[num774]; dust214.velocity = (Vector2)(dust214.velocity * 0.5f); Main.dust[num774].velocity.X -= num773 - ((npc7.velocity.X * 2f) / 3f); Main.dust[num774].scale = 2.8f; } if (Main.rand.Next(5) == 0) { int num775 = Dust.NewDust(new Vector2(((this.position.X + (base.width / 2)) - ((base.width / 2) * Math.Sign(npc7.velocity.X))) - 4f, (this.position.Y + base.height) - 16f), 4, 0x10, 0x1f, 0f, 0f, 100, new Color(), 1.5f); Dust dust215 = Main.dust[num775]; dust215.velocity = (Vector2)(dust215.velocity * 0.5f); Main.dust[num775].velocity.X -= npc7.velocity.X / 2f; Main.dust[num775].velocity.Y = -Math.Abs(Main.dust[num775].velocity.Y); } } if ((this.type == 0x1bf) && (++this.frameCounter >= 5)) { this.frameCounter = 0; if (++this.frame < 4) { return; } this.frame = 0; } return; } if (this.aiStyle == 80) { if ((this.ai[0] == 0f) && (this.ai[1] > 0f)) { this.ai[1]--; } else if ((this.ai[0] == 0f) && (this.ai[1] == 0f)) { this.ai[0] = 1f; this.ai[1] = Player.FindClosest(base.position, base.width, base.height); this.netUpdate = true; float num776 = this.velocity.Length(); base.velocity = (Vector2)(Vector2.Normalize(base.velocity) * (num776 + 4f)); for (int num777 = 0; num777 < 8; num777++) { Vector2 vector92 = (Vector2)(Vector2.UnitX * -8f); vector240 = new Vector2(); vector92 += -Vector2.UnitY.RotatedBy(((double)((num777 * 3.141593f) / 4f)), vector240) * new Vector2(2f, 8f); vector240 = new Vector2(); vector92 = vector92.RotatedBy((double)(this.rotation - 1.570796f), vector240); color5 = new Color(); int num778 = Dust.NewDust(base.Center, 0, 0, 0xe4, 0f, 0f, 0, color5, 1f); Main.dust[num778].scale = 1.5f; Main.dust[num778].noGravity = true; Main.dust[num778].position = base.Center + vector92; Main.dust[num778].velocity = (Vector2)(base.velocity * 0f); } } else if (this.ai[0] == 1f) { this.tileCollide = true; this.localAI[1]++; float num779 = 180f; float num780 = 0f; float num781 = 30f; if (this.localAI[1] == num779) { this.Kill(); return; } if ((this.localAI[1] >= num780) && (this.localAI[1] < (num780 + num781))) { Vector2 vector93 = Main.player[(int)this.ai[1]].Center - base.Center; float num782 = base.velocity.ToRotation(); double num784 = vector93.ToRotation() - num782; if (num784 > 3.1415926535897931) { num784 -= 6.2831853071795862; } if (num784 < -3.1415926535897931) { num784 += 6.2831853071795862; } vector240 = new Vector2(); base.velocity = base.velocity.RotatedBy(num784 * 0.20000000298023224, vector240); } if ((this.localAI[1] % 5f) == 0f) { for (int num785 = 0; num785 < 4; num785++) { Vector2 vector94 = (Vector2)(Vector2.UnitX * -8f); vector240 = new Vector2(); vector94 += -Vector2.UnitY.RotatedBy(((double)((num785 * 3.141593f) / 4f)), vector240) * new Vector2(2f, 4f); vector240 = new Vector2(); vector94 = vector94.RotatedBy((double)(this.rotation - 1.570796f), vector240); color5 = new Color(); int num786 = Dust.NewDust(base.Center, 0, 0, 0xe4, 0f, 0f, 0, color5, 1f); Main.dust[num786].scale = 1.5f; Main.dust[num786].noGravity = true; Main.dust[num786].position = base.Center + vector94; Main.dust[num786].velocity = (Vector2)(base.velocity * 0f); } } } this.rotation = base.velocity.ToRotation() + 1.570796f; if (++this.frameCounter >= 3) { this.frameCounter = 0; if (++this.frame >= 3) { this.frame = 0; } } for (int num787 = 0; num787 < (1f + this.ai[0]); num787++) { vector240 = new Vector2(); Vector2 vector95 = (Vector2)((Vector2.UnitY.RotatedBy(((double)this.rotation), vector240) * 8f) * (num787 + 1)); color5 = new Color(); int num788 = Dust.NewDust(base.Center, 0, 0, 0xe4, 0f, 0f, 0, color5, 1f); Main.dust[num788].position = base.Center + vector95; Main.dust[num788].scale = 1f; Main.dust[num788].noGravity = true; } for (int num789 = 0; num789 < 0xff; num789++) { Player player4 = Main.player[num789]; if ((player4.active && !player4.dead) && (Vector2.Distance(player4.Center, base.Center) <= 42f)) { this.Kill(); return; } } return; } if (this.aiStyle == 0x51) { int penetrate = this.penetrate; if (this.ai[0] == 0f) { this.tileCollide = true; this.localAI[0]++; if (this.localAI[0] > 7f) { int num791 = Utils.SelectRandom<int>(Main.rand, new int[] { 0xe2, 0xe5 }); Vector2 vector96 = base.Center; Vector2 vector97 = new Vector2(-16f, 16f); float scale = 1f; vector97 += new Vector2(-16f, 16f); vector97 = vector97.RotatedBy((double)this.rotation, new Vector2()); int num793 = 4; int num794 = Dust.NewDust((vector96 + vector97) + (Vector2.One * -num793), num793 * 2, num793 * 2, num791, 0f, 0f, 100, new Color(), scale); Dust dust216 = Main.dust[num794]; dust216.velocity = (Vector2)(dust216.velocity * 0.1f); if (Main.rand.Next(6) != 0) { Main.dust[num794].noGravity = true; } } float num795 = 0.01f; int num796 = 5; int num797 = num796 * 15; int num798 = 0; if (this.localAI[0] > 7f) { if (this.localAI[1] == 0f) { this.scale -= num795; this.alpha += num796; if (this.alpha > num797) { this.alpha = num797; this.localAI[1] = 1f; } } else if (this.localAI[1] == 1f) { this.scale += num795; this.alpha -= num796; if (this.alpha <= num798) { this.alpha = num798; this.localAI[1] = 0f; } } } this.rotation = base.velocity.ToRotation() + 0.7853982f; } else if ((this.ai[0] >= 1) && (this.ai[0] < (1 + penetrate))) { this.tileCollide = false; this.alpha += 15; base.velocity = (Vector2)(base.velocity * 0.98f); this.localAI[0] = 0f; if (this.alpha >= 0xff) { if (this.ai[0] == 1f) { this.Kill(); return; } int num799 = -1; Vector2 vector98 = base.Center; float num800 = 250f; for (int num801 = 0; num801 < 200; num801++) { NPC npc8 = Main.npc[num801]; if (npc8.CanBeChasedBy(this, false)) { Vector2 vector99 = npc8.Center; float num802 = Vector2.Distance(vector99, base.Center); if (num802 < num800) { num800 = num802; vector98 = vector99; num799 = num801; } } } if (num799 >= 0) { this.netUpdate = true; this.ai[0] += penetrate; base.position = (Vector2)((vector98 + ((((float)Main.rand.NextDouble()) * 6.283185f).ToRotationVector2() * 100f)) - (new Vector2((float)base.width, (float)base.height) / 2f)); base.velocity = (Vector2)(Vector2.Normalize(vector98 - base.Center) * 15f); this.rotation = base.velocity.ToRotation() + 0.7853982f; } else { this.Kill(); } } if (Main.rand.Next(3) == 0) { int num803 = Utils.SelectRandom<int>(Main.rand, new int[] { 0xe2, 0xe5 }); Vector2 vector100 = base.Center; Vector2 vector101 = new Vector2(-16f, 16f); vector101 = vector101 = vector101; float num804 = 0.6f; vector101 += new Vector2(-16f, 16f); vector101 = vector101.RotatedBy((double)this.rotation, new Vector2()); int num805 = 4; int num806 = Dust.NewDust((vector100 + vector101) + (Vector2.One * -num805), num805 * 2, num805 * 2, num803, 0f, 0f, 100, new Color(), num804); Dust dust217 = Main.dust[num806]; dust217.velocity = (Vector2)(dust217.velocity * 0.1f); Main.dust[num806].noGravity = true; } } else if ((this.ai[0] >= (1 + penetrate)) && (this.ai[0] < (1 + (penetrate * 2)))) { this.scale = 0.9f; this.tileCollide = false; this.rotation = base.velocity.ToRotation() + 0.7853982f; this.ai[1]++; if (this.ai[1] >= 15f) { this.alpha += 0x33; base.velocity = (Vector2)(base.velocity * 0.8f); if (this.alpha >= 0xff) { this.Kill(); } } else { this.alpha -= 0x7d; if (this.alpha < 0) { this.alpha = 0; } base.velocity = (Vector2)(base.velocity * 0.98f); } this.localAI[0]++; int num807 = Utils.SelectRandom<int>(Main.rand, new int[] { 0xe2, 0xe5 }); Vector2 vector102 = base.Center; Vector2 vector103 = new Vector2(-16f, 16f); float num808 = 0.6f; vector103 += new Vector2(-16f, 16f); vector103 = vector103.RotatedBy((double)this.rotation, new Vector2()); int num809 = 4; int num810 = Dust.NewDust((vector102 + vector103) + (Vector2.One * -num809), num809 * 2, num809 * 2, num807, 0f, 0f, 100, new Color(), num808); Dust dust218 = Main.dust[num810]; dust218.velocity = (Vector2)(dust218.velocity * 0.1f); Main.dust[num810].noGravity = true; } float num811 = ((float)this.alpha) / 255f; Lighting.AddLight(((int)base.Center.X) / 0x10, ((int)base.Center.Y) / 0x10, 0.3f * num811, 0.4f * num811, 1f * num811); return; } if (this.aiStyle == 0x52) { this.alpha -= 40; if (this.alpha < 0) { this.alpha = 0; } if (this.ai[0] == 0f) { this.localAI[0]++; if (this.localAI[0] >= 45f) { this.localAI[0] = 0f; this.ai[0] = 1f; this.ai[1] = -this.ai[1]; this.netUpdate = true; } this.velocity.X = base.velocity.RotatedBy(((double)this.ai[1]), new Vector2()).X; this.velocity.X = MathHelper.Clamp(this.velocity.X, -6f, 6f); this.velocity.Y -= 0.08f; if (this.velocity.Y > 0f) { this.velocity.Y -= 0.2f; } if (this.velocity.Y < -7f) { this.velocity.Y = -7f; } } else if (this.ai[0] == 1f) { this.localAI[0]++; if (this.localAI[0] >= 90f) { this.localAI[0] = 0f; this.ai[0] = 2f; this.ai[1] = Player.FindClosest(base.position, base.width, base.height); this.netUpdate = true; } this.velocity.X = base.velocity.RotatedBy(((double)this.ai[1]), new Vector2()).X; this.velocity.X = MathHelper.Clamp(this.velocity.X, -6f, 6f); this.velocity.Y -= 0.08f; if (this.velocity.Y > 0f) { this.velocity.Y -= 0.2f; } if (this.velocity.Y < -7f) { this.velocity.Y = -7f; } } else if (this.ai[0] == 2f) { Vector2 vector104 = Main.player[(int)this.ai[1]].Center - base.Center; if (vector104.Length() < 30f) { this.Kill(); return; } vector104.Normalize(); vector104 = (Vector2)(vector104 * 14f); vector104 = Vector2.Lerp(base.velocity, vector104, 0.6f); if (vector104.Y < 6f) { vector104.Y = 6f; } float num812 = 0.4f; if (this.velocity.X < vector104.X) { this.velocity.X += num812; if ((this.velocity.X < 0f) && (vector104.X > 0f)) { this.velocity.X += num812; } } else if (this.velocity.X > vector104.X) { this.velocity.X -= num812; if ((this.velocity.X > 0f) && (vector104.X < 0f)) { this.velocity.X -= num812; } } if (this.velocity.Y < vector104.Y) { this.velocity.Y += num812; if ((this.velocity.Y < 0f) && (vector104.Y > 0f)) { this.velocity.Y += num812; } } else if (this.velocity.Y > vector104.Y) { this.velocity.Y -= num812; if ((this.velocity.Y > 0f) && (vector104.Y < 0f)) { this.velocity.Y -= num812; } } } if (this.alpha < 40) { int num813 = Dust.NewDust(base.Center - ((Vector2)(Vector2.One * 5f)), 10, 10, 0xe5, -this.velocity.X / 3f, -this.velocity.Y / 3f, 150, Color.Transparent, 1.2f); Main.dust[num813].noGravity = true; } this.rotation = base.velocity.ToRotation() + 1.570796f; return; } if (this.aiStyle == 0x53) { if (this.alpha > 200) { this.alpha = 200; } this.alpha -= 5; if (this.alpha < 0) { this.alpha = 0; } float num814 = ((float)this.alpha) / 255f; this.scale = 1f - num814; if (this.ai[0] >= 0f) { this.ai[0]++; } if (this.ai[0] == -1f) { this.frame = 1; this.extraUpdates = 1; } else if (this.ai[0] < 30f) { base.position = (Main.npc[(int)this.ai[1]].Center - ((Vector2)(new Vector2((float)base.width, (float)base.height) / 2f))) - base.velocity; } else { base.velocity = (Vector2)(base.velocity * 0.96f); if (++this.frameCounter >= 6) { this.frameCounter = 0; if (++this.frame >= 2) { this.frame = 0; } } } if (this.alpha < 40) { for (int num815 = 0; num815 < 2; num815++) { float num816 = (((float)Main.rand.NextDouble()) * 1f) - 0.5f; if (num816 < -0.5f) { num816 = -0.5f; } if (num816 > 0.5f) { num816 = 0.5f; } vector240 = new Vector2(); vector240 = new Vector2(); Vector2 vector105 = new Vector2((-base.width * 0.65f) * this.scale, 0f).RotatedBy(((double)(num816 * 6.283185f)), vector240).RotatedBy((double)base.velocity.ToRotation(), vector240); int num817 = Dust.NewDust(base.Center - ((Vector2)(Vector2.One * 5f)), 10, 10, 0xe5, -this.velocity.X / 3f, -this.velocity.Y / 3f, 150, Color.Transparent, 0.7f); Main.dust[num817].velocity = Vector2.Zero; Main.dust[num817].position = base.Center + vector105; Main.dust[num817].noGravity = true; } return; } return; } if (this.aiStyle == 0x54) { Vector2? nullable = null; if (base.velocity.HasNaNs() || (base.velocity == Vector2.Zero)) { base.velocity = -Vector2.UnitY; } if (((this.type == 0x1c7) && Main.npc[(int)this.ai[1]].active) && (Main.npc[(int)this.ai[1]].type == 0x18c)) { Vector2 vector106 = new Vector2(27f, 59f); Vector2 vector107 = Utils.Vector2FromElipse(Main.npc[(int)this.ai[1]].localAI[0].ToRotationVector2(), (Vector2)(vector106 * Main.npc[(int)this.ai[1]].localAI[1])); base.position = (Main.npc[(int)this.ai[1]].Center + vector107) - ((Vector2)(new Vector2((float)base.width, (float)base.height) / 2f)); } else if (((this.type == 0x1c7) && Main.npc[(int)this.ai[1]].active) && (Main.npc[(int)this.ai[1]].type == 400)) { Vector2 vector108 = new Vector2(30f, 30f); Vector2 vector109 = Utils.Vector2FromElipse(Main.npc[(int)this.ai[1]].localAI[0].ToRotationVector2(), (Vector2)(vector108 * Main.npc[(int)this.ai[1]].localAI[1])); base.position = (Main.npc[(int)this.ai[1]].Center + vector109) - ((Vector2)(new Vector2((float)base.width, (float)base.height) / 2f)); } else if (((this.type == 0x219) && Main.npc[(int)this.ai[1]].active) && (Main.npc[(int)this.ai[1]].type == 0x19b)) { Vector2 vector110 = new Vector2((float)(Main.npc[(int)this.ai[1]].direction * 6), -4f); base.position = ((Main.npc[(int)this.ai[1]].Center + vector110) - ((Vector2)(base.Size / 2f))) + new Vector2(0f, -Main.npc[(int)this.ai[1]].gfxOffY); } else if (((this.type == 0x1cd) && Main.projectile[(int)this.ai[1]].active) && (Main.projectile[(int)this.ai[1]].type == 460)) { Vector2 vector111 = Vector2.Normalize(Main.projectile[(int)this.ai[1]].velocity); base.position = ((Vector2)((Main.projectile[(int)this.ai[1]].Center + (vector111 * 16f)) - (new Vector2((float)base.width, (float)base.height) / 2f))) + new Vector2(0f, -Main.projectile[(int)this.ai[1]].gfxOffY); base.velocity = Vector2.Normalize(Main.projectile[(int)this.ai[1]].velocity); } else if (((this.type == 0x282) && Main.projectile[(int)this.ai[1]].active) && (Main.projectile[(int)this.ai[1]].type == 0x281)) { base.Center = Main.projectile[(int)this.ai[1]].Center; base.velocity = Vector2.Normalize(Main.projectile[(int)this.ai[1]].ai[1].ToRotationVector2()); } else if (((this.type == 0x278) && Main.projectile[(int)this.ai[1]].active) && (Main.projectile[(int)this.ai[1]].type == 0x279)) { float num818 = ((int)this.ai[0]) - 2.5f; Vector2 vector112 = Vector2.Normalize(Main.projectile[(int)this.ai[1]].velocity); Projectile projectile = Main.projectile[(int)this.ai[1]]; float num819 = num818 * 0.5235988f; float num820 = 20f; Vector2 vector113 = Vector2.Zero; float num821 = 1f; float num822 = 15f; float num823 = -2f; if (projectile.ai[0] < 180f) { num821 = 1f - (projectile.ai[0] / 180f); num822 = 20f - ((projectile.ai[0] / 180f) * 14f); if (projectile.ai[0] < 120f) { num820 = 20f - (4f * (projectile.ai[0] / 120f)); this.Opacity = (projectile.ai[0] / 120f) * 0.4f; } else { num820 = 16f - (10f * ((projectile.ai[0] - 120f) / 60f)); this.Opacity = 0.4f + (((projectile.ai[0] - 120f) / 60f) * 0.6f); } num823 = -22f + ((projectile.ai[0] / 180f) * 20f); } else { num821 = 0f; num820 = 1.75f; num822 = 6f; this.Opacity = 1f; num823 = -2f; } float num824 = ((projectile.ai[0] + (num818 * num820)) / (num820 * 6f)) * 6.283185f; vector240 = new Vector2(); num819 = (Vector2.UnitY.RotatedBy(((double)num824), vector240).Y * 0.5235988f) * num821; vector240 = new Vector2(); vector240 = new Vector2(); vector113 = (Vector2.UnitY.RotatedBy(((double)num824), vector240) * new Vector2(4f, num822)).RotatedBy((double)projectile.velocity.ToRotation(), vector240); base.position = ((Vector2)((projectile.Center + (vector112 * 16f)) - (base.Size / 2f))) + new Vector2(0f, -Main.projectile[(int)this.ai[1]].gfxOffY); base.position += (Vector2)(projectile.velocity.ToRotation().ToRotationVector2() * num823); base.position += vector113; vector240 = new Vector2(); base.velocity = Vector2.Normalize(projectile.velocity).RotatedBy((double)num819, vector240); this.scale = 1.4f * (1f - num821); this.damage = projectile.damage; if (projectile.ai[0] >= 180f) { this.damage *= 3; nullable = new Vector2?(projectile.Center); } if (!Collision.CanHitLine(Main.player[this.owner].Center, 0, 0, projectile.Center, 0, 0)) { nullable = new Vector2?(Main.player[this.owner].Center); } this.friendly = projectile.ai[0] > 30f; } else { this.Kill(); return; } if (base.velocity.HasNaNs() || (base.velocity == Vector2.Zero)) { base.velocity = -Vector2.UnitY; } if (this.type == 0x1cd) { this.ai[0]++; if (this.ai[0] >= 300f) { this.Kill(); return; } this.scale = ((float)Math.Sin((double)((this.ai[0] * 3.141593f) / 300f))) * 10f; if (this.scale > 1f) { this.scale = 1f; } } if (this.type == 0x1c7) { if (this.localAI[0] == 0f) { Main.PlaySound(0x1d, (int)this.position.X, (int)this.position.Y, 0x68); } float num825 = 1f; if (Main.npc[(int)this.ai[1]].type == 400) { num825 = 0.4f; } this.localAI[0]++; if (this.localAI[0] >= 180f) { this.Kill(); return; } this.scale = (((float)Math.Sin((double)((this.localAI[0] * 3.141593f) / 180f))) * 10f) * num825; if (this.scale > num825) { this.scale = num825; } } if (this.type == 0x282) { float num826 = 1f; this.localAI[0]++; if (this.localAI[0] >= 50f) { this.Kill(); return; } this.scale = (((float)Math.Sin((double)((this.localAI[0] * 3.141593f) / 50f))) * 10f) * num826; if (this.scale > num826) { this.scale = num826; } } if (this.type == 0x219) { float num827 = 0.8f; this.localAI[0]++; if (this.localAI[0] >= 60f) { this.Kill(); return; } this.scale = (((float)Math.Sin((double)((this.localAI[0] * 3.141593f) / 60f))) * 10f) * num827; if (this.scale > num827) { this.scale = num827; } } float f = base.velocity.ToRotation(); if (this.type == 0x1c7) { f += this.ai[0]; } this.rotation = f - 1.570796f; base.velocity = f.ToRotationVector2(); float num829 = 0f; float width = 0f; Vector2 vector114 = base.Center; if (nullable.HasValue) { vector114 = nullable.Value; } if (this.type == 0x1c7) { num829 = 3f; width = base.width; } else if (this.type == 0x1cd) { num829 = 2f; width = 0f; } else if (this.type == 0x282) { num829 = 2f; width = 0f; } else if (this.type == 0x278) { num829 = 2f; width = 0f; } else if (this.type == 0x219) { num829 = 2f; width = 0f; } float[] numArray3 = new float[(int)num829]; for (int num831 = 0; num831 < num829; num831++) { Tuple<int, int> tuple; float num832 = ((float)num831) / (num829 - 1f); vector240 = new Vector2(); Vector2 vector115 = vector114 + ((Vector2)(((base.velocity.RotatedBy(1.5707963705062866, vector240) * (num832 - 0.5f)) * width) * this.scale)); int num833 = ((int)vector115.X) / 0x10; int num834 = ((int)vector115.Y) / 0x10; Vector2 vector116 = vector115 + ((Vector2)((base.velocity * 16f) * 150f)); int num835 = ((int)vector116.X) / 0x10; int num836 = ((int)vector116.Y) / 0x10; float num837 = 0f; if (!Collision.TupleHitLine(num833, num834, num835, num836, 0, 0, new System.Collections.Generic.List<Tuple<int, int>>(), out tuple)) { vector240 = new Vector2((float)Math.Abs((int)(num833 - tuple.Item1)), (float)Math.Abs((int)(num834 - tuple.Item2))); num837 = vector240.Length() * 16f; } else if ((tuple.Item1 == num835) && (tuple.Item2 == num836)) { num837 = 2400f; } else { vector240 = new Vector2((float)Math.Abs((int)(num833 - tuple.Item1)), (float)Math.Abs((int)(num834 - tuple.Item2))); num837 = vector240.Length() * 16f; } numArray3[num831] = num837; } float num838 = 0f; for (int num839 = 0; num839 < numArray3.Length; num839++) { num838 += numArray3[num839]; } num838 /= num829; float amount = 0.5f; if (this.type == 0x278) { amount = 0.75f; } this.localAI[1] = MathHelper.Lerp(this.localAI[1], num838, amount); if (this.type == 0x1c7) { Vector2 vector117 = base.Center + ((Vector2)(base.velocity * (this.localAI[1] - 14f))); for (int num841 = 0; num841 < 2; num841++) { float num842 = base.velocity.ToRotation() + (((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.570796f); float num843 = (((float)Main.rand.NextDouble()) * 2f) + 2f; Vector2 vector118 = new Vector2(((float)Math.Cos((double)num842)) * num843, ((float)Math.Sin((double)num842)) * num843); color5 = new Color(); int num844 = Dust.NewDust(vector117, 0, 0, 0xe5, vector118.X, vector118.Y, 0, color5, 1f); Main.dust[num844].noGravity = true; Main.dust[num844].scale = 1.7f; } if (Main.rand.Next(5) == 0) { vector240 = new Vector2(); Vector2 vector119 = (Vector2)((base.velocity.RotatedBy(1.5707963705062866, vector240) * (((float)Main.rand.NextDouble()) - 0.5f)) * base.width); color5 = new Color(); int num845 = Dust.NewDust((vector117 + vector119) - ((Vector2)(Vector2.One * 4f)), 8, 8, 0x1f, 0f, 0f, 100, color5, 1.5f); Dust dust219 = Main.dust[num845]; dust219.velocity = (Vector2)(dust219.velocity * 0.5f); Main.dust[num845].velocity.Y = -Math.Abs(Main.dust[num845].velocity.Y); } DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f); Utils.PlotTileLine(base.Center, base.Center + ((Vector2)(base.velocity * this.localAI[1])), base.width * this.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); } else if (this.type == 0x282) { Vector2 vector120 = base.Center + ((Vector2)(base.velocity * (this.localAI[1] - 14f))); for (int num846 = 0; num846 < 2; num846++) { float num847 = base.velocity.ToRotation() + (((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.570796f); float num848 = (((float)Main.rand.NextDouble()) * 2f) + 2f; Vector2 vector121 = new Vector2(((float)Math.Cos((double)num847)) * num848, ((float)Math.Sin((double)num847)) * num848); color5 = new Color(); int num849 = Dust.NewDust(vector120, 0, 0, 0xe5, vector121.X, vector121.Y, 0, color5, 1f); Main.dust[num849].noGravity = true; Main.dust[num849].scale = 1.7f; } if (Main.rand.Next(5) == 0) { vector240 = new Vector2(); Vector2 vector122 = (Vector2)((base.velocity.RotatedBy(1.5707963705062866, vector240) * (((float)Main.rand.NextDouble()) - 0.5f)) * base.width); color5 = new Color(); int num850 = Dust.NewDust((vector120 + vector122) - ((Vector2)(Vector2.One * 4f)), 8, 8, 0x1f, 0f, 0f, 100, color5, 1.5f); Dust dust220 = Main.dust[num850]; dust220.velocity = (Vector2)(dust220.velocity * 0.5f); Main.dust[num850].velocity.Y = -Math.Abs(Main.dust[num850].velocity.Y); } DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f); Utils.PlotTileLine(base.Center, base.Center + ((Vector2)(base.velocity * this.localAI[1])), base.width * this.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); } if (this.type == 0x1cd) { Vector2 vector123 = base.Center + ((Vector2)(base.velocity * (this.localAI[1] - 8f))); for (int num851 = 0; num851 < 2; num851++) { float num852 = base.velocity.ToRotation() + (((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.570796f); float num853 = (((float)Main.rand.NextDouble()) * 0.8f) + 1f; Vector2 vector124 = new Vector2(((float)Math.Cos((double)num852)) * num853, ((float)Math.Sin((double)num852)) * num853); color5 = new Color(); int num854 = Dust.NewDust(vector123, 0, 0, 0xe2, vector124.X, vector124.Y, 0, color5, 1f); Main.dust[num854].noGravity = true; Main.dust[num854].scale = 1.2f; } if (Main.rand.Next(5) == 0) { vector240 = new Vector2(); Vector2 vector125 = (Vector2)((base.velocity.RotatedBy(1.5707963705062866, vector240) * (((float)Main.rand.NextDouble()) - 0.5f)) * base.width); color5 = new Color(); int num855 = Dust.NewDust((vector123 + vector125) - ((Vector2)(Vector2.One * 4f)), 8, 8, 0x1f, 0f, 0f, 100, color5, 1.5f); Dust dust221 = Main.dust[num855]; dust221.velocity = (Vector2)(dust221.velocity * 0.5f); Main.dust[num855].velocity.Y = -Math.Abs(Main.dust[num855].velocity.Y); } DelegateMethods.v3_1 = new Vector3(0.4f, 0.85f, 0.9f); Utils.PlotTileLine(base.Center, base.Center + ((Vector2)(base.velocity * this.localAI[1])), base.width * this.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); } if (this.type == 0x219) { Vector2 vector126 = base.Center + ((Vector2)(base.velocity * (this.localAI[1] - 8f))); for (int num856 = 0; num856 < 2; num856++) { float num857 = base.velocity.ToRotation() + (((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.570796f); float num858 = (((float)Main.rand.NextDouble()) * 0.8f) + 1f; Vector2 vector127 = new Vector2(((float)Math.Cos((double)num857)) * num858, ((float)Math.Sin((double)num857)) * num858); color5 = new Color(); int num859 = Dust.NewDust(vector126, 0, 0, 0xe2, vector127.X, vector127.Y, 0, color5, 1f); Main.dust[num859].noGravity = true; Main.dust[num859].scale = 1.2f; } if (Main.rand.Next(5) == 0) { vector240 = new Vector2(); Vector2 vector128 = (Vector2)((base.velocity.RotatedBy(1.5707963705062866, vector240) * (((float)Main.rand.NextDouble()) - 0.5f)) * base.width); color5 = new Color(); int num860 = Dust.NewDust((vector126 + vector128) - ((Vector2)(Vector2.One * 4f)), 8, 8, 0x1f, 0f, 0f, 100, color5, 1.5f); Dust dust222 = Main.dust[num860]; dust222.velocity = (Vector2)(dust222.velocity * 0.5f); Main.dust[num860].velocity.Y = -Math.Abs(Main.dust[num860].velocity.Y); } DelegateMethods.v3_1 = new Vector3(0.4f, 0.85f, 0.9f); Utils.PlotTileLine(base.Center, base.Center + ((Vector2)(base.velocity * this.localAI[1])), base.width * this.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); } if (((this.type == 0x278) && (Math.Abs((float)(this.localAI[1] - num838)) < 100f)) && (this.scale > 0.15f)) { Color color2 = Main.hslToRgb(this.GetPrismHue(this.ai[0]), 1f, 0.5f); color2.A = 0; Vector2 vector129 = base.Center + ((Vector2)(base.velocity * (this.localAI[1] - (14.5f * this.scale)))); float num862 = Main.rgbToHsl(new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB)).X; for (int num863 = 0; num863 < 2; num863++) { float num864 = base.velocity.ToRotation() + (((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.570796f); float num865 = (((float)Main.rand.NextDouble()) * 0.8f) + 1f; Vector2 vector130 = new Vector2(((float)Math.Cos((double)num864)) * num865, ((float)Math.Sin((double)num864)) * num865); color5 = new Color(); int num866 = Dust.NewDust(vector129, 0, 0, 0x10b, vector130.X, vector130.Y, 0, color5, 1f); Main.dust[num866].color = color2; Main.dust[num866].scale = 1.2f; if (this.scale > 1f) { Dust dust223 = Main.dust[num866]; dust223.velocity = (Vector2)(dust223.velocity * this.scale); Dust dust224 = Main.dust[num866]; dust224.scale *= this.scale; } Main.dust[num866].noGravity = true; if (this.scale != 1.4f) { Dust dust8 = Dust.CloneDust(Main.dust[num866]); dust8.color = Color.White; dust8.scale /= 2f; } float hue = (num862 + (Main.rand.NextFloat() * 0.4f)) % 1f; Main.dust[num866].color = Color.Lerp(color2, Main.hslToRgb(hue, 1f, 0.75f), this.scale / 1.4f); } if (Main.rand.Next(5) == 0) { Vector2 vector131 = (Vector2)((base.velocity.RotatedBy(1.5707963705062866, new Vector2()) * (((float)Main.rand.NextDouble()) - 0.5f)) * base.width); int num868 = Dust.NewDust((vector129 + vector131) - ((Vector2)(Vector2.One * 4f)), 8, 8, 0x1f, 0f, 0f, 100, new Color(), 1.5f); Dust dust225 = Main.dust[num868]; dust225.velocity = (Vector2)(dust225.velocity * 0.5f); Main.dust[num868].velocity.Y = -Math.Abs(Main.dust[num868].velocity.Y); } DelegateMethods.v3_1 = (Vector3)(color2.ToVector3() * 0.3f); Utils.PlotTileLine(base.Center, base.Center + ((Vector2)(base.velocity * this.localAI[1])), base.width * this.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); return; } return; } if (this.aiStyle == 0x55) { Vector2 vector132 = new Vector2(0f, 216f); this.alpha -= 15; if (this.alpha < 0) { this.alpha = 0; } int num869 = ((int)Math.Abs(this.ai[0])) - 1; int num870 = (int)this.ai[1]; if (!Main.npc[num869].active || (Main.npc[num869].type != 0x18c)) { this.Kill(); return; } this.localAI[0]++; if (((this.localAI[0] >= 330f) && (this.ai[0] > 0f)) && (Main.netMode != 1)) { this.ai[0] *= -1f; this.netUpdate = true; } if (((Main.netMode != 1) && (this.ai[0] > 0f)) && (!Main.player[(int)this.ai[1]].active || Main.player[(int)this.ai[1]].dead)) { this.ai[0] *= -1f; this.netUpdate = true; } this.rotation = ((Main.npc[((int)Math.Abs(this.ai[0])) - 1].Center - Main.player[(int)this.ai[1]].Center) + vector132).ToRotation() + 1.570796f; if (this.ai[0] <= 0f) { Vector2 vector134 = (Main.npc[((int)Math.Abs(this.ai[0])) - 1].Center - base.Center) + vector132; if ((vector134.X != 0f) || (vector134.Y != 0f)) { base.velocity = (Vector2)(Vector2.Normalize(vector134) * Math.Min(16f, vector134.Length())); } else { base.velocity = Vector2.Zero; } if (vector134.Length() < 20f) { this.Kill(); return; } } else { Vector2 vector133 = Main.player[(int)this.ai[1]].Center - base.Center; if ((vector133.X != 0f) || (vector133.Y != 0f)) { base.velocity = (Vector2)(Vector2.Normalize(vector133) * Math.Min(16f, vector133.Length())); } else { base.velocity = Vector2.Zero; } if ((vector133.Length() < 20f) && (this.localAI[1] == 0f)) { this.localAI[1] = 1f; int num871 = 840; if (Main.expertMode) { num871 = 960; } Main.player[num870].AddBuff(0x91, num871, true); return; } } return; } if (this.aiStyle == 0x56) { if (this.localAI[1] == 0f) { this.localAI[1] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 120); } this.ai[0]++; if (this.ai[1] == 1f) { if (this.ai[0] >= 130f) { this.alpha += 10; } else { this.alpha -= 10; } if (this.alpha < 0) { this.alpha = 0; } if (this.alpha > 0xff) { this.alpha = 0xff; } if (this.ai[0] >= 150f) { this.Kill(); return; } if (((this.ai[0] % 30f) == 0f) && (Main.netMode != 1)) { Vector2 vector135 = this.rotation.ToRotationVector2(); NewProjectile(base.Center.X, base.Center.Y, vector135.X, vector135.Y, 0x1d0, this.damage, this.knockBack, this.owner, 0f, 0f); } this.rotation += 0.1047198f; Lighting.AddLight(base.Center, 0.3f, 0.75f, 0.9f); return; } base.position -= base.velocity; if (this.ai[0] >= 40f) { this.alpha += 3; } else { this.alpha -= 40; } if (this.alpha < 0) { this.alpha = 0; } if (this.alpha > 0xff) { this.alpha = 0xff; } if (this.ai[0] >= 45f) { this.Kill(); return; } vector240 = new Vector2(); Vector2 vector136 = new Vector2(0f, -720f).RotatedBy((double)base.velocity.ToRotation(), vector240); float num872 = (this.ai[0] % 45f) / 45f; Vector2 vector137 = (Vector2)(vector136 * num872); for (int num873 = 0; num873 < 6; num873++) { vector240 = new Vector2(); Vector2 vector138 = base.Center + vector137.RotatedBy(((double)((num873 * 6.283185f) / 6f)), vector240); Lighting.AddLight(vector138, 0.3f, 0.75f, 0.9f); for (int num874 = 0; num874 < 2; num874++) { int num875 = Dust.NewDust(vector138 + ((Vector2)(Utils.RandomVector2(Main.rand, -8f, 8f) / 2f)), 8, 8, 0xc5, 0f, 0f, 100, Color.Transparent, 1f); Main.dust[num875].noGravity = true; } } return; } if (this.aiStyle == 0x57) { this.position.Y = this.ai[0]; base.height = (int)this.ai[1]; if (base.Center.X > Main.player[this.owner].Center.X) { base.direction = 1; } else { base.direction = -1; } this.velocity.X = base.direction * 1E-06f; if (this.owner == Main.myPlayer) { for (int num876 = 0; num876 < 0x3e8; num876++) { if (((Main.projectile[num876].active && (num876 != base.whoAmI)) && ((Main.projectile[num876].type == this.type) && (Main.projectile[num876].owner == this.owner))) && (Main.projectile[num876].timeLeft > this.timeLeft)) { this.Kill(); return; } } } float num877 = (base.width * base.height) * 0.0045f; for (int num878 = 0; num878 < num877; num878++) { color5 = new Color(); int num879 = Dust.NewDust(base.position, base.width, base.height, 0x4b, 0f, 0f, 100, color5, 1f); Main.dust[num879].noGravity = true; Dust dust226 = Main.dust[num879]; dust226.velocity = (Vector2)(dust226.velocity * 0.5f); Main.dust[num879].velocity.Y -= 0.5f; Main.dust[num879].scale = 1.4f; Main.dust[num879].position.X += 6f; Main.dust[num879].position.Y -= 2f; } return; } if (this.aiStyle != 0x58) { float num1163; if (this.aiStyle == 0x59) { if (this.ai[1] == -1f) { this.alpha += 12; } else if (this.ai[0] < 300f) { this.alpha -= 5; } else { this.alpha += 12; } if (this.alpha < 0) { this.alpha = 0; } if (this.alpha > 0xff) { this.alpha = 0xff; } this.scale = 1f - (((float)this.alpha) / 255f); this.scale *= 0.6f; this.rotation += 0.01495997f; if (this.localAI[1] == 0f) { this.localAI[1] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 0x7b); } if (this.alpha == 0) { for (int num913 = 0; num913 < 2; num913++) { float num914 = Main.rand.Next(2, 4); float num915 = this.scale; if (num913 == 1) { num915 *= 0.42f; num914 *= -0.75f; } Vector2 vector153 = new Vector2((float)Main.rand.Next(-10, 11), (float)Main.rand.Next(-10, 11)); vector153.Normalize(); color5 = new Color(); int num916 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xe4, 0f, 0f, 100, color5, 2f); Main.dust[num916].noGravity = true; Main.dust[num916].noLight = true; Main.dust[num916].position = base.Center + ((Vector2)((vector153 * 204f) * num915)); if (Main.rand.Next(8) == 0) { Main.dust[num916].velocity = (Vector2)((vector153 * -num914) * 2f); Dust dust229 = Main.dust[num916]; dust229.scale += 0.5f; } else { Main.dust[num916].velocity = (Vector2)(vector153 * -num914); } } } this.ai[0]++; if (this.ai[0] >= 60f) { int num1 = ((int)(this.ai[0] - 0f)) / 60; for (int num917 = 0; num917 < 1; num917++) { float num918 = Main.rand.Next(1, 3); Vector2 vector154 = new Vector2((float)Main.rand.Next(-10, 11), (float)Main.rand.Next(-10, 11)); vector154.Normalize(); color5 = new Color(); int num919 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xe4, 0f, 0f, 100, color5, 2f); Main.dust[num919].noGravity = true; Main.dust[num919].noLight = true; Main.dust[num919].position = base.Center; if (Main.rand.Next(2) == 0) { Main.dust[num919].velocity = (Vector2)((vector154 * num918) * 2f); Dust dust230 = Main.dust[num919]; dust230.scale += 0.5f; } else { Main.dust[num919].velocity = (Vector2)(vector154 * num918); } Main.dust[num919].fadeIn = 2f; } } if (((this.ai[0] == 300f) && (this.ai[1] != -1f)) && (Main.netMode != 1)) { if (!NPC.AnyNPCs(0x1c6)) { this.ai[1] = NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 0x1c6, 0, 0f, 0f, 0f, 0f, 0xff); } else { this.ai[1] = NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 0x209, 0, 0f, 0f, 0f, 0f, 0xff); } } else if (this.ai[0] == 320f) { this.Kill(); return; } bool flag38 = false; if (this.ai[1] == -1f) { if (this.alpha == 0xff) { flag38 = true; } } else { flag38 = (this.ai[1] < 0f) || !Main.npc[(int)this.ai[1]].active; if (((flag38 || (Main.npc[(int)this.ai[1]].type != 0x1b7)) && (flag38 || (Main.npc[(int)this.ai[1]].type != 0x1c6))) && (flag38 || (Main.npc[(int)this.ai[1]].type != 0x209))) { flag38 = true; } } if (flag38) { this.Kill(); return; } Lighting.AddLight(base.Center, 1.1f, 0.9f, 0.4f); return; } if (this.aiStyle == 90) { if (Main.player[this.owner].dead) { this.Kill(); } if ((Main.myPlayer == this.owner) && Main.player[this.owner].magicLantern) { this.timeLeft = 2; } if (this.tileCollide) { if (!Collision.CanHit(base.position, base.width, base.height, Main.player[this.owner].Center, 1, 1)) { this.tileCollide = false; } else if (!Collision.SolidCollision(base.position, base.width, base.height) && Collision.CanHitLine(base.position, base.width, base.height, Main.player[this.owner].Center, 1, 1)) { this.tileCollide = true; } } base.direction = Main.player[this.owner].direction; this.spriteDirection = base.direction; Lighting.AddLight(base.position, 0.35f, 0.35f, 0.1f); this.localAI[0]++; if (this.localAI[0] >= 10f) { this.localAI[0] = 0f; int num920 = 0x11; Vector2 vector155 = base.Center - Main.player[Main.myPlayer].Center; if (vector155.Length() < (Main.screenWidth + (num920 * 0x10))) { int num921 = ((int)base.Center.X) / 0x10; int num922 = ((int)base.Center.Y) / 0x10; for (int num923 = num921 - num920; num923 <= (num921 + num920); num923++) { for (int num924 = num922 - num920; num924 <= (num922 + num920); num924++) { if (Main.rand.Next(4) == 0) { Vector2 vector156 = new Vector2((float)(num921 - num923), (float)(num922 - num924)); if ((((vector156.Length() < num920) && (num923 > 0)) && ((num923 < (Main.maxTilesX - 1)) && (num924 > 0))) && (((num924 < (Main.maxTilesY - 1)) && (Main.tile[num923, num924] != null)) && Main.tile[num923, num924].active())) { bool flag39 = false; if ((Main.tile[num923, num924].type == 0xb9) && (Main.tile[num923, num924].frameY == 0x12)) { if ((Main.tile[num923, num924].frameX >= 0x240) && (Main.tile[num923, num924].frameX <= 0x372)) { flag39 = true; } } else if (((Main.tile[num923, num924].type == 0xba) && (Main.tile[num923, num924].frameX >= 0x360)) && (Main.tile[num923, num924].frameX <= 0x492)) { flag39 = true; } if ((flag39 || Main.tileSpelunker[Main.tile[num923, num924].type]) || (Main.tileAlch[Main.tile[num923, num924].type] && (Main.tile[num923, num924].type != 0x52))) { color5 = new Color(); int num925 = Dust.NewDust(new Vector2((float)(num923 * 0x10), (float)(num924 * 0x10)), 0x10, 0x10, 0xcc, 0f, 0f, 150, color5, 0.3f); Main.dust[num925].fadeIn = 0.75f; Dust dust231 = Main.dust[num925]; dust231.velocity = (Vector2)(dust231.velocity * 0.1f); Main.dust[num925].noLight = true; } } } } } } } Vector2 vector157 = Main.player[this.owner].Center - base.Center; vector157.X += 40 * base.direction; vector157.Y -= 40f; float num926 = vector157.Length(); if (num926 > 1000f) { base.Center = Main.player[this.owner].Center; } float num927 = 3f; float num928 = 4f; if (num926 > 200f) { num928 += (num926 - 200f) * 0.1f; this.tileCollide = false; } if (num926 < num928) { base.velocity = (Vector2)(base.velocity * 0.25f); num928 = num926; } if ((vector157.X != 0f) || (vector157.Y != 0f)) { vector157.Normalize(); vector157 = (Vector2)(vector157 * num928); } base.velocity = (Vector2)(((base.velocity * (num927 - 1f)) + vector157) / num927); if (this.velocity.Length() <= 6f) { if (this.rotation > 3.14) { this.rotation -= 6.28f; } if ((this.rotation > -0.01) && (this.rotation < 0.01)) { this.rotation = 0f; } else { this.rotation *= 0.9f; } this.frameCounter++; if (this.frameCounter > 6) { this.frameCounter = 0; this.frame++; if (this.frame > 3) { this.frame = 0; return; } } } else { float num929 = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 1.57f; if (Math.Abs((float)(this.rotation - num929)) >= 3.14) { if (num929 < this.rotation) { this.rotation -= 6.28f; } else { this.rotation += 6.28f; } } this.rotation = ((this.rotation * 4f) + num929) / 5f; this.frameCounter++; if (this.frameCounter > 4) { this.frameCounter = 0; this.frame++; if (this.frame > 7) { this.frame = 4; } } if (this.frame < 4) { this.frame = 7; return; } } return; } if (this.aiStyle == 0x5b) { Vector2 vector158 = base.Center; this.scale = 1f - this.localAI[0]; base.width = (int)(20f * this.scale); base.height = base.width; this.position.X = vector158.X - (base.width / 2); this.position.Y = vector158.Y - (base.height / 2); if (this.localAI[0] < 0.1) { this.localAI[0] += 0.01f; } else { this.localAI[0] += 0.025f; } if (this.localAI[0] >= 0.95f) { this.Kill(); } this.velocity.X += this.ai[0] * 1.5f; this.velocity.Y += this.ai[1] * 1.5f; if (this.velocity.Length() > 16f) { this.velocity.Normalize(); base.velocity = (Vector2)(base.velocity * 16f); } this.ai[0] *= 1.05f; this.ai[1] *= 1.05f; if (this.scale < 1f) { for (int num930 = 0; num930 < (this.scale * 10f); num930++) { color5 = new Color(); int num931 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x1b, this.velocity.X, this.velocity.Y, 100, color5, 1.1f); Main.dust[num931].position = (Vector2)((Main.dust[num931].position + base.Center) / 2f); Main.dust[num931].noGravity = true; Dust dust232 = Main.dust[num931]; dust232.velocity = (Vector2)(dust232.velocity * 0.1f); Dust dust233 = Main.dust[num931]; dust233.velocity -= (Vector2)(base.velocity * (1.3f - this.scale)); Main.dust[num931].fadeIn = 100 + this.owner; Dust dust234 = Main.dust[num931]; dust234.scale += this.scale * 0.75f; } return; } return; } if (this.aiStyle == 0x5c) { this.tileCollide = false; this.ai[1]++; if (this.ai[1] > 60f) { this.ai[0] += 10f; } if (this.ai[0] > 255f) { this.Kill(); this.ai[0] = 255f; } this.alpha = (int)(100.0 + (this.ai[0] * 0.7)); this.rotation += this.velocity.X * 0.1f; this.rotation += base.direction * 0.003f; base.velocity = (Vector2)(base.velocity * 0.96f); Rectangle rectangle12 = new Rectangle((int)this.position.X, (int)this.position.Y, base.width, base.height); for (int num932 = 0; num932 < 0x3e8; num932++) { if (((num932 != base.whoAmI) && Main.projectile[num932].active) && ((Main.projectile[num932].type >= 0x1ff) && (Main.projectile[num932].type <= 0x201))) { Rectangle rectangle13 = new Rectangle((int)Main.projectile[num932].position.X, (int)Main.projectile[num932].position.Y, Main.projectile[num932].width, Main.projectile[num932].height); if (rectangle12.Intersects(rectangle13)) { Vector2 vector159 = Main.projectile[num932].Center - base.Center; if ((vector159.X == 0f) && (vector159.Y == 0f)) { if (num932 < base.whoAmI) { vector159.X = -1f; vector159.Y = 1f; } else { vector159.X = 1f; vector159.Y = -1f; } } vector159.Normalize(); vector159 = (Vector2)(vector159 * 0.005f); base.velocity -= vector159; Projectile projectile1 = Main.projectile[num932]; projectile1.velocity += vector159; } } } return; } if (this.aiStyle == 0x5d) { if (this.alpha > 0) { this.alpha -= 0x19; if (this.alpha <= 0) { this.alpha = 0; } } if (this.velocity.Y > 18f) { this.velocity.Y = 18f; } if (this.ai[0] == 0f) { this.ai[1]++; if (this.ai[1] > 20f) { this.velocity.Y += 0.1f; this.velocity.X *= 0.992f; } this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 1.57f; return; } this.tileCollide = false; if (this.ai[0] == 1f) { this.tileCollide = false; base.velocity = (Vector2)(base.velocity * 0.6f); } else { this.tileCollide = false; int num933 = (int)-this.ai[0]; num933--; base.position = Main.npc[num933].Center - base.velocity; this.position.X -= base.width / 2; this.position.Y -= base.height / 2; if (!Main.npc[num933].active || (Main.npc[num933].life < 0)) { this.tileCollide = true; this.ai[0] = 0f; this.ai[1] = 20f; base.velocity = new Vector2((float)Main.rand.Next(-100, 0x65), (float)Main.rand.Next(-100, 0x65)); this.velocity.Normalize(); base.velocity = (Vector2)(base.velocity * 6f); this.netUpdate = true; } else if (this.velocity.Length() > ((Main.npc[num933].width + Main.npc[num933].height) / 3)) { base.velocity = (Vector2)(base.velocity * 0.99f); } } if (this.ai[0] != 0f) { this.ai[1]++; if (this.ai[1] > 90f) { this.Kill(); return; } } return; } if (this.aiStyle != 0x5e) { if (this.aiStyle == 0x5f) { if (this.localAI[0] > 2f) { this.alpha -= 20; if (this.alpha < 100) { this.alpha = 100; } } else { this.localAI[0]++; } if (this.ai[0] > 30f) { if (this.velocity.Y > -8f) { this.velocity.Y -= 0.05f; } this.velocity.X *= 0.98f; } else { this.ai[0]++; } this.rotation = this.velocity.X * 0.1f; if (base.wet) { if (this.velocity.Y > 0f) { this.velocity.Y *= 0.98f; } if (this.velocity.Y > -8f) { this.velocity.Y -= 0.2f; } this.velocity.X *= 0.94f; return; } return; } if (this.aiStyle == 0x60) { this.ai[0] += 0.6f; if (this.ai[0] > 500f) { this.Kill(); } for (int num939 = 0; num939 < 2; num939++) { if (Main.rand.Next(3) != 0) { color5 = new Color(); int num940 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 170, 0f, 0f, 100, color5, 1f); Main.dust[num940].position = (Vector2)((Main.dust[num940].position + base.Center) / 2f); Main.dust[num940].noGravity = true; Dust dust235 = Main.dust[num940]; dust235.velocity = (Vector2)(dust235.velocity * 0.1f); if (num939 == 1) { Dust dust236 = Main.dust[num940]; dust236.position += (Vector2)(base.velocity / 2f); } float num941 = (800f - this.ai[0]) / 800f; Dust dust237 = Main.dust[num940]; dust237.scale *= num941 + 0.1f; } } this.velocity.Y += 0.008f; return; } if (this.aiStyle == 0x61) { this.frameCounter++; float num942 = 4f; if (this.frameCounter < (num942 * 1f)) { this.frame = 0; } else if (this.frameCounter < (num942 * 2f)) { this.frame = 1; } else if (this.frameCounter < (num942 * 3f)) { this.frame = 2; } else if (this.frameCounter < (num942 * 4f)) { this.frame = 3; } else if (this.frameCounter < (num942 * 5f)) { this.frame = 4; } else if (this.frameCounter < (num942 * 6f)) { this.frame = 3; } else if (this.frameCounter < (num942 * 7f)) { this.frame = 2; } else if (this.frameCounter < (num942 * 8f)) { this.frame = 1; } else { this.frameCounter = 0; this.frame = 0; } if (this.owner == Main.myPlayer) { for (int num943 = 0; num943 < 0x3e8; num943++) { if (((num943 != base.whoAmI) && Main.projectile[num943].active) && ((Main.projectile[num943].owner == this.owner) && (Main.projectile[num943].type == this.type))) { if (this.timeLeft >= Main.projectile[num943].timeLeft) { Main.projectile[num943].Kill(); } else { this.Kill(); } } } } if (this.ai[0] == 0f) { if (this.velocity.Length() < 0.1) { this.velocity.X = 0f; this.velocity.Y = 0f; this.ai[0] = 1f; this.ai[1] = 45f; return; } base.velocity = (Vector2)(base.velocity * 0.94f); if (this.velocity.X < 0f) { base.direction = -1; } else { base.direction = 1; } this.spriteDirection = base.direction; return; } if (Main.player[this.owner].Center.X < base.Center.X) { base.direction = -1; } else { base.direction = 1; } this.spriteDirection = base.direction; this.ai[1]++; float num944 = 0.005f; if (this.ai[1] > 0f) { this.velocity.Y -= num944; } else { this.velocity.Y += num944; } if (this.ai[1] >= 90f) { this.ai[1] *= -1f; return; } return; } if (this.aiStyle == 0x62) { Vector2 vector162 = new Vector2(this.ai[0], this.ai[1]); Vector2 vector163 = vector162 - base.Center; if (vector163.Length() < this.velocity.Length()) { this.Kill(); return; } vector163.Normalize(); vector163 = (Vector2)(vector163 * 15f); base.velocity = Vector2.Lerp(base.velocity, vector163, 0.1f); for (int num945 = 0; num945 < 2; num945++) { color5 = new Color(); int num946 = Dust.NewDust(base.Center, 0, 0, 0xe4, 0f, 0f, 100, color5, 1f); Main.dust[num946].noGravity = true; Dust dust238 = Main.dust[num946]; dust238.position += new Vector2(4f); Dust dust239 = Main.dust[num946]; dust239.scale += Main.rand.NextFloat() * 1f; } return; } if (((this.aiStyle == 0x63) && (this.type >= 0x22c)) && (this.type <= 0x231)) { this.AI_099_1(); return; } if (this.aiStyle == 0x63) { this.AI_099_2(); return; } if (this.aiStyle == 100) { Player player5 = Main.player[this.owner]; Vector2 vector164 = Vector2.Zero; if (this.type == 0x217) { vector164.X = player5.direction * 6f; vector164.Y = player5.gravDir * -14f; this.ai[0]++; int num947 = 0; if (this.ai[0] >= 60f) { num947++; } if (this.ai[0] >= 180f) { num947++; } if (this.ai[0] >= 240f) { this.Kill(); return; } bool flag40 = false; if ((this.ai[0] == 60f) || (this.ai[0] == 180f)) { flag40 = true; } bool flag41 = this.ai[0] >= 180f; if (flag41) { if (this.frame < 8) { this.frame = 8; } if (this.frame >= 12) { this.frame = 8; } this.frameCounter++; if (++this.frameCounter >= 5) { this.frameCounter = 0; if (++this.frame >= 12) { this.frame = 8; } } } else if (++this.frameCounter >= 5) { this.frameCounter = 0; if (++this.frame >= 8) { this.frame = 0; } } Vector2 vector165 = player5.Center; Vector2 vector166 = (Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY)) - vector165; if (player5.gravDir == -1f) { vector166.Y = ((Main.screenHeight - Main.mouseY) + Main.screenPosition.Y) - vector165.Y; } Vector2 vector167 = new Vector2((float)Math.Sign((vector166.X == 0f) ? ((float)player5.direction) : vector166.X), 0f); if ((vector167.X != this.velocity.X) || (vector167.Y != this.velocity.Y)) { this.netUpdate = true; } base.velocity = vector167; if ((this.soundDelay <= 0) && !flag41) { this.soundDelay = 10; this.soundDelay *= 2; if (this.ai[0] != 1f) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 15); } } if (this.ai[0] == 181f) { Main.PlaySound(4, (int)this.position.X, (int)this.position.Y, 0x11); } if ((this.ai[0] > 10f) && !flag41) { Vector2 vector168 = base.Center + new Vector2((float)(player5.direction * 2), player5.gravDir * 5f); float num948 = MathHelper.Lerp(30f, 10f, (this.ai[0] - 10f) / 180f); float num949 = Main.rand.NextFloat() * 6.283185f; for (float num950 = 0f; num950 < 1f; num950++) { vector240 = new Vector2(); Vector2 vector169 = Vector2.UnitY.RotatedBy((double)(((num950 / 1f) * 6.283185f) + num949), vector240); color5 = new Color(); Dust dust9 = Main.dust[Dust.NewDust(vector168, 0, 0, 0xe4, 0f, 0f, 0, color5, 1f)]; dust9.position = vector168 + ((Vector2)(vector169 * num948)); dust9.noGravity = true; dust9.customData = player5; dust9.velocity = (Vector2)(vector169 * -2f); } } if ((this.ai[0] > 180f) && (this.ai[0] <= 182f)) { Vector2 vector170 = base.Center + new Vector2((float)(player5.direction * 2), player5.gravDir * 5f); float num951 = MathHelper.Lerp(20f, 30f, (this.ai[0] - 180f) / 182f); Main.rand.NextFloat(); for (float num952 = 0f; num952 < 10f; num952++) { Vector2 vector171 = (Vector2)(Vector2.UnitY.RotatedByRandom(6.2831854820251465) * ((Main.rand.NextFloat() * 0.5f) + 0.5f)); color5 = new Color(); Dust dust10 = Main.dust[Dust.NewDust(vector170, 0, 0, 0xe4, 0f, 0f, 0, color5, 1f)]; dust10.position = vector170 + ((Vector2)(vector171 * num951)); dust10.noGravity = true; dust10.customData = player5; dust10.velocity = (Vector2)(vector171 * 4f); dust10.scale = 0.5f + Main.rand.NextFloat(); } } if (Main.myPlayer == this.owner) { bool flag42 = false; if (!flag40) { flag42 = true; } else { flag42 = player5.CheckMana(player5.inventory[player5.selectedItem].mana, true, false); } bool flag43 = player5.channel && flag42; if ((!flag41 && !flag43) || (this.ai[0] == 180f)) { Vector2 vector172 = player5.Center + new Vector2((float)(player5.direction * 4), player5.gravDir * 2f); int num953 = this.damage * (1 + num947); vector172 = base.Center; int num954 = 0; float num955 = 0f; for (int num956 = 0; num956 < 200; num956++) { NPC npc9 = Main.npc[num956]; if ((npc9.active && (base.Distance(npc9.Center) < 500f)) && (npc9.CanBeChasedBy(this, false) && Collision.CanHitLine(npc9.position, npc9.width, npc9.height, vector172, 0, 0))) { Vector2 vector173 = npc9.Center - vector172; num955 += vector173.ToRotation(); num954++; int num957 = NewProjectile(vector172.X, vector172.Y, vector173.X, vector173.Y, 0x218, 0, 0f, this.owner, (float)base.whoAmI, 0f); Main.projectile[num957].Center = npc9.Center; Main.projectile[num957].damage = num953; Main.projectile[num957].Damage(); Main.projectile[num957].damage = 0; Main.projectile[num957].Center = vector172; this.ai[0] = 180f; } } if (num954 != 0) { num955 /= (float)num954; } else { num955 = (player5.direction == 1) ? 0f : 3.141593f; } for (int num958 = 0; num958 < 6; num958++) { Vector2 vector174 = Vector2.Zero; if (Main.rand.Next(4) != 0) { vector240 = new Vector2(); vector174 = (Vector2)((Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(((double)num955), vector240) * new Vector2(200f, 50f)) * ((Main.rand.NextFloat() * 0.7f) + 0.3f)); } else { vector174 = (Vector2)((Vector2.UnitX.RotatedByRandom(6.2831854820251465) * new Vector2(200f, 50f)) * ((Main.rand.NextFloat() * 0.7f) + 0.3f)); } NewProjectile(vector172.X, vector172.Y, vector174.X, vector174.Y, 0x218, 0, 0f, this.owner, (float)base.whoAmI, 0f); } this.ai[0] = 180f; this.netUpdate = true; } } Lighting.AddLight(base.Center, 0.9f, 0.75f, 0.1f); } this.rotation = (player5.gravDir == 1f) ? 0f : 3.141593f; this.spriteDirection = base.direction; this.timeLeft = 2; Vector2 vector175 = (Vector2)(Main.OffsetsPlayerOnhand[player5.bodyFrame.Y / 0x38] * 2f); if (player5.direction != 1) { vector175.X = player5.bodyFrame.Width - vector175.X; } vector175 -= (Vector2)((player5.bodyFrame.Size() - new Vector2((float)player5.width, 42f)) / 2f); base.Center = (((player5.position + vector175) + vector164) - base.velocity).Floor(); player5.ChangeDir(base.direction); player5.heldProj = base.whoAmI; player5.itemTime = 2; player5.itemAnimation = 2; return; } if (this.aiStyle != 0x65) { if (this.aiStyle != 0x66) { if (this.aiStyle == 0x67) { this.scale = this.ai[1]; this.ai[0]++; if (this.ai[0] < 30f) { if (this.ai[0] >= 0f) { this.alpha -= 0x19; if (this.alpha < 0) { this.alpha = 0; if (((this.localAI[1] == 0f) && (Main.netMode != 1)) && (this.localAI[0] != 0f)) { this.localAI[1] = 1f; NPC.NewNPC((int)base.Center.X, (int)base.Bottom.Y, (int)this.localAI[0], 0, 0f, 0f, 0f, 0f, 0xff); return; } } } } else { this.alpha += 0x19; if (this.alpha >= 250) { this.Kill(); return; } } } else { if (this.aiStyle == 0x68) { if (this.ai[0] == 1f) { this.scale *= 0.995f; this.alpha += 3; if (this.alpha >= 250) { this.Kill(); } } else { this.scale *= 1.01f; this.alpha -= 7; if (this.alpha < 0) { this.alpha = 0; this.ai[0] = 1f; } } this.frameCounter++; if (this.frameCounter > 6) { this.frameCounter = 0; this.frame++; if (this.frame > 3) { this.frame = 0; } } this.velocity.Y -= 0.03f; this.velocity.X *= 0.97f; return; } if (this.aiStyle == 0x69) { float num982 = 1f - (((float)this.alpha) / 255f); num982 *= this.scale; Lighting.AddLight(base.Center, 0.2f * num982, 0.275f * num982, 0.075f * num982); this.localAI[0]++; if (this.localAI[0] >= 90f) { this.localAI[0] *= -1f; } if (this.localAI[0] >= 0f) { this.scale += 0.003f; } else { this.scale -= 0.003f; } this.rotation += 0.0025f * this.scale; float num983 = 1f; float num984 = 1f; if ((this.identity % 6) == 0) { num984 *= -1f; } if ((this.identity % 6) == 1) { num983 *= -1f; } if ((this.identity % 6) == 2) { num984 *= -1f; num983 *= -1f; } if ((this.identity % 6) == 3) { num984 = 0f; } if ((this.identity % 6) == 4) { num983 = 0f; } this.localAI[1]++; if (this.localAI[1] > 60f) { this.localAI[1] = -180f; } if (this.localAI[1] >= -60f) { this.velocity.X += 0.002f * num984; this.velocity.Y += 0.002f * num983; } else { this.velocity.X -= 0.002f * num984; this.velocity.Y -= 0.002f * num983; } this.ai[0]++; if (this.ai[0] > 5400f) { this.damage = 0; this.ai[1] = 1f; if (this.alpha < 0xff) { this.alpha += 5; if (this.alpha > 0xff) { this.alpha = 0xff; } } else if (this.owner == Main.myPlayer) { this.Kill(); } } else { Vector2 vector178 = base.Center - Main.player[this.owner].Center; float num985 = vector178.Length() / 100f; if (num985 > 4f) { num985 *= 1.1f; } if (num985 > 5f) { num985 *= 1.2f; } if (num985 > 6f) { num985 *= 1.3f; } if (num985 > 7f) { num985 *= 1.4f; } if (num985 > 8f) { num985 *= 1.5f; } if (num985 > 9f) { num985 *= 1.6f; } if (num985 > 10f) { num985 *= 1.7f; } if (!Main.player[this.owner].sporeSac) { num985 += 100f; } this.ai[0] += num985; if (this.alpha > 50) { this.alpha -= 10; if (this.alpha < 50) { this.alpha = 50; } } } bool flag49 = false; Vector2 vector179 = new Vector2(0f, 0f); float num986 = 280f; for (int num987 = 0; num987 < 200; num987++) { if (Main.npc[num987].CanBeChasedBy(this, false)) { float num988 = Main.npc[num987].position.X + (Main.npc[num987].width / 2); float num989 = Main.npc[num987].position.Y + (Main.npc[num987].height / 2); float introduced1846 = Math.Abs((float)((this.position.X + (base.width / 2)) - num988)); float num990 = introduced1846 + Math.Abs((float)((this.position.Y + (base.height / 2)) - num989)); if (num990 < num986) { num986 = num990; vector179 = Main.npc[num987].Center; flag49 = true; } } } if (flag49) { Vector2 vector180 = vector179 - base.Center; vector180.Normalize(); vector180 = (Vector2)(vector180 * 0.75f); base.velocity = (Vector2)(((base.velocity * 10f) + vector180) / 11f); return; } if (this.velocity.Length() > 0.2) { base.velocity = (Vector2)(base.velocity * 0.98f); return; } } else if (this.aiStyle == 0x6a) { this.rotation += this.velocity.X * 0.02f; if (this.velocity.X < 0f) { this.rotation -= Math.Abs(this.velocity.Y) * 0.02f; } else { this.rotation += Math.Abs(this.velocity.Y) * 0.02f; } base.velocity = (Vector2)(base.velocity * 0.98f); this.ai[0]++; if (this.ai[0] < 60f) { if (this.alpha > 80) { this.alpha -= 30; if (this.alpha < 80) { this.alpha = 80; return; } } } else if (this.alpha >= 0xff) { if (this.owner == Main.myPlayer) { this.Kill(); return; } } else { this.alpha += 5; if (this.alpha > 0xff) { this.alpha = 0xff; return; } } } else if (this.aiStyle == 0x6b) { float num991 = 10f; float num992 = 5f; float num993 = 40f; if (this.type == 0x23f) { if ((this.timeLeft > 30) && (this.alpha > 0)) { this.alpha -= 0x19; } if (((this.timeLeft > 30) && (this.alpha < 0x80)) && Collision.SolidCollision(base.position, base.width, base.height)) { this.alpha = 0x80; } if (this.alpha < 0) { this.alpha = 0; } if (++this.frameCounter > 4) { this.frameCounter = 0; if (++this.frame >= 4) { this.frame = 0; } } Lighting.AddLight(base.Center, 0.5f, 0.1f, 0.3f); } else if (this.type == 0x254) { Dust dust11; num991 = 10f; num992 = 7.5f; if ((this.timeLeft > 30) && (this.alpha > 0)) { this.alpha -= 0x19; } if (((this.timeLeft > 30) && (this.alpha < 0x80)) && Collision.SolidCollision(base.position, base.width, base.height)) { this.alpha = 0x80; } if (this.alpha < 0) { this.alpha = 0; } if (++this.frameCounter > 4) { this.frameCounter = 0; if (++this.frame >= 4) { this.frame = 0; } } float num994 = 0.5f; if (this.timeLeft < 120) { num994 = 1.1f; } if (this.timeLeft < 60) { num994 = 1.6f; } this.ai[1]++; float single2 = this.ai[1] / 180f; for (float num995 = 0f; num995 < 3f; num995++) { if (Main.rand.Next(3) != 0) { return; } color5 = new Color(); dust11 = Main.dust[Dust.NewDust(base.Center, 0, 0, 0x1b, 0f, -2f, 0, color5, 1f)]; vector240 = new Vector2(); dust11.position = base.Center + ((Vector2)(Vector2.UnitY.RotatedBy(((double)(((num995 * 6.283185f) / 3f) + this.ai[1])), vector240) * 10f)); dust11.noGravity = true; dust11.velocity = base.DirectionFrom(dust11.position); dust11.scale = num994; dust11.fadeIn = 0.5f; dust11.alpha = 200; } if (this.timeLeft < 4) { int num996 = 40; if (Main.expertMode) { num996 = 30; } base.position = base.Center; base.width = base.height = 60; base.Center = base.position; this.damage = num996; for (int num997 = 0; num997 < 10; num997++) { color5 = new Color(); dust11 = Main.dust[Dust.NewDust(base.position, base.width, base.height, Utils.SelectRandom<int>(Main.rand, new int[] { 0x1b, 6 }), 0f, -2f, 0, color5, 1f)]; dust11.noGravity = true; if (dust11.position != base.Center) { dust11.velocity = (Vector2)(base.DirectionTo(dust11.position) * 3f); } } } } int num998 = (int)this.ai[0]; if (((num998 < 0) || !Main.player[num998].active) || Main.player[num998].dead) { if (this.timeLeft > 30) { this.timeLeft = 30; } if (this.ai[0] != -1f) { this.ai[0] = -1f; this.netUpdate = true; return; } } else if (base.Distance(Main.player[num998].Center) > num993) { Vector2 vec = base.DirectionTo(Main.player[num998].Center); if (vec.HasNaNs()) { vec = Vector2.UnitY; } base.velocity = (Vector2)(((base.velocity * (num991 - 1f)) + (vec * num992)) / num991); return; } } else if (this.aiStyle == 0x6c) { if ((this.type == 0x242) && (this.localAI[0] == 0f)) { this.localAI[0] = 1f; int num999 = Player.FindClosest(base.Center, 0, 0); Vector2 unitY = Main.player[num999].Center - base.Center; if (unitY == Vector2.Zero) { unitY = Vector2.UnitY; } this.ai[1] = unitY.ToRotation(); this.netUpdate = true; } this.ai[0]++; if (this.ai[0] > 50f) { if (this.ai[0] > 90f) { if (this.ai[0] <= 120f) { this.scale = 1f; this.alpha = 0; this.rotation -= 0.05235988f; if (Main.rand.Next(2) == 0) { Vector2 vector195 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); Dust dust18 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector195 * 30f)), 0, 0, 0xe5, 0f, 0f, 0, new Color(), 1f)]; dust18.noGravity = true; dust18.position = base.Center - (vector195 * Main.rand.Next(10, 0x15)); dust18.velocity = (Vector2)(vector195.RotatedBy(1.5707963705062866, new Vector2()) * 6f); dust18.scale = 0.5f + Main.rand.NextFloat(); dust18.fadeIn = 0.5f; dust18.customData = base.Center; return; } Vector2 vector196 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); Dust dust19 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector196 * 30f)), 0, 0, 240, 0f, 0f, 0, new Color(), 1f)]; dust19.noGravity = true; dust19.position = base.Center - ((Vector2)(vector196 * 30f)); dust19.velocity = (Vector2)(vector196.RotatedBy(-1.5707963705062866, new Vector2()) * 3f); dust19.scale = 0.5f + Main.rand.NextFloat(); dust19.fadeIn = 0.5f; dust19.customData = base.Center; return; } this.scale = 1f - ((this.ai[0] - 120f) / 60f); this.alpha = 0xff - ((int)(255f * this.scale)); this.rotation -= 0.1047198f; if (this.alpha >= 0xff) { this.Kill(); } for (int num1005 = 0; num1005 < 2; num1005++) { switch (Main.rand.Next(3)) { case 0: { Vector2 vector197 = (Vector2)(Vector2.UnitY.RotatedByRandom(6.2831854820251465) * this.scale); color5 = new Color(); Dust dust20 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector197 * 30f)), 0, 0, 0xe5, 0f, 0f, 0, color5, 1f)]; dust20.noGravity = true; dust20.position = base.Center - (vector197 * Main.rand.Next(10, 0x15)); vector240 = new Vector2(); dust20.velocity = (Vector2)(vector197.RotatedBy(1.5707963705062866, vector240) * 6f); dust20.scale = 0.5f + Main.rand.NextFloat(); dust20.fadeIn = 0.5f; dust20.customData = base.Center; break; } case 1: { Vector2 vector198 = (Vector2)(Vector2.UnitY.RotatedByRandom(6.2831854820251465) * this.scale); color5 = new Color(); Dust dust21 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector198 * 30f)), 0, 0, 240, 0f, 0f, 0, color5, 1f)]; dust21.noGravity = true; dust21.position = base.Center - ((Vector2)(vector198 * 30f)); vector240 = new Vector2(); dust21.velocity = (Vector2)(vector198.RotatedBy(-1.5707963705062866, vector240) * 3f); dust21.scale = 0.5f + Main.rand.NextFloat(); dust21.fadeIn = 0.5f; dust21.customData = base.Center; break; } } } return; } this.scale = (this.ai[0] - 50f) / 40f; this.alpha = 0xff - ((int)(255f * this.scale)); this.rotation -= 0.1570796f; if (this.type == 0x243) { if (Main.rand.Next(2) == 0) { Vector2 vector189 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); color5 = new Color(); Dust dust15 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector189 * 30f)), 0, 0, 0xe5, 0f, 0f, 0, color5, 1f)]; dust15.noGravity = true; dust15.position = base.Center - (vector189 * Main.rand.Next(10, 0x15)); vector240 = new Vector2(); dust15.velocity = (Vector2)(vector189.RotatedBy(1.5707963705062866, vector240) * 6f); dust15.scale = 0.5f + Main.rand.NextFloat(); dust15.fadeIn = 0.5f; dust15.customData = base.Center; } if (Main.rand.Next(2) == 0) { Vector2 vector190 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); color5 = new Color(); Dust dust16 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector190 * 30f)), 0, 0, 240, 0f, 0f, 0, color5, 1f)]; dust16.noGravity = true; dust16.position = base.Center - ((Vector2)(vector190 * 30f)); vector240 = new Vector2(); dust16.velocity = (Vector2)(vector190.RotatedBy(-1.5707963705062866, vector240) * 3f); dust16.scale = 0.5f + Main.rand.NextFloat(); dust16.fadeIn = 0.5f; dust16.customData = base.Center; } } if (this.type != 0x242) { if (((this.type == 0x243) && (this.ai[0] == 90f)) && (Main.netMode != 1)) { for (int num1003 = 0; num1003 < 2; num1003++) { int num1004 = NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 0x1ab, base.whoAmI, 0f, 0f, 0f, 0f, 0xff); Main.npc[num1004].velocity = (-Vector2.UnitY.RotatedByRandom(6.2831854820251465) * Main.rand.Next(4, 9)) - ((Vector2)(Vector2.UnitY * 2f)); Main.npc[num1004].netUpdate = true; } return; } } else { Vector2 vector191 = this.ai[1].ToRotationVector2(); Vector2 vector192 = (vector191.RotatedBy(1.5707963705062866, new Vector2()) * (Main.rand.Next(2) == 0).ToDirectionInt()) * Main.rand.Next(10, 0x15); vector191 *= Main.rand.Next(-80, 0x51); Vector2 vector193 = vector191 - vector192; vector193 = (Vector2)(vector193 / 10f); int num1001 = Utils.SelectRandom<int>(Main.rand, new int[] { 0xe5, 0xe5 }); Dust dust17 = Main.dust[Dust.NewDust(base.Center, 0, 0, num1001, 0f, 0f, 0, new Color(), 1f)]; dust17.noGravity = true; dust17.position = base.Center + vector192; dust17.velocity = vector193; dust17.scale = 0.5f + Main.rand.NextFloat(); dust17.fadeIn = 0.5f; if ((this.ai[0] == 90f) && (Main.netMode != 1)) { Vector2 vector194 = (Vector2)(this.ai[1].ToRotationVector2() * 8f); float num1002 = Main.rand.Next(80); NewProjectile(base.Center.X - vector194.X, base.Center.Y - vector194.Y, vector194.X, vector194.Y, 580, 15, 1f, Main.myPlayer, this.ai[1], num1002); return; } } } else { if (this.type == 0x243) { if (Main.rand.Next(4) == 0) { Vector2 vector183 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); color5 = new Color(); Dust dust12 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector183 * 30f)), 0, 0, 0xe5, 0f, 0f, 0, color5, 1f)]; dust12.noGravity = true; dust12.position = base.Center - (vector183 * Main.rand.Next(10, 0x15)); vector240 = new Vector2(); dust12.velocity = (Vector2)(vector183.RotatedBy(1.5707963705062866, vector240) * 4f); dust12.scale = 0.5f + Main.rand.NextFloat(); dust12.fadeIn = 0.5f; } if (Main.rand.Next(4) == 0) { Vector2 vector184 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); color5 = new Color(); Dust dust13 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector184 * 30f)), 0, 0, 240, 0f, 0f, 0, color5, 1f)]; dust13.noGravity = true; dust13.position = base.Center - ((Vector2)(vector184 * 30f)); vector240 = new Vector2(); dust13.velocity = (Vector2)(vector184.RotatedBy(-1.5707963705062866, vector240) * 2f); dust13.scale = 0.5f + Main.rand.NextFloat(); dust13.fadeIn = 0.5f; } } if ((this.type == 0x242) && (Main.rand.Next(2) == 0)) { Vector2 vector185 = this.ai[1].ToRotationVector2(); Vector2 vector186 = (vector185.RotatedBy(1.5707963705062866, new Vector2()) * (Main.rand.Next(2) == 0).ToDirectionInt()) * Main.rand.Next(10, 0x15); Vector2 vector187 = vector185 * Main.rand.Next(-80, 0x51); Vector2 vector188 = vector187 - vector186; vector188 = (Vector2)(vector188 / 10f); int num1000 = 0xe5; color5 = new Color(); Dust dust14 = Main.dust[Dust.NewDust(base.Center, 0, 0, num1000, 0f, 0f, 0, color5, 1f)]; dust14.noGravity = true; dust14.position = base.Center + vector186; dust14.velocity = vector188; dust14.scale = 0.5f + Main.rand.NextFloat(); dust14.fadeIn = 0.5f; vector187 = vector185 * Main.rand.Next(40, 0x79); vector188 = vector187 - ((Vector2)(vector186 / 2f)); vector188 = (Vector2)(vector188 / 10f); dust14 = Main.dust[Dust.NewDust(base.Center, 0, 0, num1000, 0f, 0f, 0, new Color(), 1f)]; dust14.noGravity = true; dust14.position = base.Center + ((Vector2)(vector186 / 2f)); dust14.velocity = vector188; dust14.scale = 1f + Main.rand.NextFloat(); return; } } } else { if (this.aiStyle == 0x6d) { if (this.localAI[1] == 0f) { this.localAI[1] = this.velocity.Length(); } if (this.ai[0] == 0f) { this.localAI[0]++; if (this.localAI[0] > 30f) { this.ai[0] = 1f; this.localAI[0] = 0f; return; } } else if (this.ai[0] == 1f) { Vector2 vector199 = Vector2.Zero; if (((this.type == 0x246) && Main.npc[(int)this.ai[1]].active) && (Main.npc[(int)this.ai[1]].type == 0x7c)) { vector199 = Main.npc[(int)this.ai[1]].Center; this.tileCollide = false; } else { this.Kill(); return; } float num1007 = this.localAI[1]; Vector2 vector200 = vector199 - base.Center; if (vector200.Length() < num1007) { this.Kill(); return; } vector200.Normalize(); vector200 = (Vector2)(vector200 * num1007); base.velocity = Vector2.Lerp(base.velocity, vector200, 0.04f); } this.rotation += 0.3141593f; return; } if (this.aiStyle == 110) { if (this.localAI[1] == 0f) { this.localAI[1] = this.velocity.Length(); } Vector2 vector201 = Vector2.Zero; if (Main.npc[(int)this.ai[0]].active && Main.npc[(int)this.ai[0]].townNPC) { vector201 = Main.npc[(int)this.ai[0]].Center; } else { this.Kill(); return; } float num1008 = this.localAI[1]; Vector2 vector202 = vector201 - base.Center; if ((vector202.Length() < num1008) || base.Hitbox.Intersects(Main.npc[(int)this.ai[0]].Hitbox)) { this.Kill(); int num1009 = Main.npc[(int)this.ai[0]].lifeMax - Main.npc[(int)this.ai[0]].life; if (num1009 > 20) { num1009 = 20; } if (num1009 > 0) { NPC npc1 = Main.npc[(int)this.ai[0]]; npc1.life += num1009; Main.npc[(int)this.ai[0]].HealEffect(num1009, true); } return; } vector202.Normalize(); vector202 = (Vector2)(vector202 * num1008); if (vector202.Y < this.velocity.Y) { vector202.Y = this.velocity.Y; } vector202.Y++; base.velocity = Vector2.Lerp(base.velocity, vector202, 0.04f); this.rotation += this.velocity.X * 0.05f; return; } if (this.aiStyle == 0x6f) { if ((!Main.npc[(int)this.ai[1]].active || (Main.npc[(int)this.ai[1]].type != 20)) || (Main.npc[(int)this.ai[1]].ai[0] != 14f)) { this.Kill(); return; } this.ai[0]++; this.rotation += 0.01047198f; this.scale = this.ai[0] / 100f; if (this.scale > 1f) { this.scale = 1f; } this.alpha = (int)(255f * (1f - this.scale)); float num1010 = 300f; if (this.ai[0] >= 100f) { num1010 = MathHelper.Lerp(300f, 600f, (this.ai[0] - 100f) / 200f); } if (num1010 > 600f) { num1010 = 600f; } if (this.ai[0] >= 500f) { this.alpha = (int)MathHelper.Lerp(0f, 255f, (this.ai[0] - 500f) / 100f); num1010 = MathHelper.Lerp(600f, 1200f, (this.ai[0] - 500f) / 100f); this.rotation += 0.01047198f; } if (Main.rand.Next(4) == 0) { float num1011 = num1010; Vector2 vector203 = new Vector2((float)Main.rand.Next(-10, 11), (float)Main.rand.Next(-10, 11)); float num1012 = Main.rand.Next(3, 9); vector203.Normalize(); color5 = new Color(); int num1013 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xa3, 0f, 0f, 100, color5, 1f); Main.dust[num1013].noGravity = true; Main.dust[num1013].position = base.Center + ((Vector2)(vector203 * num1011)); if (Main.rand.Next(8) == 0) { Main.dust[num1013].velocity = (Vector2)((vector203 * -num1012) * 3f); Dust dust246 = Main.dust[num1013]; dust246.scale += 0.5f; } else { Main.dust[num1013].velocity = (Vector2)(vector203 * -num1012); } } if (Main.rand.Next(2) == 0) { Vector2 vector204 = new Vector2((float)Main.rand.Next(-10, 11), (float)Main.rand.Next(-10, 11)); float num1014 = Main.rand.Next(3, 9); vector204.Normalize(); int num1015 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0xa3, 0f, 0f, 100, new Color(), 1.5f); Main.dust[num1015].noGravity = true; Main.dust[num1015].position = base.Center + ((Vector2)(vector204 * 30f)); if (Main.rand.Next(8) == 0) { Main.dust[num1015].velocity = (Vector2)((vector204 * -num1014) * 3f); Dust dust247 = Main.dust[num1015]; dust247.scale += 0.5f; } else { Main.dust[num1015].velocity = (Vector2)(vector204 * -num1014); } } if ((this.ai[0] >= 30f) && (Main.netMode != 2)) { Player player6 = Main.player[Main.myPlayer]; if ((player6.active && !player6.dead) && ((base.Distance(player6.Center) <= num1010) && (player6.HasBuff(0xa5) == -1))) { player6.AddBuff(0xa5, 120, true); } } if (((this.ai[0] >= 30f) && ((this.ai[0] % 10f) == 0f)) && (Main.netMode != 1)) { for (int num1016 = 0; num1016 < 200; num1016++) { NPC npc10 = Main.npc[num1016]; if (((npc10.type != 0x1e8) && npc10.active) && (base.Distance(npc10.Center) <= num1010)) { if (npc10.townNPC && ((npc10.HasBuff(0xa5) == -1) || (npc10.buffTime[npc10.HasBuff(0xa5)] <= 20))) { npc10.AddBuff(0xa5, 120, false); } else if (((!npc10.friendly && (npc10.lifeMax > 5)) && !npc10.dontTakeDamage) && (((npc10.HasBuff(0xba) == -1) || (npc10.buffTime[npc10.HasBuff(0xba)] <= 20)) && (npc10.dryadBane || Collision.CanHit(base.Center, 1, 1, npc10.position, npc10.width, npc10.height)))) { npc10.AddBuff(0xba, 120, false); } } } } if (this.ai[0] >= 570f) { this.Kill(); return; } } else if (this.aiStyle == 0x70) { if (this.type == 590) { if (++this.frameCounter >= 4) { this.frameCounter = 0; if (++this.frame >= 3) { this.frame = 0; } } if (this.alpha > 0) { this.alpha -= 15; } if (this.alpha < 0) { this.alpha = 0; } if (this.alpha == 0) { float num1017 = Main.rand.Next(0x1c, 0x2a) * 0.005f; num1017 += ((float)(270 - Main.mouseTextColor)) / 500f; float num1018 = 0.1f; float num1019 = 0.3f + (num1017 / 2f); float num1020 = 0.6f + num1017; float num1021 = 0.35f; num1018 *= num1021; num1019 *= num1021; num1020 *= num1021; Lighting.AddLight(base.Center, num1018, num1019, num1020); } base.velocity = new Vector2(0f, ((float)Math.Sin((double)((6.283185f * this.ai[0]) / 180f))) * 0.15f); this.ai[0]++; if (this.ai[0] >= 180f) { this.ai[0] = 0f; } } if (this.type == 0x284) { Color color3 = Main.hslToRgb(this.ai[0], 1f, 0.5f); int num1022 = (int)this.ai[1]; if (((num1022 < 0) || (num1022 >= 0x3e8)) || (!Main.projectile[num1022].active && (Main.projectile[num1022].type != 0x283))) { this.ai[1] = -1f; } else { DelegateMethods.v3_1 = (Vector3)(color3.ToVector3() * 0.5f); Utils.PlotTileLine(base.Center, Main.projectile[num1022].Center, 8f, new Utils.PerLinePoint(DelegateMethods.CastLight)); } if (this.localAI[0] == 0f) { this.localAI[0] = (Main.rand.NextFloat() * 0.8f) + 0.8f; base.direction = (Main.rand.Next(2) > 0) ? 1 : -1; } this.rotation = ((this.localAI[1] / 40f) * 6.283185f) * base.direction; if (this.alpha > 0) { this.alpha -= 8; } if (this.alpha < 0) { this.alpha = 0; } if (this.alpha == 0) { Lighting.AddLight(base.Center, (Vector3)(color3.ToVector3() * 0.5f)); } for (int num1023 = 0; num1023 < 2; num1023++) { if (Main.rand.Next(10) == 0) { vector240 = new Vector2(); vector240 = new Vector2(); Vector2 vector205 = Vector2.UnitY.RotatedBy(((double)(num1023 * 3.141593f)), vector240).RotatedBy((double)this.rotation, vector240); Dust dust22 = Main.dust[Dust.NewDust(base.Center, 0, 0, 0x10b, 0f, 0f, 0xe1, color3, 1.5f)]; dust22.noGravity = true; dust22.noLight = true; dust22.scale = this.Opacity * this.localAI[0]; dust22.position = base.Center; dust22.velocity = (Vector2)(vector205 * 2.5f); } } for (int num1024 = 0; num1024 < 2; num1024++) { if (Main.rand.Next(10) == 0) { vector240 = new Vector2(); Vector2 vector206 = Vector2.UnitY.RotatedBy((double)(num1024 * 3.141593f), vector240); Dust dust23 = Main.dust[Dust.NewDust(base.Center, 0, 0, 0x10b, 0f, 0f, 0xe1, color3, 1.5f)]; dust23.noGravity = true; dust23.noLight = true; dust23.scale = this.Opacity * this.localAI[0]; dust23.position = base.Center; dust23.velocity = (Vector2)(vector206 * 2.5f); } } if (Main.rand.Next(10) == 0) { float num1025 = 1f + (Main.rand.NextFloat() * 2f); float num1026 = 1f + Main.rand.NextFloat(); float num1027 = 1f + Main.rand.NextFloat(); Vector2 vector207 = Utils.RandomVector2(Main.rand, -1f, 1f); if (vector207 != Vector2.Zero) { vector207.Normalize(); } vector207 = (Vector2)(vector207 * (20f + (Main.rand.NextFloat() * 100f))); Vector2 vector208 = base.Center + vector207; Point point3 = vector208.ToTileCoordinates(); bool flag50 = true; if (!WorldGen.InWorld(point3.X, point3.Y, 0)) { flag50 = false; } if (flag50 && WorldGen.SolidTile(point3.X, point3.Y)) { flag50 = false; } if (flag50) { Dust rf = Main.dust[Dust.NewDust(vector208, 0, 0, 0x10b, 0f, 0f, 0x7f, color3, 1f)]; rf.noGravity = true; rf.position = vector208; rf.velocity = (Vector2)((-Vector2.UnitY * num1025) * ((Main.rand.NextFloat() * 0.9f) + 1.6f)); rf.fadeIn = num1026; rf.scale = num1027; rf.noLight = true; Dust dust25 = Dust.CloneDust(rf); dust25.scale *= 0.65f; dust25.fadeIn *= 0.65f; dust25.color = new Color(0xff, 0xff, 0xff, 0xff); } } this.scale = (this.Opacity / 2f) * this.localAI[0]; base.velocity = Vector2.Zero; this.localAI[1]++; if (this.localAI[1] >= 60f) { this.Kill(); return; } } } else if (this.aiStyle == 0x71) { int num1028 = 0x19; if (this.type == 0x266) { num1028 = 0x3f; } if (this.alpha > 0) { this.alpha -= num1028; } if (this.alpha < 0) { this.alpha = 0; } if (this.ai[0] == 0f) { if (this.type == 0x266) { int num1029 = (int)this.ai[1]; if (!Main.npc[num1029].active) { this.Kill(); return; } base.velocity.ToRotation(); Vector2 vector209 = Main.npc[num1029].Center - base.Center; if (vector209 != Vector2.Zero) { vector209.Normalize(); vector209 = (Vector2)(vector209 * 14f); } float num1030 = 5f; base.velocity = (Vector2)(((base.velocity * (num1030 - 1f)) + vector209) / num1030); } else { this.ai[1]++; if (this.ai[1] >= 45f) { float num1031 = 0.98f; float num1032 = 0.35f; if (this.type == 0x27c) { num1031 = 0.995f; num1032 = 0.15f; } this.ai[1] = 45f; this.velocity.X *= num1031; this.velocity.Y += num1032; } this.rotation = base.velocity.ToRotation() + 1.570796f; } } if (this.ai[0] == 1f) { this.ignoreWater = true; this.tileCollide = false; int num1033 = 15; if (this.type == 0x27c) { num1033 = 5 * this.MaxUpdates; } bool flag52 = false; bool flag53 = false; this.localAI[0]++; if ((this.localAI[0] % 30f) == 0f) { flag53 = true; } int num1034 = (int)this.ai[1]; if (this.localAI[0] >= (60 * num1033)) { flag52 = true; } else if ((num1034 < 0) || (num1034 >= 200)) { flag52 = true; } else if (Main.npc[num1034].active && !Main.npc[num1034].dontTakeDamage) { base.Center = Main.npc[num1034].Center - ((Vector2)(base.velocity * 2f)); this.gfxOffY = Main.npc[num1034].gfxOffY; if (flag53) { Main.npc[num1034].HitEffect(0, 1.0); } } else { flag52 = true; } if (flag52) { this.Kill(); } } if (this.type == 0x266) { Lighting.AddLight(base.Center, 0.2f, 0.6f, 0.7f); } if (this.type == 0x27c) { Lighting.AddLight(base.Center, 0.8f, 0.7f, 0.4f); return; } } else { if (this.aiStyle == 0x72) { if ((Main.netMode == 2) && (this.localAI[0] == 0f)) { PortalHelper.SyncPortalSections(base.Center, 1); this.localAI[0] = 1f; } this.timeLeft = 3; bool flag54 = false; if ((!Main.player[this.owner].active || Main.player[this.owner].dead) || (base.Distance(Main.player[this.owner].Center) > 12800f)) { flag54 = true; } if (!flag54 && !WorldGen.InWorld(((int)base.Center.X) / 0x10, ((int)base.Center.Y) / 0x10, Lighting.offScreenTiles)) { flag54 = true; } if (!flag54 && !PortalHelper.SupportedTilesAreFine(base.Center, this.ai[0])) { flag54 = true; } if (flag54) { this.Kill(); return; } Color portalColor = PortalHelper.GetPortalColor(this.owner, (int)this.ai[1]); this.alpha -= 0x19; if (this.alpha < 0) { this.alpha = 0; } if (this.alpha == 0) { Lighting.AddLight(base.Center + ((Vector2)(base.velocity * 3f)), (Vector3)(portalColor.ToVector3() * 0.5f)); } if (++this.frameCounter >= 6) { this.frameCounter = 0; if (++this.frame >= Main.projFrames[this.type]) { this.frame = 0; } } this.rotation = this.ai[0] - 1.570796f; return; } if (this.aiStyle == 0x73) { Lighting.AddLight(base.Center, new Vector3(0.075f, 0.3f, 0.15f)); base.velocity = (Vector2)(base.velocity * 0.985f); this.rotation += this.velocity.X * 0.2f; if (this.velocity.X > 0f) { this.rotation += 0.08f; } else { this.rotation -= 0.08f; } this.ai[1]++; if (this.ai[1] > 30f) { this.alpha += 10; if (this.alpha >= 0xff) { this.alpha = 0xff; this.Kill(); return; } } } else { if (this.aiStyle == 0x74) { if (this.localAI[0] == 0f) { this.rotation = this.ai[1]; this.localAI[0] = 1f; } Player player7 = Main.player[this.owner]; if (player7.setSolar) { this.timeLeft = 2; } float angle = ((((float)player7.miscCounter) / 300f) * 12.56637f) + this.ai[1]; angle = MathHelper.WrapAngle(angle); this.rotation = this.rotation.AngleLerp(angle, 0.05f); this.alpha -= 15; if (this.alpha < 0) { this.alpha = 0; } base.velocity = ((Vector2)(this.rotation.ToRotationVector2() * 100f)) - player7.velocity; base.Center = player7.Center - base.velocity; return; } if (this.aiStyle == 0x75) { this.ai[1] += 0.01f; this.scale = this.ai[1]; this.ai[0]++; if (this.ai[0] >= (3 * Main.projFrames[this.type])) { this.Kill(); return; } if (++this.frameCounter >= 3) { this.frameCounter = 0; if (++this.frame >= Main.projFrames[this.type]) { this.hide = true; } } this.alpha -= 0x3f; if (this.alpha < 0) { this.alpha = 0; } bool flag55 = this.type == 0x264; bool flag56 = this.type == 0x270; if (flag55) { Lighting.AddLight(base.Center, 0.9f, 0.8f, 0.6f); } if (this.ai[0] == 1f) { base.position = base.Center; base.width = base.height = (int)(52f * this.scale); base.Center = base.position; this.Damage(); if (flag55) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); for (int num1036 = 0; num1036 < 4; num1036++) { color5 = new Color(); int num1037 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x1f, 0f, 0f, 100, color5, 1.5f); Main.dust[num1037].position = base.Center + ((Vector2)(((Vector2.UnitY.RotatedByRandom(3.1415927410125732) * ((float)Main.rand.NextDouble())) * base.width) / 2f)); } for (int num1038 = 0; num1038 < 10; num1038++) { color5 = new Color(); int num1039 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, 0f, 0f, 200, color5, 2.7f); Main.dust[num1039].position = base.Center + ((Vector2)(((Vector2.UnitY.RotatedByRandom(3.1415927410125732) * ((float)Main.rand.NextDouble())) * base.width) / 2f)); Main.dust[num1039].noGravity = true; Dust dust248 = Main.dust[num1039]; dust248.velocity = (Vector2)(dust248.velocity * 3f); color5 = new Color(); num1039 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, 0f, 0f, 100, color5, 1.5f); Main.dust[num1039].position = base.Center + ((Vector2)(((Vector2.UnitY.RotatedByRandom(3.1415927410125732) * ((float)Main.rand.NextDouble())) * base.width) / 2f)); Dust dust249 = Main.dust[num1039]; dust249.velocity = (Vector2)(dust249.velocity * 2f); Main.dust[num1039].noGravity = true; Main.dust[num1039].fadeIn = 2.5f; } for (int num1040 = 0; num1040 < 5; num1040++) { color5 = new Color(); int num1041 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, 0f, 0f, 0, color5, 2.7f); vector240 = new Vector2(); Main.dust[num1041].position = base.Center + ((Vector2)((Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(((double)base.velocity.ToRotation()), vector240) * base.width) / 2f)); Main.dust[num1041].noGravity = true; Dust dust250 = Main.dust[num1041]; dust250.velocity = (Vector2)(dust250.velocity * 3f); } for (int num1042 = 0; num1042 < 10; num1042++) { color5 = new Color(); int num1043 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x1f, 0f, 0f, 0, color5, 1.5f); vector240 = new Vector2(); Main.dust[num1043].position = base.Center + ((Vector2)((Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(((double)base.velocity.ToRotation()), vector240) * base.width) / 2f)); Main.dust[num1043].noGravity = true; Dust dust251 = Main.dust[num1043]; dust251.velocity = (Vector2)(dust251.velocity * 3f); } } if (flag56) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); for (int num1044 = 0; num1044 < 20; num1044++) { color5 = new Color(); int num1045 = Dust.NewDust(base.position, base.width, base.height, 0x87, 0f, 0f, 100, color5, 1.5f); Main.dust[num1045].position = base.Center + ((Vector2)(((Vector2.UnitY.RotatedByRandom(3.1415927410125732) * ((float)Main.rand.NextDouble())) * base.width) / 2f)); Dust dust252 = Main.dust[num1045]; dust252.velocity = (Vector2)(dust252.velocity * 2f); Main.dust[num1045].noGravity = true; Main.dust[num1045].fadeIn = 2.5f; Main.dust[num1045].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]); } for (int num1046 = 0; num1046 < 15; num1046++) { color5 = new Color(); int num1047 = Dust.NewDust(base.position, base.width, base.height, 0x87, 0f, 0f, 0, color5, 2.7f); vector240 = new Vector2(); Main.dust[num1047].position = base.Center + ((Vector2)((Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(((double)base.velocity.ToRotation()), vector240) * base.width) / 2f)); Main.dust[num1047].noGravity = true; Dust dust253 = Main.dust[num1047]; dust253.velocity = (Vector2)(dust253.velocity * 3f); Main.dust[num1047].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]); } float num1048 = ((float)Main.rand.NextDouble()) * 6.283185f; float num1049 = ((float)Main.rand.NextDouble()) * 6.283185f; float num1050 = ((float)Main.rand.NextDouble()) * 6.283185f; float num1051 = 7f + (((float)Main.rand.NextDouble()) * 7f); float num1052 = 7f + (((float)Main.rand.NextDouble()) * 7f); float num1053 = 7f + (((float)Main.rand.NextDouble()) * 7f); float num1054 = num1051; if (num1052 > num1054) { num1054 = num1052; } if (num1053 > num1054) { num1054 = num1053; } for (int num1055 = 0; num1055 < 200; num1055++) { int num1056 = 0x87; float num1057 = num1054; if (num1055 > 50) { num1057 = num1052; } if (num1055 > 100) { num1057 = num1051; } if (num1055 > 150) { num1057 = num1053; } color5 = new Color(); int num1058 = Dust.NewDust(base.position, 6, 6, num1056, 0f, 0f, 100, color5, 1f); Vector2 velocity = Main.dust[num1058].velocity; Main.dust[num1058].position = base.Center; velocity.Normalize(); velocity = (Vector2)(velocity * num1057); if (num1055 > 150) { velocity.Y *= 0.5f; vector240 = new Vector2(); velocity = velocity.RotatedBy((double)num1050, vector240); } else if (num1055 > 100) { velocity.X *= 0.5f; vector240 = new Vector2(); velocity = velocity.RotatedBy((double)num1048, vector240); } else if (num1055 > 50) { velocity.Y *= 0.5f; vector240 = new Vector2(); velocity = velocity.RotatedBy((double)num1049, vector240); } Dust dust254 = Main.dust[num1058]; dust254.velocity = (Vector2)(dust254.velocity * 0.2f); Dust dust255 = Main.dust[num1058]; dust255.velocity += velocity; Main.dust[num1058].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]); if (num1055 <= 200) { Main.dust[num1058].scale = 2f; Main.dust[num1058].noGravity = true; Main.dust[num1058].fadeIn = Main.rand.NextFloat() * 2f; if (Main.rand.Next(4) == 0) { Main.dust[num1058].fadeIn = 2.5f; } Main.dust[num1058].noLight = true; if (num1055 < 100) { Dust dust256 = Main.dust[num1058]; dust256.position += (Vector2)(Main.dust[num1058].velocity * 20f); Dust dust257 = Main.dust[num1058]; dust257.velocity = (Vector2)(dust257.velocity * -1f); } } } return; } } } else if (this.aiStyle == 0x76) { this.ai[0]++; int num1059 = 0; if (this.velocity.Length() <= 4f) { num1059 = 1; } this.alpha -= 15; if (this.alpha < 0) { this.alpha = 0; } switch (num1059) { case 0: this.rotation -= 0.1047198f; if (Main.rand.Next(3) == 0) { if (Main.rand.Next(2) == 0) { Vector2 vector211 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); Dust dust26 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector211 * 30f)), 0, 0, Utils.SelectRandom<int>(Main.rand, new int[] { 0x56, 90 }), 0f, 0f, 0, new Color(), 1f)]; dust26.noGravity = true; dust26.position = base.Center - (vector211 * Main.rand.Next(10, 0x15)); dust26.velocity = (Vector2)(vector211.RotatedBy(1.5707963705062866, new Vector2()) * 6f); dust26.scale = 0.5f + Main.rand.NextFloat(); dust26.fadeIn = 0.5f; dust26.customData = this; } else { Vector2 vector212 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); Dust dust27 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector212 * 30f)), 0, 0, 240, 0f, 0f, 0, new Color(), 1f)]; dust27.noGravity = true; dust27.position = base.Center - ((Vector2)(vector212 * 30f)); dust27.velocity = (Vector2)(vector212.RotatedBy(-1.5707963705062866, new Vector2()) * 3f); dust27.scale = 0.5f + Main.rand.NextFloat(); dust27.fadeIn = 0.5f; dust27.customData = this; } } if (this.ai[0] >= 30f) { base.velocity = (Vector2)(base.velocity * 0.98f); this.scale += 0.007446808f; if (this.scale > 1.3f) { this.scale = 1.3f; } this.rotation -= 0.01745329f; } if (this.velocity.Length() < 4.1f) { this.velocity.Normalize(); base.velocity = (Vector2)(base.velocity * 4f); this.ai[0] = 0f; } break; case 1: { this.rotation -= 0.1047198f; for (int num1060 = 0; num1060 < 1; num1060++) { if (Main.rand.Next(2) == 0) { Vector2 vector213 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); color5 = new Color(); Dust dust28 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector213 * 30f)), 0, 0, 0x56, 0f, 0f, 0, color5, 1f)]; dust28.noGravity = true; dust28.position = base.Center - (vector213 * Main.rand.Next(10, 0x15)); vector240 = new Vector2(); dust28.velocity = (Vector2)(vector213.RotatedBy(1.5707963705062866, vector240) * 6f); dust28.scale = 0.9f + Main.rand.NextFloat(); dust28.fadeIn = 0.5f; dust28.customData = this; vector213 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); color5 = new Color(); dust28 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector213 * 30f)), 0, 0, 90, 0f, 0f, 0, color5, 1f)]; dust28.noGravity = true; dust28.position = base.Center - (vector213 * Main.rand.Next(10, 0x15)); vector240 = new Vector2(); dust28.velocity = (Vector2)(vector213.RotatedBy(1.5707963705062866, vector240) * 6f); dust28.scale = 0.9f + Main.rand.NextFloat(); dust28.fadeIn = 0.5f; dust28.customData = this; dust28.color = Color.Crimson; } else { Vector2 vector214 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); color5 = new Color(); Dust dust29 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector214 * 30f)), 0, 0, 240, 0f, 0f, 0, color5, 1f)]; dust29.noGravity = true; dust29.position = base.Center - (vector214 * Main.rand.Next(20, 0x1f)); vector240 = new Vector2(); dust29.velocity = (Vector2)(vector214.RotatedBy(-1.5707963705062866, vector240) * 5f); dust29.scale = 0.9f + Main.rand.NextFloat(); dust29.fadeIn = 0.5f; dust29.customData = this; } } if ((((this.ai[0] % 30f) == 0f) && (this.ai[0] < 241f)) && (Main.myPlayer == this.owner)) { Vector2 vector215 = (Vector2)(Vector2.UnitY.RotatedByRandom(6.2831854820251465) * 12f); NewProjectile(base.Center.X, base.Center.Y, vector215.X, vector215.Y, 0x26a, this.damage / 2, 0f, this.owner, 0f, (float)base.whoAmI); } Vector2 vector216 = base.Center; float num1061 = 800f; bool flag57 = false; int num1062 = 0; if (this.ai[1] == 0f) { for (int num1063 = 0; num1063 < 200; num1063++) { if (Main.npc[num1063].CanBeChasedBy(this, false)) { Vector2 other = Main.npc[num1063].Center; if ((base.Distance(other) < num1061) && Collision.CanHit(new Vector2(this.position.X + (base.width / 2), this.position.Y + (base.height / 2)), 1, 1, Main.npc[num1063].position, Main.npc[num1063].width, Main.npc[num1063].height)) { num1061 = base.Distance(other); vector216 = other; flag57 = true; num1062 = num1063; } } } if (flag57) { if (this.ai[1] != (num1062 + 1)) { this.netUpdate = true; } this.ai[1] = num1062 + 1; } flag57 = false; } if (this.ai[1] != 0f) { int num1064 = (int)(this.ai[1] - 1f); if ((Main.npc[num1064].active && Main.npc[num1064].CanBeChasedBy(this, true)) && (base.Distance(Main.npc[num1064].Center) < 1000f)) { flag57 = true; vector216 = Main.npc[num1064].Center; } } if (!this.friendly) { flag57 = false; } if (flag57) { float num1065 = 4f; int num1066 = 8; Vector2 vector218 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f)); float num1067 = vector216.X - vector218.X; float num1068 = vector216.Y - vector218.Y; float num1069 = (float)Math.Sqrt((double)((num1067 * num1067) + (num1068 * num1068))); num1069 = num1065 / num1069; num1067 *= num1069; num1068 *= num1069; this.velocity.X = ((this.velocity.X * (num1066 - 1)) + num1067) / ((float)num1066); this.velocity.Y = ((this.velocity.Y * (num1066 - 1)) + num1068) / ((float)num1066); } break; } } if (this.alpha < 150) { Lighting.AddLight(base.Center, 0.7f, 0.2f, 0.6f); } if (this.ai[0] >= 600f) { this.Kill(); return; } } else if (this.aiStyle == 0x77) { int num1070 = 0; float num1071 = 0f; float num1072 = 0f; float num1073 = 0f; bool flag58 = false; bool flag59 = false; if (this.type == 0x26a) { num1070 = 0x269; num1071 = 420f; num1072 = 0.15f; num1073 = 0.15f; } if (flag59) { int num1074 = (int)this.ai[1]; if (!Main.projectile[num1074].active || (Main.projectile[num1074].type != num1070)) { this.Kill(); return; } this.timeLeft = 2; } this.ai[0]++; if (this.ai[0] < num1071) { bool flag60 = true; int num1075 = (int)this.ai[1]; if (Main.projectile[num1075].active && (Main.projectile[num1075].type == num1070)) { if (!flag58 && (Main.projectile[num1075].oldPos[1] != Vector2.Zero)) { base.position += Main.projectile[num1075].position - Main.projectile[num1075].oldPos[1]; } if (base.Center.HasNaNs()) { this.Kill(); return; } } else { this.ai[0] = num1071; flag60 = false; this.Kill(); } if (flag60 && !flag58) { base.velocity += new Vector2((float)Math.Sign((float)(Main.projectile[num1075].Center.X - base.Center.X)), (float)Math.Sign((float)(Main.projectile[num1075].Center.Y - base.Center.Y))) * new Vector2(num1072, num1073); if (this.velocity.Length() > 6f) { base.velocity = (Vector2)(base.velocity * (6f / this.velocity.Length())); } } if (this.type == 0x26a) { if (Main.rand.Next(2) == 0) { int num1076 = Dust.NewDust(base.Center, 8, 8, 0x56, 0f, 0f, 0, new Color(), 1f); Main.dust[num1076].position = base.Center; Main.dust[num1076].velocity = base.velocity; Main.dust[num1076].noGravity = true; Main.dust[num1076].scale = 1.5f; if (flag60) { Main.dust[num1076].customData = Main.projectile[(int)this.ai[1]]; } } this.alpha = 0xff; return; } this.Kill(); return; } } else if (this.aiStyle == 120) { Player player8 = Main.player[this.owner]; if (!player8.active) { base.active = false; return; } bool flag61 = this.type == 0x26f; Vector2 minionTargetPoint = player8.Center; float num1077 = 100f; float num1078 = 300f; float num1079 = 100f; float num1080 = 100f; if (flag61) { if (player8.dead) { player8.stardustGuardian = false; } if (player8.stardustGuardian) { this.timeLeft = 2; } num1077 = 150f; num1078 = 250f; num1079 = 200f; minionTargetPoint.X -= (5 + (player8.width / 2)) * player8.direction; minionTargetPoint.Y -= 25f; Lighting.AddLight(base.Center, 0.9f, 0.9f, 0.7f); if ((this.ai[0] != 3f) && (this.alpha == 0xff)) { this.alpha = 0; for (int num1081 = 0; num1081 < 30; num1081++) { color5 = new Color(); int num1082 = Dust.NewDust(base.position, base.width, base.height, 0x87, 0f, 0f, 200, color5, 1.7f); Main.dust[num1082].noGravity = true; Dust dust258 = Main.dust[num1082]; dust258.velocity = (Vector2)(dust258.velocity * 3f); Main.dust[num1082].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]); color5 = new Color(); num1082 = Dust.NewDust(base.position, base.width, base.height, 0x87, 0f, 0f, 100, color5, 1f); Dust dust259 = Main.dust[num1082]; dust259.velocity = (Vector2)(dust259.velocity * 2f); Main.dust[num1082].noGravity = true; Main.dust[num1082].fadeIn = 2.5f; Main.dust[num1082].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]); } } if (this.localAI[0] > 0f) { this.localAI[0]--; } } if (this.ai[0] != 0f) { Main.player[this.owner].tankPet = base.whoAmI; Main.player[this.owner].tankPetReset = false; } if (this.ai[0] == 0f) { if (player8.HasMinionTarget) { this.ai[0] = 3f; this.netUpdate = true; } base.Center = Vector2.Lerp(base.Center, minionTargetPoint, 0.2f); base.velocity = (Vector2)(base.velocity * 0.8f); base.direction = this.spriteDirection = player8.direction; if (flag61 && (++this.frameCounter >= 9)) { this.frameCounter = 0; if (++this.frame >= (Main.projFrames[this.type] - 4)) { this.frame = 0; } } } else if (this.ai[0] == 1f) { if (player8.HasMinionTarget) { minionTargetPoint = player8.MinionTargetPoint; } else { this.ai[0] = 0f; this.netUpdate = true; } int num1083 = -1; bool flag62 = true; if (flag61 && (Math.Abs((float)(base.Center.X - minionTargetPoint.X)) > (num1077 + 20f))) { flag62 = false; } if (flag62) { for (int num1084 = 0; num1084 < 200; num1084++) { NPC npc11 = Main.npc[num1084]; if (npc11.CanBeChasedBy(this, false) && (base.Distance(npc11.Center) < num1078)) { num1083 = num1084; } } } if (num1083 != -1) { NPC npc12 = Main.npc[num1083]; base.direction = this.spriteDirection = (npc12.Center.X > base.Center.X).ToDirectionInt(); float num1086 = Math.Abs((float)(minionTargetPoint.X - base.Center.X)); float num1087 = Math.Abs((float)(npc12.Center.X - base.Center.X)); float num1088 = Math.Abs((float)(minionTargetPoint.Y - base.Center.Y)); float num1089 = Math.Abs((float)(npc12.Center.Y - base.Bottom.Y)); float num1090 = (npc12.Center.Y > base.Bottom.Y).ToDirectionInt(); if (((num1086 < num1077) || (((minionTargetPoint.X - base.Center.X) * base.direction) < 0f)) && ((num1087 > 20f) && (num1087 < ((num1077 - num1086) + 100f)))) { this.velocity.X += 0.1f * base.direction; } else { this.velocity.X *= 0.7f; } if (((num1088 < num1080) || (((minionTargetPoint.Y - base.Bottom.Y) * num1090) < 0f)) && ((num1089 > 10f) && (num1089 < ((num1080 - num1088) + 10f)))) { this.velocity.Y += 0.1f * num1090; } else { this.velocity.Y *= 0.7f; } if (((this.localAI[0] == 0f) && (this.owner == Main.myPlayer)) && (num1087 < num1079)) { this.ai[1] = 0f; this.ai[0] = 2f; this.netUpdate = true; this.localAI[0] = 90f; } } else { if (Math.Abs((float)(minionTargetPoint.X - base.Center.X)) > (num1077 + 40f)) { this.ai[0] = 3f; this.netUpdate = true; } else if (Math.Abs((float)(minionTargetPoint.X - base.Center.X)) > 20f) { base.direction = this.spriteDirection = (minionTargetPoint.X > base.Center.X).ToDirectionInt(); this.velocity.X += 0.06f * base.direction; } else { this.velocity.X *= 0.8f; base.direction = this.spriteDirection = (player8.Center.X < base.Center.X).ToDirectionInt(); } if (Math.Abs((float)(minionTargetPoint.Y - base.Center.Y)) > num1080) { this.ai[0] = 3f; this.netUpdate = true; } else if (Math.Abs((float)(minionTargetPoint.Y - base.Center.Y)) > 10f) { this.velocity.Y += 0.06f * Math.Sign((float)(minionTargetPoint.Y - base.Center.Y)); } else { this.velocity.Y *= 0.8f; } } if (flag61 && (++this.frameCounter >= 9)) { this.frameCounter = 0; if (++this.frame >= (Main.projFrames[this.type] - 4)) { this.frame = 0; } } } else if (this.ai[0] == 2f) { this.velocity.X *= 0.9f; this.ai[1]++; float num1091 = 0f; if (flag61) { num1091 = 20f; if ((this.ai[1] == 10f) && (this.owner == Main.myPlayer)) { int num1092 = (int)(20f * Main.player[this.owner].minionDamage); NewProjectile(base.Center.X, base.Center.Y, 0f, 0f, 0x270, num1092, 6f, this.owner, 0f, 5f); } } if (this.ai[1] >= num1091) { this.ai[1] = 0f; this.ai[0] = 1f; this.netUpdate = true; } if (flag61) { if (this.frame < (Main.projFrames[this.type] - 4)) { this.frame = Main.projFrames[this.type] - 1; this.frameCounter = 0; } if (++this.frameCounter >= 5) { this.frameCounter = 0; if (--this.frame < (Main.projFrames[this.type] - 5)) { this.frame = Main.projFrames[this.type] - 1; } } } } if (this.ai[0] == 3f) { if (player8.HasMinionTarget) { minionTargetPoint = player8.MinionTargetPoint; } else { this.ai[0] = 0f; this.netUpdate = true; } if (this.alpha == 0) { this.alpha = 0xff; for (int num1093 = 0; num1093 < 30; num1093++) { color5 = new Color(); int num1094 = Dust.NewDust(base.position, base.width, base.height, 0x87, 0f, 0f, 200, color5, 1.7f); Main.dust[num1094].noGravity = true; Dust dust260 = Main.dust[num1094]; dust260.velocity = (Vector2)(dust260.velocity * 3f); Main.dust[num1094].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]); color5 = new Color(); num1094 = Dust.NewDust(base.position, base.width, base.height, 0x87, 0f, 0f, 100, color5, 1f); Dust dust261 = Main.dust[num1094]; dust261.velocity = (Vector2)(dust261.velocity * 2f); Main.dust[num1094].noGravity = true; Main.dust[num1094].fadeIn = 2.5f; Main.dust[num1094].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]); } } else { for (int num1095 = 0; num1095 < 2; num1095++) { color5 = new Color(); int num1096 = Dust.NewDust(base.position, base.width, base.height, 0x87, 0f, 0f, 200, color5, 1.7f); Main.dust[num1096].noGravity = true; Dust dust262 = Main.dust[num1096]; dust262.velocity = (Vector2)(dust262.velocity * 3f); Main.dust[num1096].noLight = true; Main.dust[num1096].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]); color5 = new Color(); num1096 = Dust.NewDust(base.position, base.width, base.height, 0x87, 0f, 0f, 100, color5, 1f); Dust dust263 = Main.dust[num1096]; dust263.velocity = (Vector2)(dust263.velocity * 2f); Main.dust[num1096].noGravity = true; Main.dust[num1096].fadeIn = 2.5f; Main.dust[num1096].noLight = true; Main.dust[num1096].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]); } } base.velocity = (Vector2)(base.velocity * 0.7f); base.Center = Vector2.Lerp(base.Center, minionTargetPoint, 0.2f); if (base.Distance(minionTargetPoint) < 10f) { this.ai[0] = 1f; this.netUpdate = true; return; } } } else { if (this.aiStyle == 0x79) { Player player9 = Main.player[this.owner]; if ((((int)Main.time) % 120) == 0) { this.netUpdate = true; } if (!player9.active) { base.active = false; return; } bool flag63 = this.type == 0x271; bool flag64 = (((this.type == 0x271) || (this.type == 0x272)) || (this.type == 0x273)) || (this.type == 0x274); int num1097 = 10; int num1098 = 10; float num1099 = 0.01f; if (flag64) { if (player9.dead) { player9.stardustDragon = false; } if (player9.stardustDragon) { this.timeLeft = 2; } num1097 = 30; num1098 = 50; num1099 = 0.2f; if (Main.rand.Next(30) == 0) { color5 = new Color(); int num1100 = Dust.NewDust(base.position, base.width, base.height, 0x87, 0f, 0f, 0, color5, 2f); Main.dust[num1100].noGravity = true; Main.dust[num1100].fadeIn = 2f; Point point4 = Main.dust[num1100].position.ToTileCoordinates(); if (WorldGen.InWorld(point4.X, point4.Y, 5) && WorldGen.SolidTile(point4.X, point4.Y)) { Main.dust[num1100].noLight = true; } } } if (flag63) { Vector2 vector220 = player9.Center; float num1101 = 700f; float num1102 = 1000f; int num1103 = -1; if (base.Distance(vector220) > 2000f) { base.Center = vector220; this.netUpdate = true; } bool flag65 = true; if (flag65) { for (int num1104 = 0; num1104 < 200; num1104++) { NPC npc13 = Main.npc[num1104]; if ((npc13.CanBeChasedBy(this, false) && (player9.Distance(npc13.Center) < num1102)) && (base.Distance(npc13.Center) < num1101)) { num1103 = num1104; bool boss = npc13.boss; } } } if (num1103 != -1) { NPC npc14 = Main.npc[num1103]; Vector2 vector221 = npc14.Center - base.Center; (vector221.X > 0f).ToDirectionInt(); (vector221.Y > 0f).ToDirectionInt(); float num1106 = 0.4f; if (vector221.Length() < 600f) { num1106 = 0.6f; } if (vector221.Length() < 300f) { num1106 = 0.8f; } if (vector221.Length() > (npc14.Size.Length() * 0.75f)) { base.velocity += (Vector2)((Vector2.Normalize(vector221) * num1106) * 1.5f); if (Vector2.Dot(base.velocity, vector221) < 0.25f) { base.velocity = (Vector2)(base.velocity * 0.8f); } } float num1107 = 30f; if (this.velocity.Length() > num1107) { base.velocity = (Vector2)(Vector2.Normalize(base.velocity) * num1107); } } else { float num1108 = 0.2f; Vector2 vector222 = vector220 - base.Center; if (vector222.Length() < 200f) { num1108 = 0.12f; } if (vector222.Length() < 140f) { num1108 = 0.06f; } if (vector222.Length() > 100f) { if (Math.Abs((float)(vector220.X - base.Center.X)) > 20f) { this.velocity.X += num1108 * Math.Sign((float)(vector220.X - base.Center.X)); } if (Math.Abs((float)(vector220.Y - base.Center.Y)) > 10f) { this.velocity.Y += num1108 * Math.Sign((float)(vector220.Y - base.Center.Y)); } } else if (this.velocity.Length() > 2f) { base.velocity = (Vector2)(base.velocity * 0.96f); } if (Math.Abs(this.velocity.Y) < 1f) { this.velocity.Y -= 0.1f; } float num1109 = 15f; if (this.velocity.Length() > num1109) { base.velocity = (Vector2)(Vector2.Normalize(base.velocity) * num1109); } } this.rotation = base.velocity.ToRotation() + 1.570796f; int direction = base.direction; base.direction = this.spriteDirection = (this.velocity.X > 0f) ? 1 : -1; if (direction != base.direction) { this.netUpdate = true; } float num1111 = MathHelper.Clamp(this.localAI[0], 0f, 4f); base.position = base.Center; this.scale = 1f + (num1111 * 0.01f); base.width = base.height = (int)(num1097 * this.scale); base.Center = base.position; if (this.alpha > 0) { for (int num1112 = 0; num1112 < 2; num1112++) { color5 = new Color(); int num1113 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x87, 0f, 0f, 100, color5, 2f); Main.dust[num1113].noGravity = true; Main.dust[num1113].noLight = true; } this.alpha -= 0x2a; if (this.alpha < 0) { this.alpha = 0; } } this.damage = (int)((num1098 * (1f + (this.localAI[0] * num1099))) * player9.minionDamage); return; } bool flag66 = false; Vector2 vector223 = Vector2.Zero; Vector2 vector1 = Vector2.Zero; float num1114 = 0f; float num1115 = 0f; float num1116 = 1f; if (this.ai[1] == 1f) { this.ai[1] = 0f; this.netUpdate = true; } /*int byUUID = GetByUUID(this.owner, (int)this.ai[0]); if (((flag64 && (byUUID >= 0)) && Main.projectile[byUUID].active) && (((Main.projectile[byUUID].type == 0x271) || (Main.projectile[byUUID].type == 0x272)) || (Main.projectile[byUUID].type == 0x273))) { flag66 = true; vector223 = Main.projectile[byUUID].Center; Vector2 vector241 = Main.projectile[byUUID].velocity; num1114 = Main.projectile[byUUID].rotation; num1116 = MathHelper.Clamp(Main.projectile[byUUID].scale, 0f, 4f); num1115 = 16f; int num1164 = Main.projectile[byUUID].alpha; Main.projectile[byUUID].localAI[0] = this.localAI[0] + 1f; if (Main.projectile[byUUID].type != 0x271) { Main.projectile[byUUID].localAI[1] = base.whoAmI; } if (((this.owner == Main.myPlayer) && (Main.projectile[byUUID].type == 0x271)) && (this.type == 0x274)) { Main.projectile[byUUID].Kill(); this.Kill(); return; } }*/ if (flag66) { if (this.alpha > 0) { for (int num1119 = 0; num1119 < 2; num1119++) { color5 = new Color(); int num1120 = Dust.NewDust(base.position, base.width, base.height, 0x87, 0f, 0f, 100, color5, 2f); Main.dust[num1120].noGravity = true; Main.dust[num1120].noLight = true; } } this.alpha -= 0x2a; if (this.alpha < 0) { this.alpha = 0; } base.velocity = Vector2.Zero; Vector2 vector224 = vector223 - base.Center; if (num1114 != this.rotation) { float num1121 = MathHelper.WrapAngle(num1114 - this.rotation); vector224 = vector224.RotatedBy((double)(num1121 * 0.1f), new Vector2()); } this.rotation = vector224.ToRotation() + 1.570796f; base.position = base.Center; this.scale = num1116; base.width = base.height = (int)(num1097 * this.scale); base.Center = base.position; if (vector224 != Vector2.Zero) { base.Center = vector223 - ((Vector2)((Vector2.Normalize(vector224) * num1115) * num1116)); } this.spriteDirection = (vector224.X > 0f) ? 1 : -1; this.damage = (int)((num1098 * (1f + (this.localAI[0] * num1099))) * player9.minionDamage); } return; } if (this.aiStyle == 0x7a) { int num1122 = (int)this.ai[0]; bool flag67 = false; if ((num1122 == -1) || !Main.npc[num1122].active) { flag67 = true; } if (flag67) { if (this.type == 0x275) { this.Kill(); return; } if ((this.type == 0x277) && (this.ai[0] != -1f)) { this.ai[0] = -1f; this.netUpdate = true; } } if (!flag67 && base.Hitbox.Intersects(Main.npc[num1122].Hitbox)) { this.Kill(); if (this.type == 0x277) { this.localAI[1] = 1f; this.Damage(); } return; } if (this.type == 0x275) { Vector2 vector225 = Main.npc[num1122].Center - base.Center; base.velocity = (Vector2)(Vector2.Normalize(vector225) * 5f); Dust.QuickDust(base.Center, Color.Red); } if (this.type == 0x277) { if (this.ai[1] > 0f) { this.ai[1]--; base.velocity = Vector2.Zero; return; } if (flag67) { if (base.velocity == Vector2.Zero) { this.Kill(); } this.tileCollide = true; this.alpha += 10; if (this.alpha > 0xff) { this.Kill(); } } else { Vector2 vector226 = Main.npc[num1122].Center - base.Center; base.velocity = (Vector2)(Vector2.Normalize(vector226) * 12f); this.alpha -= 15; if (this.alpha < 0) { this.alpha = 0; } } this.rotation = base.velocity.ToRotation() - 1.570796f; return; } } else if (this.aiStyle == 0x7b) { bool flag68 = this.type == 0x281; bool flag69 = this.type == 0x283; float num1123 = 1000f; base.velocity = Vector2.Zero; if (flag68) { this.alpha -= 5; if (this.alpha < 0) { this.alpha = 0; } if (base.direction == 0) { base.direction = Main.player[this.owner].direction; } this.rotation -= (base.direction * 6.283185f) / 120f; this.scale = this.Opacity; Lighting.AddLight(base.Center, (Vector3)(new Vector3(0.3f, 0.9f, 0.7f) * this.Opacity)); if (Main.rand.Next(2) == 0) { Vector2 vector227 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); color5 = new Color(); Dust dust30 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector227 * 30f)), 0, 0, 0xe5, 0f, 0f, 0, color5, 1f)]; dust30.noGravity = true; dust30.position = base.Center - (vector227 * Main.rand.Next(10, 0x15)); vector240 = new Vector2(); dust30.velocity = (Vector2)(vector227.RotatedBy(1.5707963705062866, vector240) * 6f); dust30.scale = 0.5f + Main.rand.NextFloat(); dust30.fadeIn = 0.5f; dust30.customData = base.Center; } if (Main.rand.Next(2) == 0) { Vector2 vector228 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); color5 = new Color(); Dust dust31 = Main.dust[Dust.NewDust(base.Center - ((Vector2)(vector228 * 30f)), 0, 0, 240, 0f, 0f, 0, color5, 1f)]; dust31.noGravity = true; dust31.position = base.Center - ((Vector2)(vector228 * 30f)); dust31.velocity = (Vector2)(vector228.RotatedBy(-1.5707963705062866, new Vector2()) * 3f); dust31.scale = 0.5f + Main.rand.NextFloat(); dust31.fadeIn = 0.5f; dust31.customData = base.Center; } if (this.ai[0] < 0f) { color5 = new Color(); int num1124 = Dust.NewDust(base.Center - ((Vector2)(Vector2.One * 8f)), 0x10, 0x10, 0xe5, this.velocity.X / 2f, this.velocity.Y / 2f, 0, color5, 1f); Dust dust264 = Main.dust[num1124]; dust264.velocity = (Vector2)(dust264.velocity * 2f); Main.dust[num1124].noGravity = true; Main.dust[num1124].scale = Utils.SelectRandom<float>(Main.rand, new float[] { 0.8f, 1.65f }); Main.dust[num1124].customData = this; } } if (flag69) { this.alpha -= 5; if (this.alpha < 0) { this.alpha = 0; } if (base.direction == 0) { base.direction = Main.player[this.owner].direction; } if (++this.frameCounter >= 3) { this.frameCounter = 0; if (++this.frame >= Main.projFrames[this.type]) { this.frame = 0; } } if ((this.alpha == 0) && (Main.rand.Next(15) == 0)) { Dust dust32 = Main.dust[Dust.NewDust(base.Top, 0, 0, 0x105, 0f, 0f, 100, new Color(), 1f)]; dust32.velocity.X = 0f; dust32.noGravity = true; dust32.fadeIn = 1f; dust32.position = base.Center + ((Vector2)(Vector2.UnitY.RotatedByRandom(6.2831854820251465) * ((4f * Main.rand.NextFloat()) + 26f))); dust32.scale = 0.5f; } this.localAI[0]++; if (this.localAI[0] >= 60f) { this.localAI[0] = 0f; } } if (this.ai[0] < 0f) { this.ai[0]++; if (flag68) { this.ai[1] -= (base.direction * 0.3926991f) / 50f; } } if (this.ai[0] == 0f) { int num1125 = -1; float num1126 = num1123; for (int num1127 = 0; num1127 < 200; num1127++) { NPC npc15 = Main.npc[num1127]; if (npc15.CanBeChasedBy(this, false)) { float num1128 = base.Distance(npc15.Center); if ((num1128 < num1126) && Collision.CanHitLine(base.Center, 0, 0, npc15.Center, 0, 0)) { num1126 = num1128; num1125 = num1127; } } } if (num1125 != -1) { this.ai[0] = 1f; this.ai[1] = num1125; this.netUpdate = true; return; } } if (this.ai[0] > 0f) { int num1129 = (int)this.ai[1]; if (!Main.npc[num1129].CanBeChasedBy(this, false)) { this.ai[0] = 0f; this.ai[1] = 0f; this.netUpdate = true; return; } this.ai[0]++; float num1130 = 30f; if (flag69) { num1130 = 5f; } if (this.ai[0] >= num1130) { Vector2 vector230 = base.DirectionTo(Main.npc[num1129].Center); if (vector230.HasNaNs()) { vector230 = Vector2.UnitY; } float num1131 = vector230.ToRotation(); int num1132 = (vector230.X > 0f) ? 1 : -1; if (flag68) { base.direction = num1132; this.ai[0] = -60f; this.ai[1] = num1131 + ((num1132 * 3.141593f) / 16f); this.netUpdate = true; if (this.owner == Main.myPlayer) { NewProjectile(base.Center.X, base.Center.Y, vector230.X, vector230.Y, 0x282, this.damage, this.knockBack, this.owner, 0f, (float)base.whoAmI); } } if (flag69) { base.direction = num1132; this.ai[0] = -20f; this.netUpdate = true; if (this.owner == Main.myPlayer) { Vector2 vector231 = (Main.npc[num1129].position + (Main.npc[num1129].Size * Utils.RandomVector2(Main.rand, 0f, 1f))) - base.Center; for (int num1133 = 0; num1133 < 3; num1133++) { Vector2 vector232 = base.Center + vector231; if (num1133 > 0) { vector232 = base.Center + ((Vector2)(vector231.RotatedByRandom(0.78539818525314331) * ((Main.rand.NextFloat() * 0.5f) + 0.75f))); } float num1134 = Main.rgbToHsl(new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB)).X; NewProjectile(vector232.X, vector232.Y, 0f, 0f, 0x284, this.damage, this.knockBack, this.owner, num1134, (float)base.whoAmI); } return; } } } } } else if (this.aiStyle == 0x7c) { Player player10 = Main.player[this.owner]; if (player10.dead) { this.Kill(); return; } if ((Main.myPlayer == this.owner) && player10.suspiciouslookingTentacle) { this.timeLeft = 2; } base.direction = this.spriteDirection = player10.direction; Vector3 vector233 = (Vector3)(new Vector3(0.5f, 0.9f, 1f) * 1.5f); DelegateMethods.v3_1 = vector233; Utils.PlotTileLine(base.Center, base.Center + ((Vector2)(base.velocity * 6f)), 20f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); Utils.PlotTileLine(base.Left, base.Right, 20f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); Utils.PlotTileLine(player10.Center, player10.Center + ((Vector2)(player10.velocity * 6f)), 40f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); Utils.PlotTileLine(player10.Left, player10.Right, 40f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); Vector2 vector234 = new Vector2((float)(player10.direction * 30), -20f); Vector2 vector235 = player10.MountedCenter + vector234; float num1135 = Vector2.Distance(base.Center, vector235); if (num1135 > 1000f) { base.Center = player10.Center + vector234; } Vector2 vector236 = vector235 - base.Center; float num1136 = 4f; if (num1135 < num1136) { base.velocity = (Vector2)(base.velocity * 0.25f); } if (vector236 != Vector2.Zero) { if (vector236.Length() < num1136) { base.velocity = vector236; } else { base.velocity = (Vector2)(vector236 * 0.1f); } } if (this.velocity.Length() > 6f) { float num1137 = base.velocity.ToRotation() + 1.570796f; if (Math.Abs((float)(this.rotation - num1137)) >= 3.141593f) { if (num1137 < this.rotation) { this.rotation -= 6.283185f; } else { this.rotation += 6.283185f; } } float num1138 = 12f; this.rotation = ((this.rotation * (num1138 - 1f)) + num1137) / num1138; if (++this.frameCounter >= 4) { this.frameCounter = 0; if (++this.frame >= Main.projFrames[this.type]) { this.frame = 0; } } } else { if (this.rotation > 3.141593f) { this.rotation -= 6.283185f; } if ((this.rotation > -0.005f) && (this.rotation < 0.005f)) { this.rotation = 0f; } else { this.rotation *= 0.96f; } if (++this.frameCounter >= 6) { this.frameCounter = 0; if (++this.frame >= Main.projFrames[this.type]) { this.frame = 0; } } } if (this.ai[0] > 0f) { this.ai[0] = num1163 = this.ai[0] + 1f; if (num1163 >= 60f) { this.ai[0] = 0f; this.ai[1] = 0f; } } if (Main.rand.Next(15) == 0) { float num1139 = -1f; int num1140 = 0x11; Vector2 vector237 = base.Center - player10.Center; if (vector237.Length() < Main.screenWidth) { int num1141 = ((int)base.Center.X) / 0x10; int num1142 = ((int)base.Center.Y) / 0x10; num1141 = (int)MathHelper.Clamp((float)num1141, (float)(num1140 + 1), (float)((Main.maxTilesX - num1140) - 1)); num1142 = (int)MathHelper.Clamp((float)num1142, (float)(num1140 + 1), (float)((Main.maxTilesY - num1140) - 1)); for (int num1143 = num1141 - num1140; num1143 <= (num1141 + num1140); num1143++) { for (int num1144 = num1142 - num1140; num1144 <= (num1142 + num1140); num1144++) { int num1145 = Main.rand.Next(8); if (num1145 < 4) { Vector2 vector238 = new Vector2((float)(num1141 - num1143), (float)(num1142 - num1144)); if (((vector238.Length() < num1140) && (Main.tile[num1143, num1144] != null)) && Main.tile[num1143, num1144].active()) { bool flag70 = false; if ((Main.tile[num1143, num1144].type == 0xb9) && (Main.tile[num1143, num1144].frameY == 0x12)) { if ((Main.tile[num1143, num1144].frameX >= 0x240) && (Main.tile[num1143, num1144].frameX <= 0x372)) { flag70 = true; } } else if (((Main.tile[num1143, num1144].type == 0xba) && (Main.tile[num1143, num1144].frameX >= 0x360)) && (Main.tile[num1143, num1144].frameX <= 0x492)) { flag70 = true; } if ((flag70 || Main.tileSpelunker[Main.tile[num1143, num1144].type]) || (Main.tileAlch[Main.tile[num1143, num1144].type] && (Main.tile[num1143, num1144].type != 0x52))) { float num1146 = base.Distance(new Vector2((float)((num1143 * 0x10) + 8), (float)((num1144 * 0x10) + 8))); if ((num1146 < num1139) || (num1139 == -1f)) { num1139 = num1146; this.ai[0] = 1f; this.ai[1] = base.AngleTo(new Vector2((float)((num1143 * 0x10) + 8), (float)((num1144 * 0x10) + 8))); } if (num1145 < 2) { color5 = new Color(); int num1147 = Dust.NewDust(new Vector2((float)(num1143 * 0x10), (float)(num1144 * 0x10)), 0x10, 0x10, 0xcc, 0f, 0f, 150, color5, 0.3f); Main.dust[num1147].fadeIn = 0.75f; Dust dust265 = Main.dust[num1147]; dust265.velocity = (Vector2)(dust265.velocity * 0.1f); } } } } } } } } float num1148 = (this.localAI[0] % 6.283185f) - 3.141593f; float num1149 = (float)Math.IEEERemainder((double)this.localAI[1], 1.0); if (num1149 < 0f) { num1149++; } float num1150 = (float)Math.Floor((double)this.localAI[1]); float max = 0.999f; float num1152 = 0f; int num1153 = 0; float num1154 = 0.1f; bool flag71 = player10.velocity.Length() > 3f; int num1155 = -1; int num1156 = -1; float num1157 = 300f; float num1158 = 500f; for (int num1159 = 0; num1159 < 200; num1159++) { NPC npc16 = Main.npc[num1159]; if ((npc16.active && npc16.chaseable) && (!npc16.dontTakeDamage && !npc16.immortal)) { float num1160 = base.Distance(npc16.Center); if (npc16.friendly || (npc16.lifeMax <= 5)) { if ((num1160 < num1157) && !flag71) { num1157 = num1160; num1156 = num1159; } } else if (num1160 < num1158) { num1158 = num1160; num1155 = num1159; } } } if (flag71) { num1152 = base.AngleTo(base.Center + player10.velocity); num1153 = 1; num1149 = MathHelper.Clamp(num1149 + 0.05f, 0f, max); num1150 += Math.Sign((float)(-10f - num1150)); } else if (num1155 != -1) { num1152 = base.AngleTo(Main.npc[num1155].Center); num1153 = 2; num1149 = MathHelper.Clamp(num1149 + 0.05f, 0f, max); num1150 += Math.Sign((float)(-12f - num1150)); } else if (num1156 != -1) { num1152 = base.AngleTo(Main.npc[num1156].Center); num1153 = 3; num1149 = MathHelper.Clamp(num1149 + 0.05f, 0f, max); num1150 += Math.Sign((float)(6f - num1150)); } else if (this.ai[0] > 0f) { num1152 = this.ai[1]; num1149 = MathHelper.Clamp(num1149 + (Math.Sign((float)(0.75f - num1149)) * 0.05f), 0f, max); num1153 = 4; num1150 += Math.Sign((float)(10f - num1150)); if (Main.rand.Next(10) == 0) { int num1161 = Dust.NewDust((Vector2)((base.Center + ((num1148.ToRotationVector2() * 6f) * num1149)) - (Vector2.One * 4f)), 8, 8, 0xcc, 0f, 0f, 150, new Color(), 0.3f); Main.dust[num1161].fadeIn = 0.75f; Dust dust266 = Main.dust[num1161]; dust266.velocity = (Vector2)(dust266.velocity * 0.1f); } } else { num1152 = (player10.direction == 1) ? 0f : 3.141603f; num1149 = MathHelper.Clamp(num1149 + (Math.Sign((float)(0.75f - num1149)) * 0.05f), 0f, max); num1150 += Math.Sign((float)(0f - num1150)); num1154 = 0.12f; } Vector2 vector239 = num1152.ToRotationVector2(); num1152 = Vector2.Lerp(num1148.ToRotationVector2(), vector239, num1154).ToRotation(); this.localAI[0] = (num1152 + (num1153 * 6.283185f)) + 3.141593f; this.localAI[1] = num1150 + num1149; } } } } } } return; } int num963 = 0; float num964 = 0f; float num965 = 0f; float num966 = 0f; int num967 = -1; int num968 = 0; float num969 = 0f; bool flag44 = true; bool flag45 = false; bool flag46 = false; switch (this.type) { case 0x23d: num963 = 0x1a8; num964 = 90f; num969 = 20f; flag44 = false; flag45 = true; break; case 0x23e: num963 = 420; num964 = 180f; num965 = 0.15f; num966 = 0.075f; num969 = 8f; flag44 = false; num967 = 0x240; num968 = 0x41; if (Main.expertMode) { num968 = 50; } flag46 = true; break; case 0x21b: num963 = 0x197; num964 = 210f; num965 = 0.15f; num966 = 0.075f; num969 = 16f; break; } if (flag46) { int num970 = (int)this.ai[1]; if (!Main.npc[num970].active || (Main.npc[num970].type != num963)) { this.Kill(); return; } this.timeLeft = 2; } this.ai[0]++; if (this.ai[0] < num964) { bool flag47 = true; int num971 = (int)this.ai[1]; if (Main.npc[num971].active && (Main.npc[num971].type == num963)) { if (!flag45 && (Main.npc[num971].oldPos[1] != Vector2.Zero)) { base.position += Main.npc[num971].position - Main.npc[num971].oldPos[1]; } } else { this.ai[0] = num964; flag47 = false; } if (flag47 && !flag45) { base.velocity += new Vector2((float)Math.Sign((float)(Main.npc[num971].Center.X - base.Center.X)), (float)Math.Sign((float)(Main.npc[num971].Center.Y - base.Center.Y))) * new Vector2(num965, num966); if (this.velocity.Length() > 6f) { base.velocity = (Vector2)(base.velocity * (6f / this.velocity.Length())); } } if (this.type == 0x21b) { if (Main.rand.Next(12) == 0) { color5 = new Color(); int num972 = Dust.NewDust(base.Center, 8, 8, 180, 0f, 0f, 0, color5, 1f); Main.dust[num972].position = base.Center; Dust dust240 = Main.dust[num972]; dust240.velocity = (Vector2)(dust240.velocity * 0.2f); Main.dust[num972].noGravity = true; } if (++this.frameCounter >= 4) { this.frameCounter = 0; if (++this.frame >= Main.projFrames[this.type]) { this.frame = 0; } } this.rotation = this.velocity.X * 0.1f; } if (this.type == 0x23d) { if (Main.rand.Next(2) == 0) { color5 = new Color(); int num973 = Dust.NewDust(base.Center, 8, 8, 0xf2, 0f, 0f, 0, color5, 1f); Main.dust[num973].position = base.Center; Main.dust[num973].velocity = base.velocity; Main.dust[num973].noGravity = true; Main.dust[num973].scale = 1.5f; } this.alpha = 0xff; } if (this.type == 0x23e) { if (Main.rand.Next(10) == 0) { color5 = new Color(); int num974 = Dust.NewDust(base.Center, 8, 8, 0xf2, 0f, 0f, 0, color5, 1f); Main.dust[num974].position = base.Center; Main.dust[num974].velocity = base.velocity; Main.dust[num974].noGravity = true; Main.dust[num974].scale = 1.5f; } if (flag47) { int target = Main.npc[num971].target; float num976 = base.velocity.ToRotation(); if (Collision.CanHitLine(base.Center, 0, 0, Main.player[target].Center, 0, 0)) { num976 = base.DirectionTo(Main.player[target].Center).ToRotation(); } this.rotation = this.rotation.AngleLerp(num976 + 1.570796f, 0.2f); } this.frame = 1; } } if (this.ai[0] == num964) { bool flag48 = true; int num977 = -1; if (!flag44) { int num978 = (int)this.ai[1]; if (Main.npc[num978].active && (Main.npc[num978].type == num963)) { num977 = Main.npc[num978].target; } else { flag48 = false; } } else { flag48 = false; } if (!flag48) { num977 = Player.FindClosest(base.position, base.width, base.height); } Vector2 vector176 = Main.player[num977].Center - base.Center; vector176.X += Main.rand.Next(-50, 0x33); vector176.Y += Main.rand.Next(-50, 0x33); vector176.X *= Main.rand.Next(80, 0x79) * 0.01f; vector176.Y *= Main.rand.Next(80, 0x79) * 0.01f; Vector2 vector177 = Vector2.Normalize(vector176); if (vector177.HasNaNs()) { vector177 = Vector2.UnitY; } if (num967 == -1) { base.velocity = (Vector2)(vector177 * num969); this.netUpdate = true; } else { if ((Main.netMode != 1) && Collision.CanHitLine(base.Center, 0, 0, Main.player[num977].Center, 0, 0)) { NewProjectile(base.Center.X, base.Center.Y, vector177.X * num969, vector177.Y * num969, num967, num968, 1f, Main.myPlayer, 0f, 0f); } this.ai[0] = 0f; } } if (this.ai[0] >= num964) { this.rotation = this.rotation.AngleLerp(base.velocity.ToRotation() + 1.570796f, 0.4f); if (this.type == 0x21b) { if (++this.frameCounter >= 2) { this.frameCounter = 0; if (++this.frame >= Main.projFrames[this.type]) { this.frame = 0; } } if (Main.rand.Next(2) == 0) { color5 = new Color(); int num979 = Dust.NewDust(base.position, base.width, base.height, 180, 0f, 0f, 100, color5, 1f); Dust dust241 = Main.dust[num979]; dust241.scale += Main.rand.Next(50) * 0.01f; Main.dust[num979].noGravity = true; Dust dust242 = Main.dust[num979]; dust242.velocity = (Vector2)(dust242.velocity * 0.1f); Main.dust[num979].fadeIn = Main.rand.NextFloat() * 1.5f; } if (Main.rand.Next(3) == 0) { color5 = new Color(); int num980 = Dust.NewDust(base.position, base.width, base.height, 0xb0, 0f, 0f, 100, color5, 1f); Dust dust243 = Main.dust[num980]; dust243.scale += 0.3f + (Main.rand.Next(50) * 0.01f); Main.dust[num980].noGravity = true; Dust dust244 = Main.dust[num980]; dust244.velocity = (Vector2)(dust244.velocity * 0.1f); Main.dust[num980].fadeIn = Main.rand.NextFloat() * 1.5f; } } if (this.type == 0x23d) { if (Main.rand.Next(4) == 0) { int num981 = Dust.NewDust(base.Center, 8, 8, 0xf2, 0f, 0f, 0, new Color(), 1f); Main.dust[num981].position = base.Center; Dust dust245 = Main.dust[num981]; dust245.velocity = (Vector2)(dust245.velocity * 0.2f); Main.dust[num981].noGravity = true; Main.dust[num981].scale = 1.5f; } this.alpha = 0; } } return; } float num959 = 20f; this.localAI[0]++; this.alpha = (int)MathHelper.Lerp(0f, 255f, this.localAI[0] / num959); int num960 = (int)this.ai[0]; int num961 = -1; int num962 = -1; switch (this.type) { case 0x218: num961 = 0x217; num962 = 0; break; case 0x24f: num962 = 1; break; } if (num962 == 1) { if (((this.localAI[0] >= num959) || (num960 < 0)) || (((num960 > 0xff) || !Main.player[num960].active) || Main.player[num960].dead)) { this.Kill(); return; } if (this.type == 0x24f) { base.Center = Mount.GetMinecartMechPoint(Main.player[num960], 20, -19) - base.velocity; this.rotation = base.velocity.ToRotation() + 1.570796f; int introduced1839 = Math.Sign(this.velocity.X); if ((introduced1839 != Math.Sign(Main.player[num960].velocity.X)) && (Main.player[num960].velocity.X != 0f)) { this.Kill(); return; } } else { base.Center = Main.player[num960].Center - base.velocity; } } else if (num962 == 0) { if (((this.localAI[0] >= num959) || (num960 < 0)) || (((num960 > 0x3e8) || !Main.projectile[num960].active) || (Main.projectile[num960].type != num961))) { this.Kill(); return; } base.Center = Main.projectile[num960].Center - base.velocity; } this.rotation = base.velocity.ToRotation() + 1.570796f; return; } if (++this.frameCounter >= 4) { this.frameCounter = 0; if (++this.frame >= Main.projFrames[this.type]) { this.frame = 0; } } this.ai[0]++; if (this.ai[0] <= 40f) { this.alpha -= 5; if (this.alpha < 0) { this.alpha = 0; } base.velocity = (Vector2)(base.velocity * 0.85f); if (this.ai[0] == 40f) { this.netUpdate = true; switch (Main.rand.Next(3)) { case 0: this.ai[1] = 10f; break; case 1: this.ai[1] = 15f; break; case 2: this.ai[1] = 30f; break; } } } else if (this.ai[0] <= 60f) { base.velocity = Vector2.Zero; if (this.ai[0] == 60f) { this.netUpdate = true; } } else if (this.ai[0] <= 210f) { if (Main.netMode != 1) { this.localAI[0] = num1163 = this.localAI[0] + 1f; if (num1163 >= this.ai[1]) { this.localAI[0] = 0f; int num934 = Item.NewItem((int)base.Center.X, (int)base.Center.Y, 0, 0, 0x49, 1, false, 0, false); Main.item[num934].velocity = (Vector2)(((Vector2.UnitY.RotatedByRandom(6.2831854820251465) * new Vector2(3f, 2f)) * ((Main.rand.NextFloat() * 0.5f) + 0.5f)) - (Vector2.UnitY * 1f)); } } if (this.ai[0] == 210f) { this.netUpdate = true; } } else { this.scale -= 0.03333334f; this.alpha += 15; if (this.ai[0] == 239f) { this.netUpdate = true; } if (this.ai[0] == 240f) { this.Kill(); } } if ((this.alpha < 90) && (Main.rand.Next(3) == 0)) { Vector2 vector160 = (Vector2)((new Vector2((float)base.width, (float)base.height) * this.scale) * 0.85f); vector160 = (Vector2)(vector160 / 2f); Vector2 vector161 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * vector160; int num935 = Dust.NewDust(base.Center + vector161, 0, 0, 0xf6, 0f, 0f, 0, new Color(), 1f); Main.dust[num935].position = base.Center + vector161; Main.dust[num935].velocity = Vector2.Zero; } float num936 = 0.8f; float num937 = 0.7098039f; float num938 = 0.282353f; Lighting.AddLight(base.Center, num936 * 0.3f, num937 * 0.3f, num938 * 0.3f); return; } if (this.type != 0x1d1) { int num900; if (this.type != 0x1d2) { int num910; if (this.type != 580) { return; } if ((this.localAI[1] == 0f) && (this.ai[0] >= 900f)) { this.ai[0] -= 1000f; this.localAI[1] = -1f; } this.frameCounter++; Lighting.AddLight(base.Center, 0.3f, 0.45f, 0.5f); if (base.velocity == Vector2.Zero) { if (this.frameCounter >= (this.extraUpdates * 2)) { this.frameCounter = 0; bool flag36 = true; for (int num902 = 1; num902 < this.oldPos.Length; num902++) { if (this.oldPos[num902] != this.oldPos[0]) { flag36 = false; } } if (flag36) { this.Kill(); return; } } if ((Main.rand.Next(this.extraUpdates) == 0) && ((base.velocity != Vector2.Zero) || (Main.rand.Next((this.localAI[1] == 2f) ? 2 : 6) == 0))) { for (int num903 = 0; num903 < 2; num903++) { float num904 = this.rotation + (((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.570796f); float num905 = (((float)Main.rand.NextDouble()) * 0.8f) + 1f; Vector2 vector148 = new Vector2(((float)Math.Cos((double)num904)) * num905, ((float)Math.Sin((double)num904)) * num905); color5 = new Color(); int num906 = Dust.NewDust(base.Center, 0, 0, 0xe2, vector148.X, vector148.Y, 0, color5, 1f); Main.dust[num906].noGravity = true; Main.dust[num906].scale = 1.2f; } if (Main.rand.Next(5) == 0) { Vector2 vector149 = (Vector2)((base.velocity.RotatedBy(1.5707963705062866, new Vector2()) * (((float)Main.rand.NextDouble()) - 0.5f)) * base.width); int num907 = Dust.NewDust((base.Center + vector149) - ((Vector2)(Vector2.One * 4f)), 8, 8, 0x1f, 0f, 0f, 100, new Color(), 1.5f); Dust dust228 = Main.dust[num907]; dust228.velocity = (Vector2)(dust228.velocity * 0.5f); Main.dust[num907].velocity.Y = -Math.Abs(Main.dust[num907].velocity.Y); return; } } return; } if (this.frameCounter < (this.extraUpdates * 2)) { return; } this.frameCounter = 0; float num908 = this.velocity.Length(); Random random2 = new Random((int)this.ai[1]); int num909 = 0; Vector2 vector150 = -Vector2.UnitY; Label_23A47: num910 = random2.Next(); this.ai[1] = num910; num910 = num910 % 100; Vector2 vector151 = ((((float)num910) / 100f) * 6.283185f).ToRotationVector2(); if (vector151.Y > 0f) { vector151.Y *= -1f; } bool flag37 = false; if (vector151.Y > -0.02f) { flag37 = true; } if (((((vector151.X * (this.extraUpdates + 1)) * 2f) * num908) + this.localAI[0]) > 40f) { flag37 = true; } if (((((vector151.X * (this.extraUpdates + 1)) * 2f) * num908) + this.localAI[0]) < -40f) { flag37 = true; } if (flag37) { if (num909++ < 100) { goto Label_23A47; } base.velocity = Vector2.Zero; if (this.localAI[1] < 1f) { this.localAI[1] += 2f; } } else { vector150 = vector151; } if (base.velocity != Vector2.Zero) { this.localAI[0] += ((vector150.X * (this.extraUpdates + 1)) * 2f) * num908; vector240 = new Vector2(); base.velocity = (Vector2)(vector150.RotatedBy(((double)(this.ai[0] + 1.570796f)), vector240) * num908); this.rotation = base.velocity.ToRotation() + 1.570796f; if (((Main.rand.Next(4) != 0) || (Main.netMode == 1)) || (this.localAI[1] != 0f)) { return; } float num912 = (Main.rand.Next(-3, 4) * 1.047198f) / 3f; Vector2 vector152 = (Vector2)(this.ai[0].ToRotationVector2().RotatedBy(((double)num912), new Vector2()) * this.velocity.Length()); if (Collision.CanHitLine(base.Center, 0, 0, base.Center + ((Vector2)(vector152 * 50f)), 0, 0)) { return; } NewProjectile(base.Center.X - vector152.X, base.Center.Y - vector152.Y, vector152.X, vector152.Y, this.type, this.damage, this.knockBack, this.owner, vector152.ToRotation() + 1000f, this.ai[1]); } return; } this.frameCounter++; Lighting.AddLight(base.Center, 0.3f, 0.45f, 0.5f); if (base.velocity == Vector2.Zero) { if (this.frameCounter >= (this.extraUpdates * 2)) { this.frameCounter = 0; bool flag34 = true; for (int num892 = 1; num892 < this.oldPos.Length; num892++) { if (this.oldPos[num892] != this.oldPos[0]) { flag34 = false; } } if (flag34) { this.Kill(); return; } } if (Main.rand.Next(this.extraUpdates) == 0) { for (int num893 = 0; num893 < 2; num893++) { float num894 = this.rotation + (((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.570796f); float num895 = (((float)Main.rand.NextDouble()) * 0.8f) + 1f; Vector2 vector144 = new Vector2(((float)Math.Cos((double)num894)) * num895, ((float)Math.Sin((double)num894)) * num895); color5 = new Color(); int num896 = Dust.NewDust(base.Center, 0, 0, 0xe2, vector144.X, vector144.Y, 0, color5, 1f); Main.dust[num896].noGravity = true; Main.dust[num896].scale = 1.2f; } if (Main.rand.Next(5) == 0) { Vector2 vector145 = (Vector2)((base.velocity.RotatedBy(1.5707963705062866, new Vector2()) * (((float)Main.rand.NextDouble()) - 0.5f)) * base.width); int num897 = Dust.NewDust((base.Center + vector145) - ((Vector2)(Vector2.One * 4f)), 8, 8, 0x1f, 0f, 0f, 100, new Color(), 1.5f); Dust dust227 = Main.dust[num897]; dust227.velocity = (Vector2)(dust227.velocity * 0.5f); Main.dust[num897].velocity.Y = -Math.Abs(Main.dust[num897].velocity.Y); return; } } return; } if (this.frameCounter < (this.extraUpdates * 2)) { return; } this.frameCounter = 0; float num898 = this.velocity.Length(); Random random = new Random((int)this.ai[1]); int num899 = 0; Vector2 vector146 = -Vector2.UnitY; Label_23502: num900 = random.Next(); this.ai[1] = num900; num900 = num900 % 100; Vector2 vector147 = ((((float)num900) / 100f) * 6.283185f).ToRotationVector2(); if (vector147.Y > 0f) { vector147.Y *= -1f; } bool flag35 = false; if (vector147.Y > -0.02f) { flag35 = true; } if (((((vector147.X * (this.extraUpdates + 1)) * 2f) * num898) + this.localAI[0]) > 40f) { flag35 = true; } if (((((vector147.X * (this.extraUpdates + 1)) * 2f) * num898) + this.localAI[0]) < -40f) { flag35 = true; } if (flag35) { if (num899++ < 100) { goto Label_23502; } base.velocity = Vector2.Zero; this.localAI[1] = 1f; } else { vector146 = vector147; } if (base.velocity != Vector2.Zero) { this.localAI[0] += ((vector146.X * (this.extraUpdates + 1)) * 2f) * num898; base.velocity = (Vector2)(vector146.RotatedBy(((double)(this.ai[0] + 1.570796f)), new Vector2()) * num898); this.rotation = base.velocity.ToRotation() + 1.570796f; } return; } if (this.localAI[1] == 0f) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 0x79); this.localAI[1] = 1f; } if (this.ai[0] < 180f) { this.alpha -= 5; if (this.alpha < 0) { this.alpha = 0; } } else { this.alpha += 5; if (this.alpha > 0xff) { this.alpha = 0xff; this.Kill(); return; } } this.ai[0]++; if ((((this.ai[0] % 30f) == 0f) && (this.ai[0] < 180f)) && (Main.netMode != 1)) { int[] numArray4 = new int[5]; Vector2[] vectorArray = new Vector2[5]; int num880 = 0; float num881 = 2000f; for (int num882 = 0; num882 < 0xff; num882++) { if (Main.player[num882].active && !Main.player[num882].dead) { Vector2 vector139 = Main.player[num882].Center; if ((Vector2.Distance(vector139, base.Center) < num881) && Collision.CanHit(base.Center, 1, 1, vector139, 1, 1)) { numArray4[num880] = num882; vectorArray[num880] = vector139; if (++num880 >= vectorArray.Length) { break; } } } } for (int num884 = 0; num884 < num880; num884++) { Vector2 vector140 = vectorArray[num884] - base.Center; float num885 = Main.rand.Next(100); Vector2 vector141 = (Vector2)(Vector2.Normalize(vector140.RotatedByRandom(0.78539818525314331)) * 7f); NewProjectile(base.Center.X, base.Center.Y, vector141.X, vector141.Y, 0x1d2, this.damage, 0f, Main.myPlayer, vector140.ToRotation(), num885); } } Lighting.AddLight(base.Center, 0.4f, 0.85f, 0.9f); if (++this.frameCounter >= 4) { this.frameCounter = 0; if (++this.frame >= Main.projFrames[this.type]) { this.frame = 0; } } if ((this.alpha < 150) && (this.ai[0] < 180f)) { for (int num886 = 0; num886 < 1; num886++) { float num887 = (((float)Main.rand.NextDouble()) * 1f) - 0.5f; if (num887 < -0.5f) { num887 = -0.5f; } if (num887 > 0.5f) { num887 = 0.5f; } vector240 = new Vector2(); vector240 = new Vector2(); Vector2 vector142 = new Vector2((-base.width * 0.2f) * this.scale, 0f).RotatedBy(((double)(num887 * 6.283185f)), vector240).RotatedBy((double)base.velocity.ToRotation(), vector240); int num888 = Dust.NewDust(base.Center - ((Vector2)(Vector2.One * 5f)), 10, 10, 0xe2, -this.velocity.X / 3f, -this.velocity.Y / 3f, 150, Color.Transparent, 0.7f); Main.dust[num888].position = base.Center + vector142; Main.dust[num888].velocity = (Vector2)(Vector2.Normalize(Main.dust[num888].position - base.Center) * 2f); Main.dust[num888].noGravity = true; } for (int num889 = 0; num889 < 1; num889++) { float num890 = (((float)Main.rand.NextDouble()) * 1f) - 0.5f; if (num890 < -0.5f) { num890 = -0.5f; } if (num890 > 0.5f) { num890 = 0.5f; } vector240 = new Vector2(); vector240 = new Vector2(); Vector2 vector143 = new Vector2((-base.width * 0.6f) * this.scale, 0f).RotatedBy(((double)(num890 * 6.283185f)), vector240).RotatedBy((double)base.velocity.ToRotation(), vector240); int num891 = Dust.NewDust(base.Center - ((Vector2)(Vector2.One * 5f)), 10, 10, 0xe2, -this.velocity.X / 3f, -this.velocity.Y / 3f, 150, Color.Transparent, 0.7f); Main.dust[num891].velocity = Vector2.Zero; Main.dust[num891].position = base.Center + vector143; Main.dust[num891].noGravity = true; } } return; } if (this.type == 0x73) { this.ai[0]++; if (this.ai[0] < 30f) { base.velocity = (Vector2)(base.velocity * 1.125f); } } if ((this.type == 0x73) && (this.localAI[1] < 5f)) { this.localAI[1] = 5f; for (int num312 = 5; num312 < 0x19; num312++) { float num313 = this.velocity.X * (30f / ((float)num312)); float num314 = this.velocity.Y * (30f / ((float)num312)); num313 *= 80f; num314 *= 80f; color5 = new Color(); int num315 = Dust.NewDust(new Vector2(this.position.X - num313, this.position.Y - num314), 8, 8, 0x1b, this.oldVelocity.X, this.oldVelocity.Y, 100, color5, 0.9f); Dust dust125 = Main.dust[num315]; dust125.velocity = (Vector2)(dust125.velocity * 0.25f); Dust dust126 = Main.dust[num315]; dust126.velocity -= (Vector2)(base.velocity * 5f); } } if ((this.localAI[1] <= 7f) || (this.type != 0xad)) { goto Label_E566; } num316 = Main.rand.Next(3); switch (num316) { case 0: num316 = 15; goto Label_E4CE; case 1: num316 = 0x39; goto Label_E4CE; } num316 = 0x3a; goto Label_E4CE; } if (this.type != 0x1eb) { if (this.type == 0x22) { color5 = new Color(); int num116 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, color5, 3.5f); Main.dust[num116].noGravity = true; Dust dust65 = Main.dust[num116]; dust65.velocity = (Vector2)(dust65.velocity * 1.4f); num116 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, new Color(), 1.5f); } else if (this.type == 0x4f) { if (this.soundDelay == 0) { float introduced1621 = Math.Abs(this.velocity.X); if ((introduced1621 + Math.Abs(this.velocity.Y)) > 2f) { this.soundDelay = 10; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 9); } } for (int num117 = 0; num117 < 1; num117++) { int num118 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 0x42, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.5f); Dust dust66 = Main.dust[num118]; dust66.velocity = (Vector2)(dust66.velocity * 0.1f); Dust dust67 = Main.dust[num118]; dust67.velocity += (Vector2)(base.velocity * 0.2f); Main.dust[num118].position.X = ((this.position.X + (base.width / 2)) + 4f) + Main.rand.Next(-2, 3); Main.dust[num118].position.Y = (this.position.Y + (base.height / 2)) + Main.rand.Next(-2, 3); Main.dust[num118].noGravity = true; } } else { if (this.soundDelay == 0) { float introduced1624 = Math.Abs(this.velocity.X); if ((introduced1624 + Math.Abs(this.velocity.Y)) > 2f) { this.soundDelay = 10; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 9); } } int num119 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 15, 0f, 0f, 100, new Color(), 2f); Dust dust68 = Main.dust[num119]; dust68.velocity = (Vector2)(dust68.velocity * 0.3f); Main.dust[num119].position.X = ((this.position.X + (base.width / 2)) + 4f) + Main.rand.Next(-4, 5); Main.dust[num119].position.Y = (this.position.Y + (base.height / 2)) + Main.rand.Next(-4, 5); Main.dust[num119].noGravity = true; } goto Label_5199; } if (Main.rand.Next(2) != 0) { goto Label_5199; } num114 = Main.rand.Next(3); switch (num114) { case 0: num114 = 15; goto Label_4D0C; case 1: num114 = 0x39; goto Label_4D0C; } num114 = 0x3a; goto Label_4D0C; } if ((Main.player[this.owner].dead || Main.player[this.owner].stoned) || (Main.player[this.owner].webbed || Main.player[this.owner].frozen)) { this.Kill(); return; } mountedCenter = Main.player[this.owner].MountedCenter; Vector2 vector10 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f)); num76 = mountedCenter.X - vector10.X; num77 = mountedCenter.Y - vector10.Y; num78 = (float)Math.Sqrt((double)((num76 * num76) + (num77 * num77))); this.rotation = ((float)Math.Atan2((double)num77, (double)num76)) - 1.57f; if (this.type == 0x100) { this.rotation = ((float)Math.Atan2((double)num77, (double)num76)) + 3.925f; } if (this.type == 0x1be) { Lighting.AddLight(mountedCenter, 0f, 0.4f, 0.3f); this.localAI[0]++; if (this.localAI[0] >= 28f) { this.localAI[0] = 0f; } DelegateMethods.v3_1 = new Vector3(0f, 0.4f, 0.3f); Utils.PlotTileLine(base.Center, mountedCenter, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); } if ((this.type < 0x286) || (this.type > 0x289)) { goto Label_3C0D; } zero = Vector3.Zero; switch (this.type) { case 0x286: zero = new Vector3(0.7f, 0.5f, 0.1f); break; case 0x287: zero = new Vector3(0f, 0.6f, 0.7f); break; case 0x288: zero = new Vector3(0.6f, 0.2f, 0.6f); break; case 0x289: zero = new Vector3(0.6f, 0.6f, 0.9f); break; } } else { if ((this.soundDelay == 0) && (this.type != 0x17f)) { this.soundDelay = 8; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 7); } if (this.type == 0x13) { for (int num29 = 0; num29 < 2; num29++) { color5 = new Color(); int num30 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), base.width, base.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, color5, 2f); Main.dust[num30].noGravity = true; Main.dust[num30].velocity.X *= 0.3f; Main.dust[num30].velocity.Y *= 0.3f; } } else if (this.type == 0x21) { if (Main.rand.Next(1) == 0) { color5 = new Color(); int num31 = Dust.NewDust(base.position, base.width, base.height, 40, this.velocity.X * 0.25f, this.velocity.Y * 0.25f, 0, color5, 1.4f); Main.dust[num31].noGravity = true; } } else if (this.type == 320) { if (Main.rand.Next(3) == 0) { color5 = new Color(); int num32 = Dust.NewDust(base.position, base.width, base.height, 5, this.velocity.X * 0.25f, this.velocity.Y * 0.25f, 0, color5, 1.1f); if (Main.rand.Next(2) == 0) { Main.dust[num32].scale = 0.9f; Dust dust56 = Main.dust[num32]; dust56.velocity = (Vector2)(dust56.velocity * 0.2f); } else { Main.dust[num32].noGravity = true; } } } else if (this.type != 6) { if ((this.type == 0x71) && (Main.rand.Next(1) == 0)) { color5 = new Color(); int num34 = Dust.NewDust(base.position, base.width, base.height, 0x4c, this.velocity.X * 0.15f, this.velocity.Y * 0.15f, 0, color5, 1.1f); Main.dust[num34].noGravity = true; color5 = new Color(); Dust.NewDust(base.position, base.width, base.height, 15, this.velocity.X * 0.05f, this.velocity.Y * 0.05f, 150, color5, 0.6f); } } else if (Main.rand.Next(5) == 0) { int num33 = Main.rand.Next(3); switch (num33) { case 0: num33 = 15; break; case 1: num33 = 0x39; break; default: num33 = 0x3a; break; } color5 = new Color(); Dust.NewDust(base.position, base.width, base.height, num33, this.velocity.X * 0.25f, this.velocity.Y * 0.25f, 150, color5, 0.7f); } if (this.ai[0] == 0f) { this.ai[1]++; if ((this.type == 0x6a) && (this.ai[1] >= 45f)) { this.ai[0] = 1f; this.ai[1] = 0f; this.netUpdate = true; } if ((this.type == 320) || (this.type == 0x17f)) { if (this.ai[1] >= 10f) { this.velocity.Y += 0.5f; if ((this.type == 0x17f) && (this.velocity.Y < 0f)) { this.velocity.Y += 0.35f; } this.velocity.X *= 0.95f; if (this.velocity.Y > 16f) { this.velocity.Y = 16f; } if ((this.type == 0x17f) && (Vector2.Distance(base.Center, Main.player[this.owner].Center) > 800f)) { this.ai[0] = 1f; } } } else if (this.type == 0xb6) { if (Main.rand.Next(2) == 0) { int num35 = Dust.NewDust(base.position, base.width, base.height, 0x39, 0f, 0f, 0xff, new Color(), 0.75f); Dust dust57 = Main.dust[num35]; dust57.velocity = (Vector2)(dust57.velocity * 0.1f); Main.dust[num35].noGravity = true; } if (this.velocity.X > 0f) { this.spriteDirection = 1; } else if (this.velocity.X < 0f) { this.spriteDirection = -1; } float num36 = this.position.X; float num37 = this.position.Y; bool flag = false; if (this.ai[1] > 10f) { for (int num38 = 0; num38 < 200; num38++) { if (Main.npc[num38].CanBeChasedBy(this, false)) { float num39 = Main.npc[num38].position.X + (Main.npc[num38].width / 2); float num40 = Main.npc[num38].position.Y + (Main.npc[num38].height / 2); float introduced1606 = Math.Abs((float)((this.position.X + (base.width / 2)) - num39)); float num41 = introduced1606 + Math.Abs((float)((this.position.Y + (base.height / 2)) - num40)); if ((num41 < 800f) && Collision.CanHit(new Vector2(this.position.X + (base.width / 2), this.position.Y + (base.height / 2)), 1, 1, Main.npc[num38].position, Main.npc[num38].width, Main.npc[num38].height)) { num36 = num39; num37 = num40; flag = true; } } } } if (!flag) { num36 = (this.position.X + (base.width / 2)) + (this.velocity.X * 100f); num37 = (this.position.Y + (base.height / 2)) + (this.velocity.Y * 100f); if (this.ai[1] >= 30f) { this.ai[0] = 1f; this.ai[1] = 0f; this.netUpdate = true; } } float num42 = 12f; float num43 = 0.25f; Vector2 vector = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f)); float num44 = num36 - vector.X; float num45 = num37 - vector.Y; float num46 = (float)Math.Sqrt((double)((num44 * num44) + (num45 * num45))); num46 = num42 / num46; num44 *= num46; num45 *= num46; if (this.velocity.X < num44) { this.velocity.X += num43; if ((this.velocity.X < 0f) && (num44 > 0f)) { this.velocity.X += num43 * 2f; } } else if (this.velocity.X > num44) { this.velocity.X -= num43; if ((this.velocity.X > 0f) && (num44 < 0f)) { this.velocity.X -= num43 * 2f; } } if (this.velocity.Y < num45) { this.velocity.Y += num43; if ((this.velocity.Y < 0f) && (num45 > 0f)) { this.velocity.Y += num43 * 2f; } } else if (this.velocity.Y > num45) { this.velocity.Y -= num43; if ((this.velocity.Y > 0f) && (num45 < 0f)) { this.velocity.Y -= num43 * 2f; } } } else if (this.type == 0x12d) { if (this.ai[1] >= 20f) { this.ai[0] = 1f; this.ai[1] = 0f; this.netUpdate = true; } } else if (this.ai[1] >= 30f) { this.ai[0] = 1f; this.ai[1] = 0f; this.netUpdate = true; } } else { this.tileCollide = false; float num47 = 9f; float num48 = 0.4f; if (this.type == 0x13) { num47 = 13f; num48 = 0.6f; } else if (this.type == 0x21) { num47 = 15f; num48 = 0.8f; } else if (this.type == 0xb6) { num47 = 16f; num48 = 1.2f; } else if (this.type == 0x6a) { num47 = 16f; num48 = 1.2f; } else if (this.type == 0x110) { num47 = 15f; num48 = 1f; } else if (this.type == 0x14d) { num47 = 12f; num48 = 0.6f; } else if (this.type == 0x12d) { num47 = 15f; num48 = 3f; } else if (this.type == 320) { num47 = 15f; num48 = 3f; } else if (this.type == 0x17f) { num47 = 16f; num48 = 4f; } Vector2 vector2 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f)); float num49 = (Main.player[this.owner].position.X + (Main.player[this.owner].width / 2)) - vector2.X; float num50 = (Main.player[this.owner].position.Y + (Main.player[this.owner].height / 2)) - vector2.Y; float num51 = (float)Math.Sqrt((double)((num49 * num49) + (num50 * num50))); if (num51 > 3000f) { this.Kill(); } num51 = num47 / num51; num49 *= num51; num50 *= num51; if (this.type == 0x17f) { Vector2 vector3 = new Vector2(num49, num50) - base.velocity; if (vector3 != Vector2.Zero) { Vector2 vector4 = vector3; vector4.Normalize(); base.velocity += (Vector2)(vector4 * Math.Min(num48, vector3.Length())); } } else { if (this.velocity.X < num49) { this.velocity.X += num48; if ((this.velocity.X < 0f) && (num49 > 0f)) { this.velocity.X += num48; } } else if (this.velocity.X > num49) { this.velocity.X -= num48; if ((this.velocity.X > 0f) && (num49 < 0f)) { this.velocity.X -= num48; } } if (this.velocity.Y < num50) { this.velocity.Y += num48; if ((this.velocity.Y < 0f) && (num50 > 0f)) { this.velocity.Y += num48; } } else if (this.velocity.Y > num50) { this.velocity.Y -= num48; if ((this.velocity.Y > 0f) && (num50 < 0f)) { this.velocity.Y -= num48; } } } if (Main.myPlayer == this.owner) { Rectangle rectangle = new Rectangle((int)this.position.X, (int)this.position.Y, base.width, base.height); Rectangle rectangle2 = new Rectangle((int)Main.player[this.owner].position.X, (int)Main.player[this.owner].position.Y, Main.player[this.owner].width, Main.player[this.owner].height); if (rectangle.Intersects(rectangle2)) { this.Kill(); } } } if (this.type == 0x6a) { this.rotation += 0.3f * base.direction; return; } if (this.type == 0x17f) { if (this.ai[0] == 0f) { Vector2 vector5 = base.velocity; vector5.Normalize(); this.rotation = ((float)Math.Atan2((double)vector5.Y, (double)vector5.X)) + 1.57f; return; } Vector2 vector6 = base.Center - Main.player[this.owner].Center; vector6.Normalize(); this.rotation = ((float)Math.Atan2((double)vector6.Y, (double)vector6.X)) + 1.57f; return; } this.rotation += 0.4f * base.direction; return; } Lighting.AddLight(mountedCenter, zero); Lighting.AddLight(base.Center, zero); DelegateMethods.v3_1 = zero; Utils.PlotTileLine(base.Center, mountedCenter, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); Label_3C0D: if (this.ai[0] == 0f) { if ((((((num78 > 300f) && (this.type == 13)) || ((num78 > 400f) && (this.type == 0x20))) || (((num78 > 440f) && (this.type == 0x49)) || ((num78 > 440f) && (this.type == 0x4a)))) || ((((num78 > 250f) && (this.type == 0xa5)) || ((num78 > 350f) && (this.type == 0x100))) || (((num78 > 500f) && (this.type == 0x13b)) || ((num78 > 550f) && (this.type == 0x142))))) || (((((num78 > 400f) && (this.type == 0x14b)) || ((num78 > 550f) && (this.type == 0x14c))) || (((num78 > 400f) && (this.type == 0x174)) || ((num78 > 300f) && (this.type == 0x18c)))) || (((((num78 > 550f) && (this.type >= 0x286)) && (this.type <= 0x289)) || (((num78 > 480f) && (this.type >= 0x1e6)) && (this.type <= 0x1e9))) || ((num78 > 500f) && (this.type == 0x1be))))) { this.ai[0] = 1f; } else if ((this.type >= 230) && (this.type <= 0xeb)) { int num79 = 300 + ((this.type - 230) * 30); if (num78 > num79) { this.ai[0] = 1f; } } Vector2 vector12 = base.Center - new Vector2(5f); Vector2 vector13 = base.Center + new Vector2(5f); Point point = (vector12 - new Vector2(16f)).ToTileCoordinates(); Point point2 = (vector13 + new Vector2(32f)).ToTileCoordinates(); int num80 = point.X; int num81 = point2.X; int num82 = point.Y; int num83 = point2.Y; if (num80 < 0) { num80 = 0; } if (num81 > Main.maxTilesX) { num81 = Main.maxTilesX; } if (num82 < 0) { num82 = 0; } if (num83 > Main.maxTilesY) { num83 = Main.maxTilesY; } for (int num84 = num80; num84 < num81; num84++) { for (int num85 = num82; num85 < num83; num85++) { Vector2 vector14; if (Main.tile[num84, num85] == null) { Main.tile[num84, num85] = new Tile(); } vector14.X = num84 * 0x10; vector14.Y = num85 * 0x10; if ((((((vector12.X + 10f) > vector14.X) && (vector12.X < (vector14.X + 16f))) && (((vector12.Y + 10f) > vector14.Y) && (vector12.Y < (vector14.Y + 16f)))) && (Main.tile[num84, num85].nactive() && (Main.tileSolid[Main.tile[num84, num85].type] || (Main.tile[num84, num85].type == 0x13a)))) && ((this.type != 0x193) || (Main.tile[num84, num85].type == 0x13a))) { if (Main.player[this.owner].grapCount < 10) { Main.player[this.owner].grappling[Main.player[this.owner].grapCount] = base.whoAmI; Player player1 = Main.player[this.owner]; player1.grapCount++; } if (Main.myPlayer == this.owner) { int num86 = 0; int num87 = -1; int timeLeft = 0x186a0; if ((this.type == 0x49) || (this.type == 0x4a)) { for (int num89 = 0; num89 < 0x3e8; num89++) { if ((((num89 != base.whoAmI) && Main.projectile[num89].active) && ((Main.projectile[num89].owner == this.owner) && (Main.projectile[num89].aiStyle == 7))) && (Main.projectile[num89].ai[0] == 2f)) { Main.projectile[num89].Kill(); } } } else { int num90 = 3; if (this.type == 0xa5) { num90 = 8; } if (this.type == 0x100) { num90 = 2; } if (this.type == 0x174) { num90 = 2; } if ((this.type >= 0x286) && (this.type <= 0x289)) { num90 = 4; } for (int num91 = 0; num91 < 0x3e8; num91++) { if ((Main.projectile[num91].active && (Main.projectile[num91].owner == this.owner)) && (Main.projectile[num91].aiStyle == 7)) { if (Main.projectile[num91].timeLeft < timeLeft) { num87 = num91; timeLeft = Main.projectile[num91].timeLeft; } num86++; } } if (num86 > num90) { Main.projectile[num87].Kill(); } } } WorldGen.KillTile(num84, num85, true, true, false); Main.PlaySound(0, num84 * 0x10, num85 * 0x10, 1); this.velocity.X = 0f; this.velocity.Y = 0f; this.ai[0] = 2f; this.position.X = ((num84 * 0x10) + 8) - (base.width / 2); this.position.Y = ((num85 * 0x10) + 8) - (base.height / 2); this.damage = 0; this.netUpdate = true; if (Main.myPlayer == this.owner) { NetMessage.SendData(13, -1, -1, "", this.owner, 0f, 0f, 0f, 0, 0, 0); } break; } } if (this.ai[0] == 2f) { return; } } return; } if (this.ai[0] == 1f) { float num92 = 11f; if (this.type == 0x20) { num92 = 15f; } if ((this.type == 0x49) || (this.type == 0x4a)) { num92 = 17f; } if (this.type == 0x13b) { num92 = 20f; } if (this.type == 0x142) { num92 = 22f; } if ((this.type >= 230) && (this.type <= 0xeb)) { num92 = 11f + ((this.type - 230) * 0.75f); } if (this.type == 0x1be) { num92 = 20f; } if ((this.type >= 0x1e6) && (this.type <= 0x1e9)) { num92 = 18f; } if ((this.type >= 0x286) && (this.type <= 0x289)) { num92 = 24f; } if (this.type == 0x14c) { num92 = 17f; } if (num78 < 24f) { this.Kill(); } num78 = num92 / num78; num76 *= num78; num77 *= num78; this.velocity.X = num76; this.velocity.Y = num77; return; } if (this.ai[0] == 2f) { int num93 = ((int)(this.position.X / 16f)) - 1; int num94 = ((int)((this.position.X + base.width) / 16f)) + 2; int num95 = ((int)(this.position.Y / 16f)) - 1; int num96 = ((int)((this.position.Y + base.height) / 16f)) + 2; if (num93 < 0) { num93 = 0; } if (num94 > Main.maxTilesX) { num94 = Main.maxTilesX; } if (num95 < 0) { num95 = 0; } if (num96 > Main.maxTilesY) { num96 = Main.maxTilesY; } bool flag2 = true; for (int num97 = num93; num97 < num94; num97++) { for (int num98 = num95; num98 < num96; num98++) { Vector2 vector15; if (Main.tile[num97, num98] == null) { Main.tile[num97, num98] = new Tile(); } vector15.X = num97 * 0x10; vector15.Y = num98 * 0x10; if (((((this.position.X + (base.width / 2)) > vector15.X) && ((this.position.X + (base.width / 2)) < (vector15.X + 16f))) && (((this.position.Y + (base.height / 2)) > vector15.Y) && ((this.position.Y + (base.height / 2)) < (vector15.Y + 16f)))) && (Main.tile[num97, num98].nactive() && ((Main.tileSolid[Main.tile[num97, num98].type] || (Main.tile[num97, num98].type == 0x13a)) || (Main.tile[num97, num98].type == 5)))) { flag2 = false; } } } if (flag2) { this.ai[0] = 1f; return; } if (Main.player[this.owner].grapCount >= 10) { return; } Main.player[this.owner].grappling[Main.player[this.owner].grapCount] = base.whoAmI; Player player11 = Main.player[this.owner]; player11.grapCount++; } return; Label_4D0C: num115 = Dust.NewDust(base.position, base.width, base.height, num114, this.velocity.X * 0.25f, this.velocity.Y * 0.25f, 0xff, new Color(), 0.7f); Dust dust64 = Main.dust[num115]; dust64.velocity = (Vector2)(dust64.velocity * 0.25f); Main.dust[num115].position = (Vector2)((Main.dust[num115].position + base.position) / 2f); Label_5199: if ((Main.myPlayer == this.owner) && (this.ai[0] <= 0f)) { if (Main.player[this.owner].channel) { float num120 = 12f; if (this.type == 0x10) { num120 = 15f; } if (this.type == 0x1eb) { num120 = 20f; } Vector2 vector16 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f)); float num121 = (Main.mouseX + Main.screenPosition.X) - vector16.X; float num122 = (Main.mouseY + Main.screenPosition.Y) - vector16.Y; if (Main.player[this.owner].gravDir == -1f) { num122 = ((Main.screenPosition.Y + Main.screenHeight) - Main.mouseY) - vector16.Y; } float num123 = (float)Math.Sqrt((double)((num121 * num121) + (num122 * num122))); num123 = (float)Math.Sqrt((double)((num121 * num121) + (num122 * num122))); if (this.ai[0] < 0f) { this.ai[0]++; } if ((this.type == 0x1eb) && (num123 < 100f)) { if (this.velocity.Length() < num120) { base.velocity = (Vector2)(base.velocity * 1.1f); if (this.velocity.Length() > num120) { this.velocity.Normalize(); base.velocity = (Vector2)(base.velocity * num120); } } if (this.ai[0] == 0f) { this.ai[0] = -10f; } } else if (num123 > num120) { num123 = num120 / num123; num121 *= num123; num122 *= num123; int num124 = (int)(num121 * 1000f); int num125 = (int)(this.velocity.X * 1000f); int num126 = (int)(num122 * 1000f); int num127 = (int)(this.velocity.Y * 1000f); if ((num124 != num125) || (num126 != num127)) { this.netUpdate = true; } if (this.type == 0x1eb) { Vector2 vector17 = new Vector2(num121, num122); base.velocity = (Vector2)(((base.velocity * 4f) + vector17) / 5f); } else { this.velocity.X = num121; this.velocity.Y = num122; } } else { int num128 = (int)(num121 * 1000f); int num129 = (int)(this.velocity.X * 1000f); int num130 = (int)(num122 * 1000f); int num131 = (int)(this.velocity.Y * 1000f); if ((num128 != num129) || (num130 != num131)) { this.netUpdate = true; } this.velocity.X = num121; this.velocity.Y = num122; } } else if (this.ai[0] <= 0f) { this.netUpdate = true; if (this.type != 0x1eb) { float num132 = 12f; Vector2 vector18 = new Vector2(this.position.X + (base.width * 0.5f), this.position.Y + (base.height * 0.5f)); float num133 = (Main.mouseX + Main.screenPosition.X) - vector18.X; float num134 = (Main.mouseY + Main.screenPosition.Y) - vector18.Y; if (Main.player[this.owner].gravDir == -1f) { num134 = ((Main.screenPosition.Y + Main.screenHeight) - Main.mouseY) - vector18.Y; } float num135 = (float)Math.Sqrt((double)((num133 * num133) + (num134 * num134))); if ((num135 == 0f) || (this.ai[0] < 0f)) { vector18 = new Vector2(Main.player[this.owner].position.X + (Main.player[this.owner].width / 2), Main.player[this.owner].position.Y + (Main.player[this.owner].height / 2)); num133 = (this.position.X + (base.width * 0.5f)) - vector18.X; num134 = (this.position.Y + (base.height * 0.5f)) - vector18.Y; num135 = (float)Math.Sqrt((double)((num133 * num133) + (num134 * num134))); } num135 = num132 / num135; num133 *= num135; num134 *= num135; this.velocity.X = num133; this.velocity.Y = num134; if ((this.velocity.X == 0f) && (this.velocity.Y == 0f)) { this.Kill(); } } this.ai[0] = 1f; } } if (this.type == 0x1eb) { this.localAI[0]++; if ((this.ai[0] > 0f) && (this.localAI[0] > 15f)) { this.tileCollide = false; Vector2 vector19 = Main.player[this.owner].Center - base.Center; if (vector19.Length() < 20f) { this.Kill(); } vector19.Normalize(); vector19 = (Vector2)(vector19 * 25f); base.velocity = (Vector2)(((base.velocity * 5f) + vector19) / 6f); } if ((this.ai[0] < 0f) || ((this.velocity.X == 0f) && (this.velocity.Y == 0f))) { this.rotation += 0.3f; } else if (this.ai[0] > 0f) { this.rotation += 0.3f * base.direction; } else { this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 1.57f; } } else if (this.type == 0x22) { this.rotation += 0.3f * base.direction; } else if ((this.velocity.X != 0f) || (this.velocity.Y != 0f)) { this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) - 2.355f; } if (this.velocity.Y > 16f) { this.velocity.Y = 16f; } return; Label_E4CE: color5 = new Color(); int index = Dust.NewDust(new Vector2((this.position.X - (this.velocity.X * 4f)) + 2f, (this.position.Y + 2f) - (this.velocity.Y * 4f)), 8, 8, num316, 0f, 0f, 100, color5, 1.25f); Dust dust127 = Main.dust[index]; dust127.velocity = (Vector2)(dust127.velocity * 0.1f); Label_E566: if ((this.localAI[1] > 7f) && (this.type == 0x84)) { color5 = new Color(); int num318 = Dust.NewDust(new Vector2((this.position.X - (this.velocity.X * 4f)) + 2f, (this.position.Y + 2f) - (this.velocity.Y * 4f)), 8, 8, 0x6b, this.oldVelocity.X, this.oldVelocity.Y, 100, color5, 1.25f); Dust dust128 = Main.dust[num318]; dust128.velocity = (Vector2)(dust128.velocity * -0.25f); color5 = new Color(); num318 = Dust.NewDust(new Vector2((this.position.X - (this.velocity.X * 4f)) + 2f, (this.position.Y + 2f) - (this.velocity.Y * 4f)), 8, 8, 0x6b, this.oldVelocity.X, this.oldVelocity.Y, 100, color5, 1.25f); Dust dust129 = Main.dust[num318]; dust129.velocity = (Vector2)(dust129.velocity * -0.25f); Dust dust130 = Main.dust[num318]; dust130.position -= (Vector2)(base.velocity * 0.5f); } if (this.localAI[1] < 15f) { this.localAI[1]++; } else { if ((this.type == 0x72) || (this.type == 0x73)) { int num319 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 4f), 8, 8, 0x1b, this.oldVelocity.X, this.oldVelocity.Y, 100, new Color(), 0.6f); Dust dust131 = Main.dust[num319]; dust131.velocity = (Vector2)(dust131.velocity * -0.25f); } else if (this.type == 0x74) { int num320 = Dust.NewDust(new Vector2((this.position.X - (this.velocity.X * 5f)) + 2f, (this.position.Y + 2f) - (this.velocity.Y * 5f)), 8, 8, 0x40, this.oldVelocity.X, this.oldVelocity.Y, 100, new Color(), 1.5f); Dust dust132 = Main.dust[num320]; dust132.velocity = (Vector2)(dust132.velocity * -0.25f); Main.dust[num320].noGravity = true; } if (this.localAI[0] == 0f) { this.scale -= 0.02f; this.alpha += 30; if (this.alpha >= 250) { this.alpha = 0xff; this.localAI[0] = 1f; } } else if (this.localAI[0] == 1f) { this.scale += 0.02f; this.alpha -= 30; if (this.alpha <= 0) { this.alpha = 0; this.localAI[0] = 0f; } } } if (this.ai[1] == 0f) { this.ai[1] = 1f; if (this.type == 0x84) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 60); } else { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8); } } if (this.type == 0x9d) { this.rotation += base.direction * 0.4f; this.spriteDirection = base.direction; } else { this.rotation = ((float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X)) + 0.785f; } if (this.velocity.Y > 16f) { this.velocity.Y = 16f; } }
public override void Explode() { chargeup += 1; if (projectile.timeLeft == timeleftfirerate && projectile.ai[0] > 0) { Player owner = Main.player[projectile.owner]; if (owner != null && !owner.dead && owner.channel) { everyother += 1; everyother %= 3; Vector2 gotohere = new Vector2(); gotohere = projectile.velocity; //Main.MouseScreen - projectile.Center; gotohere.Normalize(); float accuracy = Math.Max(0.005f, 1f - ((chargeup) / 500f)); Vector2 perturbedSpeed = new Vector2(gotohere.X, gotohere.Y).RotatedByRandom(MathHelper.ToRadians(0)) * projectile.velocity.Length(); for (int i = 2; i < 8; i += 1) { int proj = Projectile.NewProjectile(new Vector2(projectile.Center.X, projectile.Center.Y), (new Vector2(perturbedSpeed.X, perturbedSpeed.Y) * 2f).RotatedByRandom((MathHelper.ToRadians((i * 75))) * accuracy).RotatedByRandom(MathHelper.ToRadians(160f) * accuracy), mod.ProjectileType("RainbowBolt"), (int)((projectile.damage * 0.60f) * damagescale), projectile.knockBack / 10f, owner.whoAmI); Main.projectile[proj].magic = true; Main.projectile[proj].minion = false; IdgProjectile.Sync(proj); } if (everyother == 2) { Vector2 backthere = new Vector2(-100, 0).RotatedByRandom(MathHelper.ToRadians(80)); //int proj2 = Projectile.NewProjectile(backthere, gohere, mod.ProjectileType("ProjectilePortalRealityShaperHit"), (int)(projectile.damage * damagescale), projectile.knockBack / 10f, owner.whoAmI, mod.ProjectileType("HotRound")); Func <Vector2, Vector2, float, float, Projectile, float> projectilefacingmore = delegate(Vector2 playerpos, Vector2 projpos, float time, float current, Projectile proj) { float val = current; if (projectile.active) { if (time < 100) { val = current.AngleLerp(projectile.velocity.ToRotation() + proj.ai[1], 0.15f); } else { val = current.AngleLerp(projectile.velocity.ToRotation() + proj.ai[1], 0.05f); } } return(val); }; Func <Vector2, Vector2, float, Vector2, Projectile, Vector2> projectilemovingmore = delegate(Vector2 playerpos, Vector2 projpos, float time, Vector2 current, Projectile proj) { if (projectile.active) { Vector2 normspeed = projectile.velocity; normspeed.Normalize(); Vector2 gothere333 = (playerpos + backthere.RotatedBy(projectile.velocity.ToRotation())) - normspeed * 128f; Vector2 slideover = gothere333 - projpos; current = slideover / 2f; } current /= 1.125f; if (projectile.active) { Vector2 speedz = current; float spzzed = speedz.Length(); speedz.Normalize(); if (spzzed > 100f) { current = (speedz * spzzed); } } else { proj.timeLeft = Math.Min(proj.timeLeft, 20); } return(current); }; Func <float, bool> projectilepattern = (time) => (time == 20); int ize2 = ParadoxMirror.SummonMirror(owner.Center, Vector2.Zero, (int)((projectile.damage * 3) * damagescale), 200, projectile.velocity.ToRotation(), mod.ProjectileType("HellionBeam"), projectilepattern, 2.5f, 145, true); (Main.projectile[ize2].modProjectile as ParadoxMirror).projectilefacingmore = projectilefacingmore; (Main.projectile[ize2].modProjectile as ParadoxMirror).projectilemovingmore = projectilemovingmore; Main.PlaySound(SoundID.Item, (int)Main.projectile[ize2].position.X, (int)Main.projectile[ize2].position.Y, 33, 0.25f, 0.5f); Main.projectile[ize2].owner = projectile.owner; Main.projectile[ize2].aiStyle = -2; Main.projectile[ize2].ai[1] = Main.rand.NextFloat(-MathHelper.ToRadians(20), MathHelper.ToRadians(20)); Main.projectile[ize2].friendly = true; Main.projectile[ize2].hostile = false; Main.projectile[ize2].usesLocalNPCImmunity = true; Main.projectile[ize2].localNPCHitCooldown = 15; Main.projectile[ize2].netUpdate = true; IdgProjectile.Sync(ize2); } } } }
public void GetData(int start, int length, out int messageType) { if (this.whoAmI < 256) { Netplay.Clients[this.whoAmI].TimeOutTimer = 0; } else { Netplay.Connection.TimeOutTimer = 0; } int num = start + 1; byte b = this.readBuffer[start]; messageType = (int)b; if (b >= 105) { return; } Main.rxMsg++; Main.rxData += length; Main.rxMsgType[(int)b]++; Main.rxDataType[(int)b] += length; if (Main.netMode == 1 && Netplay.Connection.StatusMax > 0) { Netplay.Connection.StatusCount++; } if (Main.verboseNetplay) { for (int i = start; i < start + length; i++) { } for (int j = start; j < start + length; j++) { byte arg_D6_0 = this.readBuffer[j]; } } if (Main.netMode == 2 && b != 38 && Netplay.Clients[this.whoAmI].State == -1) { NetMessage.SendData(2, this.whoAmI, -1, Lang.mp[1], 0, 0f, 0f, 0f, 0, 0, 0); return; } if (Main.netMode == 2 && Netplay.Clients[this.whoAmI].State < 10 && b > 12 && b != 93 && b != 16 && b != 42 && b != 50 && b != 38 && b != 68) { NetMessage.BootPlayer(this.whoAmI, Lang.mp[2]); } if (this.reader == null) { this.ResetReader(); } this.reader.BaseStream.Position = (long)num; switch (b) { case 1: { if (Main.netMode != 2) { return; } if (Main.dedServ && Netplay.IsBanned(Netplay.Clients[this.whoAmI].Socket.GetRemoteAddress())) { NetMessage.SendData(2, this.whoAmI, -1, Lang.mp[3], 0, 0f, 0f, 0f, 0, 0, 0); return; } if (Netplay.Clients[this.whoAmI].State != 0) { return; } string a = this.reader.ReadString(); if (!(a == "Terraria" + Main.curRelease)) { NetMessage.SendData(2, this.whoAmI, -1, Lang.mp[4], 0, 0f, 0f, 0f, 0, 0, 0); return; } if (string.IsNullOrEmpty(Netplay.ServerPassword)) { Netplay.Clients[this.whoAmI].State = 1; NetMessage.SendData(3, this.whoAmI, -1, "", 0, 0f, 0f, 0f, 0, 0, 0); return; } Netplay.Clients[this.whoAmI].State = -1; NetMessage.SendData(37, this.whoAmI, -1, "", 0, 0f, 0f, 0f, 0, 0, 0); return; } case 2: if (Main.netMode != 1) { return; } Netplay.disconnect = true; Main.statusText = this.reader.ReadString(); return; case 3: { if (Main.netMode != 1) { return; } if (Netplay.Connection.State == 1) { Netplay.Connection.State = 2; } int num2 = (int)this.reader.ReadByte(); if (num2 != Main.myPlayer) { Main.player[num2] = Main.ActivePlayerFileData.Player; Main.player[Main.myPlayer] = new Player(); } Main.player[num2].whoAmI = num2; Main.myPlayer = num2; Player player = Main.player[num2]; NetMessage.SendData(4, -1, -1, player.name, num2, 0f, 0f, 0f, 0, 0, 0); NetMessage.SendData(68, -1, -1, "", num2, 0f, 0f, 0f, 0, 0, 0); NetMessage.SendData(16, -1, -1, "", num2, 0f, 0f, 0f, 0, 0, 0); NetMessage.SendData(42, -1, -1, "", num2, 0f, 0f, 0f, 0, 0, 0); NetMessage.SendData(50, -1, -1, "", num2, 0f, 0f, 0f, 0, 0, 0); for (int k = 0; k < 59; k++) { NetMessage.SendData(5, -1, -1, player.inventory[k].name, num2, (float)k, (float)player.inventory[k].prefix, 0f, 0, 0, 0); } for (int l = 0; l < player.armor.Length; l++) { NetMessage.SendData(5, -1, -1, player.armor[l].name, num2, (float)(59 + l), (float)player.armor[l].prefix, 0f, 0, 0, 0); } for (int m = 0; m < player.dye.Length; m++) { NetMessage.SendData(5, -1, -1, player.dye[m].name, num2, (float)(58 + player.armor.Length + 1 + m), (float)player.dye[m].prefix, 0f, 0, 0, 0); } for (int n = 0; n < player.miscEquips.Length; n++) { NetMessage.SendData(5, -1, -1, "", num2, (float)(58 + player.armor.Length + player.dye.Length + 1 + n), (float)player.miscEquips[n].prefix, 0f, 0, 0, 0); } for (int num3 = 0; num3 < player.miscDyes.Length; num3++) { NetMessage.SendData(5, -1, -1, "", num2, (float)(58 + player.armor.Length + player.dye.Length + player.miscEquips.Length + 1 + num3), (float)player.miscDyes[num3].prefix, 0f, 0, 0, 0); } for (int num4 = 0; num4 < player.bank.item.Length; num4++) { NetMessage.SendData(5, -1, -1, "", num2, (float)(58 + player.armor.Length + player.dye.Length + player.miscEquips.Length + player.miscDyes.Length + 1 + num4), (float)player.bank.item[num4].prefix, 0f, 0, 0, 0); } for (int num5 = 0; num5 < player.bank2.item.Length; num5++) { NetMessage.SendData(5, -1, -1, "", num2, (float)(58 + player.armor.Length + player.dye.Length + player.miscEquips.Length + player.miscDyes.Length + player.bank.item.Length + 1 + num5), (float)player.bank2.item[num5].prefix, 0f, 0, 0, 0); } NetMessage.SendData(5, -1, -1, "", num2, (float)(58 + player.armor.Length + player.dye.Length + player.miscEquips.Length + player.miscDyes.Length + player.bank.item.Length + player.bank2.item.Length + 1), (float)player.trashItem.prefix, 0f, 0, 0, 0); NetMessage.SendData(6, -1, -1, "", 0, 0f, 0f, 0f, 0, 0, 0); if (Netplay.Connection.State == 2) { Netplay.Connection.State = 3; return; } return; } case 4: { int num6 = (int)this.reader.ReadByte(); if (Main.netMode == 2) { num6 = this.whoAmI; } if (num6 == Main.myPlayer && !Main.ServerSideCharacter) { return; } Player player2 = Main.player[num6]; player2.whoAmI = num6; player2.skinVariant = (int)this.reader.ReadByte(); player2.skinVariant = (int)MathHelper.Clamp((float)player2.skinVariant, 0f, 7f); player2.hair = (int)this.reader.ReadByte(); if (player2.hair >= 134) { player2.hair = 0; } player2.name = this.reader.ReadString().Trim().Trim(); player2.hairDye = this.reader.ReadByte(); BitsByte bitsByte = this.reader.ReadByte(); for (int num7 = 0; num7 < 8; num7++) { player2.hideVisual[num7] = bitsByte[num7]; } bitsByte = this.reader.ReadByte(); for (int num8 = 0; num8 < 2; num8++) { player2.hideVisual[num8 + 8] = bitsByte[num8]; } player2.hideMisc = this.reader.ReadByte(); player2.hairColor = this.reader.ReadRGB(); player2.skinColor = this.reader.ReadRGB(); player2.eyeColor = this.reader.ReadRGB(); player2.shirtColor = this.reader.ReadRGB(); player2.underShirtColor = this.reader.ReadRGB(); player2.pantsColor = this.reader.ReadRGB(); player2.shoeColor = this.reader.ReadRGB(); BitsByte bitsByte2 = this.reader.ReadByte(); player2.difficulty = 0; if (bitsByte2[0]) { Player expr_B18 = player2; expr_B18.difficulty += 1; } if (bitsByte2[1]) { Player expr_B32 = player2; expr_B32.difficulty += 2; } if (player2.difficulty > 2) { player2.difficulty = 2; } player2.extraAccessory = bitsByte2[2]; if (Main.netMode != 2) { return; } bool flag = false; if (Netplay.Clients[this.whoAmI].State < 10) { for (int num9 = 0; num9 < 255; num9++) { if (num9 != num6 && player2.name == Main.player[num9].name && Netplay.Clients[num9].IsActive) { flag = true; } } } if (flag) { NetMessage.SendData(2, this.whoAmI, -1, player2.name + " " + Lang.mp[5], 0, 0f, 0f, 0f, 0, 0, 0); return; } if (player2.name.Length > Player.nameLen) { NetMessage.SendData(2, this.whoAmI, -1, "Name is too long.", 0, 0f, 0f, 0f, 0, 0, 0); return; } if (player2.name == "") { NetMessage.SendData(2, this.whoAmI, -1, "Empty name.", 0, 0f, 0f, 0f, 0, 0, 0); return; } Netplay.Clients[this.whoAmI].Name = player2.name; Netplay.Clients[this.whoAmI].Name = player2.name; NetMessage.SendData(4, -1, this.whoAmI, player2.name, num6, 0f, 0f, 0f, 0, 0, 0); return; } case 5: { int num10 = (int)this.reader.ReadByte(); if (Main.netMode == 2) { num10 = this.whoAmI; } if (num10 == Main.myPlayer && !Main.ServerSideCharacter && !Main.player[num10].IsStackingItems()) { return; } Player player3 = Main.player[num10]; lock (player3) { int num11 = (int)this.reader.ReadByte(); int stack = (int)this.reader.ReadInt16(); int num12 = (int)this.reader.ReadByte(); int type = (int)this.reader.ReadInt16(); Item[] array = null; int num13 = 0; bool flag3 = false; if (num11 > 58 + player3.armor.Length + player3.dye.Length + player3.miscEquips.Length + player3.miscDyes.Length + player3.bank.item.Length + player3.bank2.item.Length) { flag3 = true; } else if (num11 > 58 + player3.armor.Length + player3.dye.Length + player3.miscEquips.Length + player3.miscDyes.Length + player3.bank.item.Length) { num13 = num11 - 58 - (player3.armor.Length + player3.dye.Length + player3.miscEquips.Length + player3.miscDyes.Length + player3.bank.item.Length) - 1; array = player3.bank2.item; } else if (num11 > 58 + player3.armor.Length + player3.dye.Length + player3.miscEquips.Length + player3.miscDyes.Length) { num13 = num11 - 58 - (player3.armor.Length + player3.dye.Length + player3.miscEquips.Length + player3.miscDyes.Length) - 1; array = player3.bank.item; } else if (num11 > 58 + player3.armor.Length + player3.dye.Length + player3.miscEquips.Length) { num13 = num11 - 58 - (player3.armor.Length + player3.dye.Length + player3.miscEquips.Length) - 1; array = player3.miscDyes; } else if (num11 > 58 + player3.armor.Length + player3.dye.Length) { num13 = num11 - 58 - (player3.armor.Length + player3.dye.Length) - 1; array = player3.miscEquips; } else if (num11 > 58 + player3.armor.Length) { num13 = num11 - 58 - player3.armor.Length - 1; array = player3.dye; } else if (num11 > 58) { num13 = num11 - 58 - 1; array = player3.armor; } else { num13 = num11; array = player3.inventory; } if (flag3) { player3.trashItem = new Item(); player3.trashItem.netDefaults(type); player3.trashItem.stack = stack; player3.trashItem.Prefix(num12); } else if (num11 <= 58) { int type2 = array[num13].type; int stack2 = array[num13].stack; array[num13] = new Item(); array[num13].netDefaults(type); array[num13].stack = stack; array[num13].Prefix(num12); if (num10 == Main.myPlayer && num13 == 58) { Main.mouseItem = array[num13].Clone(); } if (num10 == Main.myPlayer && Main.netMode == 1) { Main.player[num10].inventoryChestStack[num11] = false; if (array[num13].stack != stack2 || array[num13].type != type2) { Recipe.FindRecipes(); Main.PlaySound(7, -1, -1, 1); } } } else { array[num13] = new Item(); array[num13].netDefaults(type); array[num13].stack = stack; array[num13].Prefix(num12); } if (Main.netMode == 2 && num10 == this.whoAmI && num11 <= 58 + player3.armor.Length + player3.dye.Length + player3.miscEquips.Length + player3.miscDyes.Length) { NetMessage.SendData(5, -1, this.whoAmI, "", num10, (float)num11, (float)num12, 0f, 0, 0, 0); } return; } break; } case 6: break; case 7: { if (Main.netMode != 1) { return; } try { Main.time = (double)this.reader.ReadInt32(); BitsByte bitsByte3 = this.reader.ReadByte(); Main.dayTime = bitsByte3[0]; Main.bloodMoon = bitsByte3[1]; Main.eclipse = bitsByte3[2]; Main.moonPhase = (int)this.reader.ReadByte(); Main.maxTilesX = (int)this.reader.ReadInt16(); Main.maxTilesY = (int)this.reader.ReadInt16(); Main.spawnTileX = (int)this.reader.ReadInt16(); Main.spawnTileY = (int)this.reader.ReadInt16(); Main.worldSurface = (double)this.reader.ReadInt16(); Main.rockLayer = (double)this.reader.ReadInt16(); Main.worldID = this.reader.ReadInt32(); Main.worldName = this.reader.ReadString(); Main.moonType = (int)this.reader.ReadByte(); WorldGen.setBG(0, (int)this.reader.ReadByte()); WorldGen.setBG(1, (int)this.reader.ReadByte()); WorldGen.setBG(2, (int)this.reader.ReadByte()); WorldGen.setBG(3, (int)this.reader.ReadByte()); WorldGen.setBG(4, (int)this.reader.ReadByte()); WorldGen.setBG(5, (int)this.reader.ReadByte()); WorldGen.setBG(6, (int)this.reader.ReadByte()); WorldGen.setBG(7, (int)this.reader.ReadByte()); Main.iceBackStyle = (int)this.reader.ReadByte(); Main.jungleBackStyle = (int)this.reader.ReadByte(); Main.hellBackStyle = (int)this.reader.ReadByte(); Main.windSpeedSet = this.reader.ReadSingle(); Main.numClouds = (int)this.reader.ReadByte(); for (int num14 = 0; num14 < 3; num14++) { Main.treeX[num14] = this.reader.ReadInt32(); } for (int num15 = 0; num15 < 4; num15++) { Main.treeStyle[num15] = (int)this.reader.ReadByte(); } for (int num16 = 0; num16 < 3; num16++) { Main.caveBackX[num16] = this.reader.ReadInt32(); } for (int num17 = 0; num17 < 4; num17++) { Main.caveBackStyle[num17] = (int)this.reader.ReadByte(); } Main.maxRaining = this.reader.ReadSingle(); Main.raining = (Main.maxRaining > 0f); BitsByte bitsByte4 = this.reader.ReadByte(); WorldGen.shadowOrbSmashed = bitsByte4[0]; NPC.downedBoss1 = bitsByte4[1]; NPC.downedBoss2 = bitsByte4[2]; NPC.downedBoss3 = bitsByte4[3]; Main.hardMode = bitsByte4[4]; NPC.downedClown = bitsByte4[5]; Main.ServerSideCharacter = bitsByte4[6]; NPC.downedPlantBoss = bitsByte4[7]; BitsByte bitsByte5 = this.reader.ReadByte(); NPC.downedMechBoss1 = bitsByte5[0]; NPC.downedMechBoss2 = bitsByte5[1]; NPC.downedMechBoss3 = bitsByte5[2]; // NPC.downedMechBoss4 = bitsByte5[3]; NPC.downedMechBossAny = bitsByte5[4]; Main.cloudBGActive = (float)(bitsByte5[5] ? 1 : 0); WorldGen.crimson = bitsByte5[6]; Main.pumpkinMoon = bitsByte5[7]; BitsByte bitsByte6 = this.reader.ReadByte(); Main.snowMoon = bitsByte6[0]; Main.expertMode = bitsByte6[1]; Main.fastForwardTime = bitsByte6[2]; Main.UpdateSundial(); bool flag4 = bitsByte6[3]; NPC.downedSlimeKing = bitsByte6[4]; NPC.downedQueenBee = bitsByte6[5]; NPC.downedFishron = bitsByte6[6]; NPC.downedMartians = bitsByte6[7]; BitsByte bitsByte7 = this.reader.ReadByte(); NPC.downedAncientCultist = bitsByte7[0]; NPC.downedMoonlord = bitsByte7[1]; NPC.downedHalloweenKing = bitsByte7[2]; NPC.downedHalloweenTree = bitsByte7[3]; NPC.downedChristmasIceQueen = bitsByte7[4]; NPC.downedChristmasSantank = bitsByte7[5]; NPC.downedChristmasTree = bitsByte7[6]; NPC.downedGolemBoss = bitsByte7[7]; // if (flag4) { Main.StartSlimeRain(true); } else { Main.StopSlimeRain(true); } Main.invasionType = (int)this.reader.ReadSByte(); Main.LobbyId = this.reader.ReadUInt64(); if (Netplay.Connection.State == 3) { Netplay.Connection.State = 4; return; } return; } catch (Exception e) { MessageBox.Show(e.ToString()); return; } } case 8: { if (Main.netMode != 2) { return; } int num18 = this.reader.ReadInt32(); int num19 = this.reader.ReadInt32(); bool flag5 = true; if (num18 == -1 || num19 == -1) { flag5 = false; } else if (num18 < 10 || num18 > Main.maxTilesX - 10) { flag5 = false; } else if (num19 < 10 || num19 > Main.maxTilesY - 10) { flag5 = false; } int num20 = Netplay.GetSectionX(Main.spawnTileX) - 2; int num21 = Netplay.GetSectionY(Main.spawnTileY) - 1; int num22 = num20 + 5; int num23 = num21 + 3; if (num20 < 0) { num20 = 0; } if (num22 >= Main.maxSectionsX) { num22 = Main.maxSectionsX - 1; } if (num21 < 0) { num21 = 0; } if (num23 >= Main.maxSectionsY) { num23 = Main.maxSectionsY - 1; } int num24 = (num22 - num20) * (num23 - num21); List<Point> list = new List<Point>(); for (int num25 = num20; num25 < num22; num25++) { for (int num26 = num21; num26 < num23; num26++) { list.Add(new Point(num25, num26)); } } int num27 = -1; int num28 = -1; if (flag5) { num18 = Netplay.GetSectionX(num18) - 2; num19 = Netplay.GetSectionY(num19) - 1; num27 = num18 + 5; num28 = num19 + 3; if (num18 < 0) { num18 = 0; } if (num27 >= Main.maxSectionsX) { num27 = Main.maxSectionsX - 1; } if (num19 < 0) { num19 = 0; } if (num28 >= Main.maxSectionsY) { num28 = Main.maxSectionsY - 1; } for (int num29 = num18; num29 < num27; num29++) { for (int num30 = num19; num30 < num28; num30++) { if (num29 < num20 || num29 >= num22 || num30 < num21 || num30 >= num23) { list.Add(new Point(num29, num30)); num24++; } } } } int num31 = 1; List<Point> list2; List<Point> list3; PortalHelper.SyncPortalsOnPlayerJoin(this.whoAmI, 1, list, out list2, out list3); num24 += list2.Count; if (Netplay.Clients[this.whoAmI].State == 2) { Netplay.Clients[this.whoAmI].State = 3; } NetMessage.SendData(9, this.whoAmI, -1, Lang.inter[44], num24, 0f, 0f, 0f, 0, 0, 0); Netplay.Clients[this.whoAmI].StatusText2 = "is receiving tile data"; Netplay.Clients[this.whoAmI].StatusMax += num24; for (int num32 = num20; num32 < num22; num32++) { for (int num33 = num21; num33 < num23; num33++) { NetMessage.SendSection(this.whoAmI, num32, num33, false); } } NetMessage.SendData(11, this.whoAmI, -1, "", num20, (float)num21, (float)(num22 - 1), (float)(num23 - 1), 0, 0, 0); if (flag5) { for (int num34 = num18; num34 < num27; num34++) { for (int num35 = num19; num35 < num28; num35++) { NetMessage.SendSection(this.whoAmI, num34, num35, true); } } NetMessage.SendData(11, this.whoAmI, -1, "", num18, (float)num19, (float)(num27 - 1), (float)(num28 - 1), 0, 0, 0); } for (int num36 = 0; num36 < list2.Count; num36++) { NetMessage.SendSection(this.whoAmI, list2[num36].X, list2[num36].Y, true); } for (int num37 = 0; num37 < list3.Count; num37++) { NetMessage.SendData(11, this.whoAmI, -1, "", list3[num37].X - num31, (float)(list3[num37].Y - num31), (float)(list3[num37].X + num31 + 1), (float)(list3[num37].Y + num31 + 1), 0, 0, 0); } for (int num38 = 0; num38 < 400; num38++) { if (Main.item[num38].active) { NetMessage.SendData(21, this.whoAmI, -1, "", num38, 0f, 0f, 0f, 0, 0, 0); NetMessage.SendData(22, this.whoAmI, -1, "", num38, 0f, 0f, 0f, 0, 0, 0); } } for (int num39 = 0; num39 < 200; num39++) { if (Main.npc[num39].active) { NetMessage.SendData(23, this.whoAmI, -1, "", num39, 0f, 0f, 0f, 0, 0, 0); } } for (int num40 = 0; num40 < 1000; num40++) { if (Main.projectile[num40].active && (Main.projPet[Main.projectile[num40].type] || Main.projectile[num40].netImportant)) { NetMessage.SendData(27, this.whoAmI, -1, "", num40, 0f, 0f, 0f, 0, 0, 0); } } for (int num41 = 0; num41 < 251; num41++) { NetMessage.SendData(83, this.whoAmI, -1, "", num41, 0f, 0f, 0f, 0, 0, 0); } NetMessage.SendData(49, this.whoAmI, -1, "", 0, 0f, 0f, 0f, 0, 0, 0); NetMessage.SendData(57, this.whoAmI, -1, "", 0, 0f, 0f, 0f, 0, 0, 0); NetMessage.SendData(7, this.whoAmI, -1, "", 0, 0f, 0f, 0f, 0, 0, 0); NetMessage.SendData(103, -1, -1, "", NPC.MoonLordCountdown, 0f, 0f, 0f, 0, 0, 0); NetMessage.SendData(101, this.whoAmI, -1, "", 0, 0f, 0f, 0f, 0, 0, 0); return; } case 9: if (Main.netMode != 1) { return; } Netplay.Connection.StatusMax += this.reader.ReadInt32(); Netplay.Connection.StatusText = this.reader.ReadString(); return; case 10: if (Main.netMode != 1) { return; } NetMessage.DecompressTileBlock(this.readBuffer, num, length); return; case 11: if (Main.netMode != 1) { return; } WorldGen.SectionTileFrame((int)this.reader.ReadInt16(), (int)this.reader.ReadInt16(), (int)this.reader.ReadInt16(), (int)this.reader.ReadInt16()); return; case 12: { int num42 = (int)this.reader.ReadByte(); if (Main.netMode == 2) { num42 = this.whoAmI; } Player player4 = Main.player[num42]; player4.SpawnX = (int)this.reader.ReadInt16(); player4.SpawnY = (int)this.reader.ReadInt16(); player4.Spawn(); if (num42 == Main.myPlayer && Main.netMode != 2) { Main.ActivePlayerFileData.StartPlayTimer(); Player.EnterWorld(Main.player[Main.myPlayer]); } if (Main.netMode != 2 || Netplay.Clients[this.whoAmI].State < 3) { return; } if (Netplay.Clients[this.whoAmI].State == 3) { Netplay.Clients[this.whoAmI].State = 10; NetMessage.greetPlayer(this.whoAmI); NetMessage.buffer[this.whoAmI].broadcast = true; NetMessage.syncPlayers(); NetMessage.SendData(12, -1, this.whoAmI, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); NetMessage.SendData(74, this.whoAmI, -1, Main.player[this.whoAmI].name, Main.anglerQuest, 0f, 0f, 0f, 0, 0, 0); return; } NetMessage.SendData(12, -1, this.whoAmI, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); return; } case 13: { int num43 = (int)this.reader.ReadByte(); if (num43 == Main.myPlayer && !Main.ServerSideCharacter) { return; } if (Main.netMode == 2) { num43 = this.whoAmI; } Player player5 = Main.player[num43]; BitsByte bitsByte8 = this.reader.ReadByte(); player5.controlUp = bitsByte8[0]; player5.controlDown = bitsByte8[1]; player5.controlLeft = bitsByte8[2]; player5.controlRight = bitsByte8[3]; player5.controlJump = bitsByte8[4]; player5.controlUseItem = bitsByte8[5]; player5.direction = (bitsByte8[6] ? 1 : -1); BitsByte bitsByte9 = this.reader.ReadByte(); if (bitsByte9[0]) { player5.pulley = true; player5.pulleyDir = (byte)(bitsByte9[1] ? 2 : 1); } else { player5.pulley = false; } player5.selectedItem = (int)this.reader.ReadByte(); player5.position = this.reader.ReadVector2(); if (bitsByte9[2]) { player5.velocity = this.reader.ReadVector2(); } else { player5.velocity = Vector2.Zero; } player5.vortexStealthActive = bitsByte9[3]; player5.gravDir = (float)(bitsByte9[4] ? 1 : -1); if (Main.netMode == 2 && Netplay.Clients[this.whoAmI].State == 10) { NetMessage.SendData(13, -1, this.whoAmI, "", num43, 0f, 0f, 0f, 0, 0, 0); return; } return; } case 14: { if (Main.netMode != 1) { return; } int num44 = (int)this.reader.ReadByte(); int num45 = (int)this.reader.ReadByte(); if (num45 == 1) { if (!Main.player[num44].active) { Main.player[num44] = new Player(); } Main.player[num44].active = true; return; } Main.player[num44].active = false; return; } case 15: case 67: case 93: case 94: return; case 16: { int num46 = (int)this.reader.ReadByte(); if (num46 == Main.myPlayer && !Main.ServerSideCharacter) { return; } if (Main.netMode == 2) { num46 = this.whoAmI; } Player player6 = Main.player[num46]; player6.statLife = (int)this.reader.ReadInt16(); player6.statLifeMax = (int)this.reader.ReadInt16(); if (player6.statLifeMax < 100) { player6.statLifeMax = 100; } player6.dead = (player6.statLife <= 0); if (Main.netMode == 2) { NetMessage.SendData(16, -1, this.whoAmI, "", num46, 0f, 0f, 0f, 0, 0, 0); return; } return; } case 17: { byte b2 = this.reader.ReadByte(); int num47 = (int)this.reader.ReadInt16(); int num48 = (int)this.reader.ReadInt16(); short num49 = this.reader.ReadInt16(); int num50 = (int)this.reader.ReadByte(); bool flag6 = num49 == 1; if (!WorldGen.InWorld(num47, num48, 3)) { return; } if (Main.tile[num47, num48] == null) { Main.tile[num47, num48] = new Tile(); } if (Main.netMode == 2) { if (!flag6) { if (b2 == 0 || b2 == 2 || b2 == 4) { Netplay.Clients[this.whoAmI].SpamDeleteBlock += 1f; } if (b2 == 1 || b2 == 3) { Netplay.Clients[this.whoAmI].SpamAddBlock += 1f; } } if (!Netplay.Clients[this.whoAmI].TileSections[Netplay.GetSectionX(num47), Netplay.GetSectionY(num48)]) { flag6 = true; } } if (b2 == 0) { WorldGen.KillTile(num47, num48, flag6, false, false); } if (b2 == 1) { WorldGen.PlaceTile(num47, num48, (int)num49, false, true, -1, num50); } if (b2 == 2) { WorldGen.KillWall(num47, num48, flag6); } if (b2 == 3) { WorldGen.PlaceWall(num47, num48, (int)num49, false); } if (b2 == 4) { WorldGen.KillTile(num47, num48, flag6, false, true); } if (b2 == 5) { WorldGen.PlaceWire(num47, num48); } if (b2 == 6) { WorldGen.KillWire(num47, num48); } if (b2 == 7) { WorldGen.PoundTile(num47, num48); } if (b2 == 8) { WorldGen.PlaceActuator(num47, num48); } if (b2 == 9) { WorldGen.KillActuator(num47, num48); } if (b2 == 10) { WorldGen.PlaceWire2(num47, num48); } if (b2 == 11) { WorldGen.KillWire2(num47, num48); } if (b2 == 12) { WorldGen.PlaceWire3(num47, num48); } if (b2 == 13) { WorldGen.KillWire3(num47, num48); } if (b2 == 14) { WorldGen.SlopeTile(num47, num48, (int)num49); } if (b2 == 15) { Minecart.FrameTrack(num47, num48, true, false); } if (Main.netMode != 2) { return; } NetMessage.SendData(17, -1, this.whoAmI, "", (int)b2, (float)num47, (float)num48, (float)num49, num50, 0, 0); if (b2 == 1 && num49 == 53) { NetMessage.SendTileSquare(-1, num47, num48, 1); return; } return; } case 18: if (Main.netMode != 1) { return; } Main.dayTime = (this.reader.ReadByte() == 1); Main.time = (double)this.reader.ReadInt32(); Main.sunModY = this.reader.ReadInt16(); Main.moonModY = this.reader.ReadInt16(); return; case 19: { byte b3 = this.reader.ReadByte(); int num51 = (int)this.reader.ReadInt16(); int num52 = (int)this.reader.ReadInt16(); if (!WorldGen.InWorld(num51, num52, 3)) { return; } int num53 = (this.reader.ReadByte() == 0) ? -1 : 1; if (b3 == 0) { WorldGen.OpenDoor(num51, num52, num53); } else if (b3 == 1) { WorldGen.CloseDoor(num51, num52, true); } else if (b3 == 2) { WorldGen.ShiftTrapdoor(num51, num52, num53 == 1, 1); } else if (b3 == 3) { WorldGen.ShiftTrapdoor(num51, num52, num53 == 1, 0); } else if (b3 == 4) { WorldGen.ShiftTallGate(num51, num52, false); } else if (b3 == 5) { WorldGen.ShiftTallGate(num51, num52, true); } if (Main.netMode == 2) { NetMessage.SendData(19, -1, this.whoAmI, "", (int)b3, (float)num51, (float)num52, (float)((num53 == 1) ? 1 : 0), 0, 0, 0); return; } return; } case 20: { short num54 = this.reader.ReadInt16(); int num55 = (int)this.reader.ReadInt16(); int num56 = (int)this.reader.ReadInt16(); if (!WorldGen.InWorld(num55, num56, 3)) { return; } BitsByte bitsByte10 = 0; BitsByte bitsByte11 = 0; for (int num57 = num55; num57 < num55 + (int)num54; num57++) { for (int num58 = num56; num58 < num56 + (int)num54; num58++) { if (Main.tile[num57, num58] == null) { Main.tile[num57, num58] = new Tile(); } Tile tile = Main.tile[num57, num58]; bool flag7 = tile.active(); bitsByte10 = this.reader.ReadByte(); bitsByte11 = this.reader.ReadByte(); tile.active(bitsByte10[0]); tile.wall = (byte)(bitsByte10[2] ? 1 : 0); bool flag8 = bitsByte10[3]; if (Main.netMode != 2) { tile.liquid = (byte)(flag8 ? 1 : 0); } tile.wire(bitsByte10[4]); tile.halfBrick(bitsByte10[5]); tile.actuator(bitsByte10[6]); tile.inActive(bitsByte10[7]); tile.wire2(bitsByte11[0]); tile.wire3(bitsByte11[1]); if (bitsByte11[2]) { tile.color(this.reader.ReadByte()); } if (bitsByte11[3]) { tile.wallColor(this.reader.ReadByte()); } if (tile.active()) { int type3 = (int)tile.type; tile.type = this.reader.ReadUInt16(); if (Main.tileFrameImportant[(int)tile.type]) { tile.frameX = this.reader.ReadInt16(); tile.frameY = this.reader.ReadInt16(); } else if (!flag7 || (int)tile.type != type3) { tile.frameX = -1; tile.frameY = -1; } byte b4 = 0; if (bitsByte11[4]) { b4 += 1; } if (bitsByte11[5]) { b4 += 2; } if (bitsByte11[6]) { b4 += 4; } tile.slope(b4); } if (tile.wall > 0) { tile.wall = this.reader.ReadByte(); } if (flag8) { tile.liquid = this.reader.ReadByte(); tile.liquidType((int)this.reader.ReadByte()); } } } WorldGen.RangeFrame(num55, num56, num55 + (int)num54, num56 + (int)num54); if (Main.netMode == 2) { NetMessage.SendData((int)b, -1, this.whoAmI, "", (int)num54, (float)num55, (float)num56, 0f, 0, 0, 0); return; } return; } case 21: case 90: { int num59 = (int)this.reader.ReadInt16(); Vector2 position = this.reader.ReadVector2(); Vector2 velocity = this.reader.ReadVector2(); int stack3 = (int)this.reader.ReadInt16(); int pre = (int)this.reader.ReadByte(); int num60 = (int)this.reader.ReadByte(); int num61 = (int)this.reader.ReadInt16(); if (Main.netMode == 1) { if (num61 == 0) { Main.item[num59].active = false; return; } int num62 = num59; Item item = Main.item[num62]; bool newAndShiny = (item.newAndShiny || item.netID != num61) && ItemSlot.Options.HighlightNewItems && (num61 < 0 || num61 >= 3602 + Main.ulterrariaItems || !ItemID.Sets.NeverShiny[num61]); item.netDefaults(num61); item.newAndShiny = newAndShiny; item.Prefix(pre); item.stack = stack3; item.position = position; item.velocity = velocity; item.active = true; if (b == 90) { item.instanced = true; item.owner = Main.myPlayer; item.keepTime = 600; } item.wet = Collision.WetCollision(item.position, item.width, item.height); return; } else { if (Main.itemLockoutTime[num59] > 0) { return; } if (num61 == 0) { if (num59 < 400) { Main.item[num59].active = false; NetMessage.SendData(21, -1, -1, "", num59, 0f, 0f, 0f, 0, 0, 0); return; } return; } else { bool flag9 = false; if (num59 == 400) { flag9 = true; } if (flag9) { Item item2 = new Item(); item2.netDefaults(num61); num59 = Item.NewItem((int)position.X, (int)position.Y, item2.width, item2.height, item2.type, stack3, true, 0, false, false); } Item item3 = Main.item[num59]; item3.netDefaults(num61); item3.Prefix(pre); item3.stack = stack3; item3.position = position; item3.velocity = velocity; item3.active = true; item3.owner = Main.myPlayer; if (flag9) { NetMessage.SendData(21, -1, -1, "", num59, 0f, 0f, 0f, 0, 0, 0); if (num60 == 0) { Main.item[num59].ownIgnore = this.whoAmI; Main.item[num59].ownTime = 100; } Main.item[num59].FindOwner(num59); return; } NetMessage.SendData(21, -1, this.whoAmI, "", num59, 0f, 0f, 0f, 0, 0, 0); return; } } break; } case 22: { int num63 = (int)this.reader.ReadInt16(); int num64 = (int)this.reader.ReadByte(); if (Main.netMode == 2 && Main.item[num63].owner != this.whoAmI) { return; } Main.item[num63].owner = num64; if (num64 == Main.myPlayer) { Main.item[num63].keepTime = 15; } else { Main.item[num63].keepTime = 0; } if (Main.netMode == 2) { Main.item[num63].owner = 255; Main.item[num63].keepTime = 15; NetMessage.SendData(22, -1, -1, "", num63, 0f, 0f, 0f, 0, 0, 0); return; } return; } case 23: { if (Main.netMode != 1) { return; } int num65 = (int)this.reader.ReadInt16(); Vector2 position2 = this.reader.ReadVector2(); Vector2 velocity2 = this.reader.ReadVector2(); int target = (int)this.reader.ReadByte(); BitsByte bitsByte12 = this.reader.ReadByte(); float[] array2 = new float[NPC.maxAI]; for (int num66 = 0; num66 < NPC.maxAI; num66++) { if (bitsByte12[num66 + 2]) { array2[num66] = this.reader.ReadSingle(); } else { array2[num66] = 0f; } } int num67 = (int)this.reader.ReadInt16(); int num68 = 0; if (!bitsByte12[7]) { byte b5 = this.reader.ReadByte(); if (b5 == 2) { num68 = (int)this.reader.ReadInt16(); } else if (b5 == 4) { num68 = this.reader.ReadInt32(); } else { num68 = (int)this.reader.ReadSByte(); } } int num69 = -1; NPC nPC = Main.npc[num65]; if (!nPC.active || nPC.netID != num67) { if (nPC.active) { num69 = nPC.type; } nPC.active = true; nPC.netDefaults(num67); } nPC.position = position2; nPC.velocity = velocity2; nPC.target = target; nPC.direction = (bitsByte12[0] ? 1 : -1); nPC.directionY = (bitsByte12[1] ? 1 : -1); nPC.spriteDirection = (bitsByte12[6] ? 1 : -1); if (bitsByte12[7]) { num68 = (nPC.life = nPC.lifeMax); } else { nPC.life = num68; } if (num68 <= 0) { nPC.active = false; } for (int num70 = 0; num70 < NPC.maxAI; num70++) { nPC.ai[num70] = array2[num70]; } if (num69 > -1 && num69 != nPC.type) { nPC.TransformVisuals(num69, nPC.type); } if (num67 == 262) { NPC.plantBoss = num65; } if (num67 == 245) { NPC.golemBoss = num65; } if (Main.npcCatchable[nPC.type]) { nPC.releaseOwner = (short)this.reader.ReadByte(); return; } return; } case 24: { int num71 = (int)this.reader.ReadInt16(); int num72 = (int)this.reader.ReadByte(); if (Main.netMode == 2) { num72 = this.whoAmI; } Player player7 = Main.player[num72]; Main.npc[num71].StrikeNPC(player7.inventory[player7.selectedItem].damage, player7.inventory[player7.selectedItem].knockBack, player7.direction, false, false, false); if (Main.netMode == 2) { NetMessage.SendData(24, -1, this.whoAmI, "", num71, (float)num72, 0f, 0f, 0, 0, 0); NetMessage.SendData(23, -1, -1, "", num71, 0f, 0f, 0f, 0, 0, 0); return; } return; } case 25: { int num73 = (int)this.reader.ReadByte(); if (Main.netMode == 2) { num73 = this.whoAmI; } Color color = this.reader.ReadRGB(); if (Main.netMode == 2) { color = new Color(255, 255, 255); } string text = this.reader.ReadString(); if (Main.netMode == 1) { string newText = text; if (num73 < 255) { newText = NameTagHandler.GenerateTag(Main.player[num73].name) + " " + text; Main.player[num73].chatOverhead.NewMessage(text, Main.chatLength / 2); } Main.NewText(newText, color.R, color.G, color.B, false); return; } if (Main.netMode != 2) { return; } string text2 = text.ToLower(); if (text2 == Lang.mp[6] || text2 == Lang.mp[21]) { string text3 = ""; for (int num74 = 0; num74 < 255; num74++) { if (Main.player[num74].active) { if (text3 == "") { text3 = Main.player[num74].name; } else { text3 = text3 + ", " + Main.player[num74].name; } } } NetMessage.SendData(25, this.whoAmI, -1, Lang.mp[7] + " " + text3 + ".", 255, 255f, 240f, 20f, 0, 0, 0); return; } if (text2.StartsWith("/me ")) { NetMessage.SendData(25, -1, -1, "*" + Main.player[this.whoAmI].name + " " + text.Substring(4), 255, 200f, 100f, 0f, 0, 0, 0); return; } if (text2 == Lang.mp[8]) { NetMessage.SendData(25, -1, -1, string.Concat(new object[] { "*", Main.player[this.whoAmI].name, " ", Lang.mp[9], " ", Main.rand.Next(1, 101) }), 255, 255f, 240f, 20f, 0, 0, 0); return; } if (text2.StartsWith("/p ")) { int team = Main.player[this.whoAmI].team; color = Main.teamColor[team]; if (team != 0) { for (int num75 = 0; num75 < 255; num75++) { if (Main.player[num75].team == team) { NetMessage.SendData(25, num75, -1, text.Substring(3), num73, (float)color.R, (float)color.G, (float)color.B, 0, 0, 0); } } return; } NetMessage.SendData(25, this.whoAmI, -1, Lang.mp[10], 255, 255f, 240f, 20f, 0, 0, 0); return; } else { if (Main.player[this.whoAmI].difficulty == 2) { color = Main.hcColor; } else if (Main.player[this.whoAmI].difficulty == 1) { color = Main.mcColor; } NetMessage.SendData(25, -1, -1, text, num73, (float)color.R, (float)color.G, (float)color.B, 0, 0, 0); if (Main.dedServ) { Console.WriteLine("<" + Main.player[this.whoAmI].name + "> " + text); return; } return; } break; } case 26: { int num76 = (int)this.reader.ReadByte(); if (Main.netMode == 2 && this.whoAmI != num76 && (!Main.player[num76].hostile || !Main.player[this.whoAmI].hostile)) { return; } int num77 = (int)(this.reader.ReadByte() - 1); int num78 = (int)this.reader.ReadInt16(); string text4 = this.reader.ReadString(); BitsByte bitsByte13 = this.reader.ReadByte(); bool flag10 = bitsByte13[0]; bool flag11 = bitsByte13[1]; int num79 = bitsByte13[2] ? 0 : -1; if (bitsByte13[3]) { num79 = 1; } Main.player[num76].Hurt(num78, num77, flag10, true, text4, flag11, num79); if (Main.netMode == 2) { NetMessage.SendData(26, -1, this.whoAmI, text4, num76, (float)num77, (float)num78, (float)(flag10 ? 1 : 0), flag11 ? 1 : 0, num79, 0); return; } return; } case 27: { int num80 = (int)this.reader.ReadInt16(); Vector2 position3 = this.reader.ReadVector2(); Vector2 velocity3 = this.reader.ReadVector2(); float knockBack = this.reader.ReadSingle(); int damage = (int)this.reader.ReadInt16(); int num81 = (int)this.reader.ReadByte(); int num82 = (int)this.reader.ReadInt16(); BitsByte bitsByte14 = this.reader.ReadByte(); float[] array3 = new float[Projectile.maxAI]; for (int num83 = 0; num83 < Projectile.maxAI; num83++) { if (bitsByte14[num83]) { array3[num83] = this.reader.ReadSingle(); } else { array3[num83] = 0f; } } int num84 = (int)(bitsByte14[Projectile.maxAI] ? this.reader.ReadInt16() : -1); if (num84 >= 1000) { num84 = -1; } if (Main.netMode == 2) { num81 = this.whoAmI; if (Main.projHostile[num82]) { return; } } int num85 = 1000; for (int num86 = 0; num86 < 1000; num86++) { if (Main.projectile[num86].owner == num81 && Main.projectile[num86].identity == num80 && Main.projectile[num86].active) { num85 = num86; break; } } if (num85 == 1000) { for (int num87 = 0; num87 < 1000; num87++) { if (!Main.projectile[num87].active) { num85 = num87; break; } } } Projectile projectile = Main.projectile[num85]; if (!projectile.active || projectile.type != num82) { projectile.SetDefaults(num82); if (Main.netMode == 2) { Netplay.Clients[this.whoAmI].SpamProjectile += 1f; } } projectile.identity = num80; projectile.position = position3; projectile.velocity = velocity3; projectile.type = num82; projectile.damage = damage; projectile.knockBack = knockBack; projectile.owner = num81; for (int num88 = 0; num88 < Projectile.maxAI; num88++) { projectile.ai[num88] = array3[num88]; } if (num84 >= 0) { projectile.projUUID = num84; Main.projectileIdentity[num81, num84] = num85; } projectile.ProjectileFixDesperation(); if (Main.netMode == 2) { NetMessage.SendData(27, -1, this.whoAmI, "", num85, 0f, 0f, 0f, 0, 0, 0); return; } return; } case 28: { int num89 = (int)this.reader.ReadInt16(); int num90 = (int)this.reader.ReadInt16(); float num91 = this.reader.ReadSingle(); int num92 = (int)(this.reader.ReadByte() - 1); byte b6 = this.reader.ReadByte(); if (Main.netMode == 2) { if (num90 < 0) { num90 = 0; } Main.npc[num89].PlayerInteraction(this.whoAmI); } if (num90 >= 0) { Main.npc[num89].StrikeNPC(num90, num91, num92, b6 == 1, false, true); } else { Main.npc[num89].life = 0; Main.npc[num89].HitEffect(0, 10.0); Main.npc[num89].active = false; } if (Main.netMode != 2) { return; } NetMessage.SendData(28, -1, this.whoAmI, "", num89, (float)num90, num91, (float)num92, (int)b6, 0, 0); if (Main.npc[num89].life <= 0) { NetMessage.SendData(23, -1, -1, "", num89, 0f, 0f, 0f, 0, 0, 0); } else { Main.npc[num89].netUpdate = true; } if (Main.npc[num89].realLife < 0) { return; } if (Main.npc[Main.npc[num89].realLife].life <= 0) { NetMessage.SendData(23, -1, -1, "", Main.npc[num89].realLife, 0f, 0f, 0f, 0, 0, 0); return; } Main.npc[Main.npc[num89].realLife].netUpdate = true; return; } case 29: { int num93 = (int)this.reader.ReadInt16(); int num94 = (int)this.reader.ReadByte(); if (Main.netMode == 2) { num94 = this.whoAmI; } for (int num95 = 0; num95 < 1000; num95++) { if (Main.projectile[num95].owner == num94 && Main.projectile[num95].identity == num93 && Main.projectile[num95].active) { Main.projectile[num95].Kill(); break; } } if (Main.netMode == 2) { NetMessage.SendData(29, -1, this.whoAmI, "", num93, (float)num94, 0f, 0f, 0, 0, 0); return; } return; } case 30: { int num96 = (int)this.reader.ReadByte(); if (Main.netMode == 2) { num96 = this.whoAmI; } bool flag12 = this.reader.ReadBoolean(); Main.player[num96].hostile = flag12; if (Main.netMode == 2) { NetMessage.SendData(30, -1, this.whoAmI, "", num96, 0f, 0f, 0f, 0, 0, 0); string str = " " + Lang.mp[flag12 ? 11 : 12]; Color color2 = Main.teamColor[Main.player[num96].team]; NetMessage.SendData(25, -1, -1, Main.player[num96].name + str, 255, (float)color2.R, (float)color2.G, (float)color2.B, 0, 0, 0); return; } return; } case 31: { if (Main.netMode != 2) { return; } int x = (int)this.reader.ReadInt16(); int y = (int)this.reader.ReadInt16(); int num97 = Chest.FindChest(x, y); if (num97 > -1 && Chest.UsingChest(num97) == -1) { for (int num98 = 0; num98 < 40; num98++) { NetMessage.SendData(32, this.whoAmI, -1, "", num97, (float)num98, 0f, 0f, 0, 0, 0); } NetMessage.SendData(33, this.whoAmI, -1, "", num97, 0f, 0f, 0f, 0, 0, 0); Main.player[this.whoAmI].chest = num97; if (Main.myPlayer == this.whoAmI) { Main.recBigList = false; } NetMessage.SendData(80, -1, this.whoAmI, "", this.whoAmI, (float)num97, 0f, 0f, 0, 0, 0); return; } return; } case 32: { int num99 = (int)this.reader.ReadInt16(); int num100 = (int)this.reader.ReadByte(); int stack4 = (int)this.reader.ReadInt16(); int pre2 = (int)this.reader.ReadByte(); int type4 = (int)this.reader.ReadInt16(); if (Main.chest[num99] == null) { Main.chest[num99] = new Chest(false); } if (Main.chest[num99].item[num100] == null) { Main.chest[num99].item[num100] = new Item(); } Main.chest[num99].item[num100].netDefaults(type4); Main.chest[num99].item[num100].Prefix(pre2); Main.chest[num99].item[num100].stack = stack4; Recipe.FindRecipes(); return; } case 33: { int num101 = (int)this.reader.ReadInt16(); int num102 = (int)this.reader.ReadInt16(); int num103 = (int)this.reader.ReadInt16(); int num104 = (int)this.reader.ReadByte(); string text5 = string.Empty; if (num104 != 0) { if (num104 <= 20) { text5 = this.reader.ReadString(); } else if (num104 != 255) { num104 = 0; } } if (Main.netMode != 1) { if (num104 != 0) { int chest = Main.player[this.whoAmI].chest; Chest chest2 = Main.chest[chest]; chest2.name = text5; NetMessage.SendData(69, -1, this.whoAmI, text5, chest, (float)chest2.x, (float)chest2.y, 0f, 0, 0, 0); } Main.player[this.whoAmI].chest = num101; Recipe.FindRecipes(); NetMessage.SendData(80, -1, this.whoAmI, "", this.whoAmI, (float)num101, 0f, 0f, 0, 0, 0); return; } Player player8 = Main.player[Main.myPlayer]; if (player8.chest == -1) { Main.playerInventory = true; Main.PlaySound(10, -1, -1, 1); } else if (player8.chest != num101 && num101 != -1) { Main.playerInventory = true; Main.PlaySound(12, -1, -1, 1); Main.recBigList = false; } else if (player8.chest != -1 && num101 == -1) { Main.PlaySound(11, -1, -1, 1); Main.recBigList = false; } player8.chest = num101; player8.chestX = num102; player8.chestY = num103; Recipe.FindRecipes(); if (Main.tile[num102, num103].frameX >= 36 && Main.tile[num102, num103].frameX < 72) { AchievementsHelper.HandleSpecialEvent(Main.player[Main.myPlayer], 16); return; } return; } case 34: { byte b7 = this.reader.ReadByte(); int num105 = (int)this.reader.ReadInt16(); int num106 = (int)this.reader.ReadInt16(); int num107 = (int)this.reader.ReadInt16(); if (Main.netMode == 2) { if (b7 == 0) { int num108 = WorldGen.PlaceChest(num105, num106, 21, false, num107); if (num108 == -1) { NetMessage.SendData(34, this.whoAmI, -1, "", (int)b7, (float)num105, (float)num106, (float)num107, num108, 0, 0); Item.NewItem(num105 * 16, num106 * 16, 32, 32, Chest.chestItemSpawn[num107], 1, true, 0, false, false); return; } NetMessage.SendData(34, -1, -1, "", (int)b7, (float)num105, (float)num106, (float)num107, num108, 0, 0); return; } else if (b7 == 2) { int num109 = WorldGen.PlaceChest(num105, num106, 88, false, num107); if (num109 == -1) { NetMessage.SendData(34, this.whoAmI, -1, "", (int)b7, (float)num105, (float)num106, (float)num107, num109, 0, 0); Item.NewItem(num105 * 16, num106 * 16, 32, 32, Chest.dresserItemSpawn[num107], 1, true, 0, false, false); return; } NetMessage.SendData(34, -1, -1, "", (int)b7, (float)num105, (float)num106, (float)num107, num109, 0, 0); return; } else { Tile tile2 = Main.tile[num105, num106]; if (tile2.type == 21 && b7 == 1) { if (tile2.frameX % 36 != 0) { num105--; } if (tile2.frameY % 36 != 0) { num106--; } int number = Chest.FindChest(num105, num106); WorldGen.KillTile(num105, num106, false, false, false); if (!tile2.active()) { NetMessage.SendData(34, -1, -1, "", (int)b7, (float)num105, (float)num106, 0f, number, 0, 0); return; } return; } else { if (tile2.type != 88 || b7 != 3) { return; } num105 -= (int)(tile2.frameX % 54 / 18); if (tile2.frameY % 36 != 0) { num106--; } int number2 = Chest.FindChest(num105, num106); WorldGen.KillTile(num105, num106, false, false, false); if (!tile2.active()) { NetMessage.SendData(34, -1, -1, "", (int)b7, (float)num105, (float)num106, 0f, number2, 0, 0); return; } return; } } } else { int num110 = (int)this.reader.ReadInt16(); if (b7 == 0) { if (num110 == -1) { WorldGen.KillTile(num105, num106, false, false, false); return; } WorldGen.PlaceChestDirect(num105, num106, 21, num107, num110); return; } else { if (b7 != 2) { Chest.DestroyChestDirect(num105, num106, num110); WorldGen.KillTile(num105, num106, false, false, false); return; } if (num110 == -1) { WorldGen.KillTile(num105, num106, false, false, false); return; } WorldGen.PlaceDresserDirect(num105, num106, 88, num107, num110); return; } } break; } case 35: { int num111 = (int)this.reader.ReadByte(); if (Main.netMode == 2) { num111 = this.whoAmI; } int num112 = (int)this.reader.ReadInt16(); if (num111 != Main.myPlayer || Main.ServerSideCharacter) { Main.player[num111].HealEffect(num112, true); } if (Main.netMode == 2) { NetMessage.SendData(35, -1, this.whoAmI, "", num111, (float)num112, 0f, 0f, 0, 0, 0); return; } return; } case 36: { int num113 = (int)this.reader.ReadByte(); if (Main.netMode == 2) { num113 = this.whoAmI; } Player player9 = Main.player[num113]; player9.zone1 = this.reader.ReadByte(); player9.zone2 = this.reader.ReadByte(); if (Main.netMode == 2) { NetMessage.SendData(36, -1, this.whoAmI, "", num113, 0f, 0f, 0f, 0, 0, 0); return; } return; } case 37: if (Main.netMode != 1) { return; } if (Main.autoPass) { NetMessage.SendData(38, -1, -1, Netplay.ServerPassword, 0, 0f, 0f, 0f, 0, 0, 0); Main.autoPass = false; return; } Netplay.ServerPassword = ""; Main.menuMode = 31; return; case 38: { if (Main.netMode != 2) { return; } string a2 = this.reader.ReadString(); if (a2 == Netplay.ServerPassword) { Netplay.Clients[this.whoAmI].State = 1; NetMessage.SendData(3, this.whoAmI, -1, "", 0, 0f, 0f, 0f, 0, 0, 0); return; } NetMessage.SendData(2, this.whoAmI, -1, Lang.mp[1], 0, 0f, 0f, 0f, 0, 0, 0); return; } case 39: { if (Main.netMode != 1) { return; } int num114 = (int)this.reader.ReadInt16(); Main.item[num114].owner = 255; NetMessage.SendData(22, -1, -1, "", num114, 0f, 0f, 0f, 0, 0, 0); return; } case 40: { int num115 = (int)this.reader.ReadByte(); if (Main.netMode == 2) { num115 = this.whoAmI; } int talkNPC = (int)this.reader.ReadInt16(); Main.player[num115].talkNPC = talkNPC; if (Main.netMode == 2) { NetMessage.SendData(40, -1, this.whoAmI, "", num115, 0f, 0f, 0f, 0, 0, 0); return; } return; } case 41: { int num116 = (int)this.reader.ReadByte(); if (Main.netMode == 2) { num116 = this.whoAmI; } Player player10 = Main.player[num116]; float itemRotation = this.reader.ReadSingle(); int itemAnimation = (int)this.reader.ReadInt16(); player10.itemRotation = itemRotation; player10.itemAnimation = itemAnimation; player10.channel = player10.inventory[player10.selectedItem].channel; if (Main.netMode == 2) { NetMessage.SendData(41, -1, this.whoAmI, "", num116, 0f, 0f, 0f, 0, 0, 0); return; } return; } case 42: { int num117 = (int)this.reader.ReadByte(); if (Main.netMode == 2) { num117 = this.whoAmI; } else if (Main.myPlayer == num117 && !Main.ServerSideCharacter) { return; } int statMana = (int)this.reader.ReadInt16(); int statManaMax = (int)this.reader.ReadInt16(); Main.player[num117].statMana = statMana; Main.player[num117].statManaMax = statManaMax; return; } case 43: { int num118 = (int)this.reader.ReadByte(); if (Main.netMode == 2) { num118 = this.whoAmI; } int num119 = (int)this.reader.ReadInt16(); if (num118 != Main.myPlayer) { Main.player[num118].ManaEffect(num119); } if (Main.netMode == 2) { NetMessage.SendData(43, -1, this.whoAmI, "", num118, (float)num119, 0f, 0f, 0, 0, 0); return; } return; } case 44: { int num120 = (int)this.reader.ReadByte(); if (Main.netMode == 2) { num120 = this.whoAmI; } int num121 = (int)(this.reader.ReadByte() - 1); int num122 = (int)this.reader.ReadInt16(); byte b8 = this.reader.ReadByte(); string text6 = this.reader.ReadString(); Main.player[num120].KillMe((double)num122, num121, b8 == 1, text6); if (Main.netMode == 2) { NetMessage.SendData(44, -1, this.whoAmI, text6, num120, (float)num121, (float)num122, (float)b8, 0, 0, 0); return; } return; } case 45: { int num123 = (int)this.reader.ReadByte(); if (Main.netMode == 2) { num123 = this.whoAmI; } int num124 = (int)this.reader.ReadByte(); Player player11 = Main.player[num123]; int team2 = player11.team; player11.team = num124; Color color3 = Main.teamColor[num124]; if (Main.netMode == 2) { NetMessage.SendData(45, -1, this.whoAmI, "", num123, 0f, 0f, 0f, 0, 0, 0); string str2 = " " + Lang.mp[13 + num124]; if (num124 == 5) { str2 = " " + Lang.mp[22]; } for (int num125 = 0; num125 < 255; num125++) { if (num125 == this.whoAmI || (team2 > 0 && Main.player[num125].team == team2) || (num124 > 0 && Main.player[num125].team == num124)) { NetMessage.SendData(25, num125, -1, player11.name + str2, 255, (float)color3.R, (float)color3.G, (float)color3.B, 0, 0, 0); } } return; } return; } case 46: { if (Main.netMode != 2) { return; } int i2 = (int)this.reader.ReadInt16(); int j2 = (int)this.reader.ReadInt16(); int num126 = Sign.ReadSign(i2, j2, true); if (num126 >= 0) { NetMessage.SendData(47, this.whoAmI, -1, "", num126, (float)this.whoAmI, 0f, 0f, 0, 0, 0); return; } return; } case 47: { int num127 = (int)this.reader.ReadInt16(); int x2 = (int)this.reader.ReadInt16(); int y2 = (int)this.reader.ReadInt16(); string text7 = this.reader.ReadString(); string a3 = null; if (Main.sign[num127] != null) { a3 = Main.sign[num127].text; } Main.sign[num127] = new Sign(); Main.sign[num127].x = x2; Main.sign[num127].y = y2; Sign.TextSign(num127, text7); int num128 = (int)this.reader.ReadByte(); if (Main.netMode == 2 && a3 != text7) { num128 = this.whoAmI; NetMessage.SendData(47, -1, this.whoAmI, "", num127, (float)num128, 0f, 0f, 0, 0, 0); } if (Main.netMode == 1 && num128 == Main.myPlayer && Main.sign[num127] != null) { Main.playerInventory = false; Main.player[Main.myPlayer].talkNPC = -1; Main.npcChatCornerItem = 0; Main.editSign = false; Main.PlaySound(10, -1, -1, 1); Main.player[Main.myPlayer].sign = num127; Main.npcChatText = Main.sign[num127].text; return; } return; } case 48: { int num129 = (int)this.reader.ReadInt16(); int num130 = (int)this.reader.ReadInt16(); byte liquid = this.reader.ReadByte(); byte liquidType = this.reader.ReadByte(); if (Main.netMode == 2 && Netplay.spamCheck) { int num131 = this.whoAmI; int num132 = (int)(Main.player[num131].position.X + (float)(Main.player[num131].width / 2)); int num133 = (int)(Main.player[num131].position.Y + (float)(Main.player[num131].height / 2)); int num134 = 10; int num135 = num132 - num134; int num136 = num132 + num134; int num137 = num133 - num134; int num138 = num133 + num134; if (num129 < num135 || num129 > num136 || num130 < num137 || num130 > num138) { NetMessage.BootPlayer(this.whoAmI, "Cheating attempt detected: Liquid spam"); return; } } if (Main.tile[num129, num130] == null) { Main.tile[num129, num130] = new Tile(); } lock (Main.tile[num129, num130]) { Main.tile[num129, num130].liquid = liquid; Main.tile[num129, num130].liquidType((int)liquidType); if (Main.netMode == 2) { WorldGen.SquareTileFrame(num129, num130, true); } return; } goto IL_4824; } case 49: goto IL_4824; case 50: { int num139 = (int)this.reader.ReadByte(); if (Main.netMode == 2) { num139 = this.whoAmI; } else if (num139 == Main.myPlayer && !Main.ServerSideCharacter) { return; } Player player12 = Main.player[num139]; for (int num140 = 0; num140 < 22; num140++) { player12.buffType[num140] = (int)this.reader.ReadByte(); if (player12.buffType[num140] > 0) { player12.buffTime[num140] = 60; } else { player12.buffTime[num140] = 0; } } if (Main.netMode == 2) { NetMessage.SendData(50, -1, this.whoAmI, "", num139, 0f, 0f, 0f, 0, 0, 0); return; } return; } case 51: { byte b9 = this.reader.ReadByte(); byte b10 = this.reader.ReadByte(); if (b10 == 1) { NPC.SpawnSkeletron(); return; } if (b10 == 2) { if (Main.netMode == 2) { NetMessage.SendData(51, -1, this.whoAmI, "", (int)b9, (float)b10, 0f, 0f, 0, 0, 0); return; } Main.PlaySound(2, (int)Main.player[(int)b9].position.X, (int)Main.player[(int)b9].position.Y, 1); return; } else if (b10 == 3) { if (Main.netMode == 2) { Main.Sundialing(); return; } return; } else { if (b10 == 4) { Main.npc[(int)b9].BigMimicSpawnSmoke(); return; } return; } break; } case 52: { int num141 = (int)this.reader.ReadByte(); int num142 = (int)this.reader.ReadInt16(); int num143 = (int)this.reader.ReadInt16(); if (num141 == 1) { Chest.Unlock(num142, num143); if (Main.netMode == 2) { NetMessage.SendData(52, -1, this.whoAmI, "", 0, (float)num141, (float)num142, (float)num143, 0, 0, 0); NetMessage.SendTileSquare(-1, num142, num143, 2); } } if (num141 != 2) { return; } WorldGen.UnlockDoor(num142, num143); if (Main.netMode == 2) { NetMessage.SendData(52, -1, this.whoAmI, "", 0, (float)num141, (float)num142, (float)num143, 0, 0, 0); NetMessage.SendTileSquare(-1, num142, num143, 2); return; } return; } case 53: { int num144 = (int)this.reader.ReadInt16(); int type5 = (int)this.reader.ReadByte(); int time = (int)this.reader.ReadInt16(); Main.npc[num144].AddBuff(type5, time, true); if (Main.netMode == 2) { NetMessage.SendData(54, -1, -1, "", num144, 0f, 0f, 0f, 0, 0, 0); return; } return; } case 54: { if (Main.netMode != 1) { return; } int num145 = (int)this.reader.ReadInt16(); NPC nPC2 = Main.npc[num145]; for (int num146 = 0; num146 < 5; num146++) { nPC2.buffType[num146] = (int)this.reader.ReadByte(); nPC2.buffTime[num146] = (int)this.reader.ReadInt16(); } return; } case 55: { int num147 = (int)this.reader.ReadByte(); int num148 = (int)this.reader.ReadByte(); int num149 = (int)this.reader.ReadInt16(); if (Main.netMode == 2 && num147 != this.whoAmI && !Main.pvpBuff[num148]) { return; } if (Main.netMode == 1 && num147 == Main.myPlayer) { Main.player[num147].AddBuff(num148, num149, true); return; } if (Main.netMode == 2) { NetMessage.SendData(55, num147, -1, "", num147, (float)num148, (float)num149, 0f, 0, 0, 0); return; } return; } case 56: { int num150 = (int)this.reader.ReadInt16(); if (num150 < 0 || num150 >= 200) { return; } string displayName = this.reader.ReadString(); if (Main.netMode == 1) { Main.npc[num150].displayName = displayName; return; } if (Main.netMode == 2) { NetMessage.SendData(56, this.whoAmI, -1, Main.npc[num150].displayName, num150, 0f, 0f, 0f, 0, 0, 0); return; } return; } case 57: if (Main.netMode != 1) { return; } WorldGen.tGood = this.reader.ReadByte(); WorldGen.tEvil = this.reader.ReadByte(); WorldGen.tBlood = this.reader.ReadByte(); return; case 58: { int num151 = (int)this.reader.ReadByte(); if (Main.netMode == 2) { num151 = this.whoAmI; } float num152 = this.reader.ReadSingle(); if (Main.netMode == 2) { NetMessage.SendData(58, -1, this.whoAmI, "", this.whoAmI, num152, 0f, 0f, 0, 0, 0); return; } Player player13 = Main.player[num151]; Main.harpNote = num152; int style = 26; if (player13.inventory[player13.selectedItem].type == 507) { style = 35; } Main.PlaySound(2, (int)player13.position.X, (int)player13.position.Y, style); return; } case 59: { int num153 = (int)this.reader.ReadInt16(); int num154 = (int)this.reader.ReadInt16(); Wiring.HitSwitch(num153, num154); if (Main.netMode == 2) { NetMessage.SendData(59, -1, this.whoAmI, "", num153, (float)num154, 0f, 0f, 0, 0, 0); return; } return; } case 60: { int num155 = (int)this.reader.ReadInt16(); int num156 = (int)this.reader.ReadInt16(); int num157 = (int)this.reader.ReadInt16(); byte b11 = this.reader.ReadByte(); if (num155 >= 200) { NetMessage.BootPlayer(this.whoAmI, "cheating attempt detected: Invalid kick-out"); return; } if (Main.netMode == 1) { Main.npc[num155].homeless = (b11 == 1); Main.npc[num155].homeTileX = num156; Main.npc[num155].homeTileY = num157; return; } if (b11 == 0) { WorldGen.kickOut(num155); return; } WorldGen.moveRoom(num156, num157, num155); return; } case 61: { int plr = (int)this.reader.ReadInt16(); int num158 = (int)this.reader.ReadInt16(); if (Main.netMode != 2) { return; } if (num158 >= 0 && num158 < 540 + Main.ulterrariaNPCs && NPCID.Sets.MPAllowedEnemies[num158]) { bool flag14 = !NPC.AnyNPCs(num158); if (flag14) { NPC.SpawnOnPlayer(plr, num158); return; } return; } else if (num158 == -4) { if (!Main.dayTime) { NetMessage.SendData(25, -1, -1, Lang.misc[31], 255, 50f, 255f, 130f, 0, 0, 0); Main.startPumpkinMoon(); NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0, 0, 0); NetMessage.SendData(78, -1, -1, "", 0, 1f, 2f, 1f, 0, 0, 0); return; } return; } else if (num158 == -5) { if (!Main.dayTime) { NetMessage.SendData(25, -1, -1, Lang.misc[34], 255, 50f, 255f, 130f, 0, 0, 0); Main.startSnowMoon(); NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0, 0, 0); NetMessage.SendData(78, -1, -1, "", 0, 1f, 1f, 1f, 0, 0, 0); return; } return; } else if (num158 == -6) { if (Main.dayTime && !Main.eclipse) { NetMessage.SendData(25, -1, -1, Lang.misc[20], 255, 50f, 255f, 130f, 0, 0, 0); Main.eclipse = true; NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0, 0, 0); return; } return; } else { if (num158 == -7) { NetMessage.SendData(25, -1, -1, "martian moon toggled", 255, 50f, 255f, 130f, 0, 0, 0); Main.invasionDelay = 0; Main.StartInvasion(4); NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0, 0, 0); NetMessage.SendData(78, -1, -1, "", 0, 1f, (float)(Main.invasionType + 2), 0f, 0, 0, 0); return; } if (num158 == -8) { if (NPC.downedGolemBoss && Main.hardMode && !NPC.AnyDanger() && !NPC.AnyoneNearCultists()) { WorldGen.StartImpendingDoom(); NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0, 0, 0); return; } return; } else { if (num158 < 0) { int num159 = 1; if (num158 > -5) { num159 = -num158; } if (num159 > 0 && Main.invasionType == 0) { Main.invasionDelay = 0; Main.StartInvasion(num159); } NetMessage.SendData(78, -1, -1, "", 0, 1f, (float)(Main.invasionType + 2), 0f, 0, 0, 0); return; } return; } } break; } case 62: { int num160 = (int)this.reader.ReadByte(); int num161 = (int)this.reader.ReadByte(); if (Main.netMode == 2) { num160 = this.whoAmI; } if (num161 == 1) { Main.player[num160].NinjaDodge(); } if (num161 == 2) { Main.player[num160].ShadowDodge(); } if (Main.netMode == 2) { NetMessage.SendData(62, -1, this.whoAmI, "", num160, (float)num161, 0f, 0f, 0, 0, 0); return; } return; } case 63: { int num162 = (int)this.reader.ReadInt16(); int num163 = (int)this.reader.ReadInt16(); byte b12 = this.reader.ReadByte(); WorldGen.paintTile(num162, num163, b12, false); if (Main.netMode == 2) { NetMessage.SendData(63, -1, this.whoAmI, "", num162, (float)num163, (float)b12, 0f, 0, 0, 0); return; } return; } case 64: { int num164 = (int)this.reader.ReadInt16(); int num165 = (int)this.reader.ReadInt16(); byte b13 = this.reader.ReadByte(); WorldGen.paintWall(num164, num165, b13, false); if (Main.netMode == 2) { NetMessage.SendData(64, -1, this.whoAmI, "", num164, (float)num165, (float)b13, 0f, 0, 0, 0); return; } return; } case 65: { BitsByte bitsByte15 = this.reader.ReadByte(); int num166 = (int)this.reader.ReadInt16(); if (Main.netMode == 2) { num166 = this.whoAmI; } Vector2 vector = this.reader.ReadVector2(); int num167 = 0; int num168 = 0; if (bitsByte15[0]) { num167++; } if (bitsByte15[1]) { num167 += 2; } if (bitsByte15[2]) { num168++; } if (bitsByte15[3]) { num168 += 2; } if (num167 == 0) { Main.player[num166].Teleport(vector, num168, 0); } else if (num167 == 1) { Main.npc[num166].Teleport(vector, num168, 0); } else if (num167 == 2) { Main.player[num166].Teleport(vector, num168, 0); if (Main.netMode == 2) { RemoteClient.CheckSection(this.whoAmI, vector, 1); NetMessage.SendData(65, -1, -1, "", 0, (float)num166, vector.X, vector.Y, num168, 0, 0); int num169 = -1; float num170 = 9999f; for (int num171 = 0; num171 < 255; num171++) { if (Main.player[num171].active && num171 != this.whoAmI) { Vector2 vector2 = Main.player[num171].position - Main.player[this.whoAmI].position; if (vector2.Length() < num170) { num170 = vector2.Length(); num169 = num171; } } } if (num169 >= 0) { NetMessage.SendData(25, -1, -1, Main.player[this.whoAmI].name + " has teleported to " + Main.player[num169].name, 255, 250f, 250f, 0f, 0, 0, 0); } } } if (Main.netMode == 2 && num167 == 0) { NetMessage.SendData(65, -1, this.whoAmI, "", 0, (float)num166, vector.X, vector.Y, num168, 0, 0); return; } return; } case 66: { int num172 = (int)this.reader.ReadByte(); int num173 = (int)this.reader.ReadInt16(); if (num173 <= 0) { return; } Player player14 = Main.player[num172]; player14.statLife += num173; if (player14.statLife > player14.statLifeMax2) { player14.statLife = player14.statLifeMax2; } player14.HealEffect(num173, false); if (Main.netMode == 2) { NetMessage.SendData(66, -1, this.whoAmI, "", num172, (float)num173, 0f, 0f, 0, 0, 0); return; } return; } case 68: this.reader.ReadString(); return; case 69: { int num174 = (int)this.reader.ReadInt16(); int num175 = (int)this.reader.ReadInt16(); int num176 = (int)this.reader.ReadInt16(); if (Main.netMode == 1) { if (num174 < 0 || num174 >= 1000) { return; } Chest chest3 = Main.chest[num174]; if (chest3 == null) { chest3 = new Chest(false); chest3.x = num175; chest3.y = num176; Main.chest[num174] = chest3; } else if (chest3.x != num175 || chest3.y != num176) { return; } chest3.name = this.reader.ReadString(); return; } else { if (num174 < -1 || num174 >= 1000) { return; } if (num174 == -1) { num174 = Chest.FindChest(num175, num176); if (num174 == -1) { return; } } Chest chest4 = Main.chest[num174]; if (chest4.x != num175 || chest4.y != num176) { return; } NetMessage.SendData(69, this.whoAmI, -1, chest4.name, num174, (float)num175, (float)num176, 0f, 0, 0, 0); return; } break; } case 70: { if (Main.netMode != 2) { return; } int num177 = (int)this.reader.ReadInt16(); int who = (int)this.reader.ReadByte(); if (Main.netMode == 2) { who = this.whoAmI; } if (num177 < 200 && num177 >= 0) { NPC.CatchNPC(num177, who); return; } return; } case 71: { if (Main.netMode != 2) { return; } int x3 = this.reader.ReadInt32(); int y3 = this.reader.ReadInt32(); int type6 = (int)this.reader.ReadInt16(); byte style2 = this.reader.ReadByte(); NPC.ReleaseNPC(x3, y3, type6, (int)style2, this.whoAmI); return; } case 72: if (Main.netMode != 1) { return; } for (int num178 = 0; num178 < 40; num178++) { Main.travelShop[num178] = (int)this.reader.ReadInt16(); } return; case 73: Main.player[this.whoAmI].TeleportationPotion(); return; case 74: if (Main.netMode != 1) { return; } Main.anglerQuest = (int)this.reader.ReadByte(); Main.anglerQuestFinished = this.reader.ReadBoolean(); return; case 75: { if (Main.netMode != 2) { return; } string name = Main.player[this.whoAmI].name; if (!Main.anglerWhoFinishedToday.Contains(name)) { Main.anglerWhoFinishedToday.Add(name); return; } return; } case 76: { int num179 = (int)this.reader.ReadByte(); if (num179 == Main.myPlayer && !Main.ServerSideCharacter) { return; } if (Main.netMode == 2) { num179 = this.whoAmI; } Player player15 = Main.player[num179]; player15.anglerQuestsFinished = this.reader.ReadInt32(); if (Main.netMode == 2) { NetMessage.SendData(76, -1, this.whoAmI, "", num179, 0f, 0f, 0f, 0, 0, 0); return; } return; } case 77: { short type7 = this.reader.ReadInt16(); ushort tileType = this.reader.ReadUInt16(); short x4 = this.reader.ReadInt16(); short y4 = this.reader.ReadInt16(); Animation.NewTemporaryAnimation((int)type7, tileType, (int)x4, (int)y4); return; } case 78: if (Main.netMode != 1) { return; } Main.ReportInvasionProgress(this.reader.ReadInt32(), this.reader.ReadInt32(), (int)this.reader.ReadSByte(), (int)this.reader.ReadSByte()); return; case 79: { int x5 = (int)this.reader.ReadInt16(); int y5 = (int)this.reader.ReadInt16(); short type8 = this.reader.ReadInt16(); int style3 = (int)this.reader.ReadInt16(); int num180 = (int)this.reader.ReadByte(); int random = (int)this.reader.ReadSByte(); int direction; if (this.reader.ReadBoolean()) { direction = 1; } else { direction = -1; } if (Main.netMode == 2) { Netplay.Clients[this.whoAmI].SpamAddBlock += 1f; if (!WorldGen.InWorld(x5, y5, 10) || !Netplay.Clients[this.whoAmI].TileSections[Netplay.GetSectionX(x5), Netplay.GetSectionY(y5)]) { return; } } WorldGen.PlaceObject(x5, y5, (int)type8, false, style3, num180, random, direction); if (Main.netMode == 2) { NetMessage.SendObjectPlacment(this.whoAmI, x5, y5, (int)type8, style3, num180, random, direction); return; } return; } case 80: { if (Main.netMode != 1) { return; } int num181 = (int)this.reader.ReadByte(); int num182 = (int)this.reader.ReadInt16(); if (num182 >= -3 && num182 < 1000) { Main.player[num181].chest = num182; Recipe.FindRecipes(); return; } return; } case 81: { if (Main.netMode != 1) { return; } int x6 = (int)this.reader.ReadSingle(); int y6 = (int)this.reader.ReadSingle(); Color color4 = this.reader.ReadRGB(); string text8 = this.reader.ReadString(); CombatText.NewText(new Rectangle(x6, y6, 0, 0), color4, text8, false, false); return; } case 82: NetManager.Instance.Read(this.reader, this.whoAmI); return; case 83: { if (Main.netMode != 1) { return; } int num183 = (int)this.reader.ReadInt16(); int num184 = this.reader.ReadInt32(); if (num183 >= 0 && num183 < 251) { NPC.killCount[num183] = num184; return; } return; } case 84: { byte b14 = this.reader.ReadByte(); float stealth = this.reader.ReadSingle(); Main.player[(int)b14].stealth = stealth; if (Main.netMode == 2) { NetMessage.SendData(84, -1, this.whoAmI, "", (int)b14, 0f, 0f, 0f, 0, 0, 0); return; } return; } case 85: { int num185 = this.whoAmI; byte b15 = this.reader.ReadByte(); if (Main.netMode == 2 && num185 < 255 && b15 < 58) { Chest.ServerPlaceItem(this.whoAmI, (int)b15); return; } return; } case 86: { if (Main.netMode != 1) { return; } int key = this.reader.ReadInt32(); bool flag15 = !this.reader.ReadBoolean(); if (!flag15) { TileEntity tileEntity = TileEntity.Read(this.reader); TileEntity.ByID[tileEntity.ID] = tileEntity; TileEntity.ByPosition[tileEntity.Position] = tileEntity; return; } TileEntity tileEntity2; if (TileEntity.ByID.TryGetValue(key, out tileEntity2) && (tileEntity2 is TETrainingDummy || tileEntity2 is TEItemFrame)) { TileEntity.ByID.Remove(key); TileEntity.ByPosition.Remove(tileEntity2.Position); return; } return; } case 87: { if (Main.netMode != 2) { return; } int num186 = (int)this.reader.ReadInt16(); int num187 = (int)this.reader.ReadInt16(); int num188 = (int)this.reader.ReadByte(); if (num186 < 0 || num186 >= Main.maxTilesX) { return; } if (num187 < 0 || num187 >= Main.maxTilesY) { return; } if (TileEntity.ByPosition.ContainsKey(new Point16(num186, num187))) { return; } switch (num188) { case 0: if (!TETrainingDummy.ValidTile(num186, num187)) { return; } TETrainingDummy.Place(num186, num187); return; case 1: { if (!TEItemFrame.ValidTile(num186, num187)) { return; } int number3 = TEItemFrame.Place(num186, num187); NetMessage.SendData(86, -1, -1, "", number3, (float)num186, (float)num187, 0f, 0, 0, 0); return; } default: return; } break; } case 88: { if (Main.netMode != 1) { return; } int num189 = (int)this.reader.ReadInt16(); if (num189 < 0 || num189 > 400) { return; } Item item4 = Main.item[num189]; BitsByte bitsByte16 = this.reader.ReadByte(); if (bitsByte16[0]) { item4.color.PackedValue = this.reader.ReadUInt32(); } if (bitsByte16[1]) { item4.damage = (int)this.reader.ReadUInt16(); } if (bitsByte16[2]) { item4.knockBack = this.reader.ReadSingle(); } if (bitsByte16[3]) { item4.useAnimation = (int)this.reader.ReadUInt16(); } if (bitsByte16[4]) { item4.useTime = (int)this.reader.ReadUInt16(); } if (bitsByte16[5]) { item4.shoot = (int)this.reader.ReadInt16(); } if (bitsByte16[6]) { item4.shootSpeed = this.reader.ReadSingle(); } if (!bitsByte16[7]) { return; } bitsByte16 = this.reader.ReadByte(); if (bitsByte16[0]) { item4.width = (int)this.reader.ReadInt16(); } if (bitsByte16[1]) { item4.height = (int)this.reader.ReadInt16(); } if (bitsByte16[2]) { item4.scale = this.reader.ReadSingle(); } if (bitsByte16[3]) { item4.ammo = (int)this.reader.ReadInt16(); } if (bitsByte16[4]) { item4.useAmmo = (int)this.reader.ReadInt16(); } if (bitsByte16[5]) { item4.notAmmo = this.reader.ReadBoolean(); return; } return; } case 89: { if (Main.netMode != 2) { return; } int x7 = (int)this.reader.ReadInt16(); int y7 = (int)this.reader.ReadInt16(); int netid = (int)this.reader.ReadInt16(); int prefix = (int)this.reader.ReadByte(); int stack5 = (int)this.reader.ReadInt16(); TEItemFrame.TryPlacing(x7, y7, netid, prefix, stack5); return; } case 91: { if (Main.netMode != 1) { return; } int num190 = this.reader.ReadInt32(); int num191 = (int)this.reader.ReadByte(); if (num191 != 255) { int meta = (int)this.reader.ReadUInt16(); int num192 = (int)this.reader.ReadByte(); int num193 = (int)this.reader.ReadByte(); int metadata = 0; if (num193 < 0) { metadata = (int)this.reader.ReadInt16(); } WorldUIAnchor worldUIAnchor = EmoteBubble.DeserializeNetAnchor(num191, meta); lock (EmoteBubble.byID) { if (!EmoteBubble.byID.ContainsKey(num190)) { EmoteBubble.byID[num190] = new EmoteBubble(num193, worldUIAnchor, num192); } else { EmoteBubble.byID[num190].lifeTime = num192; EmoteBubble.byID[num190].lifeTimeStart = num192; EmoteBubble.byID[num190].emote = num193; EmoteBubble.byID[num190].anchor = worldUIAnchor; } EmoteBubble.byID[num190].ID = num190; EmoteBubble.byID[num190].metadata = metadata; return; } goto IL_63B1; } if (EmoteBubble.byID.ContainsKey(num190)) { EmoteBubble.byID.Remove(num190); return; } return; } case 92: goto IL_63B1; case 95: { if (Main.netMode != 2) { return; } ushort num194 = this.reader.ReadUInt16(); if (num194 < 0 || num194 >= 1000) { return; } Projectile projectile2 = Main.projectile[(int)num194]; if (projectile2.type != 602) { return; } projectile2.Kill(); if (Main.netMode != 0) { NetMessage.SendData(29, -1, -1, "", projectile2.whoAmI, (float)projectile2.owner, 0f, 0f, 0, 0, 0); return; } return; } case 96: { int num195 = (int)this.reader.ReadByte(); Player player16 = Main.player[num195]; int num196 = (int)this.reader.ReadInt16(); Vector2 newPos = this.reader.ReadVector2(); Vector2 velocity4 = this.reader.ReadVector2(); int lastPortalColorIndex = num196 + ((num196 % 2 == 0) ? 1 : -1); player16.lastPortalColorIndex = lastPortalColorIndex; player16.Teleport(newPos, 4, num196); player16.velocity = velocity4; return; } case 97: if (Main.netMode != 1) { return; } AchievementsHelper.NotifyNPCKilledDirect(Main.player[Main.myPlayer], (int)this.reader.ReadInt16()); return; case 98: if (Main.netMode != 1) { return; } AchievementsHelper.NotifyProgressionEvent((int)this.reader.ReadInt16()); return; case 99: { int num197 = (int)this.reader.ReadByte(); if (Main.netMode == 2) { num197 = this.whoAmI; } Player player17 = Main.player[num197]; player17.MinionTargetPoint = this.reader.ReadVector2(); if (Main.netMode == 2) { NetMessage.SendData(99, -1, this.whoAmI, "", num197, 0f, 0f, 0f, 0, 0, 0); return; } return; } case 100: { int num198 = (int)this.reader.ReadUInt16(); NPC nPC3 = Main.npc[num198]; int num199 = (int)this.reader.ReadInt16(); Vector2 newPos2 = this.reader.ReadVector2(); Vector2 velocity5 = this.reader.ReadVector2(); int lastPortalColorIndex2 = num199 + ((num199 % 2 == 0) ? 1 : -1); nPC3.lastPortalColorIndex = lastPortalColorIndex2; nPC3.Teleport(newPos2, 4, num199); nPC3.velocity = velocity5; return; } case 101: if (Main.netMode == 2) { return; } NPC.ShieldStrengthTowerSolar = (int)this.reader.ReadUInt16(); NPC.ShieldStrengthTowerVortex = (int)this.reader.ReadUInt16(); NPC.ShieldStrengthTowerNebula = (int)this.reader.ReadUInt16(); NPC.ShieldStrengthTowerStardust = (int)this.reader.ReadUInt16(); if (NPC.ShieldStrengthTowerSolar < 0) { NPC.ShieldStrengthTowerSolar = 0; } if (NPC.ShieldStrengthTowerVortex < 0) { NPC.ShieldStrengthTowerVortex = 0; } if (NPC.ShieldStrengthTowerNebula < 0) { NPC.ShieldStrengthTowerNebula = 0; } if (NPC.ShieldStrengthTowerStardust < 0) { NPC.ShieldStrengthTowerStardust = 0; } if (NPC.ShieldStrengthTowerSolar > NPC.LunarShieldPowerExpert) { NPC.ShieldStrengthTowerSolar = NPC.LunarShieldPowerExpert; } if (NPC.ShieldStrengthTowerVortex > NPC.LunarShieldPowerExpert) { NPC.ShieldStrengthTowerVortex = NPC.LunarShieldPowerExpert; } if (NPC.ShieldStrengthTowerNebula > NPC.LunarShieldPowerExpert) { NPC.ShieldStrengthTowerNebula = NPC.LunarShieldPowerExpert; } if (NPC.ShieldStrengthTowerStardust > NPC.LunarShieldPowerExpert) { NPC.ShieldStrengthTowerStardust = NPC.LunarShieldPowerExpert; return; } return; case 102: { int num200 = (int)this.reader.ReadByte(); byte b16 = this.reader.ReadByte(); Vector2 other = this.reader.ReadVector2(); if (Main.netMode == 2) { num200 = this.whoAmI; NetMessage.SendData(102, -1, -1, "", num200, (float)b16, other.X, other.Y, 0, 0, 0); return; } Player player18 = Main.player[num200]; for (int num201 = 0; num201 < 255; num201++) { Player player19 = Main.player[num201]; if (player19.active && !player19.dead && (player18.team == 0 || player18.team == player19.team) && player19.Distance(other) < 700f) { Vector2 value = player18.Center - player19.Center; Vector2 vector3 = Vector2.Normalize(value); if (!vector3.HasNaNs()) { int type9 = 90; float num202 = 0f; float num203 = 0.209439516f; Vector2 spinningpoint = new Vector2(0f, -8f); Vector2 value2 = new Vector2(-3f); float num204 = 0f; float num205 = 0.005f; byte b17 = b16; if (b17 != 173) { if (b17 != 176) { if (b17 == 179) { type9 = 86; } } else { type9 = 88; } } else { type9 = 90; } int num206 = 0; while ((float)num206 < value.Length() / 6f) { Vector2 position4 = player19.Center + 6f * (float)num206 * vector3 + spinningpoint.RotatedBy((double)num202, default(Vector2)) + value2; num202 += num203; int num207 = Dust.NewDust(position4, 6, 6, type9, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num207].noGravity = true; Main.dust[num207].velocity = Vector2.Zero; num204 = (Main.dust[num207].fadeIn = num204 + num205); Main.dust[num207].velocity += vector3 * 1.5f; num206++; } } player19.NebulaLevelup((int)b16); } } return; } case 103: if (Main.netMode == 1) { NPC.MoonLordCountdown = this.reader.ReadInt32(); return; } return; case 104: { if (Main.netMode != 1 || Main.npcShop <= 0) { return; } Item[] item5 = Main.instance.shop[Main.npcShop].item; int num208 = (int)this.reader.ReadByte(); int type10 = (int)this.reader.ReadInt16(); int stack6 = (int)this.reader.ReadInt16(); int pre3 = (int)this.reader.ReadByte(); int value3 = this.reader.ReadInt32(); BitsByte bitsByte17 = this.reader.ReadByte(); if (num208 < item5.Length) { item5[num208] = new Item(); item5[num208].netDefaults(type10); item5[num208].stack = stack6; item5[num208].Prefix(pre3); item5[num208].value = value3; item5[num208].buyOnce = bitsByte17[0]; return; } return; } default: return; } if (Main.netMode != 2) { return; } if (Netplay.Clients[this.whoAmI].State == 1) { Netplay.Clients[this.whoAmI].State = 2; Netplay.Clients[this.whoAmI].ResetSections(); } NetMessage.SendData(7, this.whoAmI, -1, "", 0, 0f, 0f, 0f, 0, 0, 0); Main.SyncAnInvasion(this.whoAmI); return; IL_4824: if (Netplay.Connection.State == 6) { Netplay.Connection.State = 10; Main.ActivePlayerFileData.StartPlayTimer(); Player.EnterWorld(Main.player[Main.myPlayer]); Main.player[Main.myPlayer].Spawn(); return; } return; IL_63B1: int num209 = (int)this.reader.ReadInt16(); float num210 = this.reader.ReadSingle(); float num211 = this.reader.ReadSingle(); float num212 = this.reader.ReadSingle(); if (num209 < 0 || num209 > 200) { return; } if (Main.netMode == 1) { Main.npc[num209].moneyPing(new Vector2(num211, num212)); Main.npc[num209].extraValue = num210; return; } Main.npc[num209].extraValue += num210; NetMessage.SendData(92, -1, -1, "", num209, Main.npc[num209].extraValue, num211, num212, 0, 0, 0); return; }
public override void AI() { Player player = Main.player[projectile.owner]; float num = 1.57079637f; Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); if (projectile.localAI[1] > 0f) { projectile.localAI[1] -= 1f; } projectile.alpha -= 42; if (projectile.alpha < 0) { projectile.alpha = 0; } if (projectile.localAI[0] == 0f) { projectile.localAI[0] = projectile.velocity.ToRotation(); } float num32 = (float)((projectile.localAI[0].ToRotationVector2().X >= 0f) ? 1 : -1); if (projectile.ai[1] <= 0f) { num32 *= -1f; } int timeAlive = projectile.GetGlobalProjectile <EAProjectileType>().whipAliveTime; Vector2 vector17 = (num32 * (projectile.ai[0] / timeAlive * 6.28318548f - 1.57079637f)).ToRotationVector2(); vector17.Y *= (float)Math.Sin((double)projectile.ai[1]); if (projectile.ai[1] <= 0f) { vector17.Y *= -1f; } vector17 = vector17.RotatedBy((double)projectile.localAI[0], default(Vector2)); projectile.ai[0] += 1f; if (projectile.ai[0] < timeAlive) { float distance = 34f; projectile.velocity += distance * vector17; // determines how far it goes } else { projectile.Kill(); } if (projectile.ai[0] == timeAlive / 2) { Projectile.NewProjectile(projectile.position.X + projectile.velocity.X, projectile.position.Y + projectile.velocity.Y, projectile.velocity.X * Main.rand.NextFloat(0.02f, 0.03f), projectile.velocity.Y * Main.rand.NextFloat(0.02f, 0.03f), mod.ProjectileType("TerraOrb"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); } projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; projectile.rotation = projectile.velocity.ToRotation() + num; projectile.spriteDirection = projectile.direction; projectile.timeLeft = 2; player.ChangeDir(projectile.direction); player.heldProj = projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); Vector2 vector24 = Main.OffsetsPlayerOnhand[player.bodyFrame.Y / 56] * 2f; if (player.direction != 1) { vector24.X = (float)player.bodyFrame.Width - vector24.X; } if (player.gravDir != 1f) { vector24.Y = (float)player.bodyFrame.Height - vector24.Y; } vector24 -= new Vector2((float)(player.bodyFrame.Width - player.width), (float)(player.bodyFrame.Height - 42)) / 2f; projectile.Center = player.RotatedRelativePoint(player.position + vector24, true) - projectile.velocity; if (projectile.alpha == 0) { if (Main.rand.Next(2) == 0) { Dust dust = Main.dust[Dust.NewDust(projectile.position + projectile.velocity * 2f, projectile.width, projectile.height, 107, 0f, 0f, 100, default(Color), 2f)]; dust.noGravity = true; dust.velocity *= 2f; dust.velocity += projectile.localAI[0].ToRotationVector2(); dust.fadeIn = 1.5f; } float num52 = 18f; int num53 = 0; while ((float)num53 < num52) { if (Main.rand.Next(6) == 0) { Vector2 position = projectile.position + projectile.velocity + projectile.velocity * ((float)num53 / num52); Dust dust2 = Main.dust[Dust.NewDust(position, projectile.width, projectile.height, 107, 0f, 0f, 100, default(Color), 1f)]; dust2.noGravity = true; dust2.fadeIn = 0.5f; dust2.velocity += projectile.localAI[0].ToRotationVector2(); } num53++; } } }
private void SetDirection(NPC npc) { IList<int> targets = ((NPCs.PuritySpirit.PuritySpirit)npc.modNPC).targets; bool needsRotation = true; if (targets.Count > 0) { int player = targets[0]; Vector2 offset = Main.player[player].Center - projectile.Center; if (offset != Vector2.Zero) { projectile.rotation = (float)Math.Atan2(offset.Y, offset.X); needsRotation = false; } } if (needsRotation) { projectile.rotation = -(float)Math.PI / 2f; } int numChecks = 3; projectile.localAI[1] = 0f; Vector2 direction = new Vector2((float)Math.Cos(projectile.rotation), (float)Math.Sin(projectile.rotation)); for (int k = 0; k < numChecks; k++) { float side = (float)k / (numChecks - 1f); Vector2 sidePos = projectile.Center + direction.RotatedBy(Math.PI / 2) * (side - 0.5f) * projectile.width; int startX = (int)sidePos.X / 16; int startY = (int)sidePos.Y / 16; Vector2 endCheck = sidePos + direction * 16f * 150f; int endX = (int)endCheck.X / 16; int endY = (int)endCheck.Y / 16; Tuple<int, int> collide; if (!Collision.TupleHitLine(startX, startY, endX, endY, 0, 0, new List<Tuple<int, int>>(), out collide)) { projectile.localAI[1] += new Vector2((float)(startX - collide.Item1), (float)(startY - collide.Item2)).Length() * 16f; } else if (collide.Item1 == endX && collide.Item2 == endY) { projectile.localAI[1] += 1800f; } else { projectile.localAI[1] += new Vector2((float)(startX - collide.Item1), (float)(startY - collide.Item2)).Length() * 16f; } } projectile.localAI[1] /= numChecks; }
public void AI() { Vector2 vector2 = new Vector2(); Vector2 vector21 = new Vector2(); Vector2 vector22 = new Vector2(); int num = 0; int num1 = 0; int num2 = 0; bool flag; Vector2 vector23 = new Vector2(); int x; int x1; int num3; float single; Vector2 center; Vector2 y; int num4; int num5; bool flag1; Color skyBlue; int num6; int[] numArray; float single1; Vector2 vector24; int num7; int num8; int num9; int num10; bool flag2; bool flag3; bool flag4; bool flag5; if (this.aiStyle == 0) { for (int i = 0; i < 255; i++) { if (Main.player[i].active && Main.player[i].talkNPC == this.whoAmI) { if (this.type == 105) { this.Transform(107); return; } if (this.type == 106) { this.Transform(108); return; } if (this.type == 123) { this.Transform(124); return; } if (this.type == 354) { this.Transform(353); return; } if (this.type == 376) { this.Transform(369); return; } } } if (this.type != 376) { this.TargetClosest(true); this.spriteDirection = this.direction; } if (this.type != 376) { this.velocity.X = this.velocity.X * 0.93f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; return; } } else if (this.wet || Main.tile[(int)(base.Center.X / 16f), (int)(this.position.Y - 4f) / 16].liquid > 0) { this.velocity.Y = -0.4f; int num11 = 1; if (base.Center.X / 16f > (float)(Main.maxTilesX / 2)) { num11 = -1; } int num12 = 12; int x2 = (int)base.Center.X / 16; int y1 = (int)base.Center.Y / 16; bool flag6 = false; if (num11 <= 0) { for (int j = x2; j > x2 - num12; j--) { if (WorldGen.SolidTile(j, y1)) { flag6 = true; } } } else { for (int k = x2; k < x2 + num12; k++) { if (WorldGen.SolidTile(k, y1)) { flag6 = true; } } } if (!flag6) { this.velocity.X = this.velocity.X + (float)num11 * 0.01f; if (this.velocity.X > 0.2f) { this.velocity.X = this.velocity.X * 0.95f; } if (this.velocity.X < -0.2f) { this.velocity.X = this.velocity.X * 0.95f; return; } } else { this.velocity.X = this.velocity.X * 0.99f; if ((double)this.velocity.X > -0.01 && (double)this.velocity.X < 0.01) { this.velocity.X = 0f; return; } } } else { this.velocity.X = this.velocity.X * 0.93f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; return; } } } else if (this.aiStyle == 1) { if (this.type == 1 && (this.ai[1] == 1f || this.ai[1] == 2f || this.ai[1] == 3f)) { this.ai[1] = -1f; } if (this.type == 1 && this.ai[1] == 0f && Main.netMode != 1 && this.@value > 0f) { this.ai[1] = -1f; if (Main.rand.Next(20) == 0) { int num13 = Main.rand.Next(4); if (num13 == 0) { num13 = Main.rand.Next(7); if (num13 == 0) { num13 = 290; } else if (num13 == 1) { num13 = 292; } else if (num13 == 2) { num13 = 296; } else if (num13 != 3) { num13 = (Main.netMode == 0 || Main.rand.Next(2) != 0 ? 2350 : 2997); } else { num13 = 2322; } } else if (num13 == 1) { num13 = Main.rand.Next(4); if (num13 == 0) { num13 = 8; } else if (num13 != 1) { num13 = (num13 != 2 ? 58 : 965); } else { num13 = 166; } } else if (num13 != 2) { num13 = Main.rand.Next(3); if (num13 != 0) { num13 = (num13 != 1 ? 73 : 72); } else { num13 = 71; } } else { num13 = (Main.rand.Next(2) != 0 ? Main.rand.Next(699, 703) : Main.rand.Next(11, 15)); } this.ai[1] = (float)num13; this.netUpdate = true; } } if (this.type == 244) { float discoR = (float)Main.DiscoR / 255f; float discoG = (float)Main.DiscoG / 255f; float discoB = (float)Main.DiscoB / 255f; discoR = discoR * 1f; discoG = discoG * 1f; discoB = discoB * 1f; this.color.R = (byte)Main.DiscoR; this.color.G = (byte)Main.DiscoG; this.color.B = (byte)Main.DiscoB; this.color.A = 100; this.alpha = 175; } bool flag7 = false; if (!Main.dayTime || this.life != this.lifeMax || (double)this.position.Y > Main.worldSurface * 16 || Main.slimeRain) { flag7 = true; } if (this.type == 81) { flag7 = true; } if ((this.type == 377 || this.type == 446) && this.target != 255 && !Main.player[this.target].dead && Vector2.Distance(base.Center, Main.player[this.target].Center) <= 200f) { flag7 = true; } if (this.type == 183) { flag7 = true; } if (this.type == 304) { flag7 = true; } if (this.type == 244) { flag7 = true; this.ai[0] = this.ai[0] + 2f; } if (this.type == 184) { flag7 = true; if (this.localAI[0] > 0f) { this.localAI[0] = this.localAI[0] - 1f; } if (!this.wet && !Main.player[this.target].npcTypeNoAggro[this.type]) { Vector2 vector27 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float single2 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector27.X; float y2 = Main.player[this.target].position.Y - vector27.Y; float single3 = (float)Math.Sqrt((double)(single2 * single2 + y2 * y2)); if (Main.expertMode && single3 < 120f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height) && this.velocity.Y == 0f) { this.ai[0] = -40f; if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.9f; } if (Main.netMode != 1 && this.localAI[0] == 0f) { for (int l = 0; l < 5; l++) { Vector2 vector28 = new Vector2((float)(l - 2), -4f); vector28.Normalize(); vector28 = vector28 * (4f + (float)Main.rand.Next(-50, 51) * 0.01f); Projectile.NewProjectile(vector27.X, vector27.Y, vector28.X, vector28.Y, 174, 9, 0f, Main.myPlayer, 0f, 0f); this.localAI[0] = 30f; } } } else if (single3 < 200f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height) && this.velocity.Y == 0f) { this.ai[0] = -40f; if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.9f; } if (Main.netMode != 1 && this.localAI[0] == 0f) { y2 = Main.player[this.target].position.Y - vector27.Y - (float)Main.rand.Next(0, 200); single3 = (float)Math.Sqrt((double)(single2 * single2 + y2 * y2)); single3 = 4.5f / single3; single2 = single2 * single3; y2 = y2 * single3; this.localAI[0] = 50f; Projectile.NewProjectile(vector27.X, vector27.Y, single2, y2, 174, 9, 0f, Main.myPlayer, 0f, 0f); } } } } if (this.type == 535) { flag7 = true; if (this.localAI[0] > 0f) { this.localAI[0] = this.localAI[0] - 1f; } if (!this.wet && !Main.player[this.target].npcTypeNoAggro[this.type]) { Vector2 vector29 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x3 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector29.X; float y3 = Main.player[this.target].position.Y - vector29.Y; float single4 = (float)Math.Sqrt((double)(x3 * x3 + y3 * y3)); if (Main.expertMode && single4 < 120f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height) && this.velocity.Y == 0f) { this.ai[0] = -40f; if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.9f; } if (Main.netMode != 1 && this.localAI[0] == 0f) { for (int m = 0; m < 5; m++) { Vector2 vector210 = new Vector2((float)(m - 2), -4f); vector210.Normalize(); vector210 = vector210 * (4f + (float)Main.rand.Next(-50, 51) * 0.01f); Projectile.NewProjectile(vector29.X, vector29.Y, vector210.X, vector210.Y, 605, 9, 0f, Main.myPlayer, 0f, 0f); this.localAI[0] = 30f; } } } else if (single4 < 200f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height) && this.velocity.Y == 0f) { this.ai[0] = -40f; if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.9f; } if (Main.netMode != 1 && this.localAI[0] == 0f) { y3 = Main.player[this.target].position.Y - vector29.Y - (float)Main.rand.Next(0, 200); single4 = (float)Math.Sqrt((double)(x3 * x3 + y3 * y3)); single4 = 4.5f / single4; x3 = x3 * single4; y3 = y3 * single4; this.localAI[0] = 50f; Projectile.NewProjectile(vector29.X, vector29.Y, x3, y3, 605, 9, 0f, Main.myPlayer, 0f, 0f); } } } } if (this.type == 204) { flag7 = true; if (this.localAI[0] > 0f) { this.localAI[0] = this.localAI[0] - 1f; } if (!this.wet && !Main.player[this.target].npcTypeNoAggro[this.type]) { Vector2 vector211 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x4 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector211.X; float y4 = Main.player[this.target].position.Y - vector211.Y; float single5 = (float)Math.Sqrt((double)(x4 * x4 + y4 * y4)); if (Main.expertMode && single5 < 200f && Collision.CanHit(new Vector2(this.position.X, this.position.Y - 20f), this.width, this.height + 20, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height) && this.velocity.Y == 0f) { this.ai[0] = -40f; if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.9f; } if (Main.netMode != 1 && this.localAI[0] == 0f) { for (int n = 0; n < 5; n++) { Vector2 vector212 = new Vector2((float)(n - 2), -2f); vector212.Normalize(); vector212 = vector212 * (3f + (float)Main.rand.Next(-50, 51) * 0.01f); Projectile.NewProjectile(vector211.X, vector211.Y, vector212.X, vector212.Y, 176, 13, 0f, Main.myPlayer, 0f, 0f); this.localAI[0] = 80f; } } } if (single5 < 400f && Collision.CanHit(new Vector2(this.position.X, this.position.Y - 20f), this.width, this.height + 20, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height) && this.velocity.Y == 0f) { this.ai[0] = -80f; if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.9f; } if (Main.netMode != 1 && this.localAI[0] == 0f) { y4 = Main.player[this.target].position.Y - vector211.Y - (float)Main.rand.Next(-30, 20); y4 = y4 - single5 * 0.05f; x4 = Main.player[this.target].position.X - vector211.X - (float)Main.rand.Next(-20, 20); single5 = (float)Math.Sqrt((double)(x4 * x4 + y4 * y4)); single5 = 7f / single5; x4 = x4 * single5; y4 = y4 * single5; this.localAI[0] = 65f; Projectile.NewProjectile(vector211.X, vector211.Y, x4, y4, 176, 13, 0f, Main.myPlayer, 0f, 0f); } } } } if (this.type == 377 || this.type == 446) { if (this.localAI[2] >= 90f) { this.friendly = false; } else { this.localAI[2] = this.localAI[2] + 1f; } } if (this.ai[2] > 1f) { this.ai[2] = this.ai[2] - 1f; } if (this.wet) { if (this.collideY) { this.velocity.Y = -2f; } if (this.velocity.Y < 0f && this.ai[3] == this.position.X) { NPC nPC = this; nPC.direction = nPC.direction * -1; this.ai[2] = 200f; } if (this.velocity.Y > 0f) { this.ai[3] = this.position.X; } if (this.type != 59) { if (this.velocity.Y > 2f) { this.velocity.Y = this.velocity.Y * 0.9f; } this.velocity.Y = this.velocity.Y - 0.5f; if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } } else { if (this.velocity.Y > 2f) { this.velocity.Y = this.velocity.Y * 0.9f; } else if (this.directionY < 0) { this.velocity.Y = this.velocity.Y - 0.8f; } this.velocity.Y = this.velocity.Y - 0.5f; if (this.velocity.Y < -10f) { this.velocity.Y = -10f; } } if (this.ai[2] == 1f && flag7) { this.TargetClosest(true); } } this.aiAction = 0; if (this.ai[2] == 0f) { this.ai[0] = -100f; this.ai[2] = 1f; this.TargetClosest(true); } if (this.velocity.Y == 0f) { if (this.ai[3] == this.position.X) { NPC nPC1 = this; nPC1.direction = nPC1.direction * -1; this.ai[2] = 200f; } this.ai[3] = 0f; this.velocity.X = this.velocity.X * 0.8f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } if (flag7) { this.ai[0] = this.ai[0] + 1f; } this.ai[0] = this.ai[0] + 1f; if (this.type == 59) { this.ai[0] = this.ai[0] + 2f; } if (this.type == 71) { this.ai[0] = this.ai[0] + 3f; } if (this.type == 138) { this.ai[0] = this.ai[0] + 2f; } if (this.type == 183) { this.ai[0] = this.ai[0] + 1f; } if (this.type == 304) { float single6 = (float)((1 - this.life / this.lifeMax) * 10); this.ai[0] = this.ai[0] + single6; } if (this.type == 377 || this.type == 446) { this.ai[0] = this.ai[0] + 3f; } if (this.type == 81) { if (this.scale < 0f) { this.ai[0] = this.ai[0] + 1f; } else { this.ai[0] = this.ai[0] + 4f; } } int num24 = 0; if (this.ai[0] >= 0f) { num24 = 1; } if (this.ai[0] >= -1000f && this.ai[0] <= -500f) { num24 = 2; } if (this.ai[0] >= -2000f && this.ai[0] <= -1500f) { num24 = 3; } if (num24 > 0) { this.netUpdate = true; if (flag7 && this.ai[2] == 1f) { this.TargetClosest(true); } if (num24 != 3) { this.velocity.Y = -6f; this.velocity.X = this.velocity.X + (float)(2 * this.direction); if (this.type == 59) { this.velocity.X = this.velocity.X + (float)(2 * this.direction); } this.ai[0] = -120f; if (num24 != 1) { this.ai[0] = this.ai[0] - 2000f; } else { this.ai[0] = this.ai[0] - 1000f; } } else { this.velocity.Y = -8f; if (this.type == 59) { this.velocity.Y = this.velocity.Y - 2f; } this.velocity.X = this.velocity.X + (float)(3 * this.direction); if (this.type == 59) { this.velocity.X = this.velocity.X + 0.5f * (float)this.direction; } this.ai[0] = -200f; this.ai[3] = this.position.X; } if (this.type == 141) { this.velocity.Y = this.velocity.Y * 1.3f; this.velocity.X = this.velocity.X * 1.2f; } if (this.type == 377 || this.type == 446) { this.velocity.Y = this.velocity.Y * 0.9f; this.velocity.X = this.velocity.X * 0.6f; if (flag7) { this.direction = -this.direction; this.velocity.X = this.velocity.X * -1f; return; } } } else if (this.ai[0] >= -30f) { this.aiAction = 1; return; } } else if (this.target < 255 && (this.direction == 1 && this.velocity.X < 3f || this.direction == -1 && this.velocity.X > -3f)) { if ((this.direction != -1 || (double)this.velocity.X >= 0.1) && (this.direction != 1 || (double)this.velocity.X <= -0.1)) { this.velocity.X = this.velocity.X * 0.93f; return; } this.velocity.X = this.velocity.X + 0.2f * (float)this.direction; return; } } else if (this.aiStyle == 2) { this.noGravity = true; if (!this.noTileCollide) { if (this.collideX) { this.velocity.X = this.oldVelocity.X * -0.5f; if (this.direction == -1 && this.velocity.X > 0f && this.velocity.X < 2f) { this.velocity.X = 2f; } if (this.direction == 1 && this.velocity.X < 0f && this.velocity.X > -2f) { this.velocity.X = -2f; } } if (this.collideY) { this.velocity.Y = this.oldVelocity.Y * -0.5f; if (this.velocity.Y > 0f && this.velocity.Y < 1f) { this.velocity.Y = 1f; } if (this.velocity.Y < 0f && this.velocity.Y > -1f) { this.velocity.Y = -1f; } } } if (!Main.dayTime || (double)this.position.Y > Main.worldSurface * 16 || this.type != 2 && this.type != 133 && this.type != 190 && this.type != 191 && this.type != 192 && this.type != 193 && this.type != 194 && this.type != 317 && this.type != 318) { this.TargetClosest(true); } else { if (this.timeLeft > 10) { this.timeLeft = 10; } this.directionY = -1; if (this.velocity.Y > 0f) { this.direction = 1; } this.direction = -1; if (this.velocity.X > 0f) { this.direction = 1; } } if (this.type == 170 || this.type == 171 || this.type == 180) { if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { if (this.ai[1] > 0f && !Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[1] = 0f; this.ai[0] = 0f; this.netUpdate = true; } } else if (this.ai[1] == 0f) { this.ai[0] = this.ai[0] + 1f; } if (this.ai[0] >= 300f) { this.ai[1] = 1f; this.ai[0] = 0f; this.netUpdate = true; } if (this.ai[1] != 0f) { this.wet = false; this.alpha = 200; this.noTileCollide = true; } else { this.alpha = 0; this.noTileCollide = false; } this.rotation = this.velocity.Y * 0.1f * (float)this.direction; this.TargetClosest(true); if (this.direction == -1 && this.velocity.X > -4f && this.position.X > Main.player[this.target].position.X + (float)Main.player[this.target].width) { this.velocity.X = this.velocity.X - 0.08f; if (this.velocity.X > 4f) { this.velocity.X = this.velocity.X - 0.04f; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X - 0.2f; } if (this.velocity.X < -4f) { this.velocity.X = -4f; } } else if (this.direction == 1 && this.velocity.X < 4f && this.position.X + (float)this.width < Main.player[this.target].position.X) { this.velocity.X = this.velocity.X + 0.08f; if (this.velocity.X < -4f) { this.velocity.X = this.velocity.X + 0.04f; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X + 0.2f; } if (this.velocity.X > 4f) { this.velocity.X = 4f; } } if (this.directionY == -1 && (double)this.velocity.Y > -2.5 && this.position.Y > Main.player[this.target].position.Y + (float)Main.player[this.target].height) { this.velocity.Y = this.velocity.Y - 0.1f; if ((double)this.velocity.Y > 2.5) { this.velocity.Y = this.velocity.Y - 0.05f; } else if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y - 0.15f; } if ((double)this.velocity.Y < -2.5) { this.velocity.Y = -2.5f; } } else if (this.directionY == 1 && (double)this.velocity.Y < 2.5 && this.position.Y + (float)this.height < Main.player[this.target].position.Y) { this.velocity.Y = this.velocity.Y + 0.1f; if ((double)this.velocity.Y < -2.5) { this.velocity.Y = this.velocity.Y + 0.05f; } else if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y + 0.15f; } if ((double)this.velocity.Y > 2.5) { this.velocity.Y = 2.5f; } } } else if (this.type == 116) { this.TargetClosest(true); if (this.direction == -1 && this.velocity.X > -6f) { this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > 6f) { this.velocity.X = this.velocity.X - 0.1f; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X - 0.2f; } if (this.velocity.X < -6f) { this.velocity.X = -6f; } } else if (this.direction == 1 && this.velocity.X < 6f) { this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -6f) { this.velocity.X = this.velocity.X + 0.1f; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X + 0.2f; } if (this.velocity.X > 6f) { this.velocity.X = 6f; } } if (this.directionY == -1 && (double)this.velocity.Y > -2.5) { this.velocity.Y = this.velocity.Y - 0.04f; if ((double)this.velocity.Y > 2.5) { this.velocity.Y = this.velocity.Y - 0.05f; } else if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y - 0.15f; } if ((double)this.velocity.Y < -2.5) { this.velocity.Y = -2.5f; } } else if (this.directionY == 1 && (double)this.velocity.Y < 1.5) { this.velocity.Y = this.velocity.Y + 0.04f; if ((double)this.velocity.Y < -2.5) { this.velocity.Y = this.velocity.Y + 0.05f; } else if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y + 0.15f; } if ((double)this.velocity.Y > 2.5) { this.velocity.Y = 2.5f; } } } else if (this.type != 133) { float single7 = 4f; float single8 = 1.5f; single7 = single7 * (1f + (1f - this.scale)); single8 = single8 * (1f + (1f - this.scale)); if (this.direction == -1 && this.velocity.X > -single7) { this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > single7) { this.velocity.X = this.velocity.X - 0.1f; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X + 0.05f; } if (this.velocity.X < -single7) { this.velocity.X = -single7; } } else if (this.direction == 1 && this.velocity.X < single7) { this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -single7) { this.velocity.X = this.velocity.X + 0.1f; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X - 0.05f; } if (this.velocity.X > single7) { this.velocity.X = single7; } } if (this.directionY == -1 && this.velocity.Y > -single8) { this.velocity.Y = this.velocity.Y - 0.04f; if (this.velocity.Y > single8) { this.velocity.Y = this.velocity.Y - 0.05f; } else if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y + 0.03f; } if (this.velocity.Y < -single8) { this.velocity.Y = -single8; } } else if (this.directionY == 1 && this.velocity.Y < single8) { this.velocity.Y = this.velocity.Y + 0.04f; if (this.velocity.Y < -single8) { this.velocity.Y = this.velocity.Y + 0.05f; } else if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y - 0.03f; } if (this.velocity.Y > single8) { this.velocity.Y = single8; } } } else if ((double)this.life >= (double)this.lifeMax * 0.5) { if (this.direction == -1 && this.velocity.X > -4f) { this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > 4f) { this.velocity.X = this.velocity.X - 0.1f; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X + 0.05f; } if (this.velocity.X < -4f) { this.velocity.X = -4f; } } else if (this.direction == 1 && this.velocity.X < 4f) { this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -4f) { this.velocity.X = this.velocity.X + 0.1f; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X - 0.05f; } if (this.velocity.X > 4f) { this.velocity.X = 4f; } } if (this.directionY == -1 && (double)this.velocity.Y > -1.5) { this.velocity.Y = this.velocity.Y - 0.04f; if ((double)this.velocity.Y > 1.5) { this.velocity.Y = this.velocity.Y - 0.05f; } else if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y + 0.03f; } if ((double)this.velocity.Y < -1.5) { this.velocity.Y = -1.5f; } } else if (this.directionY == 1 && (double)this.velocity.Y < 1.5) { this.velocity.Y = this.velocity.Y + 0.04f; if ((double)this.velocity.Y < -1.5) { this.velocity.Y = this.velocity.Y + 0.05f; } else if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y - 0.03f; } if ((double)this.velocity.Y > 1.5) { this.velocity.Y = 1.5f; } } } else { if (this.direction == -1 && this.velocity.X > -6f) { this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > 6f) { this.velocity.X = this.velocity.X - 0.1f; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X + 0.05f; } if (this.velocity.X < -6f) { this.velocity.X = -6f; } } else if (this.direction == 1 && this.velocity.X < 6f) { this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -6f) { this.velocity.X = this.velocity.X + 0.1f; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X - 0.05f; } if (this.velocity.X > 6f) { this.velocity.X = 6f; } } if (this.directionY == -1 && this.velocity.Y > -4f) { this.velocity.Y = this.velocity.Y - 0.1f; if (this.velocity.Y > 4f) { this.velocity.Y = this.velocity.Y - 0.1f; } else if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y + 0.05f; } if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } } else if (this.directionY == 1 && this.velocity.Y < 4f) { this.velocity.Y = this.velocity.Y + 0.1f; if (this.velocity.Y < -4f) { this.velocity.Y = this.velocity.Y + 0.1f; } else if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y - 0.05f; } if (this.velocity.Y > 4f) { this.velocity.Y = 4f; } } } if (this.wet && this.type != 170 && this.type != 171 && this.type != 172) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.95f; } this.velocity.Y = this.velocity.Y - 0.5f; if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } this.TargetClosest(true); return; } } else if (this.aiStyle == 3) { if (this.type == 466) { int num31 = 200; if (this.ai[2] == 0f) { this.alpha = num31; this.TargetClosest(true); if (!Main.player[this.target].dead && (Main.player[this.target].Center - base.Center).Length() < 170f) { this.ai[2] = -16f; } if (this.velocity.X != 0f || this.velocity.Y < 0f || this.velocity.Y > 2f || this.justHit) { this.ai[2] = -16f; } return; } if (this.ai[2] < 0f) { if (this.alpha > 0) { NPC nPC2 = this; nPC2.alpha = nPC2.alpha - num31 / 16; if (this.alpha < 0) { this.alpha = 0; } } this.ai[2] = this.ai[2] + 1f; if (this.ai[2] == 0f) { this.ai[2] = 1f; this.velocity.X = (float)(this.direction * 2); } return; } this.alpha = 0; } if (this.type == 166) { if (Main.netMode != 1 && Main.rand.Next(240) == 0) { this.ai[2] = (float)Main.rand.Next(-480, -60); this.netUpdate = true; } if (this.ai[2] < 0f) { this.TargetClosest(true); if (this.justHit) { this.ai[2] = 0f; } if (Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[2] = 0f; } } if (this.ai[2] < 0f) { this.velocity.X = this.velocity.X * 0.9f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } this.ai[2] = this.ai[2] + 1f; if (this.ai[2] == 0f) { this.velocity.X = (float)this.direction * 0.1f; } return; } } if (this.type == 461) { if (this.wet) { this.knockBackResist = 0f; this.ai[3] = -0.10101f; this.noGravity = true; Vector2 center1 = base.Center; this.width = 34; this.height = 24; this.position.X = center1.X - (float)(this.width / 2); this.position.Y = center1.Y - (float)(this.height / 2); this.TargetClosest(true); if (this.collideX) { this.velocity.X = -this.oldVelocity.X; } if (this.velocity.X < 0f) { this.direction = -1; } if (this.velocity.X > 0f) { this.direction = 1; } if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].Center, 1, 1)) { Vector2 center2 = Main.player[this.target].Center - base.Center; center2.Normalize(); center2 = center2 * 5f; this.velocity = ((this.velocity * 19f) + center2) / 20f; return; } float single9 = 5f; if (this.velocity.Y > 0f) { single9 = 3f; } if (this.velocity.Y < 0f) { single9 = 8f; } Vector2 vector216 = new Vector2((float)this.direction, -1f); vector216.Normalize(); vector216 = vector216 * single9; if (single9 < 5f) { this.velocity = ((this.velocity * 24f) + vector216) / 25f; return; } this.velocity = ((this.velocity * 9f) + vector216) / 10f; return; } this.knockBackResist = 0.4f * Main.knockBackMultiplier; this.noGravity = false; Vector2 center3 = base.Center; this.width = 18; this.height = 40; this.position.X = center3.X - (float)(this.width / 2); this.position.Y = center3.Y - (float)(this.height / 2); if (this.ai[3] == -0.10101f) { this.ai[3] = 0f; float single10 = this.velocity.Length(); single10 = single10 * 2f; if (single10 > 10f) { single10 = 10f; } this.velocity.Normalize(); NPC nPC3 = this; nPC3.velocity = nPC3.velocity * single10; if (this.velocity.X < 0f) { this.direction = -1; } if (this.velocity.X > 0f) { this.direction = 1; } this.spriteDirection = this.direction; } } if (this.type == 379 || this.type == 380) { if (this.ai[3] < 0f) { this.damage = 0; this.velocity.X = this.velocity.X * 0.93f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } int num32 = (int)(-this.ai[3] - 1f); int num33 = Math.Sign(Main.npc[num32].Center.X - base.Center.X); if (num33 != this.direction) { this.velocity.X = 0f; this.direction = num33; this.netUpdate = true; } if (this.justHit && Main.netMode != 1 && Main.npc[num32].localAI[0] == 0f) { Main.npc[num32].localAI[0] = 1f; } return; } this.damage = this.defDamage; } if (this.type == 383 && this.ai[2] == 0f && this.localAI[0] == 0f && Main.netMode != 1) { int num34 = NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 384, this.whoAmI, 0f, 0f, 0f, 0f, 255); this.ai[2] = (float)(num34 + 1); this.localAI[0] = -1f; this.netUpdate = true; Main.npc[num34].ai[0] = (float)this.whoAmI; Main.npc[num34].netUpdate = true; } if (this.type == 383) { int num35 = (int)this.ai[2] - 1; if (num35 == -1 || !Main.npc[num35].active || Main.npc[num35].type != 384) { this.dontTakeDamage = false; this.ai[2] = 0f; if (this.localAI[0] == -1f) { this.localAI[0] = 180f; } if (this.localAI[0] > 0f) { this.localAI[0] = this.localAI[0] - 1f; } } else { this.dontTakeDamage = true; } } if (this.type == 482) { int num36 = 300; int num37 = 120; this.dontTakeDamage = false; if (this.ai[2] < 0f) { this.dontTakeDamage = true; this.ai[2] = this.ai[2] + 1f; this.velocity.X = this.velocity.X * 0.9f; if ((double)Math.Abs(this.velocity.X) < 0.001) { this.velocity.X = 0.001f * (float)this.direction; } if (Math.Abs(this.velocity.Y) > 1f) { this.ai[2] = this.ai[2] + 10f; } if (this.ai[2] >= 0f) { this.netUpdate = true; this.velocity.X = this.velocity.X + (float)this.direction * 0.3f; } return; } if (this.ai[2] < (float)num36) { if (this.justHit) { this.ai[2] = this.ai[2] + 15f; } this.ai[2] = this.ai[2] + 1f; } else if (this.velocity.Y == 0f) { this.ai[2] = (float)(-num37); this.netUpdate = true; } } if (this.type == 480) { int num38 = 180; int num39 = 300; int num40 = 180; int num41 = 60; int num42 = 15; if (this.life < this.lifeMax / 3) { num38 = 120; num39 = 240; num40 = 240; num41 = 90; } if (this.ai[2] > 0f) { this.ai[2] = this.ai[2] - 1f; } else if (this.ai[2] != 0f) { if (this.ai[2] < 0f && this.ai[2] < (float)(-num40)) { this.velocity.X = this.velocity.X * 0.9f; if (this.velocity.Y < -2f || this.velocity.Y > 4f || this.justHit) { this.ai[2] = (float)num38; return; } this.ai[2] = this.ai[2] + 1f; if (this.ai[2] == 0f) { this.ai[2] = (float)num39; } return; } if (this.ai[2] < 0f && this.ai[2] >= (float)(-num40)) { this.velocity.X = this.velocity.X * 0.9f; if (this.velocity.Y < -2f || this.velocity.Y > 4f || this.justHit) { this.ai[2] = (float)num38; } else { this.ai[2] = this.ai[2] + 1f; if (this.ai[2] == 0f) { this.ai[2] = (float)num39; } } if (Main.netMode != 2) { Player player = Main.player[Main.myPlayer]; int num43 = Main.myPlayer; if (!player.dead && player.active && player.HasBuff(156) == -1 && (player.Center - base.Center).Length() < 1000f && (player.Center.X < base.Center.X && this.direction < 0 && player.direction > 0 || player.Center.X > base.Center.X && this.direction > 0 && player.direction < 0) && Collision.CanHit(base.Center, 1, 1, player.Center, 1, 1)) { player.AddBuff(156, num41 + (int)this.ai[2] * -1, true); } } return; } } else if ((Main.player[this.target].Center.X < base.Center.X && this.direction < 0 || Main.player[this.target].Center.X > base.Center.X && this.direction > 0) && this.velocity.Y == 0f && Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[2] = (float)(-num40 - num42); this.netUpdate = true; } } if (this.type == 471) { if (this.ai[3] >= 0f) { this.localAI[3] = 0f; this.knockBackResist = 0.35f * Main.knockBackMultiplier; NPC nPC4 = this; nPC4.rotation = nPC4.rotation * 0.9f; this.defense = this.defDefense; this.noGravity = false; this.noTileCollide = false; } else { this.knockBackResist = 0f; this.defense = (int)((double)this.defDefense * 1.1); this.noGravity = true; this.noTileCollide = true; if (this.velocity.X < 0f) { this.direction = -1; } else if (this.velocity.X > 0f) { this.direction = 1; } this.rotation = this.velocity.X * 0.1f; if (Main.netMode != 1) { this.localAI[3] = this.localAI[3] + 1f; if (this.localAI[3] > (float)Main.rand.Next(20, 180)) { this.localAI[3] = 0f; Vector2 center4 = base.Center; center4 = center4 + this.velocity; NPC.NewNPC((int)center4.X, (int)center4.Y, 30, 0, 0f, 0f, 0f, 0f, 255); } } } if (this.ai[3] == 1f) { this.knockBackResist = 0f; NPC nPC5 = this; nPC5.defense = nPC5.defense + 10; } if (this.ai[3] == -1f) { this.TargetClosest(true); float single11 = 8f; float single12 = 40f; Vector2 center5 = Main.player[this.target].Center - base.Center; float single13 = center5.Length(); single11 = single11 + single13 / 200f; center5.Normalize(); center5 = center5 * single11; this.velocity = ((this.velocity * (single12 - 1f)) + center5) / single12; if (single13 < 500f && !Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[3] = 0f; this.ai[2] = 0f; } return; } if (this.ai[3] == -2f) { this.velocity.Y = this.velocity.Y - 0.2f; if (this.velocity.Y < -10f) { this.velocity.Y = -10f; } if (Main.player[this.target].Center.Y - base.Center.Y > 200f) { this.TargetClosest(true); this.ai[3] = -3f; if (Main.player[this.target].Center.X <= base.Center.X) { this.ai[2] = -1f; } else { this.ai[2] = 1f; } } this.velocity.X = this.velocity.X * 0.99f; return; } if (this.ai[3] == -3f) { if (this.direction == 0) { this.TargetClosest(true); } if (this.ai[2] == 0f) { this.ai[2] = (float)this.direction; } this.velocity.Y = this.velocity.Y * 0.9f; this.velocity.X = this.velocity.X + this.ai[2] * 0.3f; if (this.velocity.X > 10f) { this.velocity.X = 10f; } if (this.velocity.X < -10f) { this.velocity.X = -10f; } float x7 = Main.player[this.target].Center.X - base.Center.X; if (this.ai[2] < 0f && x7 > 300f || this.ai[2] > 0f && x7 < -300f) { this.ai[3] = -4f; this.ai[2] = 0f; return; } if (Math.Abs(x7) > 800f) { this.ai[3] = -1f; this.ai[2] = 0f; } return; } if (this.ai[3] != -4f) { if (this.ai[3] == 1f) { Vector2 y5 = base.Center; y5.Y = y5.Y - 70f; this.velocity.X = this.velocity.X * 0.8f; this.ai[2] = this.ai[2] + 1f; if (this.ai[2] == 60f) { if (Main.netMode != 1) { NPC.NewNPC((int)y5.X, (int)y5.Y + 18, 472, 0, 0f, 0f, 0f, 0f, 255); } } else if (this.ai[2] >= 90f) { this.ai[3] = -2f; this.ai[2] = 0f; } return; } this.ai[2] = this.ai[2] + 1f; int num45 = 10; if (this.velocity.Y != 0f || NPC.CountNPCS(472) >= num45) { if (NPC.CountNPCS(472) >= num45) { this.ai[2] = this.ai[2] + 1f; } if (this.ai[2] >= 360f) { this.ai[2] = 0f; this.ai[3] = -2f; this.velocity.Y = this.velocity.Y - 3f; } } else if (this.ai[2] >= 180f) { this.ai[2] = 0f; this.ai[3] = 1f; } if (this.target >= 0 && !Main.player[this.target].dead && (Main.player[this.target].Center - base.Center).Length() > 800f) { this.ai[3] = -1f; this.ai[2] = 0f; } } else { this.ai[2] = this.ai[2] + 1f; this.velocity.Y = this.velocity.Y + 0.1f; if (this.velocity.Length() > 4f) { NPC nPC6 = this; nPC6.velocity = nPC6.velocity * 0.9f; } int x8 = (int)base.Center.X / 16; int y6 = (int)(this.position.Y + (float)this.height + 12f) / 16; bool flag8 = false; for (int p = x8 - 1; p <= x8 + 1; p++) { if (Main.tile[p, y6] == null) { Main.tile[x8, y6] = new Tile(); } if (Main.tile[p, y6].active() && Main.tileSolid[Main.tile[p, y6].type]) { flag8 = true; } } if (flag8 && !Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[3] = 0f; this.ai[2] = 0f; } else if (this.ai[2] > 300f || base.Center.Y > Main.player[this.target].Center.Y + 200f) { this.ai[3] = -1f; this.ai[2] = 0f; } } if (Main.player[this.target].dead) { this.TargetClosest(true); if (Main.player[this.target].dead && this.timeLeft > 1) { this.timeLeft = 1; } } } if (this.type == 419) { this.reflectingProjectiles = false; this.takenDamageMultiplier = 1f; int num46 = 6; int num47 = 10; float single14 = 16f; if (this.ai[2] > 0f) { this.ai[2] = this.ai[2] - 1f; } if (this.ai[2] != 0f) { if (this.ai[2] < 0f && this.ai[2] > (float)(-num46)) { this.ai[2] = this.ai[2] - 1f; this.velocity.X = this.velocity.X * 0.9f; return; } if (this.ai[2] == (float)(-num46)) { this.ai[2] = this.ai[2] - 1f; this.TargetClosest(true); Vector2 vector219 = base.DirectionTo(Main.player[this.target].Top + new Vector2(0f, -30f)); if (vector219.HasNaNs()) { vector219 = Vector2.Normalize(new Vector2((float)this.spriteDirection, -1f)); } this.velocity = vector219 * single14; this.netUpdate = true; return; } if (this.ai[2] < (float)(-num46)) { this.ai[2] = this.ai[2] - 1f; if (this.velocity.Y == 0f) { this.ai[2] = 60f; } else if (this.ai[2] < (float)(-num46 - num47)) { this.velocity.Y = this.velocity.Y + 0.15f; if (this.velocity.Y > 24f) { this.velocity.Y = 24f; } } this.reflectingProjectiles = true; this.takenDamageMultiplier = 3f; if (this.justHit) { this.ai[2] = 60f; this.netUpdate = true; } return; } } else if ((Main.player[this.target].Center.X < base.Center.X && this.direction < 0 || Main.player[this.target].Center.X > base.Center.X && this.direction > 0) && Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[2] = -1f; this.netUpdate = true; this.TargetClosest(true); } } if (this.type == 415) { int num48 = 42; int num49 = 18; if (this.justHit) { this.ai[2] = 120f; this.netUpdate = true; } if (this.ai[2] > 0f) { this.ai[2] = this.ai[2] - 1f; } if (this.ai[2] == 0f) { int num50 = 0; for (int q = 0; q < 200; q++) { if (Main.npc[q].active && Main.npc[q].type == 516) { num50++; } } if (num50 > 6) { this.ai[2] = 90f; } else if ((Main.player[this.target].Center.X < base.Center.X && this.direction < 0 || Main.player[this.target].Center.X > base.Center.X && this.direction > 0) && Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[2] = -1f; this.netUpdate = true; this.TargetClosest(true); } } else if (this.ai[2] < 0f && this.ai[2] > (float)(-num48)) { this.ai[2] = this.ai[2] - 1f; if (this.ai[2] == (float)(-num48)) { this.ai[2] = (float)(180 + 30 * Main.rand.Next(10)); } this.velocity.X = this.velocity.X * 0.8f; if (this.ai[2] == (float)(-num49) || this.ai[2] == (float)(-num49 - 8) || this.ai[2] == (float)(-num49 - 16)) { if (this.velocity.X > -0.5f && this.velocity.X < 0.5f) { this.velocity.X = 0f; } if (Main.netMode != 1) { NPC.NewNPC((int)base.Center.X + this.spriteDirection * 45, (int)base.Center.Y + 8, 516, 0, 0f, 0f, 0f, 0f, this.target); } } return; } } if (this.type == 428) { this.localAI[0] = this.localAI[0] + 1f; if (this.localAI[0] >= 300f) { int x9 = (int)base.Center.X / 16 - 1; int y7 = (int)base.Center.Y / 16 - 1; if (!Collision.SolidTiles(x9, x9 + 2, y7, y7 + 1) && Main.netMode != 1) { this.Transform(427); this.life = this.lifeMax; this.localAI[0] = 0f; return; } } int num51 = 0; if (this.localAI[0] < 60f) { num51 = 16; } else if (this.localAI[0] < 120f) { num51 = 8; } else if (this.localAI[0] < 180f) { num51 = 4; } else if (this.localAI[0] >= 240f) { num51 = (this.localAI[0] >= 300f ? 1 : 1); } else { num51 = 2; } } if (this.type == 427) { this.localAI[0] = this.localAI[0] + 1f; this.localAI[0] = this.localAI[0] + Math.Abs(this.velocity.X) / 2f; if (this.localAI[0] >= 1200f && Main.netMode != 1) { int x10 = (int)base.Center.X / 16 - 2; int y8 = (int)base.Center.Y / 16 - 3; if (!Collision.SolidTiles(x10, x10 + 4, y8, y8 + 4)) { this.Transform(426); this.life = this.lifeMax; this.localAI[0] = 0f; return; } } int num54 = 0; if (this.localAI[0] < 360f) { num54 = 32; } else if (this.localAI[0] < 720f) { num54 = 16; } else if (this.localAI[0] < 1080f) { num54 = 6; } else if (this.localAI[0] >= 1440f) { num54 = (this.localAI[0] >= 1800f ? 1 : 1); } else { num54 = 2; } } bool flag9 = false; if (this.velocity.X == 0f) { flag9 = true; } if (this.justHit) { flag9 = false; } if (Main.netMode != 1 && this.type == 198 && (double)this.life <= (double)this.lifeMax * 0.55) { this.Transform(199); } if (Main.netMode != 1 && this.type == 348 && (double)this.life <= (double)this.lifeMax * 0.55) { this.Transform(349); } int num57 = 60; if (this.type == 120) { num57 = 180; if (this.ai[3] == -120f) { NPC nPC7 = this; nPC7.velocity = nPC7.velocity * 0f; this.ai[3] = 0f; } } bool flag10 = false; bool flag11 = true; if (this.type == 343 || this.type == 47 || this.type == 67 || this.type == 109 || this.type == 110 || this.type == 111 || this.type == 120 || this.type == 163 || this.type == 164 || this.type == 239 || this.type == 168 || this.type == 199 || this.type == 206 || this.type == 214 || this.type == 215 || this.type == 216 || this.type == 217 || this.type == 218 || this.type == 219 || this.type == 220 || this.type == 226 || this.type == 243 || this.type == 251 || this.type == 257 || this.type == 258 || this.type == 290 || this.type == 291 || this.type == 292 || this.type == 293 || this.type == 305 || this.type == 306 || this.type == 307 || this.type == 308 || this.type == 309 || this.type == 348 || this.type == 349 || this.type == 350 || this.type == 351 || this.type == 379 || this.type >= 430 && this.type <= 436 || this.type == 380 || this.type == 381 || this.type == 382 || this.type == 383 || this.type == 386 || this.type == 391 || this.type >= 449 && this.type <= 452 || this.type == 466 || this.type == 464 || this.type == 166 || this.type == 469 || this.type == 468 || this.type == 471 || this.type == 470 || this.type == 480 || this.type == 481 || this.type == 482 || this.type == 411 || this.type == 424 || this.type == 409 || this.type >= 494 && this.type <= 506 || this.type == 425 || this.type == 427 || this.type == 426 || this.type == 428 || this.type == 508 || this.type == 415 || this.type == 419 || this.type == 520 || this.type >= 524 && this.type <= 527 || this.type == 528 || this.type == 529 || this.type == 530 || this.type == 532) { flag11 = false; } bool flag12 = false; num6 = this.type; if (num6 == 425 || num6 == 471) { flag12 = true; } bool flag13 = true; num6 = this.type; if (num6 <= 350) { if (num6 > 206) { switch (num6) { case 214: case 215: case 216: { break; } default: { switch (num6) { case 291: case 292: case 293: { break; } default: { if (num6 == 350) { goto Label9; } goto Label8; } } break; } } } else { switch (num6) { case 110: case 111: { break; } default: { if (num6 == 206) { break; } goto Label8; } } } } else if (num6 <= 426) { switch (num6) { case 379: case 380: case 381: case 382: { break; } default: { switch (num6) { case 409: case 411: { break; } case 410: { goto Label8; } default: { switch (num6) { case 424: case 426: { break; } default: { goto Label8; } } break; } } break; } } } else if (num6 != 466) { switch (num6) { case 498: case 499: case 500: case 501: case 502: case 503: case 504: case 505: case 506: { break; } default: { if (num6 != 520) { goto Label8; } else { break; } } } } Label9: if (this.ai[2] > 0f) { flag13 = false; } Label8: if (!flag12 && flag13) { if (this.velocity.Y == 0f && (this.velocity.X > 0f && this.direction < 0 || this.velocity.X < 0f && this.direction > 0)) { flag10 = true; } if (this.position.X == this.oldPosition.X || this.ai[3] >= (float)num57 || flag10) { this.ai[3] = this.ai[3] + 1f; } else if ((double)Math.Abs(this.velocity.X) > 0.9 && this.ai[3] > 0f) { this.ai[3] = this.ai[3] - 1f; } if (this.ai[3] > (float)(num57 * 10)) { this.ai[3] = 0f; } if (this.justHit) { this.ai[3] = 0f; } if (this.ai[3] == (float)num57) { this.netUpdate = true; } } if (this.type == 463 && Main.netMode != 1) { if (this.localAI[3] > 0f) { this.localAI[3] = this.localAI[3] - 1f; } if (this.justHit && this.localAI[3] <= 0f && Main.rand.Next(3) == 0) { this.localAI[3] = 30f; int num64 = Main.rand.Next(3, 6); int[] numArray1 = new int[num64]; int num65 = 0; for (int u = 0; u < 255; u++) { if (Main.player[u].active && !Main.player[u].dead && Collision.CanHitLine(this.position, this.width, this.height, Main.player[u].position, Main.player[u].width, Main.player[u].height)) { numArray1[num65] = u; num65++; if (num65 == num64) { break; } } } if (num65 > 1) { for (int v = 0; v < 100; v++) { int num66 = Main.rand.Next(num65); int num67 = num66; while (num67 == num66) { num67 = Main.rand.Next(num65); } int num68 = numArray1[num66]; numArray1[num66] = numArray1[num67]; numArray1[num67] = num68; } } Vector2 vector225 = new Vector2(-1f, -1f); for (int w = 0; w < num65; w++) { Vector2 center7 = Main.npc[numArray1[w]].Center - base.Center; center7.Normalize(); vector225 = vector225 + center7; } vector225.Normalize(); for (int x12 = 0; x12 < num64; x12++) { float single16 = (float)Main.rand.Next(8, 13); Vector2 center8 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); center8.Normalize(); if (num65 > 0) { center8 = center8 + vector225; center8.Normalize(); } center8 = center8 * single16; if (num65 > 0) { num65--; center8 = Main.player[numArray1[num65]].Center - base.Center; center8.Normalize(); center8 = center8 * single16; } Projectile.NewProjectile(base.Center.X, this.position.Y + (float)(this.width / 4), center8.X, center8.Y, 498, (int)((double)this.damage * 0.15), 1f, 255, 0f, 0f); } } } if (this.type == 460) { if (this.velocity.Y < -NPC.gravity || this.velocity.Y > NPC.gravity) { this.knockBackResist = 0f; } else { this.knockBackResist = 0.25f * Main.knockBackMultiplier; } } if (this.type == 469) { this.knockBackResist = 0.45f * Main.knockBackMultiplier; if (this.ai[2] == 1f) { this.knockBackResist = 0f; } bool flag14 = false; int x13 = (int)base.Center.X / 16; int y10 = (int)base.Center.Y / 16; for (int y11 = x13 - 1; y11 <= x13 + 1; y11++) { int num69 = y10 - 1; while (num69 <= y10 + 1) { if (Main.tile[y11, num69] == null || Main.tile[y11, num69].wall <= 0) { num69++; } else { flag14 = true; break; } } if (flag14) { break; } } if (this.ai[2] == 0f && flag14) { if (this.velocity.Y == 0f) { this.velocity.Y = -4.6f; this.velocity.X = this.velocity.X * 1.3f; } else if (this.velocity.Y > 0f) { this.ai[2] = 1f; } } if (flag14 && this.ai[2] == 1f && Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { Vector2 center9 = Main.player[this.target].Center - base.Center; float single17 = center9.Length(); center9.Normalize(); center9 = center9 * (4.5f + single17 / 300f); this.velocity = ((this.velocity * 29f) + center9) / 30f; this.noGravity = true; this.ai[2] = 1f; return; } this.noGravity = false; this.ai[2] = 0f; } if (this.type == 462 && this.velocity.Y == 0f && (Main.player[this.target].Center - base.Center).Length() < 150f && Math.Abs(this.velocity.X) > 3f && (this.velocity.X < 0f && base.Center.X > Main.player[this.target].Center.X || this.velocity.X > 0f && base.Center.X < Main.player[this.target].Center.X)) { this.velocity.X = this.velocity.X * 1.75f; this.velocity.Y = this.velocity.Y - 4.5f; if (base.Center.Y - Main.player[this.target].Center.Y > 20f) { this.velocity.Y = this.velocity.Y - 0.5f; } if (base.Center.Y - Main.player[this.target].Center.Y > 40f) { this.velocity.Y = this.velocity.Y - 1f; } if (base.Center.Y - Main.player[this.target].Center.Y > 80f) { this.velocity.Y = this.velocity.Y - 1.5f; } if (base.Center.Y - Main.player[this.target].Center.Y > 100f) { this.velocity.Y = this.velocity.Y - 1.5f; } if (Math.Abs(this.velocity.X) > 7f) { if (this.velocity.X >= 0f) { this.velocity.X = 7f; } else { this.velocity.X = -7f; } } } if (this.ai[3] < (float)num57 && (Main.eclipse || !Main.dayTime || (double)this.position.Y > Main.worldSurface * 16 || Main.invasionType == 1 && (this.type == 343 || this.type == 350) || Main.invasionType == 1 && (this.type == 26 || this.type == 27 || this.type == 28 || this.type == 73 || this.type == 111 || this.type == 471) || Main.invasionType == 3 && this.type >= 212 && this.type <= 216 || Main.invasionType == 4 && (this.type == 381 || this.type == 382 || this.type == 383 || this.type == 385 || this.type == 386 || this.type == 389 || this.type == 391 || this.type == 520) || this.type == 31 || this.type == 294 || this.type == 295 || this.type == 296 || this.type == 47 || this.type == 67 || this.type == 77 || this.type == 78 || this.type == 79 || this.type == 80 || this.type == 110 || this.type == 120 || this.type == 168 || this.type == 181 || this.type == 185 || this.type == 198 || this.type == 199 || this.type == 206 || this.type == 217 || this.type == 218 || this.type == 219 || this.type == 220 || this.type == 239 || this.type == 243 || this.type == 254 || this.type == 255 || this.type == 257 || this.type == 258 || this.type == 291 || this.type == 292 || this.type == 293 || this.type == 379 || this.type == 380 || this.type == 464 || this.type == 470 || this.type == 424 || this.type == 411 && (this.ai[1] >= 180f || this.ai[1] < 90f) || this.type == 409 || this.type == 425 || this.type == 429 || this.type == 427 || this.type == 428 || this.type == 508 || this.type == 415 || this.type == 419 || this.type >= 524 && this.type <= 527 || this.type == 528 || this.type == 529 || this.type == 530 || this.type == 532)) { this.TargetClosest(true); } else if (this.ai[2] <= 0f || this.type != 110 && this.type != 111 && this.type != 206 && this.type != 216 && this.type != 214 && this.type != 215 && this.type != 291 && this.type != 292 && this.type != 293 && this.type != 350 && this.type != 381 && this.type != 382 && this.type != 383 && this.type != 385 && this.type != 386 && this.type != 389 && this.type != 391 && this.type != 469 && this.type != 166 && this.type != 466 && this.type != 471 && this.type != 411 && this.type != 409 && this.type != 424 && this.type != 425 && this.type != 426 && this.type != 415 && this.type != 419 && this.type != 520) { if (Main.dayTime && (double)(this.position.Y / 16f) < Main.worldSurface && this.timeLeft > 10) { this.timeLeft = 10; } if (this.velocity.X != 0f) { this.ai[0] = 0f; } else if (this.velocity.Y == 0f) { this.ai[0] = this.ai[0] + 1f; if (this.ai[0] >= 2f) { NPC nPC8 = this; nPC8.direction = nPC8.direction * -1; this.spriteDirection = this.direction; this.ai[0] = 0f; } } if (this.direction == 0) { this.direction = 1; } } if (this.type == 159 || this.type == 349) { if (this.type == 159 && (this.velocity.X > 0f && this.direction < 0 || this.velocity.X < 0f && this.direction > 0)) { this.velocity.X = this.velocity.X * 0.95f; } if (this.velocity.X < -6f || this.velocity.X > 6f) { if (this.velocity.Y == 0f) { NPC nPC9 = this; nPC9.velocity = nPC9.velocity * 0.8f; } } else if (this.velocity.X < 6f && this.direction == 1) { if (this.velocity.Y == 0f && this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.99f; } this.velocity.X = this.velocity.X + 0.07f; if (this.velocity.X > 6f) { this.velocity.X = 6f; } } else if (this.velocity.X > -6f && this.direction == -1) { if (this.velocity.Y == 0f && this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.99f; } this.velocity.X = this.velocity.X - 0.07f; if (this.velocity.X < -6f) { this.velocity.X = -6f; } } } else if (this.type == 199) { if (this.velocity.X < -4f || this.velocity.X > 4f) { if (this.velocity.Y == 0f) { NPC nPC10 = this; nPC10.velocity = nPC10.velocity * 0.8f; } } else if (this.velocity.X < 4f && this.direction == 1) { if (this.velocity.Y == 0f && this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.8f; } this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X > 4f) { this.velocity.X = 4f; } } else if (this.velocity.X > -4f && this.direction == -1) { if (this.velocity.Y == 0f && this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.8f; } this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X < -4f) { this.velocity.X = -4f; } } } else if (this.type == 120 || this.type == 166 || this.type == 213 || this.type == 258 || this.type == 528 || this.type == 529) { if (this.velocity.X < -3f || this.velocity.X > 3f) { if (this.velocity.Y == 0f) { NPC nPC11 = this; nPC11.velocity = nPC11.velocity * 0.8f; } } else if (this.velocity.X < 3f && this.direction == 1) { if (this.velocity.Y == 0f && this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.99f; } this.velocity.X = this.velocity.X + 0.07f; if (this.velocity.X > 3f) { this.velocity.X = 3f; } } else if (this.velocity.X > -3f && this.direction == -1) { if (this.velocity.Y == 0f && this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.99f; } this.velocity.X = this.velocity.X - 0.07f; if (this.velocity.X < -3f) { this.velocity.X = -3f; } } } else if (this.type == 461 || this.type == 27 || this.type == 77 || this.type == 104 || this.type == 163 || this.type == 162 || this.type == 196 || this.type == 197 || this.type == 212 || this.type == 257 || this.type == 326 || this.type == 343 || this.type == 348 || this.type == 351 || this.type >= 524 && this.type <= 527 || this.type == 530) { if (this.velocity.X < -2f || this.velocity.X > 2f) { if (this.velocity.Y == 0f) { NPC nPC12 = this; nPC12.velocity = nPC12.velocity * 0.8f; } } else if (this.velocity.X < 2f && this.direction == 1) { this.velocity.X = this.velocity.X + 0.07f; if (this.velocity.X > 2f) { this.velocity.X = 2f; } } else if (this.velocity.X > -2f && this.direction == -1) { this.velocity.X = this.velocity.X - 0.07f; if (this.velocity.X < -2f) { this.velocity.X = -2f; } } } else if (this.type == 109) { if (this.velocity.X < -2f || this.velocity.X > 2f) { if (this.velocity.Y == 0f) { NPC nPC13 = this; nPC13.velocity = nPC13.velocity * 0.8f; } } else if (this.velocity.X < 2f && this.direction == 1) { this.velocity.X = this.velocity.X + 0.04f; if (this.velocity.X > 2f) { this.velocity.X = 2f; } } else if (this.velocity.X > -2f && this.direction == -1) { this.velocity.X = this.velocity.X - 0.04f; if (this.velocity.X < -2f) { this.velocity.X = -2f; } } } else if (this.type == 21 || this.type == 26 || this.type == 31 || this.type == 294 || this.type == 295 || this.type == 296 || this.type == 47 || this.type == 73 || this.type == 140 || this.type == 164 || this.type == 239 || this.type == 167 || this.type == 168 || this.type == 185 || this.type == 198 || this.type == 201 || this.type == 202 || this.type == 203 || this.type == 217 || this.type == 218 || this.type == 219 || this.type == 226 || this.type == 181 || this.type == 254 || this.type == 338 || this.type == 339 || this.type == 340 || this.type == 342 || this.type == 385 || this.type == 389 || this.type == 462 || this.type == 463 || this.type == 466 || this.type == 464 || this.type == 469 || this.type == 470 || this.type == 480 || this.type == 482 || this.type == 425 || this.type == 429) { float single18 = 1.5f; if (this.type == 294) { single18 = 2f; } else if (this.type == 295) { single18 = 1.75f; } else if (this.type == 296) { single18 = 1.25f; } else if (this.type == 201) { single18 = 1.1f; } else if (this.type == 202) { single18 = 0.9f; } else if (this.type == 203) { single18 = 1.2f; } else if (this.type == 338) { single18 = 1.75f; } else if (this.type == 339) { single18 = 1.25f; } else if (this.type == 340) { single18 = 2f; } else if (this.type == 385) { single18 = 1.8f; } else if (this.type == 389) { single18 = 2.25f; } else if (this.type == 462) { single18 = 4f; } else if (this.type == 463) { single18 = 0.75f; } else if (this.type == 466) { single18 = 3.75f; } else if (this.type == 469) { single18 = 3.25f; } else if (this.type == 480) { single18 = 1.5f + (1f - (float)this.life / (float)this.lifeMax) * 2f; } else if (this.type == 425) { single18 = 6f; } else if (this.type == 429) { single18 = 4f; } if (this.type == 21 || this.type == 201 || this.type == 202 || this.type == 203 || this.type == 342) { single18 = single18 * (1f + (1f - this.scale)); } if (this.velocity.X < -single18 || this.velocity.X > single18) { if (this.velocity.Y == 0f) { NPC nPC14 = this; nPC14.velocity = nPC14.velocity * 0.8f; } } else if (this.velocity.X < single18 && this.direction == 1) { if (this.type == 466 && this.velocity.X < -2f) { this.velocity.X = this.velocity.X * 0.9f; } this.velocity.X = this.velocity.X + 0.07f; if (this.velocity.X > single18) { this.velocity.X = single18; } } else if (this.velocity.X > -single18 && this.direction == -1) { if (this.type == 466 && this.velocity.X > 2f) { this.velocity.X = this.velocity.X * 0.9f; } this.velocity.X = this.velocity.X - 0.07f; if (this.velocity.X < -single18) { this.velocity.X = -single18; } } if (this.velocity.Y == 0f && this.type == 462 && (this.direction > 0 && this.velocity.X < 0f || this.direction < 0 && this.velocity.X > 0f)) { this.velocity.X = this.velocity.X * 0.9f; } } else if (this.type >= 269 && this.type <= 280) { float single19 = 1.5f; if (this.type == 269) { single19 = 2f; } if (this.type == 270) { single19 = 1f; } if (this.type == 271) { single19 = 1.5f; } if (this.type == 272) { single19 = 3f; } if (this.type == 273) { single19 = 1.25f; } if (this.type == 274) { single19 = 3f; } if (this.type == 275) { single19 = 3.25f; } if (this.type == 276) { single19 = 2f; } if (this.type == 277) { single19 = 2.75f; } if (this.type == 278) { single19 = 1.8f; } if (this.type == 279) { single19 = 1.3f; } if (this.type == 280) { single19 = 2.5f; } single19 = single19 * (1f + (1f - this.scale)); if (this.velocity.X < -single19 || this.velocity.X > single19) { if (this.velocity.Y == 0f) { NPC nPC15 = this; nPC15.velocity = nPC15.velocity * 0.8f; } } else if (this.velocity.X < single19 && this.direction == 1) { this.velocity.X = this.velocity.X + 0.07f; if (this.velocity.X > single19) { this.velocity.X = single19; } } else if (this.velocity.X > -single19 && this.direction == -1) { this.velocity.X = this.velocity.X - 0.07f; if (this.velocity.X < -single19) { this.velocity.X = -single19; } } } else if (this.type >= 305 && this.type <= 314) { float single20 = 1.5f; if (this.type == 305 || this.type == 310) { single20 = 2f; } if (this.type == 306 || this.type == 311) { single20 = 1.25f; } if (this.type == 307 || this.type == 312) { single20 = 2.25f; } if (this.type == 308 || this.type == 313) { single20 = 1.5f; } if (this.type == 309 || this.type == 314) { single20 = 1f; } if (this.type < 310) { if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.85f; if ((double)this.velocity.X > -0.3 && (double)this.velocity.X < 0.3) { this.velocity.Y = -7f; this.velocity.X = single20 * (float)this.direction; } } else if (this.spriteDirection == this.direction) { this.velocity.X = (this.velocity.X * 10f + single20 * (float)this.direction) / 11f; } } else if (this.velocity.X < -single20 || this.velocity.X > single20) { if (this.velocity.Y == 0f) { NPC nPC16 = this; nPC16.velocity = nPC16.velocity * 0.8f; } } else if (this.velocity.X < single20 && this.direction == 1) { this.velocity.X = this.velocity.X + 0.07f; if (this.velocity.X > single20) { this.velocity.X = single20; } } else if (this.velocity.X > -single20 && this.direction == -1) { this.velocity.X = this.velocity.X - 0.07f; if (this.velocity.X < -single20) { this.velocity.X = -single20; } } } else if (this.type == 67 || this.type == 220 || this.type == 428) { if (this.velocity.X < -0.5f || this.velocity.X > 0.5f) { if (this.velocity.Y == 0f) { NPC nPC17 = this; nPC17.velocity = nPC17.velocity * 0.7f; } } else if (this.velocity.X < 0.5f && this.direction == 1) { this.velocity.X = this.velocity.X + 0.03f; if (this.velocity.X > 0.5f) { this.velocity.X = 0.5f; } } else if (this.velocity.X > -0.5f && this.direction == -1) { this.velocity.X = this.velocity.X - 0.03f; if (this.velocity.X < -0.5f) { this.velocity.X = -0.5f; } } } else if (this.type == 78 || this.type == 79 || this.type == 80) { float single21 = 1f; float single22 = 0.05f; if (this.life < this.lifeMax / 2) { single21 = 2f; single22 = 0.1f; } if (this.type == 79) { single21 = single21 * 1.5f; } if (this.velocity.X < -single21 || this.velocity.X > single21) { if (this.velocity.Y == 0f) { NPC nPC18 = this; nPC18.velocity = nPC18.velocity * 0.7f; } } else if (this.velocity.X < single21 && this.direction == 1) { this.velocity.X = this.velocity.X + single22; if (this.velocity.X > single21) { this.velocity.X = single21; } } else if (this.velocity.X > -single21 && this.direction == -1) { this.velocity.X = this.velocity.X - single22; if (this.velocity.X < -single21) { this.velocity.X = -single21; } } } else if (this.type == 287) { float single23 = 5f; float single24 = 0.2f; if (this.velocity.X < -single23 || this.velocity.X > single23) { if (this.velocity.Y == 0f) { NPC nPC19 = this; nPC19.velocity = nPC19.velocity * 0.7f; } } else if (this.velocity.X < single23 && this.direction == 1) { this.velocity.X = this.velocity.X + single24; if (this.velocity.X > single23) { this.velocity.X = single23; } } else if (this.velocity.X > -single23 && this.direction == -1) { this.velocity.X = this.velocity.X - single24; if (this.velocity.X < -single23) { this.velocity.X = -single23; } } } else if (this.type == 243) { float single25 = 1f; float single26 = 0.07f; single25 = single25 + (1f - (float)this.life / (float)this.lifeMax) * 1.5f; single26 = single26 + (1f - (float)this.life / (float)this.lifeMax) * 0.15f; if (this.velocity.X < -single25 || this.velocity.X > single25) { if (this.velocity.Y == 0f) { NPC nPC20 = this; nPC20.velocity = nPC20.velocity * 0.7f; } } else if (this.velocity.X < single25 && this.direction == 1) { this.velocity.X = this.velocity.X + single26; if (this.velocity.X > single25) { this.velocity.X = single25; } } else if (this.velocity.X > -single25 && this.direction == -1) { this.velocity.X = this.velocity.X - single26; if (this.velocity.X < -single25) { this.velocity.X = -single25; } } } else if (this.type == 251) { float single27 = 1f; float single28 = 0.08f; single27 = single27 + (1f - (float)this.life / (float)this.lifeMax) * 2f; single28 = single28 + (1f - (float)this.life / (float)this.lifeMax) * 0.2f; if (this.velocity.X < -single27 || this.velocity.X > single27) { if (this.velocity.Y == 0f) { NPC nPC21 = this; nPC21.velocity = nPC21.velocity * 0.7f; } } else if (this.velocity.X < single27 && this.direction == 1) { this.velocity.X = this.velocity.X + single28; if (this.velocity.X > single27) { this.velocity.X = single27; } } else if (this.velocity.X > -single27 && this.direction == -1) { this.velocity.X = this.velocity.X - single28; if (this.velocity.X < -single27) { this.velocity.X = -single27; } } } else if (this.type == 386) { if (this.ai[2] <= 0f) { float single29 = 0.15f; float single30 = 1.5f; if (this.velocity.X < -single30 || this.velocity.X > single30) { if (this.velocity.Y == 0f) { NPC nPC22 = this; nPC22.velocity = nPC22.velocity * 0.7f; } } else if (this.velocity.X < single30 && this.direction == 1) { this.velocity.X = this.velocity.X + single29; if (this.velocity.X > single30) { this.velocity.X = single30; } } else if (this.velocity.X > -single30 && this.direction == -1) { this.velocity.X = this.velocity.X - single29; if (this.velocity.X < -single30) { this.velocity.X = -single30; } } } else if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.8f; } } else if (this.type == 460) { float single31 = 3f; float single32 = 0.1f; if (Math.Abs(this.velocity.X) > 2f) { single32 = single32 * 0.8f; } if ((double)Math.Abs(this.velocity.X) > 2.5) { single32 = single32 * 0.8f; } if (Math.Abs(this.velocity.X) > 3f) { single32 = single32 * 0.8f; } if ((double)Math.Abs(this.velocity.X) > 3.5) { single32 = single32 * 0.8f; } if (Math.Abs(this.velocity.X) > 4f) { single32 = single32 * 0.8f; } if ((double)Math.Abs(this.velocity.X) > 4.5) { single32 = single32 * 0.8f; } if (Math.Abs(this.velocity.X) > 5f) { single32 = single32 * 0.8f; } if ((double)Math.Abs(this.velocity.X) > 5.5) { single32 = single32 * 0.8f; } single31 = single31 + (1f - (float)this.life / (float)this.lifeMax) * 3f; if (this.velocity.X < -single31 || this.velocity.X > single31) { if (this.velocity.Y == 0f) { NPC nPC23 = this; nPC23.velocity = nPC23.velocity * 0.7f; } } else if (this.velocity.X < single31 && this.direction == 1) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.93f; } this.velocity.X = this.velocity.X + single32; if (this.velocity.X > single31) { this.velocity.X = single31; } } else if (this.velocity.X > -single31 && this.direction == -1) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.93f; } this.velocity.X = this.velocity.X - single32; if (this.velocity.X < -single31) { this.velocity.X = -single31; } } } else if (this.type == 508) { float single33 = 2.5f; float single34 = 40f; float single35 = Math.Abs(this.velocity.X); if (single35 > 2.75f) { single33 = 3.5f; single34 = single34 + 80f; } else if ((double)single35 > 2.25) { single33 = 3f; single34 = single34 + 60f; } if ((double)Math.Abs(this.velocity.Y) < 0.5) { if (this.velocity.X > 0f && this.direction < 0) { NPC nPC24 = this; nPC24.velocity = nPC24.velocity * 0.9f; } if (this.velocity.X < 0f && this.direction > 0) { NPC nPC25 = this; nPC25.velocity = nPC25.velocity * 0.9f; } } if (Math.Abs(this.velocity.Y) > NPC.gravity) { single34 = single34 * 3f; } if (this.velocity.X <= 0f && this.direction < 0) { this.velocity.X = (this.velocity.X * single34 - single33) / (single34 + 1f); } else if (this.velocity.X >= 0f && this.direction > 0) { this.velocity.X = (this.velocity.X * single34 + single33) / (single34 + 1f); } else if (Math.Abs(base.Center.X - Main.player[this.target].Center.X) > 20f && Math.Abs(this.velocity.Y) <= NPC.gravity) { this.velocity.X = this.velocity.X * 0.99f; this.velocity.X = this.velocity.X + (float)this.direction * 0.025f; } } else if (this.type == 391 || this.type == 427 || this.type == 415 || this.type == 419 || this.type == 518 || this.type == 532) { float single36 = 5f; float single37 = 0.25f; float single38 = 0.7f; if (this.type == 427) { single36 = 6f; single37 = 0.2f; single38 = 0.8f; } else if (this.type == 415) { single36 = 4f; single37 = 0.1f; single38 = 0.95f; } else if (this.type == 419) { single36 = 6f; single37 = 0.15f; single38 = 0.85f; } else if (this.type == 518) { single36 = 5f; single37 = 0.1f; single38 = 0.95f; } else if (this.type == 532) { single36 = 5f; single37 = 0.15f; single38 = 0.98f; } if (this.velocity.X < -single36 || this.velocity.X > single36) { if (this.velocity.Y == 0f) { NPC nPC26 = this; nPC26.velocity = nPC26.velocity * single38; } } else if (this.velocity.X < single36 && this.direction == 1) { this.velocity.X = this.velocity.X + single37; if (this.velocity.X > single36) { this.velocity.X = single36; } } else if (this.velocity.X > -single36 && this.direction == -1) { this.velocity.X = this.velocity.X - single37; if (this.velocity.X < -single36) { this.velocity.X = -single36; } } } else if (this.type >= 430 && this.type <= 436 || this.type == 494 || this.type == 495) { if (this.ai[2] != 0f) { this.damage = (int)((double)this.defDamage * 1.5); this.ai[3] = 1f; this.velocity.X = this.velocity.X * 0.9f; if ((double)Math.Abs(this.velocity.X) < 0.1) { this.velocity.X = 0f; } this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= 20f || this.velocity.Y != 0f || Main.dayTime && (double)this.position.Y < Main.worldSurface * 16) { this.ai[2] = 0f; } } else { this.damage = this.defDamage; float single39 = 1f; single39 = single39 * (1f + (1f - this.scale)); if (this.velocity.X < -single39 || this.velocity.X > single39) { if (this.velocity.Y == 0f) { NPC nPC27 = this; nPC27.velocity = nPC27.velocity * 0.8f; } } else if (this.velocity.X < single39 && this.direction == 1) { this.velocity.X = this.velocity.X + 0.07f; if (this.velocity.X > single39) { this.velocity.X = single39; } } else if (this.velocity.X > -single39 && this.direction == -1) { this.velocity.X = this.velocity.X - 0.07f; if (this.velocity.X < -single39) { this.velocity.X = -single39; } } if (this.velocity.Y == 0f && (!Main.dayTime || (double)this.position.Y > Main.worldSurface * 16) && !Main.player[this.target].dead) { Vector2 center10 = base.Center - Main.player[this.target].Center; int num70 = 50; if (this.type >= 494 && this.type <= 495) { num70 = 42; } if (center10.Length() < (float)num70 && Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.velocity.X = this.velocity.X * 0.7f; this.ai[2] = 1f; } } } } else if (this.type != 110 && this.type != 111 && this.type != 206 && this.type != 214 && this.type != 215 && this.type != 216 && this.type != 290 && this.type != 291 && this.type != 292 && this.type != 293 && this.type != 350 && this.type != 379 && this.type != 380 && this.type != 381 && this.type != 382 && (this.type < 449 || this.type > 452) && this.type != 468 && this.type != 481 && this.type != 411 && this.type != 409 && (this.type < 498 || this.type > 506) && this.type != 424 && this.type != 426 && this.type != 520) { float single40 = 1f; if (this.type == 186) { single40 = 1.1f; } if (this.type == 187) { single40 = 0.9f; } if (this.type == 188) { single40 = 1.2f; } if (this.type == 189) { single40 = 0.8f; } if (this.type == 132) { single40 = 0.95f; } if (this.type == 200) { single40 = 0.87f; } if (this.type == 223) { single40 = 1.05f; } if (this.type == 489) { Vector2 center11 = Main.player[this.target].Center - base.Center; float single41 = center11.Length(); single41 = single41 * 0.0025f; if ((double)single41 > 1.5) { single41 = 1.5f; } single40 = (!Main.expertMode ? 2.5f - single41 : 3f - single41); single40 = single40 * 0.8f; } if (this.type == 489 || this.type == 3 || this.type == 132 || this.type == 186 || this.type == 187 || this.type == 188 || this.type == 189 || this.type == 200 || this.type == 223 || this.type == 331 || this.type == 332) { single40 = single40 * (1f + (1f - this.scale)); } if (this.velocity.X < -single40 || this.velocity.X > single40) { if (this.velocity.Y == 0f) { NPC nPC28 = this; nPC28.velocity = nPC28.velocity * 0.8f; } } else if (this.velocity.X < single40 && this.direction == 1) { this.velocity.X = this.velocity.X + 0.07f; if (this.velocity.X > single40) { this.velocity.X = single40; } } else if (this.velocity.X > -single40 && this.direction == -1) { this.velocity.X = this.velocity.X - 0.07f; if (this.velocity.X < -single40) { this.velocity.X = -single40; } } } else if (this.type == 415) { this.hide = false; int num71 = 0; while (num71 < 200) { if (!Main.npc[num71].active || Main.npc[num71].type != 416 || Main.npc[num71].ai[0] != (float)this.whoAmI) { num71++; } else { this.hide = true; goto Label10; } } } else if (this.type == 258) { if (this.velocity.Y != 0f) { this.TargetClosest(true); this.spriteDirection = this.direction; if (Main.player[this.target].Center.X < this.position.X && this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.95f; } else if (Main.player[this.target].Center.X > this.position.X + (float)this.width && this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.95f; } if (Main.player[this.target].Center.X < this.position.X && this.velocity.X > -5f) { this.velocity.X = this.velocity.X - 0.1f; } else if (Main.player[this.target].Center.X > this.position.X + (float)this.width && this.velocity.X < 5f) { this.velocity.X = this.velocity.X + 0.1f; } } else if (Main.player[this.target].Center.Y + 50f < this.position.Y && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.velocity.Y = -7f; } } else if (this.type == 425) { if (this.velocity.Y == 0f) { this.ai[2] = 0f; } if (this.velocity.Y != 0f && this.ai[2] == 1f) { this.TargetClosest(true); this.spriteDirection = -this.direction; if (Collision.CanHit(base.Center, 0, 0, Main.player[this.target].Center, 0, 0)) { float x14 = Main.player[this.target].Center.X - (float)(this.direction * 400) - base.Center.X; float y12 = Main.player[this.target].Bottom.Y - base.Bottom.Y; if (x14 < 0f && this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.9f; } else if (x14 > 0f && this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.9f; } if (x14 < 0f && this.velocity.X > -5f) { this.velocity.X = this.velocity.X - 0.1f; } else if (x14 > 0f && this.velocity.X < 5f) { this.velocity.X = this.velocity.X + 0.1f; } if (this.velocity.X > 6f) { this.velocity.X = 6f; } if (this.velocity.X < -6f) { this.velocity.X = -6f; } if (y12 < -20f && this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.8f; } else if (y12 > 20f && this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.8f; } if (y12 < -20f && this.velocity.Y > -5f) { this.velocity.Y = this.velocity.Y - 0.3f; } else if (y12 > 20f && this.velocity.Y < 5f) { this.velocity.Y = this.velocity.Y + 0.3f; } } for (int a = 0; a < 200; a++) { if (a != this.whoAmI && Main.npc[a].active && Main.npc[a].type == this.type && Math.Abs(this.position.X - Main.npc[a].position.X) + Math.Abs(this.position.Y - Main.npc[a].position.Y) < (float)this.width) { if (this.position.X >= Main.npc[a].position.X) { this.velocity.X = this.velocity.X + 0.05f; } else { this.velocity.X = this.velocity.X - 0.05f; } if (this.position.Y >= Main.npc[a].position.Y) { this.velocity.Y = this.velocity.Y + 0.05f; } else { this.velocity.Y = this.velocity.Y - 0.05f; } } } } else if (Main.player[this.target].Center.Y + 100f < this.position.Y && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.velocity.Y = -5f; this.ai[2] = 1f; } if (Main.netMode != 1) { this.localAI[2] = this.localAI[2] + 1f; if (this.localAI[2] >= (float)(360 + Main.rand.Next(360)) && base.Distance(Main.player[this.target].Center) < 400f && Math.Abs(base.DirectionTo(Main.player[this.target].Center).Y) < 0.5f && Collision.CanHitLine(base.Center, 0, 0, Main.player[this.target].Center, 0, 0)) { this.localAI[2] = 0f; Vector2 center13 = base.Center + new Vector2((float)(this.direction * 30), 2f); Vector2 vector227 = base.DirectionTo(Main.player[this.target].Center) * 7f; if (vector227.HasNaNs()) { vector227 = new Vector2((float)(this.direction * 8), 0f); } int num72 = (Main.expertMode ? 50 : 75); for (int b = 0; b < 4; b++) { Vector2 vector228 = vector227 + Utils.RandomVector2(Main.rand, -0.8f, 0.8f); Projectile.NewProjectile(center13.X, center13.Y, vector228.X, vector228.Y, 577, num72, 1f, Main.myPlayer, 0f, 0f); } } } } else if (this.type == 427) { if (this.velocity.Y != 0f) { this.rotation = this.velocity.X * 0.1f; } else { this.ai[2] = 0f; this.rotation = 0f; } if (this.velocity.Y != 0f && this.ai[2] == 1f) { this.TargetClosest(true); this.spriteDirection = -this.direction; if (Collision.CanHit(base.Center, 0, 0, Main.player[this.target].Center, 0, 0)) { float x15 = Main.player[this.target].Center.X - base.Center.X; float y13 = Main.player[this.target].Center.Y - base.Center.Y; if (x15 < 0f && this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.98f; } else if (x15 > 0f && this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.98f; } if (x15 < -20f && this.velocity.X > -6f) { this.velocity.X = this.velocity.X - 0.015f; } else if (x15 > 20f && this.velocity.X < 6f) { this.velocity.X = this.velocity.X + 0.015f; } if (this.velocity.X > 6f) { this.velocity.X = 6f; } if (this.velocity.X < -6f) { this.velocity.X = -6f; } if (y13 < -20f && this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.98f; } else if (y13 > 20f && this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.98f; } if (y13 < -20f && this.velocity.Y > -6f) { this.velocity.Y = this.velocity.Y - 0.15f; } else if (y13 > 20f && this.velocity.Y < 6f) { this.velocity.Y = this.velocity.Y + 0.15f; } } for (int c = 0; c < 200; c++) { if (c != this.whoAmI && Main.npc[c].active && Main.npc[c].type == this.type && Math.Abs(this.position.X - Main.npc[c].position.X) + Math.Abs(this.position.Y - Main.npc[c].position.Y) < (float)this.width) { if (this.position.X >= Main.npc[c].position.X) { this.velocity.X = this.velocity.X + 0.05f; } else { this.velocity.X = this.velocity.X - 0.05f; } if (this.position.Y >= Main.npc[c].position.Y) { this.velocity.Y = this.velocity.Y + 0.05f; } else { this.velocity.Y = this.velocity.Y - 0.05f; } } } } else if (Main.player[this.target].Center.Y + 100f < this.position.Y && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.velocity.Y = -5f; this.ai[2] = 1f; } } else if (this.type == 426) { if (this.ai[1] > 0f && this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.85f; if (this.velocity.Y == 0f) { this.velocity.Y = -0.4f; } } if (this.velocity.Y != 0f) { this.TargetClosest(true); this.spriteDirection = this.direction; if (Collision.CanHit(base.Center, 0, 0, Main.player[this.target].Center, 0, 0)) { float x16 = Main.player[this.target].Center.X - (float)(this.direction * 300) - base.Center.X; if (x16 < 40f && this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.98f; } else if (x16 > 40f && this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.98f; } if (x16 < 40f && this.velocity.X > -5f) { this.velocity.X = this.velocity.X - 0.2f; } else if (x16 > 40f && this.velocity.X < 5f) { this.velocity.X = this.velocity.X + 0.2f; } if (this.velocity.X > 6f) { this.velocity.X = 6f; } if (this.velocity.X < -6f) { this.velocity.X = -6f; } } } else if (Main.player[this.target].Center.Y + 100f < this.position.Y && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.velocity.Y = -6f; } for (int d = 0; d < 200; d++) { if (d != this.whoAmI && Main.npc[d].active && Main.npc[d].type == this.type && Math.Abs(this.position.X - Main.npc[d].position.X) + Math.Abs(this.position.Y - Main.npc[d].position.Y) < (float)this.width) { if (this.position.X >= Main.npc[d].position.X) { this.velocity.X = this.velocity.X + 0.1f; } else { this.velocity.X = this.velocity.X - 0.1f; } if (this.position.Y >= Main.npc[d].position.Y) { this.velocity.Y = this.velocity.Y + 0.1f; } else { this.velocity.Y = this.velocity.Y - 0.1f; } } } } else if (this.type != 185) { if (this.type == 428) { if (this.velocity.Y != 0f) { NPC x19 = this; x19.rotation = x19.rotation + this.velocity.X * 0.08f; } else { this.rotation = 0f; } } } else if (this.velocity.Y == 0f) { this.rotation = 0f; this.localAI[0] = 0f; } else if (this.localAI[0] == 1f) { NPC x20 = this; x20.rotation = x20.rotation + this.velocity.X * 0.05f; } Label10: if (this.type == 159 && Main.netMode != 1) { Vector2 vector229 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x21 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector229.X; float y16 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector229.Y; if ((float)Math.Sqrt((double)(x21 * x21 + y16 * y16)) > 300f) { this.Transform(158); } } if (this.type == 164 && Main.netMode != 1 && this.velocity.Y == 0f) { int x22 = (int)base.Center.X / 16; int y17 = (int)base.Center.Y / 16; bool flag15 = false; for (int e = x22 - 1; e <= x22 + 1; e++) { for (int f = y17 - 1; f <= y17 + 1; f++) { if (Main.tile[e, f].wall > 0) { flag15 = true; } } } if (flag15) { this.Transform(165); } } if (this.type == 239 && Main.netMode != 1 && this.velocity.Y == 0f) { int x23 = (int)base.Center.X / 16; int y18 = (int)base.Center.Y / 16; bool flag16 = false; for (int g = x23 - 1; g <= x23 + 1; g++) { for (int h = y18 - 1; h <= y18 + 1; h++) { if (Main.tile[g, h].wall > 0) { flag16 = true; } } } if (flag16) { this.Transform(240); } } if (this.type == 530 && Main.netMode != 1 && this.velocity.Y == 0f) { int x24 = (int)base.Center.X / 16; int y19 = (int)base.Center.Y / 16; bool flag17 = false; for (int i1 = x24 - 1; i1 <= x24 + 1; i1++) { for (int j1 = y19 - 1; j1 <= y19 + 1; j1++) { if (Main.tile[i1, j1].wall > 0) { flag17 = true; } } } if (flag17) { this.Transform(531); } } if (Main.netMode != 1 && Main.expertMode && this.target >= 0 && (this.type == 163 || this.type == 238) && Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.localAI[0] = this.localAI[0] + 1f; if (this.justHit) { this.localAI[0] = this.localAI[0] - (float)Main.rand.Next(20, 60); if (this.localAI[0] < 0f) { this.localAI[0] = 0f; } } if (this.localAI[0] > (float)Main.rand.Next(180, 900)) { this.localAI[0] = 0f; Vector2 center17 = Main.player[this.target].Center - base.Center; center17.Normalize(); center17 = center17 * 8f; Projectile.NewProjectile(base.Center.X, base.Center.Y, center17.X, center17.Y, 472, 18, 0f, Main.myPlayer, 0f, 0f); } } if (this.type == 163 && Main.netMode != 1 && this.velocity.Y == 0f) { int x25 = (int)base.Center.X / 16; int y20 = (int)base.Center.Y / 16; bool flag18 = false; for (int k1 = x25 - 1; k1 <= x25 + 1; k1++) { for (int l1 = y20 - 1; l1 <= y20 + 1; l1++) { if (Main.tile[k1, l1].wall > 0) { flag18 = true; } } } if (flag18) { this.Transform(238); } } if (this.type == 236 && Main.netMode != 1 && this.velocity.Y == 0f) { int x26 = (int)base.Center.X / 16; int y21 = (int)base.Center.Y / 16; bool flag19 = false; for (int m1 = x26 - 1; m1 <= x26 + 1; m1++) { for (int n1 = y21 - 1; n1 <= y21 + 1; n1++) { if (Main.tile[m1, n1].wall > 0) { flag19 = true; } } } if (flag19) { this.Transform(237); } } if (this.type == 243) { if (this.justHit && Main.rand.Next(3) == 0) { this.ai[2] = this.ai[2] - (float)Main.rand.Next(30); } if (this.ai[2] < 0f) { this.ai[2] = 0f; } if (this.confused) { this.ai[2] = 0f; } this.ai[2] = this.ai[2] + 1f; float single42 = (float)Main.rand.Next(30, 900); single42 = single42 * ((float)this.life / (float)this.lifeMax); single42 = single42 + 30f; if (Main.netMode != 1 && this.ai[2] >= single42 && this.velocity.Y == 0f && !Main.player[this.target].dead && !Main.player[this.target].frozen && (this.direction > 0 && base.Center.X < Main.player[this.target].Center.X || this.direction < 0 && base.Center.X > Main.player[this.target].Center.X) && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { float single43 = 15f; Vector2 y22 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + 20f); float x27 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - y22.X; float y23 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - y22.Y; x27 = x27 + (float)Main.rand.Next(-40, 41); y23 = y23 + (float)Main.rand.Next(-40, 41); float single44 = (float)Math.Sqrt((double)(x27 * x27 + y23 * y23)); this.netUpdate = true; single44 = single43 / single44; x27 = x27 * single44; y23 = y23 * single44; int num74 = 32; int num75 = 257; y22.X = y22.X + x27 * 3f; y22.Y = y22.Y + y23 * 3f; Projectile.NewProjectile(y22.X, y22.Y, x27, y23, num75, num74, 0f, Main.myPlayer, 0f, 0f); this.ai[2] = 0f; } } if (this.type == 251) { if (this.justHit) { this.ai[2] = this.ai[2] - (float)Main.rand.Next(30); } if (this.ai[2] < 0f) { this.ai[2] = 0f; } if (this.confused) { this.ai[2] = 0f; } this.ai[2] = this.ai[2] + 1f; float single45 = (float)Main.rand.Next(60, 1800); single45 = single45 * ((float)this.life / (float)this.lifeMax); single45 = single45 + 15f; if (Main.netMode != 1 && this.ai[2] >= single45 && this.velocity.Y == 0f && !Main.player[this.target].dead && !Main.player[this.target].frozen && (this.direction > 0 && base.Center.X < Main.player[this.target].Center.X || this.direction < 0 && base.Center.X > Main.player[this.target].Center.X) && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { float single46 = 15f; Vector2 y24 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + 12f); float x28 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - y24.X; float y25 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - y24.Y; x28 = x28 + (float)Main.rand.Next(-40, 41); y25 = y25 + (float)Main.rand.Next(-30, 0); float single47 = (float)Math.Sqrt((double)(x28 * x28 + y25 * y25)); this.netUpdate = true; single47 = single46 / single47; x28 = x28 * single47; y25 = y25 * single47; int num76 = 30; int num77 = 83; y24.X = y24.X + x28 * 3f; y24.Y = y24.Y + y25 * 3f; Projectile.NewProjectile(y24.X, y24.Y, x28, y25, num77, num76, 0f, Main.myPlayer, 0f, 0f); this.ai[2] = 0f; } } if (this.type == 386) { if (!this.confused) { if (this.ai[2] < 60f) { this.ai[2] = this.ai[2] + 1f; } if (this.ai[2] > 0f && NPC.CountNPCS(387) >= 4 * NPC.CountNPCS(386)) { this.ai[2] = 0f; } if (this.justHit) { this.ai[2] = -30f; } if (this.ai[2] == 30f) { int x29 = (int)this.position.X / 16; int y26 = (int)this.position.Y / 16; int x30 = (int)this.position.X / 16; int y27 = (int)this.position.Y / 16; int num78 = 5; int num79 = 0; bool flag20 = false; int num80 = 2; int num81 = 0; Label11: while (!flag20 && num79 < 100) { num79++; int num82 = Main.rand.Next(x29 - num78, x29 + num78); int num83 = Main.rand.Next(y26 - num78, y26 + num78); for (int o1 = num83; o1 < y26 + num78; o1++) { if ((o1 < y26 - num80 || o1 > y26 + num80 || num82 < x29 - num80 || num82 > x29 + num80) && (o1 < y27 - num81 || o1 > y27 + num81 || num82 < x30 - num81 || num82 > x30 + num81) && Main.tile[num82, o1].nactive()) { bool flag21 = true; if (Main.tile[num82, o1 - 1].lava()) { flag21 = false; } if (flag21 && Main.tileSolid[Main.tile[num82, o1].type] && !Collision.SolidTiles(num82 - 1, num82 + 1, o1 - 4, o1 - 1)) { int num84 = NPC.NewNPC(num82 * 16 - this.width / 2, o1 * 16, 387, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num84].position.Y = (float)(o1 * 16 - Main.npc[num84].height); flag20 = true; this.netUpdate = true; goto Label11; } } } } } if (this.ai[2] == 60f) { this.ai[2] = -120f; } } else { this.ai[2] = -60f; } } if (this.type == 389) { if (!this.confused) { if (this.ai[2] < 20f) { this.ai[2] = this.ai[2] + 1f; } if (this.justHit) { this.ai[2] = -30f; } if (this.ai[2] == 20f && Main.netMode != 1) { this.ai[2] = (float)(-10 + Main.rand.Next(3) * -10); Projectile.NewProjectile(base.Center.X, base.Center.Y + 8f, (float)(this.direction * 6), 0f, 437, 25, 1f, Main.myPlayer, 0f, 0f); } } else { this.ai[2] = -60f; } } if (this.type == 110 || this.type == 111 || this.type == 206 || this.type == 214 || this.type == 215 || this.type == 216 || this.type == 290 || this.type == 291 || this.type == 292 || this.type == 293 || this.type == 350 || this.type == 379 || this.type == 380 || this.type == 381 || this.type == 382 || this.type >= 449 && this.type <= 452 || this.type == 468 || this.type == 481 || this.type == 411 || this.type == 409 || this.type >= 498 && this.type <= 506 || this.type == 424 || this.type == 426 || this.type == 520) { bool flag22 = (this.type == 381 || this.type == 382 ? true : this.type == 520); bool flag23 = this.type == 426; bool flag24 = true; int num85 = -1; int num86 = -1; if (this.type == 411) { flag22 = true; num85 = 90; num86 = 90; if (this.ai[1] <= 150f) { flag24 = false; } } if (!this.confused) { if (this.ai[1] > 0f) { this.ai[1] = this.ai[1] - 1f; } if (this.justHit) { this.ai[1] = 30f; this.ai[2] = 0f; } int num87 = 70; if (this.type == 379 || this.type == 380) { num87 = 80; } if (this.type == 381 || this.type == 382) { num87 = 80; } if (this.type == 520) { num87 = 15; } if (this.type == 350) { num87 = 110; } if (this.type == 291) { num87 = 200; } if (this.type == 292) { num87 = 120; } if (this.type == 293) { num87 = 90; } if (this.type == 111) { num87 = 180; } if (this.type == 206) { num87 = 50; } if (this.type == 214) { num87 = 40; } if (this.type == 215) { num87 = 80; } if (this.type == 290) { num87 = 30; } if (this.type == 411) { num87 = 300; } if (this.type == 409) { num87 = 60; } if (this.type == 424) { num87 = 180; } if (this.type == 426) { num87 = 60; } bool flag25 = false; if (this.type == 216) { if (this.localAI[2] >= 20f) { flag25 = true; } num87 = (!flag25 ? 8 : 60); } int num88 = num87 / 2; if (this.type == 424) { num88 = num87 - 1; } if (this.type == 426) { num88 = num87 - 1; } if (this.ai[2] > 0f) { if (flag24) { this.TargetClosest(true); } if (this.ai[1] == (float)num88) { if (this.type == 216) { this.localAI[2] = this.localAI[2] + 1f; } float single48 = 11f; if (this.type == 111) { single48 = 9f; } if (this.type == 206) { single48 = 7f; } if (this.type == 290) { single48 = 9f; } if (this.type == 293) { single48 = 4f; } if (this.type == 214) { single48 = 14f; } if (this.type == 215) { single48 = 16f; } if (this.type == 382) { single48 = 7f; } if (this.type == 520) { single48 = 8f; } if (this.type == 409) { single48 = 4f; } if (this.type >= 449 && this.type <= 452) { single48 = 7f; } if (this.type == 481) { single48 = 9f; } if (this.type == 468) { single48 = 7.5f; } if (this.type == 411) { single48 = 1f; } if (this.type >= 498 && this.type <= 506) { single48 = 7f; } Vector2 y28 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); if (this.type == 481) { y28.Y = y28.Y - 14f; } if (this.type == 206) { y28.Y = y28.Y - 10f; } if (this.type == 290) { y28.Y = y28.Y - 10f; } if (this.type == 381 || this.type == 382) { y28.Y = y28.Y + 6f; } if (this.type == 520) { y28.Y = this.position.Y + 20f; } if (this.type >= 498 && this.type <= 506) { y28.Y = y28.Y - 8f; } if (this.type == 426) { y28 = y28 + new Vector2((float)(this.spriteDirection * 2), -12f); } float x31 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - y28.X; float single49 = Math.Abs(x31) * 0.1f; if (this.type == 291 || this.type == 292) { single49 = 0f; } if (this.type == 215) { single49 = Math.Abs(x31) * 0.08f; } if (this.type == 214 || this.type == 216 && !flag25) { single49 = 0f; } if (this.type == 381 || this.type == 382 || this.type == 520) { single49 = 0f; } if (this.type >= 449 && this.type <= 452) { single49 = Math.Abs(x31) * (float)Main.rand.Next(10, 50) * 0.01f; } if (this.type == 468) { single49 = Math.Abs(x31) * (float)Main.rand.Next(10, 50) * 0.01f; } if (this.type == 481) { single49 = Math.Abs(x31) * (float)Main.rand.Next(-10, 11) * 0.0025f; } if (this.type >= 498 && this.type <= 506) { single49 = Math.Abs(x31) * (float)Main.rand.Next(1, 11) * 0.0025f; } float y29 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - y28.Y - single49; if (this.type == 291) { x31 = x31 + (float)Main.rand.Next(-40, 41) * 0.2f; y29 = y29 + (float)Main.rand.Next(-40, 41) * 0.2f; } else if (this.type == 381 || this.type == 382 || this.type == 520) { x31 = x31 + (float)Main.rand.Next(-100, 101) * 0.4f; y29 = y29 + (float)Main.rand.Next(-100, 101) * 0.4f; x31 = x31 * ((float)Main.rand.Next(85, 116) * 0.01f); y29 = y29 * ((float)Main.rand.Next(85, 116) * 0.01f); if (this.type == 520) { x31 = x31 + (float)Main.rand.Next(-100, 101) * 0.6f; y29 = y29 + (float)Main.rand.Next(-100, 101) * 0.6f; x31 = x31 * ((float)Main.rand.Next(85, 116) * 0.015f); y29 = y29 * ((float)Main.rand.Next(85, 116) * 0.015f); } } else if (this.type == 481) { x31 = x31 + (float)Main.rand.Next(-40, 41) * 0.4f; y29 = y29 + (float)Main.rand.Next(-40, 41) * 0.4f; } else if (this.type >= 498 && this.type <= 506) { x31 = x31 + (float)Main.rand.Next(-40, 41) * 0.3f; y29 = y29 + (float)Main.rand.Next(-40, 41) * 0.3f; } else if (this.type != 292) { x31 = x31 + (float)Main.rand.Next(-40, 41); y29 = y29 + (float)Main.rand.Next(-40, 41); } float single50 = (float)Math.Sqrt((double)(x31 * x31 + y29 * y29)); this.netUpdate = true; single50 = single48 / single50; x31 = x31 * single50; y29 = y29 * single50; int num89 = 35; int num90 = 82; if (this.type == 111) { num89 = 11; } if (this.type == 206) { num89 = 37; } if (this.type == 379 || this.type == 380) { num89 = 40; } if (this.type == 350) { num89 = 45; } if (this.type == 468) { num89 = 50; } if (this.type == 111) { num90 = 81; } if (this.type == 379 || this.type == 380) { num90 = 81; } if (this.type == 381) { num90 = 436; num89 = 24; } if (this.type == 382) { num90 = 438; num89 = 30; } if (this.type == 520) { num90 = 592; num89 = 35; } if (this.type >= 449 && this.type <= 452) { num90 = 471; num89 = 20; } if (this.type >= 498 && this.type <= 506) { num90 = 572; num89 = 14; } if (this.type == 481) { num90 = 508; num89 = 24; } if (this.type == 206) { num90 = 177; } if (this.type == 468) { num90 = 501; } if (this.type == 411) { num90 = 537; num89 = (Main.expertMode ? 45 : 60); } if (this.type == 424) { num90 = 573; num89 = (Main.expertMode ? 45 : 60); } if (this.type == 426) { num90 = 581; num89 = (Main.expertMode ? 45 : 60); } if (this.type == 291) { num90 = 302; num89 = 100; } if (this.type == 290) { num90 = 300; num89 = 60; } if (this.type == 293) { num90 = 303; num89 = 60; } if (this.type == 214) { num90 = 180; num89 = 25; } if (this.type == 215) { num90 = 82; num89 = 40; } if (this.type == 292) { num89 = 50; num90 = 180; } if (this.type == 216) { num90 = 180; num89 = 30; if (flag25) { num89 = 100; num90 = 240; this.localAI[2] = 0f; } } y28.X = y28.X + x31; y28.Y = y28.Y + y29; if (Main.expertMode && this.type == 290) { num89 = (int)((double)num89 * 0.75); } if (Main.expertMode && this.type >= 381 && this.type <= 392) { num89 = (int)((double)num89 * 0.8); } if (Main.netMode != 1) { if (this.type == 292) { for (int p1 = 0; p1 < 4; p1++) { x31 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - y28.X; y29 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - y28.Y; single50 = (float)Math.Sqrt((double)(x31 * x31 + y29 * y29)); single50 = 12f / single50; float single51 = x31 + (float)Main.rand.Next(-40, 41); x31 = single51; x31 = single51; float single52 = y29 + (float)Main.rand.Next(-40, 41); y29 = single52; y29 = single52; x31 = x31 * single50; y29 = y29 * single50; Projectile.NewProjectile(y28.X, y28.Y, x31, y29, num90, num89, 0f, Main.myPlayer, 0f, 0f); } } else if (this.type == 411) { Projectile.NewProjectile(y28.X, y28.Y, x31, y29, num90, num89, 0f, Main.myPlayer, 0f, (float)this.whoAmI); } else if (this.type == 424) { for (int q1 = 0; q1 < 4; q1++) { Projectile.NewProjectile(base.Center.X - (float)(this.spriteDirection * 4), base.Center.Y + 6f, (float)(-3 + 2 * q1) * 0.15f, (float)(-Main.rand.Next(0, 3)) * 0.2f - 0.1f, num90, num89, 0f, Main.myPlayer, 0f, (float)this.whoAmI); } } else if (this.type != 409) { Projectile.NewProjectile(y28.X, y28.Y, x31, y29, num90, num89, 0f, Main.myPlayer, 0f, 0f); } else { int num91 = NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 410, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num91].velocity = new Vector2(x31, -6f + y29); } } if (Math.Abs(y29) > Math.Abs(x31) * 2f) { if (y29 <= 0f) { this.ai[2] = 5f; } else { this.ai[2] = 1f; } } else if (Math.Abs(x31) > Math.Abs(y29) * 2f) { this.ai[2] = 3f; } else if (y29 <= 0f) { this.ai[2] = 4f; } else { this.ai[2] = 2f; } } if (this.velocity.Y != 0f && !flag23 || this.ai[1] <= 0f) { this.ai[2] = 0f; this.ai[1] = 0f; } else if (!flag22 || num85 != -1 && this.ai[1] >= (float)num85 && this.ai[1] < (float)(num85 + num86) && (!flag23 || this.velocity.Y == 0f)) { this.velocity.X = this.velocity.X * 0.9f; this.spriteDirection = this.direction; } } if (this.type == 468 && !Main.eclipse) { flag22 = true; } else if ((this.ai[2] <= 0f || flag22) && (this.velocity.Y == 0f || flag23) && this.ai[1] <= 0f && !Main.player[this.target].dead) { bool flag26 = Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height); if (this.type == 520) { flag26 = Collision.CanHitLine(base.Top + new Vector2(0f, 20f), 0, 0, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height); } if (Main.player[this.target].stealth == 0f && Main.player[this.target].itemAnimation == 0) { flag26 = false; } if (flag26) { float single53 = 10f; Vector2 vector230 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x32 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector230.X; float single54 = Math.Abs(x32) * 0.1f; float y30 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector230.Y - single54; x32 = x32 + (float)Main.rand.Next(-40, 41); y30 = y30 + (float)Main.rand.Next(-40, 41); float single55 = (float)Math.Sqrt((double)(x32 * x32 + y30 * y30)); float single56 = 700f; if (this.type == 214) { single56 = 550f; } if (this.type == 215) { single56 = 800f; } if (this.type >= 498 && this.type <= 506) { single56 = 190f; } if (this.type >= 449 && this.type <= 452) { single56 = 200f; } if (this.type == 481) { single56 = 400f; } if (this.type == 468) { single56 = 400f; } if (single55 < single56) { this.netUpdate = true; this.velocity.X = this.velocity.X * 0.5f; single55 = single53 / single55; x32 = x32 * single55; y30 = y30 * single55; this.ai[2] = 3f; this.ai[1] = (float)num87; if (Math.Abs(y30) > Math.Abs(x32) * 2f) { if (y30 <= 0f) { this.ai[2] = 5f; } else { this.ai[2] = 1f; } } else if (Math.Abs(x32) > Math.Abs(y30) * 2f) { this.ai[2] = 3f; } else if (y30 <= 0f) { this.ai[2] = 4f; } else { this.ai[2] = 2f; } } } } if (this.ai[2] <= 0f || flag22 && (num85 == -1 || this.ai[1] < (float)num85 || this.ai[1] >= (float)(num85 + num86))) { float single57 = 1f; float single58 = 0.07f; float single59 = 0.8f; if (this.type == 214) { single57 = 2f; single58 = 0.09f; } else if (this.type == 215) { single57 = 1.5f; single58 = 0.08f; } else if (this.type == 381 || this.type == 382) { single57 = 2f; single58 = 0.5f; } else if (this.type == 520) { single57 = 4f; single58 = 1f; single59 = 0.7f; } else if (this.type == 411) { single57 = 2f; single58 = 0.5f; } else if (this.type == 409) { single57 = 2f; single58 = 0.5f; } bool flag27 = false; if ((this.type == 381 || this.type == 382) && Vector2.Distance(base.Center, Main.player[this.target].Center) < 300f && Collision.CanHitLine(base.Center, 0, 0, Main.player[this.target].Center, 0, 0)) { flag27 = true; this.ai[3] = 0f; } if (this.type == 520 && Vector2.Distance(base.Center, Main.player[this.target].Center) < 400f && Collision.CanHitLine(base.Center, 0, 0, Main.player[this.target].Center, 0, 0)) { flag27 = true; this.ai[3] = 0f; } if (this.velocity.X < -single57 || this.velocity.X > single57 || flag27) { if (this.velocity.Y == 0f) { NPC nPC29 = this; nPC29.velocity = nPC29.velocity * single59; } } else if (this.velocity.X < single57 && this.direction == 1) { this.velocity.X = this.velocity.X + single58; if (this.velocity.X > single57) { this.velocity.X = single57; } } else if (this.velocity.X > -single57 && this.direction == -1) { this.velocity.X = this.velocity.X - single58; if (this.velocity.X < -single57) { this.velocity.X = -single57; } } } if (this.type == 520) { this.localAI[2] = this.localAI[2] + 1f; if (this.localAI[2] >= 6f) { this.localAI[2] = 0f; this.localAI[3] = Main.player[this.target].DirectionFrom(base.Top + new Vector2(0f, 20f)).ToRotation(); } } } else { this.ai[2] = 0f; } } if (this.type == 109 && Main.netMode != 1 && !Main.player[this.target].dead) { if (this.justHit) { this.ai[2] = 0f; } this.ai[2] = this.ai[2] + 1f; if (this.ai[2] > 450f) { Vector2 vector231 = new Vector2(this.position.X + (float)this.width * 0.5f - (float)(this.direction * 24), this.position.Y + 4f); int num92 = 3 * this.direction; int num93 = -5; int num94 = Projectile.NewProjectile(vector231.X, vector231.Y, (float)num92, (float)num93, 75, 0, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num94].timeLeft = 300; this.ai[2] = 0f; } } bool flag28 = false; if (this.velocity.Y == 0f) { int y31 = (int)(this.position.Y + (float)this.height + 7f) / 16; int x33 = (int)this.position.X / 16; int x34 = (int)(this.position.X + (float)this.width) / 16; int num95 = x33; while (num95 <= x34) { if (Main.tile[num95, y31] == null) { return; } if (!Main.tile[num95, y31].nactive() || !Main.tileSolid[Main.tile[num95, y31].type]) { num95++; } else { flag28 = true; break; } } } if (this.type == 428) { flag28 = false; } if (this.velocity.Y >= 0f) { int num96 = 0; if (this.velocity.X < 0f) { num96 = -1; } if (this.velocity.X > 0f) { num96 = 1; } Vector2 vector232 = this.position; vector232.X = vector232.X + this.velocity.X; int x35 = (int)((vector232.X + (float)(this.width / 2) + (float)((this.width / 2 + 1) * num96)) / 16f); int y32 = (int)((vector232.Y + (float)this.height - 1f) / 16f); if (Main.tile[x35, y32] == null) { Main.tile[x35, y32] = new Tile(); } if (Main.tile[x35, y32 - 1] == null) { Main.tile[x35, y32 - 1] = new Tile(); } if (Main.tile[x35, y32 - 2] == null) { Main.tile[x35, y32 - 2] = new Tile(); } if (Main.tile[x35, y32 - 3] == null) { Main.tile[x35, y32 - 3] = new Tile(); } if (Main.tile[x35, y32 + 1] == null) { Main.tile[x35, y32 + 1] = new Tile(); } if (Main.tile[x35 - num96, y32 - 3] == null) { Main.tile[x35 - num96, y32 - 3] = new Tile(); } if ((float)(x35 * 16) < vector232.X + (float)this.width && (float)(x35 * 16 + 16) > vector232.X && (Main.tile[x35, y32].nactive() && !Main.tile[x35, y32].topSlope() && !Main.tile[x35, y32 - 1].topSlope() && Main.tileSolid[Main.tile[x35, y32].type] && !Main.tileSolidTop[Main.tile[x35, y32].type] || Main.tile[x35, y32 - 1].halfBrick() && Main.tile[x35, y32 - 1].nactive()) && (!Main.tile[x35, y32 - 1].nactive() || !Main.tileSolid[Main.tile[x35, y32 - 1].type] || Main.tileSolidTop[Main.tile[x35, y32 - 1].type] || Main.tile[x35, y32 - 1].halfBrick() && (!Main.tile[x35, y32 - 4].nactive() || !Main.tileSolid[Main.tile[x35, y32 - 4].type] || Main.tileSolidTop[Main.tile[x35, y32 - 4].type])) && (!Main.tile[x35, y32 - 2].nactive() || !Main.tileSolid[Main.tile[x35, y32 - 2].type] || Main.tileSolidTop[Main.tile[x35, y32 - 2].type]) && (!Main.tile[x35, y32 - 3].nactive() || !Main.tileSolid[Main.tile[x35, y32 - 3].type] || Main.tileSolidTop[Main.tile[x35, y32 - 3].type]) && (!Main.tile[x35 - num96, y32 - 3].nactive() || !Main.tileSolid[Main.tile[x35 - num96, y32 - 3].type])) { float single60 = (float)(y32 * 16); if (Main.tile[x35, y32].halfBrick()) { single60 = single60 + 8f; } if (Main.tile[x35, y32 - 1].halfBrick()) { single60 = single60 - 8f; } if (single60 < vector232.Y + (float)this.height) { float y33 = vector232.Y + (float)this.height - single60; float single61 = 16.1f; if (this.type == 163 || this.type == 164 || this.type == 236 || this.type == 239 || this.type == 530) { single61 = single61 + 8f; } if (y33 <= single61) { NPC nPC30 = this; nPC30.gfxOffY = nPC30.gfxOffY + (this.position.Y + (float)this.height - single60); this.position.Y = single60 - (float)this.height; if (y33 >= 9f) { this.stepSpeed = 2f; } else { this.stepSpeed = 1f; } } } } } if (flag28) { int x36 = (int)((this.position.X + (float)(this.width / 2) + (float)(15 * this.direction)) / 16f); int y34 = (int)((this.position.Y + (float)this.height - 15f) / 16f); if (this.type == 109 || this.type == 163 || this.type == 164 || this.type == 199 || this.type == 236 || this.type == 239 || this.type == 257 || this.type == 258 || this.type == 290 || this.type == 391 || this.type == 425 || this.type == 427 || this.type == 426 || this.type == 508 || this.type == 415 || this.type == 530 || this.type == 532) { x36 = (int)((this.position.X + (float)(this.width / 2) + (float)((this.width / 2 + 16) * this.direction)) / 16f); } if (Main.tile[x36, y34] == null) { Main.tile[x36, y34] = new Tile(); } if (Main.tile[x36, y34 - 1] == null) { Main.tile[x36, y34 - 1] = new Tile(); } if (Main.tile[x36, y34 - 2] == null) { Main.tile[x36, y34 - 2] = new Tile(); } if (Main.tile[x36, y34 - 3] == null) { Main.tile[x36, y34 - 3] = new Tile(); } if (Main.tile[x36, y34 + 1] == null) { Main.tile[x36, y34 + 1] = new Tile(); } if (Main.tile[x36 + this.direction, y34 - 1] == null) { Main.tile[x36 + this.direction, y34 - 1] = new Tile(); } if (Main.tile[x36 + this.direction, y34 + 1] == null) { Main.tile[x36 + this.direction, y34 + 1] = new Tile(); } if (Main.tile[x36 - this.direction, y34 + 1] == null) { Main.tile[x36 - this.direction, y34 + 1] = new Tile(); } Main.tile[x36, y34 + 1].halfBrick(); if (!Main.tile[x36, y34 - 1].nactive() || Main.tile[x36, y34 - 1].type != 10 && Main.tile[x36, y34 - 1].type != 388 || !flag11) { int num97 = this.spriteDirection; if (this.type == 425) { num97 = num97 * -1; } if (this.velocity.X < 0f && num97 == -1 || this.velocity.X > 0f && num97 == 1) { if (this.height >= 32 && Main.tile[x36, y34 - 2].nactive() && Main.tileSolid[Main.tile[x36, y34 - 2].type]) { if (!Main.tile[x36, y34 - 3].nactive() || !Main.tileSolid[Main.tile[x36, y34 - 3].type]) { this.velocity.Y = -7f; this.netUpdate = true; } else { this.velocity.Y = -8f; this.netUpdate = true; } } else if (Main.tile[x36, y34 - 1].nactive() && Main.tileSolid[Main.tile[x36, y34 - 1].type]) { this.velocity.Y = -6f; this.netUpdate = true; } else if (this.position.Y + (float)this.height - (float)(y34 * 16) > 20f && Main.tile[x36, y34].nactive() && !Main.tile[x36, y34].topSlope() && Main.tileSolid[Main.tile[x36, y34].type]) { this.velocity.Y = -5f; this.netUpdate = true; } else if (this.directionY < 0 && this.type != 67 && (!Main.tile[x36, y34 + 1].nactive() || !Main.tileSolid[Main.tile[x36, y34 + 1].type]) && (!Main.tile[x36 + this.direction, y34 + 1].nactive() || !Main.tileSolid[Main.tile[x36 + this.direction, y34 + 1].type])) { this.velocity.Y = -8f; this.velocity.X = this.velocity.X * 1.5f; this.netUpdate = true; } else if (flag11) { this.ai[1] = 0f; this.ai[2] = 0f; } if (this.velocity.Y == 0f && flag9 && this.ai[3] == 1f) { this.velocity.Y = -5f; } } if ((this.type == 31 || this.type == 294 || this.type == 295 || this.type == 296 || this.type == 47 || this.type == 77 || this.type == 104 || this.type == 168 || this.type == 196 || this.type == 385 || this.type == 389 || this.type == 464 || this.type == 470 || this.type >= 524 && this.type <= 527) && this.velocity.Y == 0f && Math.Abs(this.position.X + (float)(this.width / 2) - (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2))) < 100f && Math.Abs(this.position.Y + (float)(this.height / 2) - (Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2))) < 50f && (this.direction > 0 && this.velocity.X >= 1f || this.direction < 0 && this.velocity.X <= -1f)) { this.velocity.X = this.velocity.X * 2f; if (this.velocity.X > 3f) { this.velocity.X = 3f; } if (this.velocity.X < -3f) { this.velocity.X = -3f; } this.velocity.Y = -4f; this.netUpdate = true; } if (this.type == 120 && this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 1.1f; } if (this.type == 287 && this.velocity.Y == 0f && Math.Abs(this.position.X + (float)(this.width / 2) - (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2))) < 150f && Math.Abs(this.position.Y + (float)(this.height / 2) - (Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2))) < 50f && (this.direction > 0 && this.velocity.X >= 1f || this.direction < 0 && this.velocity.X <= -1f)) { this.velocity.X = (float)(8 * this.direction); this.velocity.Y = -4f; this.netUpdate = true; } if (this.type == 287 && this.velocity.Y < 0f) { this.velocity.X = this.velocity.X * 1.2f; this.velocity.Y = this.velocity.Y * 1.1f; } if (this.type == 460 && this.velocity.Y < 0f) { this.velocity.X = this.velocity.X * 1.3f; this.velocity.Y = this.velocity.Y * 1.1f; } } else { this.ai[2] = this.ai[2] + 1f; this.ai[3] = 0f; if (this.ai[2] >= 60f) { if (!Main.bloodMoon && (this.type == 3 || this.type == 331 || this.type == 332 || this.type == 132 || this.type == 161 || this.type == 186 || this.type == 187 || this.type == 188 || this.type == 189 || this.type == 200 || this.type == 223 || this.type == 320 || this.type == 321 || this.type == 319)) { this.ai[1] = 0f; } this.velocity.X = 0.5f * (float)(-this.direction); int num98 = 5; if (Main.tile[x36, y34 - 1].type == 388) { num98 = 2; } this.ai[1] = this.ai[1] + (float)num98; if (this.type == 27) { this.ai[1] = this.ai[1] + 1f; } if (this.type == 31 || this.type == 294 || this.type == 295 || this.type == 296) { this.ai[1] = this.ai[1] + 6f; } this.ai[2] = 0f; bool flag29 = false; if (this.ai[1] >= 10f) { flag29 = true; this.ai[1] = 10f; } if (this.type == 460) { flag29 = true; } WorldGen.KillTile(x36, y34 - 1, true, false, false); if ((Main.netMode != 1 || !flag29) && flag29 && Main.netMode != 1) { if (this.type != 26) { if (Main.tile[x36, y34 - 1].type == 10) { bool flag30 = WorldGen.OpenDoor(x36, y34 - 1, this.direction); if (!flag30) { this.ai[3] = (float)num57; this.netUpdate = true; } if (Main.netMode == 2 && flag30) { NetMessage.SendData(19, -1, -1, "", 0, (float)x36, (float)(y34 - 1), (float)this.direction, 0, 0, 0); } } if (Main.tile[x36, y34 - 1].type == 388) { bool flag31 = WorldGen.ShiftTallGate(x36, y34 - 1, false); if (!flag31) { this.ai[3] = (float)num57; this.netUpdate = true; } if (Main.netMode == 2 && flag31) { NetMessage.SendData(19, -1, -1, "", 4, (float)x36, (float)(y34 - 1), 0f, 0, 0, 0); } } } else { WorldGen.KillTile(x36, y34 - 1, false, false, false); if (Main.netMode == 2) { NetMessage.SendData(17, -1, -1, "", 0, (float)x36, (float)(y34 - 1), 0f, 0, 0, 0); } } } } } } else if (flag11) { this.ai[1] = 0f; this.ai[2] = 0f; } if (Main.netMode != 1 && this.type == 120 && this.ai[3] >= (float)num57) { int x37 = (int)Main.player[this.target].position.X / 16; int y35 = (int)Main.player[this.target].position.Y / 16; int x38 = (int)this.position.X / 16; int y36 = (int)this.position.Y / 16; int num99 = 20; int num100 = 0; bool flag32 = false; if (Math.Abs(this.position.X - Main.player[this.target].position.X) + Math.Abs(this.position.Y - Main.player[this.target].position.Y) > 2000f) { num100 = 100; flag32 = true; } while (!flag32) { if (num100 >= 100) { return; } num100++; int num101 = Main.rand.Next(x37 - num99, x37 + num99); int num102 = Main.rand.Next(y35 - num99, y35 + num99); for (int r1 = num102; r1 < y35 + num99; r1++) { if ((r1 < y35 - 4 || r1 > y35 + 4 || num101 < x37 - 4 || num101 > x37 + 4) && (r1 < y36 - 1 || r1 > y36 + 1 || num101 < x38 - 1 || num101 > x38 + 1) && Main.tile[num101, r1].nactive()) { bool flag33 = true; if (this.type == 32 && Main.tile[num101, r1 - 1].wall == 0) { flag33 = false; } else if (Main.tile[num101, r1 - 1].lava()) { flag33 = false; } if (flag33 && Main.tileSolid[Main.tile[num101, r1].type] && !Collision.SolidTiles(num101 - 1, num101 + 1, r1 - 4, r1 - 1)) { this.position.X = (float)(num101 * 16 - this.width / 2); this.position.Y = (float)(r1 * 16 - this.height); this.netUpdate = true; this.ai[3] = -120f; } } } } } } else if (this.aiStyle == 4) { bool flag34 = false; if (Main.expertMode && (double)this.life < (double)this.lifeMax * 0.12) { flag34 = true; } bool flag35 = false; if (Main.expertMode && (double)this.life < (double)this.lifeMax * 0.04) { flag35 = true; } float single62 = 20f; if (flag35) { single62 = 10f; } if (this.target < 0 || this.target == 255 || Main.player[this.target].dead || !Main.player[this.target].active) { this.TargetClosest(true); } bool flag36 = Main.player[this.target].dead; float x39 = this.position.X + (float)(this.width / 2) - Main.player[this.target].position.X - (float)(Main.player[this.target].width / 2); float y37 = this.position.Y + (float)this.height - 59f - Main.player[this.target].position.Y - (float)(Main.player[this.target].height / 2); float single63 = (float)Math.Atan2((double)y37, (double)x39) + 1.57f; if (single63 < 0f) { single63 = single63 + 6.283f; } else if ((double)single63 > 6.283) { single63 = single63 - 6.283f; } float single64 = 0f; if (this.ai[0] == 0f && this.ai[1] == 0f) { single64 = 0.02f; } if (this.ai[0] == 0f && this.ai[1] == 2f && this.ai[2] > 40f) { single64 = 0.05f; } if (this.ai[0] == 3f && this.ai[1] == 0f) { single64 = 0.05f; } if (this.ai[0] == 3f && this.ai[1] == 2f && this.ai[2] > 40f) { single64 = 0.08f; } if (this.ai[0] == 3f && this.ai[1] == 4f && this.ai[2] > single62) { single64 = 0.15f; } if (this.ai[0] == 3f && this.ai[1] == 5f) { single64 = 0.05f; } if (Main.expertMode) { single64 = single64 * 1.5f; } if (flag35 && Main.expertMode) { single64 = 0f; } if (this.rotation < single63) { if ((double)(single63 - this.rotation) <= 3.1415) { NPC nPC31 = this; nPC31.rotation = nPC31.rotation + single64; } else { NPC nPC32 = this; nPC32.rotation = nPC32.rotation - single64; } } else if (this.rotation > single63) { if ((double)(this.rotation - single63) <= 3.1415) { NPC nPC33 = this; nPC33.rotation = nPC33.rotation - single64; } else { NPC nPC34 = this; nPC34.rotation = nPC34.rotation + single64; } } if (this.rotation > single63 - single64 && this.rotation < single63 + single64) { this.rotation = single63; } if (this.rotation < 0f) { NPC nPC35 = this; nPC35.rotation = nPC35.rotation + 6.283f; } else if ((double)this.rotation > 6.283) { NPC nPC36 = this; nPC36.rotation = nPC36.rotation - 6.283f; } if (this.rotation > single63 - single64 && this.rotation < single63 + single64) { this.rotation = single63; } if (Main.dayTime || flag36) { this.velocity.Y = this.velocity.Y - 0.04f; if (this.timeLeft > 10) { this.timeLeft = 10; return; } } else if (this.ai[0] == 0f) { if (this.ai[1] == 0f) { float single65 = 5f; float single66 = 0.04f; if (Main.expertMode) { single66 = 0.15f; single65 = 7f; } Vector2 vector234 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x41 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector234.X; float y38 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - 200f - vector234.Y; float single67 = (float)Math.Sqrt((double)(x41 * x41 + y38 * y38)); float single68 = single67; single67 = single65 / single67; x41 = x41 * single67; y38 = y38 * single67; if (this.velocity.X < x41) { this.velocity.X = this.velocity.X + single66; if (this.velocity.X < 0f && x41 > 0f) { this.velocity.X = this.velocity.X + single66; } } else if (this.velocity.X > x41) { this.velocity.X = this.velocity.X - single66; if (this.velocity.X > 0f && x41 < 0f) { this.velocity.X = this.velocity.X - single66; } } if (this.velocity.Y < y38) { this.velocity.Y = this.velocity.Y + single66; if (this.velocity.Y < 0f && y38 > 0f) { this.velocity.Y = this.velocity.Y + single66; } } else if (this.velocity.Y > y38) { this.velocity.Y = this.velocity.Y - single66; if (this.velocity.Y > 0f && y38 < 0f) { this.velocity.Y = this.velocity.Y - single66; } } this.ai[2] = this.ai[2] + 1f; float single69 = 600f; if (Main.expertMode) { single69 = single69 * 0.35f; } if (this.ai[2] >= single69) { this.ai[1] = 1f; this.ai[2] = 0f; this.ai[3] = 0f; this.target = 255; this.netUpdate = true; } else if (this.position.Y + (float)this.height < Main.player[this.target].position.Y && single68 < 500f || Main.expertMode && single68 < 500f) { if (!Main.player[this.target].dead) { this.ai[3] = this.ai[3] + 1f; } float single70 = 110f; if (Main.expertMode) { single70 = single70 * 0.4f; } if (this.ai[3] >= single70) { this.ai[3] = 0f; this.rotation = single63; float single71 = 5f; if (Main.expertMode) { single71 = 6f; } float x42 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector234.X; float y39 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector234.Y; float single72 = (float)Math.Sqrt((double)(x42 * x42 + y39 * y39)); single72 = single71 / single72; Vector2 vector235 = vector234; vector2.X = x42 * single72; vector2.Y = y39 * single72; vector235.X = vector235.X + vector2.X * 10f; vector235.Y = vector235.Y + vector2.Y * 10f; if (Main.netMode != 1) { int num106 = NPC.NewNPC((int)vector235.X, (int)vector235.Y, 5, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num106].velocity.X = vector2.X; Main.npc[num106].velocity.Y = vector2.Y; if (Main.netMode == 2 && num106 < 200) { NetMessage.SendData(23, -1, -1, "", num106, 0f, 0f, 0f, 0, 0, 0); } } } } } else if (this.ai[1] == 1f) { this.rotation = single63; float single73 = 6f; if (Main.expertMode) { single73 = 7f; } Vector2 vector236 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x43 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector236.X; float y40 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector236.Y; float single74 = (float)Math.Sqrt((double)(x43 * x43 + y40 * y40)); single74 = single73 / single74; this.velocity.X = x43 * single74; this.velocity.Y = y40 * single74; this.ai[1] = 2f; this.netUpdate = true; if (this.netSpam > 10) { this.netSpam = 10; } } else if (this.ai[1] == 2f) { this.ai[2] = this.ai[2] + 1f; if (this.ai[2] < 40f) { this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 1.57f; } else { NPC nPC37 = this; nPC37.velocity = nPC37.velocity * 0.98f; if (Main.expertMode) { NPC nPC38 = this; nPC38.velocity = nPC38.velocity * 0.985f; } if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1) { this.velocity.Y = 0f; } } int num107 = 150; if (Main.expertMode) { num107 = 100; } if (this.ai[2] >= (float)num107) { this.ai[3] = this.ai[3] + 1f; this.ai[2] = 0f; this.target = 255; this.rotation = single63; if (this.ai[3] < 3f) { this.ai[1] = 1f; } else { this.ai[1] = 0f; this.ai[3] = 0f; } } } float single75 = 0.5f; if (Main.expertMode) { single75 = 0.65f; } if ((float)this.life < (float)this.lifeMax * single75) { this.ai[0] = 1f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; if (this.netSpam > 10) { this.netSpam = 10; return; } } } else if (this.ai[0] == 1f || this.ai[0] == 2f) { if (this.ai[0] != 1f) { this.ai[2] = this.ai[2] - 0.005f; if (this.ai[2] < 0f) { this.ai[2] = 0f; } } else { this.ai[2] = this.ai[2] + 0.005f; if ((double)this.ai[2] > 0.5) { this.ai[2] = 0.5f; } } NPC nPC39 = this; nPC39.rotation = nPC39.rotation + this.ai[2]; this.ai[1] = this.ai[1] + 1f; if (Main.expertMode && this.ai[1] % 20f == 0f) { float single76 = 5f; Vector2 vector237 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float single77 = (float)Main.rand.Next(-200, 200); float single78 = (float)Main.rand.Next(-200, 200); float single79 = (float)Math.Sqrt((double)(single77 * single77 + single78 * single78)); single79 = single76 / single79; Vector2 vector238 = vector237; vector21.X = single77 * single79; vector21.Y = single78 * single79; vector238.X = vector238.X + vector21.X * 10f; vector238.Y = vector238.Y + vector21.Y * 10f; if (Main.netMode != 1) { int num108 = NPC.NewNPC((int)vector238.X, (int)vector238.Y, 5, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num108].velocity.X = vector21.X; Main.npc[num108].velocity.Y = vector21.Y; if (Main.netMode == 2 && num108 < 200) { NetMessage.SendData(23, -1, -1, "", num108, 0f, 0f, 0f, 0, 0, 0); } } } if (this.ai[1] == 100f) { this.ai[0] = this.ai[0] + 1f; this.ai[1] = 0f; if (this.ai[0] == 3f) { this.ai[2] = 0f; } } this.velocity.X = this.velocity.X * 0.98f; this.velocity.Y = this.velocity.Y * 0.98f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1) { this.velocity.Y = 0f; return; } } else { this.defense = 0; this.damage = (int)(23f * Main.expertDamage); if (Main.expertMode) { if (flag34) { this.defense = -15; } if (!flag35) { this.damage = (int)(18f * Main.expertDamage); } else { this.damage = (int)(20f * Main.expertDamage); this.defense = -30; } } if (this.ai[1] == 0f && flag34) { this.ai[1] = 5f; } if (this.ai[1] == 0f) { float single80 = 6f; float single81 = 0.07f; Vector2 vector241 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x44 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector241.X; float y41 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - 120f - vector241.Y; float single82 = (float)Math.Sqrt((double)(x44 * x44 + y41 * y41)); if (single82 > 400f && Main.expertMode) { single80 = single80 + 1f; single81 = single81 + 0.05f; if (single82 > 600f) { single80 = single80 + 1f; single81 = single81 + 0.05f; if (single82 > 800f) { single80 = single80 + 1f; single81 = single81 + 0.05f; } } } single82 = single80 / single82; x44 = x44 * single82; y41 = y41 * single82; if (this.velocity.X < x44) { this.velocity.X = this.velocity.X + single81; if (this.velocity.X < 0f && x44 > 0f) { this.velocity.X = this.velocity.X + single81; } } else if (this.velocity.X > x44) { this.velocity.X = this.velocity.X - single81; if (this.velocity.X > 0f && x44 < 0f) { this.velocity.X = this.velocity.X - single81; } } if (this.velocity.Y < y41) { this.velocity.Y = this.velocity.Y + single81; if (this.velocity.Y < 0f && y41 > 0f) { this.velocity.Y = this.velocity.Y + single81; } } else if (this.velocity.Y > y41) { this.velocity.Y = this.velocity.Y - single81; if (this.velocity.Y > 0f && y41 < 0f) { this.velocity.Y = this.velocity.Y - single81; } } this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= 200f) { this.ai[1] = 1f; this.ai[2] = 0f; this.ai[3] = 0f; if (Main.expertMode && (double)this.life < (double)this.lifeMax * 0.35) { this.ai[1] = 3f; } this.target = 255; this.netUpdate = true; } if (Main.expertMode && flag35) { this.TargetClosest(true); this.netUpdate = true; this.ai[1] = 3f; this.ai[2] = 0f; this.ai[3] = this.ai[3] - 1000f; } } else if (this.ai[1] == 1f) { this.rotation = single63; float single83 = 6.8f; if (Main.expertMode && this.ai[3] == 1f) { single83 = single83 * 1.15f; } if (Main.expertMode && this.ai[3] == 2f) { single83 = single83 * 1.3f; } Vector2 vector242 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x45 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector242.X; float y42 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector242.Y; float single84 = (float)Math.Sqrt((double)(x45 * x45 + y42 * y42)); single84 = single83 / single84; this.velocity.X = x45 * single84; this.velocity.Y = y42 * single84; this.ai[1] = 2f; this.netUpdate = true; if (this.netSpam > 10) { this.netSpam = 10; } } else if (this.ai[1] == 2f) { float single85 = 40f; this.ai[2] = this.ai[2] + 1f; if (Main.expertMode) { single85 = 50f; } if (this.ai[2] < single85) { this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 1.57f; } else { NPC nPC40 = this; nPC40.velocity = nPC40.velocity * 0.97f; if (Main.expertMode) { NPC nPC41 = this; nPC41.velocity = nPC41.velocity * 0.98f; } if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1) { this.velocity.Y = 0f; } } int num113 = 130; if (Main.expertMode) { num113 = 90; } if (this.ai[2] >= (float)num113) { this.ai[3] = this.ai[3] + 1f; this.ai[2] = 0f; this.target = 255; this.rotation = single63; if (this.ai[3] < 3f) { this.ai[1] = 1f; } else { this.ai[1] = 0f; this.ai[3] = 0f; if (Main.expertMode && Main.netMode != 1 && (double)this.life < (double)this.lifeMax * 0.5) { this.ai[1] = 3f; this.ai[3] = this.ai[3] + (float)Main.rand.Next(1, 4); } this.netUpdate = true; if (this.netSpam > 10) { this.netSpam = 10; } } } } else if (this.ai[1] == 3f) { if (this.ai[3] == 4f && flag34 && base.Center.Y > Main.player[this.target].Center.Y) { this.TargetClosest(true); this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; if (this.netSpam > 10) { this.netSpam = 10; } } else if (Main.netMode != 1) { this.TargetClosest(true); float single86 = 20f; Vector2 vector243 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x46 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector243.X; float y43 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector243.Y; float single87 = Math.Abs(Main.player[this.target].velocity.X) + Math.Abs(Main.player[this.target].velocity.Y) / 4f; single87 = single87 + (10f - single87); if (single87 < 5f) { single87 = 5f; } if (single87 > 15f) { single87 = 15f; } if (this.ai[2] == -1f && !flag35) { single87 = single87 * 4f; single86 = single86 * 1.3f; } if (flag35) { single87 = single87 * 2f; } x46 = x46 - Main.player[this.target].velocity.X * single87; y43 = y43 - Main.player[this.target].velocity.Y * single87 / 4f; x46 = x46 * (1f + (float)Main.rand.Next(-10, 11) * 0.01f); y43 = y43 * (1f + (float)Main.rand.Next(-10, 11) * 0.01f); if (flag35) { x46 = x46 * (1f + (float)Main.rand.Next(-10, 11) * 0.01f); y43 = y43 * (1f + (float)Main.rand.Next(-10, 11) * 0.01f); } float single88 = (float)Math.Sqrt((double)(x46 * x46 + y43 * y43)); float single89 = single88; single88 = single86 / single88; this.velocity.X = x46 * single88; this.velocity.Y = y43 * single88; this.velocity.X = this.velocity.X + (float)Main.rand.Next(-20, 21) * 0.1f; this.velocity.Y = this.velocity.Y + (float)Main.rand.Next(-20, 21) * 0.1f; if (flag35) { this.velocity.X = this.velocity.X + (float)Main.rand.Next(-50, 51) * 0.1f; this.velocity.Y = this.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.1f; float single90 = Math.Abs(this.velocity.X); float single91 = Math.Abs(this.velocity.Y); if (base.Center.X > Main.player[this.target].Center.X) { single91 = single91 * -1f; } if (base.Center.Y > Main.player[this.target].Center.Y) { single90 = single90 * -1f; } this.velocity.X = single91 + this.velocity.X; this.velocity.Y = single90 + this.velocity.Y; this.velocity.Normalize(); NPC nPC42 = this; nPC42.velocity = nPC42.velocity * single86; this.velocity.X = this.velocity.X + (float)Main.rand.Next(-20, 21) * 0.1f; this.velocity.Y = this.velocity.Y + (float)Main.rand.Next(-20, 21) * 0.1f; } else if (single89 < 100f) { if (Math.Abs(this.velocity.X) > Math.Abs(this.velocity.Y)) { float single92 = Math.Abs(this.velocity.X); float single93 = Math.Abs(this.velocity.Y); if (base.Center.X > Main.player[this.target].Center.X) { single93 = single93 * -1f; } if (base.Center.Y > Main.player[this.target].Center.Y) { single92 = single92 * -1f; } this.velocity.X = single93; this.velocity.Y = single92; } } else if (Math.Abs(this.velocity.X) > Math.Abs(this.velocity.Y)) { float single94 = (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) / 2f; float single95 = single94; if (base.Center.X > Main.player[this.target].Center.X) { single95 = single95 * -1f; } if (base.Center.Y > Main.player[this.target].Center.Y) { single94 = single94 * -1f; } this.velocity.X = single95; this.velocity.Y = single94; } this.ai[1] = 4f; this.netUpdate = true; if (this.netSpam > 10) { this.netSpam = 10; } } } else if (this.ai[1] == 4f) { float single96 = single62; this.ai[2] = this.ai[2] + 1f; if (this.ai[2] == single96 && Vector2.Distance(this.position, Main.player[this.target].position) < 200f) { this.ai[2] = this.ai[2] - 1f; } if (this.ai[2] < single96) { this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 1.57f; } else { NPC nPC43 = this; nPC43.velocity = nPC43.velocity * 0.95f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1) { this.velocity.Y = 0f; } } if (this.ai[2] >= single96 + 13f) { this.netUpdate = true; if (this.netSpam > 10) { this.netSpam = 10; } this.ai[3] = this.ai[3] + 1f; this.ai[2] = 0f; if (this.ai[3] < 5f) { this.ai[1] = 3f; } else { this.ai[1] = 0f; this.ai[3] = 0f; } } } else if (this.ai[1] == 5f) { float single97 = 600f; float single98 = 9f; float single99 = 0.3f; Vector2 vector244 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x47 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector244.X; float y44 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) + single97 - vector244.Y; float single100 = (float)Math.Sqrt((double)(x47 * x47 + y44 * y44)); single100 = single98 / single100; x47 = x47 * single100; y44 = y44 * single100; if (this.velocity.X < x47) { this.velocity.X = this.velocity.X + single99; if (this.velocity.X < 0f && x47 > 0f) { this.velocity.X = this.velocity.X + single99; } } else if (this.velocity.X > x47) { this.velocity.X = this.velocity.X - single99; if (this.velocity.X > 0f && x47 < 0f) { this.velocity.X = this.velocity.X - single99; } } if (this.velocity.Y < y44) { this.velocity.Y = this.velocity.Y + single99; if (this.velocity.Y < 0f && y44 > 0f) { this.velocity.Y = this.velocity.Y + single99; } } else if (this.velocity.Y > y44) { this.velocity.Y = this.velocity.Y - single99; if (this.velocity.Y > 0f && y44 < 0f) { this.velocity.Y = this.velocity.Y - single99; } } this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= 70f) { this.TargetClosest(true); this.ai[1] = 3f; this.ai[2] = -1f; this.ai[3] = (float)Main.rand.Next(-3, 1); this.netUpdate = true; } } if (flag35 && this.ai[1] == 5f) { this.ai[1] = 3f; return; } } } else if (this.aiStyle == 5) { if (this.target < 0 || this.target == 255 || Main.player[this.target].dead) { this.TargetClosest(true); } float single101 = 6f; float single102 = 0.05f; if (this.type == 6 || this.type == 173) { single101 = 4f; single102 = 0.02f; if (this.type == 6 && Main.expertMode) { single102 = 0.035f; } } else if (this.type == 94) { single101 = 4.2f; single102 = 0.022f; } else if (this.type == 252) { if (!Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { single102 = 0.01f; single101 = 2f; } else { single101 = 6f; single102 = 0.1f; } } else if (this.type == 42 || this.type >= 231 && this.type <= 235) { single101 = 3.5f; single102 = 0.021f; if (this.type == 231) { single101 = 3f; single102 = 0.017f; } single101 = single101 * (1f - this.scale); single102 = single102 * (1f - this.scale); } else if (this.type == 205) { single101 = 3.25f; single102 = 0.018f; } else if (this.type == 176) { single101 = 4f; single102 = 0.017f; } else if (this.type == 23) { single101 = 1f; single102 = 0.03f; } else if (this.type == 5) { single101 = 5f; single102 = 0.03f; } else if (this.type == 210 || this.type == 211) { this.localAI[0] = this.localAI[0] + 1f; float single103 = (this.localAI[0] - 60f) / 60f; if (single103 <= 1f) { if (this.velocity.X > 6f) { this.velocity.X = 6f; } if (this.velocity.X < -6f) { this.velocity.X = -6f; } if (this.velocity.Y > 6f) { this.velocity.Y = 6f; } if (this.velocity.Y < -6f) { this.velocity.Y = -6f; } } else { single103 = 1f; } single101 = 5f; single102 = 0.1f; single102 = single102 * single103; } Vector2 vector245 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x48 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2); float y45 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2); x48 = (float)((int)(x48 / 8f) * 8); y45 = (float)((int)(y45 / 8f) * 8); vector245.X = (float)((int)(vector245.X / 8f) * 8); vector245.Y = (float)((int)(vector245.Y / 8f) * 8); x48 = x48 - vector245.X; y45 = y45 - vector245.Y; float single104 = (float)Math.Sqrt((double)(x48 * x48 + y45 * y45)); float single105 = single104; bool flag37 = false; if (single104 > 600f) { flag37 = true; } if (single104 != 0f) { single104 = single101 / single104; x48 = x48 * single104; y45 = y45 * single104; } else { x48 = this.velocity.X; y45 = this.velocity.Y; } if (this.type == 6 || this.type == 42 || this.type == 94 || this.type == 139 || this.type == 173 || this.type == 176 || this.type == 205 || this.type == 210 || this.type == 211 || this.type >= 231 && this.type <= 235) { if (single105 > 100f || this.type == 42 || this.type == 94 || this.type == 176 || this.type == 210 || this.type == 211 || this.type >= 231 && this.type <= 235) { this.ai[0] = this.ai[0] + 1f; if (this.ai[0] <= 0f) { this.velocity.Y = this.velocity.Y - 0.023f; } else { this.velocity.Y = this.velocity.Y + 0.023f; } if (this.ai[0] < -100f || this.ai[0] > 100f) { this.velocity.X = this.velocity.X + 0.023f; } else { this.velocity.X = this.velocity.X - 0.023f; } if (this.ai[0] > 200f) { this.ai[0] = -200f; } } if (single105 < 150f && (this.type == 6 || this.type == 94 || this.type == 173)) { this.velocity.X = this.velocity.X + x48 * 0.007f; this.velocity.Y = this.velocity.Y + y45 * 0.007f; } } if (Main.player[this.target].dead) { x48 = (float)this.direction * single101 / 2f; y45 = -single101 / 2f; } if (this.velocity.X < x48) { this.velocity.X = this.velocity.X + single102; if (this.type != 173 && this.type != 6 && this.type != 42 && (this.type < 231 || this.type > 235) && this.type != 94 && this.type != 139 && this.velocity.X < 0f && x48 > 0f) { this.velocity.X = this.velocity.X + single102; } } else if (this.velocity.X > x48) { this.velocity.X = this.velocity.X - single102; if (this.type != 173 && this.type != 6 && this.type != 42 && (this.type < 231 || this.type > 235) && this.type != 94 && this.type != 139 && this.velocity.X > 0f && x48 < 0f) { this.velocity.X = this.velocity.X - single102; } } if (this.velocity.Y < y45) { this.velocity.Y = this.velocity.Y + single102; if (this.type != 173 && this.type != 6 && this.type != 42 && (this.type < 231 || this.type > 235) && this.type != 94 && this.type != 139 && this.velocity.Y < 0f && y45 > 0f) { this.velocity.Y = this.velocity.Y + single102; } } else if (this.velocity.Y > y45) { this.velocity.Y = this.velocity.Y - single102; if (this.type != 173 && this.type != 6 && this.type != 42 && (this.type < 231 || this.type > 235) && this.type != 94 && this.type != 139 && this.velocity.Y > 0f && y45 < 0f) { this.velocity.Y = this.velocity.Y - single102; } } if (this.type == 23) { if (x48 > 0f) { this.spriteDirection = 1; this.rotation = (float)Math.Atan2((double)y45, (double)x48); } else if (x48 < 0f) { this.spriteDirection = -1; this.rotation = (float)Math.Atan2((double)y45, (double)x48) + 3.14f; } } else if (this.type == 139) { this.localAI[0] = this.localAI[0] + 1f; if (this.justHit) { this.localAI[0] = 0f; } if (Main.netMode != 1 && this.localAI[0] >= 120f) { this.localAI[0] = 0f; if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { int num114 = 25; if (Main.expertMode) { num114 = 22; } int num115 = 84; Projectile.NewProjectile(vector245.X, vector245.Y, x48, y45, num115, num114, 0f, Main.myPlayer, 0f, 0f); } } int x49 = (int)this.position.X + this.width / 2; int y46 = (int)this.position.Y + this.height / 2; if (x48 > 0f) { this.spriteDirection = 1; this.rotation = (float)Math.Atan2((double)y45, (double)x48); } if (x48 < 0f) { this.spriteDirection = -1; this.rotation = (float)Math.Atan2((double)y45, (double)x48) + 3.14f; } } else if (this.type == 6 || this.type == 94 || this.type == 173) { this.rotation = (float)Math.Atan2((double)y45, (double)x48) - 1.57f; } else if (this.type == 42 || this.type == 176 || this.type == 205 || this.type >= 231 && this.type <= 235) { if (this.velocity.X > 0f) { this.spriteDirection = 1; } if (this.velocity.X < 0f) { this.spriteDirection = -1; } this.rotation = this.velocity.X * 0.1f; } else { this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 1.57f; } if (this.type == 6 || this.type == 23 || this.type == 42 || this.type == 94 || this.type == 139 || this.type == 173 || this.type == 176 || this.type == 205 || this.type == 210 || this.type == 211 || this.type >= 231 && this.type <= 235) { float single106 = 0.7f; if (this.type == 6 || this.type == 173) { single106 = 0.4f; } if (this.collideX) { this.netUpdate = true; this.velocity.X = this.oldVelocity.X * -single106; if (this.direction == -1 && this.velocity.X > 0f && this.velocity.X < 2f) { this.velocity.X = 2f; } if (this.direction == 1 && this.velocity.X < 0f && this.velocity.X > -2f) { this.velocity.X = -2f; } } if (this.collideY) { this.netUpdate = true; this.velocity.Y = this.oldVelocity.Y * -single106; if (this.velocity.Y > 0f && (double)this.velocity.Y < 1.5) { this.velocity.Y = 2f; } if (this.velocity.Y < 0f && (double)this.velocity.Y > -1.5) { this.velocity.Y = -2f; } } } if ((this.type == 6 || this.type == 94 || this.type == 173) && this.wet) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.95f; } this.velocity.Y = this.velocity.Y - 0.3f; if (this.velocity.Y < -2f) { this.velocity.Y = -2f; } } if (this.type == 205 && this.wet) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.95f; } this.velocity.Y = this.velocity.Y - 0.5f; if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } this.TargetClosest(true); } if (this.type == 42 || this.type == 176 || this.type >= 231 && this.type <= 235) { if (this.wet) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.95f; } this.velocity.Y = this.velocity.Y - 0.5f; if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } this.TargetClosest(true); } if (this.ai[1] == 101f) { this.ai[1] = 0f; } if (Main.netMode != 1) { this.ai[1] = this.ai[1] + (float)Main.rand.Next(5, 20) * 0.1f * this.scale; if (this.type == 176) { this.ai[1] = this.ai[1] + (float)Main.rand.Next(5, 20) * 0.1f * this.scale; } if (Main.player[this.target].stealth == 0f && Main.player[this.target].itemAnimation == 0) { this.ai[1] = 0f; } if (this.ai[1] >= 130f) { if (!Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.ai[1] = 0f; } else { float single107 = 8f; Vector2 vector248 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)(this.height / 2)); float x51 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector248.X + (float)Main.rand.Next(-20, 21); float y47 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector248.Y + (float)Main.rand.Next(-20, 21); if ((x51 >= 0f || this.velocity.X >= 0f) && (x51 <= 0f || this.velocity.X <= 0f)) { this.ai[1] = 0f; } else { float single108 = (float)Math.Sqrt((double)(x51 * x51 + y47 * y47)); single108 = single107 / single108; x51 = x51 * single108; y47 = y47 * single108; int num124 = (int)(10f * this.scale); if (this.type == 176) { num124 = (int)(30f * this.scale); } int num125 = 55; int num126 = Projectile.NewProjectile(vector248.X, vector248.Y, x51, y47, num125, num124, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num126].timeLeft = 300; this.ai[1] = 101f; this.netUpdate = true; } } } } } if (this.type == 139 && flag37) { if ((this.velocity.X <= 0f || x48 <= 0f) && (this.velocity.X >= 0f || x48 >= 0f)) { this.velocity.X = this.velocity.X * 0.9f; } else if (Math.Abs(this.velocity.X) < 12f) { this.velocity.X = this.velocity.X * 1.05f; } } if (Main.netMode != 1 && this.type == 94 && !Main.player[this.target].dead) { if (this.justHit) { this.localAI[0] = 0f; } this.localAI[0] = this.localAI[0] + 1f; if (this.localAI[0] == 180f) { if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { NPC.NewNPC((int)(this.position.X + (float)(this.width / 2) + this.velocity.X), (int)(this.position.Y + (float)(this.height / 2) + this.velocity.Y), 112, 0, 0f, 0f, 0f, 0f, 255); } this.localAI[0] = 0f; } } if (Main.dayTime && this.type != 173 && this.type != 6 && this.type != 23 && this.type != 42 && this.type != 94 && this.type != 176 && this.type != 205 && this.type != 210 && this.type != 211 && this.type != 252 && (this.type < 231 || this.type > 235) || Main.player[this.target].dead) { this.velocity.Y = this.velocity.Y - single102 * 2f; if (this.timeLeft > 10) { this.timeLeft = 10; } } if ((this.velocity.X > 0f && this.oldVelocity.X < 0f || this.velocity.X < 0f && this.oldVelocity.X > 0f || this.velocity.Y > 0f && this.oldVelocity.Y < 0f || this.velocity.Y < 0f && this.oldVelocity.Y > 0f) && !this.justHit) { this.netUpdate = true; return; } } else if (this.aiStyle == 6) { if (this.type == 117 && this.localAI[1] == 0f) { this.localAI[1] = 1f; int num127 = 1; if (this.velocity.X < 0f) { num127 = -1; } } if (this.type == 454 && this.localAI[3] == 0f) { this.localAI[3] = 1f; } if (this.type >= 454 && this.type <= 459) { this.dontTakeDamage = this.alpha > 0; if (this.type == 454 || this.type != 454 && Main.npc[(int)this.ai[1]].alpha < 85) { NPC nPC44 = this; nPC44.alpha = nPC44.alpha - 42; if (this.alpha < 0) { this.alpha = 0; } } } else if (this.type == 402 && this.ai[1] == 0f) { this.ai[1] = (float)Main.rand.Next(-2, 0); this.netUpdate = true; } if (Main.netMode != 1 && Main.expertMode) { if (this.type == 14 && (double)(this.position.Y / 16f) < Main.worldSurface) { if (Main.rand.Next(900) == 0) { this.TargetClosest(true); if (Collision.CanHitLine(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { NPC.NewNPC((int)(this.position.X + (float)(this.width / 2) + this.velocity.X), (int)(this.position.Y + (float)(this.height / 2) + this.velocity.Y), 112, 0, 0f, 0f, 0f, 0f, 255); } } } else if (this.type == 13) { int num131 = 90; num131 = num131 + (int)((float)this.life / (float)this.lifeMax * 60f * 5f); if (Main.rand.Next(num131) == 0) { this.TargetClosest(true); if (Collision.CanHitLine(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { NPC.NewNPC((int)(this.position.X + (float)(this.width / 2) + this.velocity.X), (int)(this.position.Y + (float)(this.height / 2) + this.velocity.Y), 112, 0, 0f, 0f, 0f, 0f, 255); } } } } if (this.type >= 13 && this.type <= 15) { this.realLife = -1; } else if (this.ai[3] > 0f) { this.realLife = (int)this.ai[3]; } if (this.target < 0 || this.target == 255 || Main.player[this.target].dead) { this.TargetClosest(true); } if (Main.player[this.target].dead && this.timeLeft > 300) { this.timeLeft = 300; } if (Main.netMode != 1) { if (this.type == 87 && this.ai[0] == 0f) { this.ai[3] = (float)this.whoAmI; this.realLife = this.whoAmI; int num132 = 0; int num133 = this.whoAmI; for (int y110 = 0; y110 < 14; y110++) { int num134 = 89; if (y110 == 1 || y110 == 8) { num134 = 88; } else if (y110 == 11) { num134 = 90; } else if (y110 == 12) { num134 = 91; } else if (y110 == 13) { num134 = 92; } num132 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), num134, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num132].ai[3] = (float)this.whoAmI; Main.npc[num132].realLife = this.whoAmI; Main.npc[num132].ai[1] = (float)num133; Main.npc[num133].ai[0] = (float)num132; NetMessage.SendData(23, -1, -1, "", num132, 0f, 0f, 0f, 0, 0, 0); num133 = num132; } } if (this.type == 454 && this.ai[0] == 0f) { this.ai[3] = (float)this.whoAmI; this.realLife = this.whoAmI; int num135 = 0; int num136 = this.whoAmI; for (int a1 = 0; a1 < 30; a1++) { int num137 = 456; if ((a1 - 2) % 4 == 0 && a1 < 26) { num137 = 455; } else if (a1 == 27) { num137 = 457; } else if (a1 == 28) { num137 = 458; } else if (a1 == 29) { num137 = 459; } num135 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), num137, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num135].ai[3] = (float)this.whoAmI; Main.npc[num135].realLife = this.whoAmI; Main.npc[num135].ai[1] = (float)num136; Main.npc[num136].ai[0] = (float)num135; NetMessage.SendData(23, -1, -1, "", num135, 0f, 0f, 0f, 0, 0, 0); num136 = num135; } } if (this.type == 513 && this.ai[0] == 0f) { this.ai[3] = (float)this.whoAmI; this.realLife = this.whoAmI; int num138 = 0; int num139 = this.whoAmI; int num140 = Main.rand.Next(6, 10); for (int b1 = 0; b1 < num140; b1++) { int num141 = 514; if (b1 == num140 - 1) { num141 = 515; } num138 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), num141, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num138].ai[3] = (float)this.whoAmI; Main.npc[num138].realLife = this.whoAmI; Main.npc[num138].ai[1] = (float)num139; Main.npc[num139].ai[0] = (float)num138; NetMessage.SendData(23, -1, -1, "", num138, 0f, 0f, 0f, 0, 0, 0); num139 = num138; } } if (this.type == 510 && this.ai[0] == 0f) { this.ai[3] = (float)this.whoAmI; this.realLife = this.whoAmI; int num142 = 0; int num143 = this.whoAmI; int num144 = Main.rand.Next(12, 21); for (int c1 = 0; c1 < num144; c1++) { int num145 = 511; if (c1 == num144 - 1) { num145 = 512; } num142 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), num145, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num142].ai[3] = (float)this.whoAmI; Main.npc[num142].realLife = this.whoAmI; Main.npc[num142].ai[1] = (float)num143; Main.npc[num143].ai[0] = (float)num142; NetMessage.SendData(23, -1, -1, "", num142, 0f, 0f, 0f, 0, 0, 0); num143 = num142; } } else if ((this.type == 7 || this.type == 8 || this.type == 10 || this.type == 11 || this.type == 13 || this.type == 14 || this.type == 39 || this.type == 40 || this.type == 95 || this.type == 96 || this.type == 98 || this.type == 99 || this.type == 117 || this.type == 118) && this.ai[0] == 0f) { if (this.type == 7 || this.type == 10 || this.type == 13 || this.type == 39 || this.type == 95 || this.type == 98 || this.type == 117) { if (this.type < 13 || this.type > 15) { this.ai[3] = (float)this.whoAmI; this.realLife = this.whoAmI; } this.ai[2] = (float)Main.rand.Next(8, 13); if (this.type == 10) { this.ai[2] = (float)Main.rand.Next(4, 7); } if (this.type == 13) { this.ai[2] = (float)Main.rand.Next(45, 56); if (Main.expertMode) { this.ai[2] = (float)((int)(this.ai[2] * 1.1f)); } } if (this.type == 39) { this.ai[2] = (float)Main.rand.Next(12, 19); } if (this.type == 95) { this.ai[2] = (float)Main.rand.Next(6, 12); } if (this.type == 98) { this.ai[2] = (float)Main.rand.Next(20, 26); } if (this.type == 117) { this.ai[2] = (float)Main.rand.Next(3, 6); } this.ai[0] = (float)NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), this.type + 1, this.whoAmI, 0f, 0f, 0f, 0f, 255); } else if ((this.type == 8 || this.type == 11 || this.type == 14 || this.type == 40 || this.type == 96 || this.type == 99 || this.type == 118) && this.ai[2] > 0f) { this.ai[0] = (float)NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), this.type, this.whoAmI, 0f, 0f, 0f, 0f, 255); } else { this.ai[0] = (float)NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), this.type + 1, this.whoAmI, 0f, 0f, 0f, 0f, 255); } if (this.type < 13 || this.type > 15) { Main.npc[(int)this.ai[0]].ai[3] = this.ai[3]; Main.npc[(int)this.ai[0]].realLife = this.realLife; } Main.npc[(int)this.ai[0]].ai[1] = (float)this.whoAmI; Main.npc[(int)this.ai[0]].ai[2] = this.ai[2] - 1f; this.netUpdate = true; } if (this.type == 412 && this.ai[0] == 0f) { this.ai[3] = (float)this.whoAmI; this.realLife = this.whoAmI; int num146 = 0; int num147 = this.whoAmI; int num148 = 30; for (int d1 = 0; d1 < num148; d1++) { int num149 = 413; if (d1 == num148 - 1) { num149 = 414; } num146 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), num149, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num146].ai[3] = (float)this.whoAmI; Main.npc[num146].realLife = this.whoAmI; Main.npc[num146].ai[1] = (float)num147; Main.npc[num147].ai[0] = (float)num146; NetMessage.SendData(23, -1, -1, "", num146, 0f, 0f, 0f, 0, 0, 0); num147 = num146; } } num6 = this.type; if (num6 <= 100) { switch (num6) { case 8: case 9: case 11: case 12: { break; } case 10: { goto Label6; } default: { switch (num6) { case 40: case 41: { break; } default: { switch (num6) { case 88: case 89: case 90: case 91: case 92: case 96: case 97: case 99: case 100: { break; } default: { goto Label6; } } break; } } break; } } } else if (num6 > 414) { switch (num6) { case 455: case 456: case 457: case 458: case 459: { break; } default: { switch (num6) { case 511: case 512: case 514: case 515: { break; } default: { goto Label6; } } break; } } } else { switch (num6) { case 118: case 119: { break; } default: { switch (num6) { case 413: case 414: { break; } default: { goto Label6; } } break; } } } if (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].aiStyle != this.aiStyle) { this.life = 0; this.HitEffect(0, 10); this.active = false; NetMessage.SendData(28, -1, -1, "", this.whoAmI, -1f, 0f, 0f, 0, 0, 0); } Label6: num6 = this.type; if (num6 <= 99) { switch (num6) { case 7: case 8: case 10: case 11: { break; } case 9: { goto Label7; } default: { switch (num6) { case 39: case 40: { break; } default: { switch (num6) { case 87: case 88: case 89: case 90: case 91: case 95: case 96: case 98: case 99: { break; } default: { goto Label7; } } break; } } break; } } } else if (num6 > 413) { switch (num6) { case 454: case 455: case 456: case 457: case 458: { break; } default: { switch (num6) { case 510: case 511: case 513: case 514: { break; } default: { goto Label7; } } break; } } } else { switch (num6) { case 117: case 118: { break; } default: { switch (num6) { case 412: case 413: { break; } default: { goto Label7; } } break; } } } if (!Main.npc[(int)this.ai[0]].active || Main.npc[(int)this.ai[0]].aiStyle != this.aiStyle) { this.life = 0; this.HitEffect(0, 10); this.active = false; NetMessage.SendData(28, -1, -1, "", this.whoAmI, -1f, 0f, 0f, 0, 0, 0); } Label7: if (this.type == 13 || this.type == 14 || this.type == 15) { if (!Main.npc[(int)this.ai[1]].active && !Main.npc[(int)this.ai[0]].active) { this.life = 0; this.HitEffect(0, 10); this.checkDead(); this.active = false; NetMessage.SendData(28, -1, -1, "", this.whoAmI, -1f, 0f, 0f, 0, 0, 0); } if (this.type == 13 && !Main.npc[(int)this.ai[0]].active) { this.life = 0; this.HitEffect(0, 10); this.checkDead(); this.active = false; NetMessage.SendData(28, -1, -1, "", this.whoAmI, -1f, 0f, 0f, 0, 0, 0); } if (this.type == 15 && !Main.npc[(int)this.ai[1]].active) { this.life = 0; this.HitEffect(0, 10); this.checkDead(); this.active = false; NetMessage.SendData(28, -1, -1, "", this.whoAmI, -1f, 0f, 0f, 0, 0, 0); } if (this.type == 14 && (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].aiStyle != this.aiStyle)) { this.type = 13; int num150 = this.whoAmI; float single110 = (float)this.life / (float)this.lifeMax; float single111 = this.ai[0]; this.SetDefaultsKeepPlayerInteraction(this.type); this.life = (int)((float)this.lifeMax * single110); this.ai[0] = single111; this.TargetClosest(true); this.netUpdate = true; this.whoAmI = num150; } if (this.type == 14 && (!Main.npc[(int)this.ai[0]].active || Main.npc[(int)this.ai[0]].aiStyle != this.aiStyle)) { int num151 = this.whoAmI; float single112 = (float)this.life / (float)this.lifeMax; float single113 = this.ai[1]; this.SetDefaultsKeepPlayerInteraction(this.type); this.life = (int)((float)this.lifeMax * single112); this.ai[1] = single113; this.TargetClosest(true); this.netUpdate = true; this.whoAmI = num151; } } if (!this.active && Main.netMode == 2) { NetMessage.SendData(28, -1, -1, "", this.whoAmI, -1f, 0f, 0f, 0, 0, 0); } } int x52 = (int)(this.position.X / 16f) - 1; int x53 = (int)((this.position.X + (float)this.width) / 16f) + 2; int y48 = (int)(this.position.Y / 16f) - 1; int y49 = (int)((this.position.Y + (float)this.height) / 16f) + 2; if (x52 < 0) { x52 = 0; } if (x53 > Main.maxTilesX) { x53 = Main.maxTilesX; } if (y48 < 0) { y48 = 0; } if (y49 > Main.maxTilesY) { y49 = Main.maxTilesY; } bool flag38 = false; if (this.type >= 87 && this.type <= 92) { flag38 = true; } if (this.type >= 454 && this.type <= 459) { flag38 = true; } if (this.type == 402 && this.ai[1] == -1f) { flag38 = true; } if (this.type >= 412 && this.type <= 414) { flag38 = true; } if (!flag38) { for (int e1 = x52; e1 < x53; e1++) { for (int f1 = y48; f1 < y49; f1++) { if (Main.tile[e1, f1] != null && (Main.tile[e1, f1].nactive() && (Main.tileSolid[Main.tile[e1, f1].type] || Main.tileSolidTop[Main.tile[e1, f1].type] && Main.tile[e1, f1].frameY == 0) || Main.tile[e1, f1].liquid > 64)) { vector22.X = (float)(e1 * 16); vector22.Y = (float)(f1 * 16); if (this.position.X + (float)this.width > vector22.X && this.position.X < vector22.X + 16f && this.position.Y + (float)this.height > vector22.Y && this.position.Y < vector22.Y + 16f) { flag38 = true; if (Main.rand.Next(100) == 0 && this.type != 117 && Main.tile[e1, f1].nactive()) { WorldGen.KillTile(e1, f1, true, true, false); } } } } } } if (!flag38 && (this.type == 7 || this.type == 10 || this.type == 13 || this.type == 39 || this.type == 95 || this.type == 98 || this.type == 117 || this.type == 375 || this.type == 454 || this.type == 510 || this.type == 513)) { Rectangle rectangle = new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height); int num152 = 1000; bool flag39 = true; for (int g1 = 0; g1 < 255; g1++) { if (Main.player[g1].active) { Rectangle rectangle1 = new Rectangle((int)Main.player[g1].position.X - num152, (int)Main.player[g1].position.Y - num152, num152 * 2, num152 * 2); if (rectangle.Intersects(rectangle1)) { flag39 = false; break; } } } if (flag39) { flag38 = true; } } if (this.type >= 87 && this.type <= 92 || this.type >= 454 && this.type <= 459) { if (this.velocity.X < 0f) { this.spriteDirection = 1; } else if (this.velocity.X > 0f) { this.spriteDirection = -1; } } if (this.type == 414) { if (this.justHit) { this.localAI[3] = 3f; } if (this.localAI[2] > 0f) { this.localAI[2] = this.localAI[2] - 16f; if (this.localAI[2] == 0f) { this.localAI[2] = -128f; } } else if (this.localAI[2] < 0f) { this.localAI[2] = this.localAI[2] + 16f; } else if (this.localAI[3] > 0f) { this.localAI[2] = 128f; this.localAI[3] = this.localAI[3] - 1f; } } float single114 = 8f; float single115 = 0.07f; if (this.type == 95) { single114 = 5.5f; single115 = 0.045f; } if (this.type == 10) { single114 = 6f; single115 = 0.05f; } if (this.type == 513) { single114 = 7f; single115 = 0.03f; } if (this.type == 13) { single114 = 10f; single115 = 0.07f; if (Main.expertMode) { single114 = 12f; single115 = 0.15f; } } if (this.type == 510) { single114 = 10f; single115 = 0.25f; } if (this.type == 87) { single114 = 11f; single115 = 0.25f; } if (this.type == 375) { single114 = 6f; single115 = 0.15f; } if (this.type == 454) { single114 = 20f; single115 = 0.55f; } if (this.type == 402) { single114 = 6f; single115 = 0.2f; } if (this.type == 117 && Main.wof >= 0) { float single116 = (float)((float)Main.npc[Main.wof].life / (float)Main.npc[Main.wof].lifeMax); if ((double)single116 < 0.5) { single114 = single114 + 1f; single115 = single115 + 0.1f; } if ((double)single116 < 0.25) { single114 = single114 + 1f; single115 = single115 + 0.1f; } if ((double)single116 < 0.1) { single114 = single114 + 2f; single115 = single115 + 0.1f; } } Vector2 y50 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x54 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2); float y51 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2); if (this.type == 412) { single114 = 10f; single115 = 0.3f; int num153 = -1; int x55 = (int)(Main.player[this.target].Center.X / 16f); int y52 = (int)(Main.player[this.target].Center.Y / 16f); for (int h1 = x55 - 2; h1 <= x55 + 2; h1++) { int num154 = y52; while (num154 <= y52 + 15) { if (!WorldGen.SolidTile2(h1, num154)) { num154++; } else { num153 = num154; break; } } if (num153 > 0) { break; } } if (num153 <= 0) { single114 = 14f; single115 = 0.5f; } else { num153 = num153 * 16; float single117 = (float)(num153 - 800); if (Main.player[this.target].position.Y > single117) { y51 = single117; if (Math.Abs(base.Center.X - Main.player[this.target].Center.X) < 500f) { x54 = (this.velocity.X <= 0f ? Main.player[this.target].Center.X - 600f : Main.player[this.target].Center.X + 600f); } } } float single118 = single114 * 1.3f; float single119 = single114 * 0.7f; float single120 = this.velocity.Length(); if (single120 > 0f) { if (single120 > single118) { this.velocity.Normalize(); NPC nPC45 = this; nPC45.velocity = nPC45.velocity * single118; } else if (single120 < single119) { this.velocity.Normalize(); NPC nPC46 = this; nPC46.velocity = nPC46.velocity * single119; } } if (num153 <= 0) { for (int i2 = 0; i2 < 200; i2++) { if (Main.npc[i2].active && Main.npc[i2].type == this.type && i2 != this.whoAmI) { Vector2 center19 = Main.npc[i2].Center - base.Center; if (center19.Length() < 60f) { center19.Normalize(); center19 = center19 * 200f; x54 = x54 - center19.X; y51 = y51 - center19.Y; } } } } else { for (int j2 = 0; j2 < 200; j2++) { if (Main.npc[j2].active && Main.npc[j2].type == this.type && j2 != this.whoAmI) { Vector2 center20 = Main.npc[j2].Center - base.Center; if (center20.Length() < 400f) { center20.Normalize(); center20 = center20 * 1000f; x54 = x54 - center20.X; y51 = y51 - center20.Y; } } } } } x54 = (float)((int)(x54 / 16f) * 16); y51 = (float)((int)(y51 / 16f) * 16); y50.X = (float)((int)(y50.X / 16f) * 16); y50.Y = (float)((int)(y50.Y / 16f) * 16); x54 = x54 - y50.X; y51 = y51 - y50.Y; if (this.type == 375) { x54 = x54 * -1f; y51 = y51 * -1f; } float single121 = (float)Math.Sqrt((double)(x54 * x54 + y51 * y51)); if (this.ai[1] <= 0f || this.ai[1] >= (float)((int)Main.npc.Length)) { if (flag38) { single121 = (float)Math.Sqrt((double)(x54 * x54 + y51 * y51)); float single123 = Math.Abs(x54); float single124 = Math.Abs(y51); float single125 = single114 / single121; x54 = x54 * single125; y51 = y51 * single125; bool flag40 = false; if ((this.type == 7 || this.type == 13) && !Main.player[this.target].ZoneCorrupt && !Main.player[this.target].ZoneCrimson) { flag40 = true; } if (this.type == 513 && (double)Main.player[this.target].position.Y < Main.worldSurface * 16) { flag40 = true; } if (this.type == 510 && (double)Main.player[this.target].position.Y < Main.worldSurface * 16) { flag40 = true; } if (flag40) { bool flag41 = true; for (int k2 = 0; k2 < 255; k2++) { if (Main.player[k2].active && !Main.player[k2].dead && Main.player[k2].ZoneCorrupt) { flag41 = false; } } if (flag41) { if (Main.netMode != 1 && (double)(this.position.Y / 16f) > (Main.rockLayer + (double)Main.maxTilesY) / 2) { this.active = false; for (int l2 = (int)this.ai[0]; l2 > 0 && l2 < 200 && Main.npc[l2].active && Main.npc[l2].aiStyle == this.aiStyle; l2 = num) { num = (int)Main.npc[l2].ai[0]; Main.npc[l2].active = false; this.life = 0; if (Main.netMode == 2) { NetMessage.SendData(23, -1, -1, "", l2, 0f, 0f, 0f, 0, 0, 0); } } if (Main.netMode == 2) { NetMessage.SendData(23, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } x54 = 0f; y51 = single114; } } bool flag42 = false; if (this.type == 87) { if ((this.velocity.X > 0f && x54 < 0f || this.velocity.X < 0f && x54 > 0f || this.velocity.Y > 0f && y51 < 0f || this.velocity.Y < 0f && y51 > 0f) && Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) > single115 / 2f && single121 < 300f) { flag42 = true; if (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) < single114) { NPC nPC47 = this; nPC47.velocity = nPC47.velocity * 1.1f; } } if (this.position.Y > Main.player[this.target].position.Y || (double)(Main.player[this.target].position.Y / 16f) > Main.worldSurface || Main.player[this.target].dead) { flag42 = true; if (Math.Abs(this.velocity.X) < single114 / 2f) { if (this.velocity.X == 0f) { this.velocity.X = this.velocity.X - (float)this.direction; } this.velocity.X = this.velocity.X * 1.1f; } else if (this.velocity.Y > -single114) { this.velocity.Y = this.velocity.Y - single115; } } } if (this.type == 454) { if ((this.velocity.X > 0f && x54 < 0f || this.velocity.X < 0f && x54 > 0f || this.velocity.Y > 0f && y51 < 0f || this.velocity.Y < 0f && y51 > 0f) && Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) > single115 / 2f && single121 < 300f) { flag42 = true; if (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) < single114) { NPC nPC48 = this; nPC48.velocity = nPC48.velocity * 1.1f; } } if (this.position.Y > Main.player[this.target].position.Y || Main.player[this.target].dead) { flag42 = true; if (Math.Abs(this.velocity.X) < single114 / 2f) { if (this.velocity.X == 0f) { this.velocity.X = this.velocity.X - (float)this.direction; } this.velocity.X = this.velocity.X * 1.1f; } else if (this.velocity.Y > -single114) { this.velocity.Y = this.velocity.Y - single115; } } } if (!flag42) { if (this.velocity.X > 0f && x54 > 0f || this.velocity.X < 0f && x54 < 0f || this.velocity.Y > 0f && y51 > 0f || this.velocity.Y < 0f && y51 < 0f) { if (this.velocity.X < x54) { this.velocity.X = this.velocity.X + single115; } else if (this.velocity.X > x54) { this.velocity.X = this.velocity.X - single115; } if (this.velocity.Y < y51) { this.velocity.Y = this.velocity.Y + single115; } else if (this.velocity.Y > y51) { this.velocity.Y = this.velocity.Y - single115; } if ((double)Math.Abs(y51) < (double)single114 * 0.2 && (this.velocity.X > 0f && x54 < 0f || this.velocity.X < 0f && x54 > 0f)) { if (this.velocity.Y <= 0f) { this.velocity.Y = this.velocity.Y - single115 * 2f; } else { this.velocity.Y = this.velocity.Y + single115 * 2f; } } if ((double)Math.Abs(x54) < (double)single114 * 0.2 && (this.velocity.Y > 0f && y51 < 0f || this.velocity.Y < 0f && y51 > 0f)) { if (this.velocity.X <= 0f) { this.velocity.X = this.velocity.X - single115 * 2f; } else { this.velocity.X = this.velocity.X + single115 * 2f; } } } else if (single123 <= single124) { if (this.velocity.Y < y51) { this.velocity.Y = this.velocity.Y + single115 * 1.1f; } else if (this.velocity.Y > y51) { this.velocity.Y = this.velocity.Y - single115 * 1.1f; } if ((double)(Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) < (double)single114 * 0.5) { if (this.velocity.X <= 0f) { this.velocity.X = this.velocity.X - single115; } else { this.velocity.X = this.velocity.X + single115; } } } else { if (this.velocity.X < x54) { this.velocity.X = this.velocity.X + single115 * 1.1f; } else if (this.velocity.X > x54) { this.velocity.X = this.velocity.X - single115 * 1.1f; } if ((double)(Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) < (double)single114 * 0.5) { if (this.velocity.Y <= 0f) { this.velocity.Y = this.velocity.Y - single115; } else { this.velocity.Y = this.velocity.Y + single115; } } } } } else { this.TargetClosest(true); this.velocity.Y = this.velocity.Y + 0.11f; if (this.velocity.Y > single114) { this.velocity.Y = single114; } if ((double)(Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) < (double)single114 * 0.4) { if (this.velocity.X >= 0f) { this.velocity.X = this.velocity.X + single115 * 1.1f; } else { this.velocity.X = this.velocity.X - single115 * 1.1f; } } else if (this.velocity.Y != single114) { if (this.velocity.Y > 4f) { if (this.velocity.X >= 0f) { this.velocity.X = this.velocity.X - single115 * 0.9f; } else { this.velocity.X = this.velocity.X + single115 * 0.9f; } } } else if (this.velocity.X < x54) { this.velocity.X = this.velocity.X + single115; } else if (this.velocity.X > x54) { this.velocity.X = this.velocity.X - single115; } } this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f; if (this.type == 7 || this.type == 10 || this.type == 13 || this.type == 39 || this.type == 95 || this.type == 98 || this.type == 117 || this.type == 510 || this.type == 513) { if (!flag38) { if (this.localAI[0] != 0f) { this.netUpdate = true; } this.localAI[0] = 0f; } else { if (this.localAI[0] != 1f) { this.netUpdate = true; } this.localAI[0] = 1f; } if ((this.velocity.X > 0f && this.oldVelocity.X < 0f || this.velocity.X < 0f && this.oldVelocity.X > 0f || this.velocity.Y > 0f && this.oldVelocity.Y < 0f || this.velocity.Y < 0f && this.oldVelocity.Y > 0f) && !this.justHit) { this.netUpdate = true; } } if (this.type == 454) { float single126 = Vector2.Distance(Main.player[this.target].Center, base.Center); int num155 = 0; if (Vector2.Normalize(Main.player[this.target].Center - base.Center).ToRotation().AngleTowards(this.velocity.ToRotation(), 1.57079637f) == this.velocity.ToRotation() && single126 < 350f) { num155 = 4; } if ((double)num155 > this.frameCounter) { NPC nPC49 = this; nPC49.frameCounter = nPC49.frameCounter + 1; } if ((double)num155 < this.frameCounter) { NPC nPC50 = this; nPC50.frameCounter = nPC50.frameCounter - 1; } if (this.frameCounter < 0) { this.frameCounter = 0; } if (this.frameCounter > 4) { this.frameCounter = 4; return; } } } else { try { y50 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); x54 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - y50.X; y51 = Main.npc[(int)this.ai[1]].position.Y + (float)(Main.npc[(int)this.ai[1]].height / 2) - y50.Y; } catch (Exception ex) { #if DEBUG Console.WriteLine(ex); System.Diagnostics.Debugger.Break(); #endif } this.rotation = (float)Math.Atan2((double)y51, (double)x54) + 1.57f; single121 = (float)Math.Sqrt((double)(x54 * x54 + y51 * y51)); int num156 = this.width; if (this.type >= 87 && this.type <= 92) { num156 = 42; } if (this.type >= 454 && this.type <= 459) { num156 = 36; } if (this.type >= 13 && this.type <= 15) { num156 = (int)((float)num156 * this.scale); } if (this.type >= 412 && this.type <= 414) { num156 = num156 + 6; } single121 = (single121 - (float)num156) / single121; x54 = x54 * single121; y51 = y51 * single121; this.velocity = Vector2.Zero; this.position.X = this.position.X + x54; this.position.Y = this.position.Y + y51; if (this.type >= 87 && this.type <= 92) { if (x54 < 0f) { this.spriteDirection = 1; } else if (x54 > 0f) { this.spriteDirection = -1; } } if (this.type >= 454 && this.type <= 459) { if (x54 < 0f) { this.spriteDirection = 1; return; } if (x54 > 0f) { this.spriteDirection = -1; return; } } } } else if (this.aiStyle == 7) { bool flag43 = Main.raining; if (!Main.dayTime) { flag43 = true; } if (Main.eclipse) { flag43 = true; } if (Main.slimeRain) { flag43 = true; } if (!Main.expertMode) { this.defense = (this.dryadWard ? this.defDefense : this.defDefense + 6); } else { this.defense = (this.dryadWard ? this.defDefense : this.defDefense + 10); } float single127 = 1f; if (this.townNPC || this.type == 453) { if (NPC.downedBoss1) { single127 = single127 + 0.1f; NPC nPC51 = this; nPC51.defense = nPC51.defense + 3; } if (NPC.downedBoss2) { single127 = single127 + 0.1f; NPC nPC52 = this; nPC52.defense = nPC52.defense + 3; } if (NPC.downedBoss3) { single127 = single127 + 0.1f; NPC nPC53 = this; nPC53.defense = nPC53.defense + 3; } if (NPC.downedQueenBee) { single127 = single127 + 0.1f; NPC nPC54 = this; nPC54.defense = nPC54.defense + 3; } if (Main.hardMode) { single127 = single127 + 0.4f; NPC nPC55 = this; nPC55.defense = nPC55.defense + 12; } if (NPC.downedMechBoss1) { single127 = single127 + 0.15f; NPC nPC56 = this; nPC56.defense = nPC56.defense + 6; } if (NPC.downedMechBoss2) { single127 = single127 + 0.15f; NPC nPC57 = this; nPC57.defense = nPC57.defense + 6; } if (NPC.downedMechBoss3) { single127 = single127 + 0.15f; NPC nPC58 = this; nPC58.defense = nPC58.defense + 6; } if (NPC.downedPlantBoss) { single127 = single127 + 0.15f; NPC nPC59 = this; nPC59.defense = nPC59.defense + 8; } if (NPC.downedGolemBoss) { single127 = single127 + 0.15f; NPC nPC60 = this; nPC60.defense = nPC60.defense + 8; } if (NPC.downedAncientCultist) { single127 = single127 + 0.15f; NPC nPC61 = this; nPC61.defense = nPC61.defense + 8; } } if (this.type == 142 && Main.netMode != 1 && !Main.xMas) { this.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); if (Main.netMode == 2) { NetMessage.SendData(28, -1, -1, "", this.whoAmI, 9999f, 0f, 0f, 0, 0, 0); } } if ((this.type == 148 || this.type == 149) && this.localAI[0] == 0f) { this.localAI[0] = (float)Main.rand.Next(1, 5); } if (this.type == 124) { bool flag44 = false; int num157 = 0; while (num157 < 1000) { if (!Main.projectile[num157].active || Main.projectile[num157].type != 582 || Main.projectile[num157].ai[1] != (float)this.whoAmI) { num157++; } else { flag44 = true; break; } } this.localAI[0] = (float)flag44.ToInt(); } if ((this.type == 362 || this.type == 364) && Main.netMode != 1 && (this.velocity.Y > 4f || this.velocity.Y < -4f || this.wet)) { int num158 = this.direction; this.Transform(this.type + 1); this.TargetClosest(true); this.direction = num158; this.netUpdate = true; return; } num6 = this.type; if (num6 <= 124) { switch (num6) { case 107: { NPC.savedGoblin = true; break; } case 108: { NPC.savedWizard = true; break; } default: { if (num6 == 124) { NPC.savedMech = true; break; } else { break; } } } } else if (num6 == 353) { NPC.savedStylist = true; } else if (num6 == 369) { NPC.savedAngler = true; } else if (num6 == 441) { NPC.savedTaxCollector = true; } if (this.type >= 0 && this.type < 540 && NPCID.Sets.TownCritter[this.type] && this.target == 255) { this.TargetClosest(true); if (this.position.X < Main.player[this.target].position.X) { this.direction = 1; this.spriteDirection = this.direction; } if (this.position.X > Main.player[this.target].position.X) { this.direction = -1; this.spriteDirection = this.direction; } if (this.homeTileX == -1) { this.homeTileX = (int)((this.position.X + (float)(this.width / 2)) / 16f); } } else if (this.homeTileX == -1 && this.homeTileY == -1 && this.velocity.Y == 0f) { this.homeTileX = (int)base.Center.X / 16; this.homeTileY = (int)(this.position.Y + (float)this.height + 4f) / 16; } bool flag45 = false; int num159 = this.homeTileY; if (this.type == 441) { NPC.taxCollector = true; } this.directionY = -1; if (this.direction == 0) { this.direction = 1; } for (int m2 = 0; m2 < 255; m2++) { if (Main.player[m2].active && Main.player[m2].talkNPC == this.whoAmI) { flag45 = true; if (this.ai[0] != 0f) { this.netUpdate = true; } this.ai[0] = 0f; this.ai[1] = 300f; this.localAI[3] = 100f; if (Main.player[m2].position.X + (float)(Main.player[m2].width / 2) >= this.position.X + (float)(this.width / 2)) { this.direction = 1; } else { this.direction = -1; } } } if (this.ai[3] == 1f) { this.life = -1; this.HitEffect(0, 10); this.active = false; this.netUpdate = true; return; } if (this.type == 37 && Main.netMode != 1) { this.homeless = false; this.homeTileX = Main.dungeonX; this.homeTileY = Main.dungeonY; if (NPC.downedBoss3) { this.ai[3] = 1f; this.netUpdate = true; } } if (Main.netMode != 1 && this.homeTileY > 0) { while (!WorldGen.SolidTile(this.homeTileX, num159) && num159 < Main.maxTilesY - 20) { num159++; } } if (this.type == 368) { this.homeless = true; if (!Main.dayTime) { this.homeTileX = (int)(base.Center.X / 16f); this.homeTileY = (int)(this.position.Y + (float)this.height + 2f) / 16; if (!flag45) { this.ai[0] = 1f; this.ai[1] = 200f; } flag43 = false; } } if (this.type == 369 && this.homeless && this.wet) { if (base.Center.X / 16f < 380f || base.Center.X / 16f > (float)(Main.maxTilesX - 380)) { this.homeTileX = Main.spawnTileX; this.homeTileY = Main.spawnTileY; this.ai[0] = 1f; this.ai[1] = 200f; } if (this.position.X / 16f < 200f) { this.direction = 1; } else if (this.position.X / 16f > (float)(Main.maxTilesX - 200)) { this.direction = -1; } } int x56 = (int)(this.position.X + (float)(this.width / 2)) / 16; int y53 = (int)(this.position.Y + (float)this.height + 1f) / 16; if (!WorldGen.InWorld(x56, y53, 0) || Main.tile[x56, y53] == null) { return; } if (!this.homeless && Main.netMode != 1 && this.townNPC && (flag43 || Main.tileDungeon[Main.tile[x56, y53].type]) && (x56 != this.homeTileX || y53 != num159)) { bool flag46 = true; for (int n2 = 0; n2 < 2; n2++) { Rectangle rectangle2 = new Rectangle((int)(this.position.X + (float)(this.width / 2) - (float)(NPC.sWidth / 2) - (float)NPC.safeRangeX), (int)(this.position.Y + (float)(this.height / 2) - (float)(NPC.sHeight / 2) - (float)NPC.safeRangeY), NPC.sWidth + NPC.safeRangeX * 2, NPC.sHeight + NPC.safeRangeY * 2); if (n2 == 1) { rectangle2 = new Rectangle(this.homeTileX * 16 + 8 - NPC.sWidth / 2 - NPC.safeRangeX, num159 * 16 + 8 - NPC.sHeight / 2 - NPC.safeRangeY, NPC.sWidth + NPC.safeRangeX * 2, NPC.sHeight + NPC.safeRangeY * 2); } for (int o2 = 0; o2 < 255; o2++) { if (Main.player[o2].active) { Rectangle rectangle3 = new Rectangle((int)Main.player[o2].position.X, (int)Main.player[o2].position.Y, Main.player[o2].width, Main.player[o2].height); if (rectangle3.Intersects(rectangle2)) { flag46 = false; break; } } if (!flag46) { break; } } } if (flag46) { if (this.type == 37 || !Collision.SolidTiles(this.homeTileX - 1, this.homeTileX + 1, num159 - 3, num159 - 1)) { this.velocity.X = 0f; this.velocity.Y = 0f; this.position.X = (float)(this.homeTileX * 16 + 8 - this.width / 2); this.position.Y = (float)(num159 * 16 - this.height) - 0.1f; this.netUpdate = true; } else { this.homeless = true; WorldGen.QuickFindHome(this.whoAmI); } } } bool flag47 = (this.type == 300 ? true : this.type == 447); float dangerDetectRange = 200f; if (NPCID.Sets.DangerDetectRange[this.type] != -1) { dangerDetectRange = (float)NPCID.Sets.DangerDetectRange[this.type]; } bool flag48 = false; bool flag49 = false; float single128 = -1f; float single129 = -1f; int num160 = 0; int num161 = -1; int num162 = -1; if (Main.netMode != 1 && !flag45) { for (int p2 = 0; p2 < 200; p2++) { if (Main.npc[p2].active && !Main.npc[p2].friendly && Main.npc[p2].damage > 0 && Main.npc[p2].Distance(base.Center) < dangerDetectRange && (this.type != 453 || !NPCID.Sets.Skeletons.Contains(Main.npc[p2].netID))) { flag48 = true; float x57 = Main.npc[p2].Center.X - base.Center.X; if (x57 < 0f && (single128 == -1f || x57 > single128)) { single128 = x57; num161 = p2; } if (x57 > 0f && (single129 == -1f || x57 < single129)) { single129 = x57; num162 = p2; } } } if (flag48) { if (single128 != -1f) { num160 = (single129 != -1f ? (single129 < -single128).ToDirectionInt() : -1); } else { num160 = 1; } float single130 = 0f; if (single128 != -1f) { single130 = -single128; } if (single130 == 0f || single129 < single130 && single129 > 0f) { single130 = single129; } if (this.ai[0] == 8f) { if (this.direction == -num160) { this.ai[0] = 1f; this.ai[1] = (float)(300 + Main.rand.Next(300)); this.ai[2] = 0f; this.localAI[3] = 0f; this.netUpdate = true; } } else if (this.ai[0] != 10f && this.ai[0] != 12f && this.ai[0] != 13f && this.ai[0] != 14f && this.ai[0] != 15f) { if (NPCID.Sets.PrettySafe[this.type] != -1 && (float)NPCID.Sets.PrettySafe[this.type] < single130) { flag48 = false; flag49 = true; } else if (this.ai[0] != 1f) { if ((this.ai[0] == 3f || this.ai[0] == 4f || this.ai[0] == 16f ? true : this.ai[0] == 17f)) { NPC nPC62 = Main.npc[(int)this.ai[2]]; if (nPC62.active) { nPC62.ai[0] = 1f; nPC62.ai[1] = (float)(120 + Main.rand.Next(120)); nPC62.ai[2] = 0f; nPC62.localAI[3] = 0f; nPC62.direction = -num160; nPC62.netUpdate = true; } } this.ai[0] = 1f; this.ai[1] = (float)(120 + Main.rand.Next(120)); this.ai[2] = 0f; this.localAI[3] = 0f; this.direction = -num160; this.netUpdate = true; } else if (this.ai[0] == 1f && this.direction != -num160) { this.direction = -num160; this.netUpdate = true; } } } } if (this.ai[0] == 0f) { if (this.localAI[3] > 0f) { this.localAI[3] = this.localAI[3] - 1f; } if (!flag43 || flag45 || NPCID.Sets.TownCritter[this.type]) { if (flag47) { this.velocity.X = this.velocity.X * 0.5f; } if (this.velocity.X > 0.1f) { this.velocity.X = this.velocity.X - 0.1f; } else if (this.velocity.X >= -0.1f) { this.velocity.X = 0f; } else { this.velocity.X = this.velocity.X + 0.1f; } if (Main.netMode != 1) { if (this.ai[1] > 0f) { this.ai[1] = this.ai[1] - 1f; } if (this.ai[1] <= 0f) { this.ai[0] = 1f; this.ai[1] = (float)(200 + Main.rand.Next(300)); this.ai[2] = 0f; if (NPCID.Sets.TownCritter[this.type]) { this.ai[1] = this.ai[1] + (float)Main.rand.Next(200, 400); } this.localAI[3] = 0f; this.netUpdate = true; } } } else if (Main.netMode != 1) { if (x56 != this.homeTileX || y53 != num159) { if (x56 <= this.homeTileX) { this.direction = 1; } else { this.direction = -1; } this.ai[0] = 1f; this.ai[1] = (float)(200 + Main.rand.Next(200)); this.ai[2] = 0f; this.localAI[3] = 0f; this.netUpdate = true; } else { if (this.velocity.X != 0f) { this.netUpdate = true; } if (this.velocity.X > 0.1f) { this.velocity.X = this.velocity.X - 0.1f; } else if (this.velocity.X >= -0.1f) { this.velocity.X = 0f; } else { this.velocity.X = this.velocity.X + 0.1f; } } } if (Main.netMode != 1 && (!flag43 || x56 == this.homeTileX && y53 == num159)) { if (x56 >= this.homeTileX - 25 && x56 <= this.homeTileX + 25) { if (Main.rand.Next(80) == 0 && this.localAI[3] == 0f) { this.localAI[3] = 200f; NPC nPC63 = this; nPC63.direction = nPC63.direction * -1; this.netUpdate = true; } } else if (this.localAI[3] == 0f) { if (x56 < this.homeTileX - 50 && this.direction == -1) { this.direction = 1; this.netUpdate = true; } else if (x56 > this.homeTileX + 50 && this.direction == 1) { this.direction = -1; this.netUpdate = true; } } } } else if (this.ai[0] == 1f) { if (Main.netMode == 1 || !flag43 || x56 != this.homeTileX || y53 != this.homeTileY || NPCID.Sets.TownCritter[this.type]) { bool flag50 = Collision.DrownCollision(this.position, this.width, this.height, 1f); if (!flag50) { if (Main.netMode != 1 && !this.homeless && !Main.tileDungeon[Main.tile[x56, y53].type] && (x56 < this.homeTileX - 35 || x56 > this.homeTileX + 35)) { if (this.position.X < (float)(this.homeTileX * 16) && this.direction == -1) { this.ai[1] = this.ai[1] - 5f; } else if (this.position.X > (float)(this.homeTileX * 16) && this.direction == 1) { this.ai[1] = this.ai[1] - 5f; } } this.ai[1] = this.ai[1] - 1f; } if (this.ai[1] <= 0f) { this.ai[0] = 0f; this.ai[1] = (float)(300 + Main.rand.Next(300)); this.ai[2] = 0f; if (!NPCID.Sets.TownCritter[this.type]) { this.ai[1] = this.ai[1] + (float)Main.rand.Next(900); } else { this.ai[1] = this.ai[1] - (float)Main.rand.Next(100); } this.localAI[3] = 60f; this.netUpdate = true; } if (this.closeDoor && ((this.position.X + (float)(this.width / 2)) / 16f > (float)(this.doorX + 2) || (this.position.X + (float)(this.width / 2)) / 16f < (float)(this.doorX - 2))) { Tile tileSafely = Framing.GetTileSafely(this.doorX, this.doorY); if (tileSafely.type == 11) { if (WorldGen.CloseDoor(this.doorX, this.doorY, false)) { this.closeDoor = false; NetMessage.SendData(19, -1, -1, "", 1, (float)this.doorX, (float)this.doorY, (float)this.direction, 0, 0, 0); } if ((this.position.X + (float)(this.width / 2)) / 16f > (float)(this.doorX + 4) || (this.position.X + (float)(this.width / 2)) / 16f < (float)(this.doorX - 4) || (this.position.Y + (float)(this.height / 2)) / 16f > (float)(this.doorY + 4) || (this.position.Y + (float)(this.height / 2)) / 16f < (float)(this.doorY - 4)) { this.closeDoor = false; } } else if (tileSafely.type != 389) { this.closeDoor = false; } else { if (WorldGen.ShiftTallGate(this.doorX, this.doorY, true)) { this.closeDoor = false; NetMessage.SendData(19, -1, -1, "", 5, (float)this.doorX, (float)this.doorY, 0f, 0, 0, 0); } if ((this.position.X + (float)(this.width / 2)) / 16f > (float)(this.doorX + 4) || (this.position.X + (float)(this.width / 2)) / 16f < (float)(this.doorX - 4) || (this.position.Y + (float)(this.height / 2)) / 16f > (float)(this.doorY + 4) || (this.position.Y + (float)(this.height / 2)) / 16f < (float)(this.doorY - 4)) { this.closeDoor = false; } } } float single131 = 1f; float single132 = 0.07f; if (this.type == 299 || this.type == 539 || this.type == 538) { single131 = 1.5f; } if (flag47) { single131 = 2f; single132 = 1f; } if (this.friendly && (flag48 || flag50)) { single131 = 1.5f; float single133 = 1f - (float)this.life / (float)this.lifeMax; single131 = single131 + single133 * 0.9f; single132 = 0.1f; } if (this.velocity.X < -single131 || this.velocity.X > single131) { if (this.velocity.Y == 0f) { NPC nPC64 = this; nPC64.velocity = nPC64.velocity * 0.8f; } } else if (this.velocity.X < single131 && this.direction == 1) { this.velocity.X = this.velocity.X + single132; if (this.velocity.X > single131) { this.velocity.X = single131; } } else if (this.velocity.X > -single131 && this.direction == -1) { this.velocity.X = this.velocity.X - single132; if (this.velocity.X > single131) { this.velocity.X = single131; } } bool flag51 = true; if ((float)(this.homeTileY * 16 - 32) > this.position.Y) { flag51 = false; } if (this.direction == 1 && this.position.Y + (float)(this.width / 2) > (float)(this.homeTileX * 16) || this.direction == -1 && this.position.Y + (float)(this.width / 2) < (float)(this.homeTileX * 16)) { flag51 = true; } if (this.velocity.Y == 0f) { Collision.StepDown(ref this.position, ref this.velocity, this.width, this.height, ref this.stepSpeed, ref this.gfxOffY, 1, false); } if (this.velocity.Y >= 0f) { Collision.StepUp(ref this.position, ref this.velocity, this.width, this.height, ref this.stepSpeed, ref this.gfxOffY, 1, flag51, 1); } if (this.velocity.Y == 0f) { int x58 = (int)((this.position.X + (float)(this.width / 2) + (float)(15 * this.direction)) / 16f); int y54 = (int)((this.position.Y + (float)this.height - 16f) / 16f); bool flag52 = false; bool flag53 = true; if (this.townNPC && this.ai[1] < 30f) { flag52 = !Utils.PlotTileLine(base.Top, base.Bottom, (float)this.width, new Utils.PerLinePoint(DelegateMethods.SearchAvoidedByNPCs)); if (!flag52) { Rectangle hitbox = base.Hitbox; hitbox.X = hitbox.X - 20; hitbox.Width = hitbox.Width + 40; int num163 = 0; while (num163 < 200) { if (!Main.npc[num163].active || !Main.npc[num163].friendly || num163 == this.whoAmI || Main.npc[num163].velocity.X != 0f || !hitbox.Intersects(Main.npc[num163].Hitbox)) { num163++; } else { flag52 = true; break; } } } } if (!flag52 && flag50) { flag52 = true; } if (flag53 && (NPCID.Sets.TownCritter[this.type] || x56 < this.homeTileX - 35 || x56 > this.homeTileX + 35)) { flag53 = false; } if (flag53) { int num164 = 0; int num165 = -1; while (num165 <= 4) { Tile tile = Framing.GetTileSafely(x58 - this.direction * num164, y54 + num165); if (!tile.lava() || tile.liquid <= 0) { if (tile.nactive() && Main.tileSolid[tile.type]) { flag53 = false; } num165++; } else { flag53 = true; break; } } } if (!flag53 && this.wet) { bool flag54 = flag50; bool flag55 = false; if (!flag54) { flag55 = Collision.DrownCollision(this.position + new Vector2((float)(this.width * this.direction), 0f), this.width, this.height, 1f); } flag55 = (flag55 ? true : Collision.DrownCollision(this.position + new Vector2((float)(this.width * this.direction), (float)(this.height * 2 - 16 - (flag54 ? 16 : 0))), this.width, 16 + (flag54 ? 16 : 0), 1f)); if (flag55 && this.localAI[3] <= 0f) { flag53 = true; this.localAI[3] = 600f; } } if (this.position.X == this.localAI[3]) { NPC nPC65 = this; nPC65.direction = nPC65.direction * -1; this.netUpdate = true; this.localAI[3] = 600f; } if (!flag50) { this.localAI[3] = -1f; } else if (this.localAI[3] > 0f) { this.localAI[3] = this.localAI[3] - 1f; } Tile tileSafely1 = Framing.GetTileSafely(x58, y54); Tile tile1 = Framing.GetTileSafely(x58, y54 - 1); Tile tileSafely2 = Framing.GetTileSafely(x58, y54 - 2); if (!this.townNPC || !tileSafely2.nactive() || tileSafely2.type != 10 && tileSafely2.type != 388 || Main.rand.Next(10) != 0 && !flag43) { if (this.velocity.X < 0f && this.spriteDirection == -1 || this.velocity.X > 0f && this.spriteDirection == 1) { if (tileSafely2.nactive() && Main.tileSolid[tileSafely2.type] && !Main.tileSolidTop[tileSafely2.type]) { if (!Collision.SolidTilesVersatile(x58 - this.direction * 2, x58 - this.direction, y54 - 5, y54 - 1) && !Collision.SolidTiles(x58, x58, y54 - 5, y54 - 3)) { this.velocity.Y = -6f; this.netUpdate = true; } else if (flag47) { if (WorldGen.SolidTile((int)(base.Center.X / 16f) + this.direction, (int)(base.Center.Y / 16f))) { NPC nPC66 = this; nPC66.direction = nPC66.direction * -1; this.velocity.X = this.velocity.X * 0f; this.netUpdate = true; } } else if (!flag48) { NPC nPC67 = this; nPC67.direction = nPC67.direction * -1; this.netUpdate = true; } else { flag52 = false; this.velocity.X = 0f; NPC nPC68 = this; nPC68.direction = nPC68.direction * -1; this.netUpdate = true; this.ai[0] = 8f; this.ai[1] = 240f; } } else if (tile1.nactive() && Main.tileSolid[tile1.type] && !Main.tileSolidTop[tile1.type]) { if (!Collision.SolidTilesVersatile(x58 - this.direction * 2, x58 - this.direction, y54 - 4, y54 - 1) && !Collision.SolidTiles(x58, x58, y54 - 4, y54 - 2)) { this.velocity.Y = -5f; this.netUpdate = true; } else if (!flag48) { NPC nPC69 = this; nPC69.direction = nPC69.direction * -1; this.netUpdate = true; } else { flag52 = false; this.velocity.X = 0f; NPC nPC70 = this; nPC70.direction = nPC70.direction * -1; this.netUpdate = true; this.ai[0] = 8f; this.ai[1] = 240f; } } else if (this.position.Y + (float)this.height - (float)(y54 * 16) <= 20f || !tileSafely1.nactive() || !Main.tileSolid[tileSafely1.type] || tileSafely1.topSlope()) { if (flag53) { NPC nPC71 = this; nPC71.direction = nPC71.direction * -1; this.velocity.X = this.velocity.X * -1f; this.netUpdate = true; if (flag48) { flag52 = false; this.velocity.X = 0f; this.ai[0] = 8f; this.ai[1] = 240f; } } } else if (!Collision.SolidTilesVersatile(x58 - this.direction * 2, x58, y54 - 3, y54 - 1)) { this.velocity.Y = -4.4f; this.netUpdate = true; } else if (!flag48) { NPC nPC72 = this; nPC72.direction = nPC72.direction * -1; this.netUpdate = true; } else { flag52 = false; this.velocity.X = 0f; NPC nPC73 = this; nPC73.direction = nPC73.direction * -1; this.netUpdate = true; this.ai[0] = 8f; this.ai[1] = 240f; } if (flag52) { this.ai[1] = 90f; this.netUpdate = true; } if (this.velocity.Y < 0f) { this.localAI[3] = this.position.X; } } if (this.velocity.Y < 0f && this.wet) { this.velocity.Y = this.velocity.Y * 1.2f; } if (this.velocity.Y < 0f && NPCID.Sets.TownCritter[this.type] && !flag47) { this.velocity.Y = this.velocity.Y * 1.2f; } } else if (Main.netMode != 1) { if (WorldGen.OpenDoor(x58, y54 - 2, this.direction)) { this.closeDoor = true; this.doorX = x58; this.doorY = y54 - 2; NetMessage.SendData(19, -1, -1, "", 0, (float)x58, (float)(y54 - 2), (float)this.direction, 0, 0, 0); this.netUpdate = true; this.ai[1] = this.ai[1] + 80f; } else if (WorldGen.OpenDoor(x58, y54 - 2, -this.direction)) { this.closeDoor = true; this.doorX = x58; this.doorY = y54 - 2; NetMessage.SendData(19, -1, -1, "", 0, (float)x58, (float)(y54 - 2), (float)(-this.direction), 0, 0, 0); this.netUpdate = true; this.ai[1] = this.ai[1] + 80f; } else if (!WorldGen.ShiftTallGate(x58, y54 - 2, false)) { NPC nPC74 = this; nPC74.direction = nPC74.direction * -1; this.netUpdate = true; } else { this.closeDoor = true; this.doorX = x58; this.doorY = y54 - 2; NetMessage.SendData(19, -1, -1, "", 4, (float)x58, (float)(y54 - 2), 0f, 0, 0, 0); this.netUpdate = true; this.ai[1] = this.ai[1] + 80f; } } } } else { this.ai[0] = 0f; this.ai[1] = (float)(200 + Main.rand.Next(200)); this.localAI[3] = 60f; this.netUpdate = true; } } else if (this.ai[0] == 2f || this.ai[0] == 11f) { if (Main.netMode != 1) { this.localAI[3] = this.localAI[3] - 1f; if (Main.rand.Next(60) == 0 && this.localAI[3] == 0f) { this.localAI[3] = 60f; NPC nPC75 = this; nPC75.direction = nPC75.direction * -1; this.netUpdate = true; } } this.ai[1] = this.ai[1] - 1f; this.velocity.X = this.velocity.X * 0.8f; if (this.ai[1] <= 0f) { this.localAI[3] = 40f; this.ai[0] = 0f; this.ai[1] = (float)(60 + Main.rand.Next(60)); this.netUpdate = true; } } else if (this.ai[0] == 3f || this.ai[0] == 4f || this.ai[0] == 5f || this.ai[0] == 8f || this.ai[0] == 9f || this.ai[0] == 16f || this.ai[0] == 17f) { this.velocity.X = this.velocity.X * 0.8f; this.ai[1] = this.ai[1] - 1f; if (this.ai[0] == 8f && this.ai[1] < 60f && flag48) { this.ai[1] = 180f; this.netUpdate = true; } if (this.ai[0] == 5f) { Point tileCoordinates = base.Center.ToTileCoordinates(); if (Main.tile[tileCoordinates.X, tileCoordinates.Y].type != 15) { this.ai[1] = 0f; } } if (this.ai[1] <= 0f) { this.ai[0] = 0f; this.ai[1] = (float)(60 + Main.rand.Next(60)); this.ai[2] = 0f; this.localAI[3] = (float)(30 + Main.rand.Next(60)); this.netUpdate = true; } } else if (this.ai[0] == 6f || this.ai[0] == 7f) { this.velocity.X = this.velocity.X * 0.8f; this.ai[1] = this.ai[1] - 1f; int num166 = (int)this.ai[2]; if (num166 < 0 || num166 > 255 || !Main.player[num166].active || Main.player[num166].dead || Main.player[num166].Distance(base.Center) > 200f || !Collision.CanHitLine(base.Top, 0, 0, Main.player[num166].Top, 0, 0)) { this.ai[1] = 0f; } if (this.ai[1] <= 0f) { this.ai[0] = 0f; this.ai[1] = (float)(60 + Main.rand.Next(60)); this.ai[2] = 0f; this.localAI[3] = (float)(30 + Main.rand.Next(60)); this.netUpdate = true; } else { int num167 = (base.Center.X < Main.player[num166].Center.X ? 1 : -1); if (num167 != this.direction) { this.netUpdate = true; } this.direction = num167; } } else if (this.ai[0] == 10f) { int num168 = 0; int num169 = 0; float single134 = 0f; float single135 = 0f; int num170 = 0; int num171 = 0; int num172 = 0; float single136 = 0f; float dangerDetectRange1 = (float)NPCID.Sets.DangerDetectRange[this.type]; float single137 = 0f; if ((float)NPCID.Sets.AttackTime[this.type] == this.ai[1]) { this.frameCounter = 0; this.localAI[3] = 0f; } if (this.type == 38) { num168 = 30; single135 = 6f; num169 = 20; num170 = 10; num171 = 180; num172 = 120; single136 = 16f; single134 = 7f; } else if (this.type == 208) { num168 = 588; single135 = 6f; num169 = 30; num170 = 10; num171 = 60; num172 = 120; single136 = 16f; single134 = 6f; } else if (this.type == 17) { num168 = 48; single135 = 9f; num169 = 12; num170 = 10; num171 = 60; num172 = 60; single136 = 16f; single134 = 1.5f; } else if (this.type == 369) { num168 = 520; single135 = 12f; num169 = 10; num170 = 10; num171 = 0; num172 = 1; single136 = 16f; single134 = 3f; } else if (this.type == 453) { num168 = 21; single135 = 14f; num169 = 14; num170 = 10; num171 = 0; num172 = 1; single136 = 16f; single134 = 3f; } else if (this.type == 107) { num168 = 24; single135 = 5f; num169 = 15; num170 = 10; num171 = 60; num172 = 60; single136 = 16f; single134 = 1f; } else if (this.type == 124) { num168 = 582; single135 = 10f; num169 = 11; num170 = 1; num171 = 30; num172 = 30; single134 = 3.5f; } else if (this.type == 18) { num168 = 583; single135 = 8f; num169 = 8; num170 = 1; num171 = 15; num172 = 10; single134 = 2f; single136 = 10f; } else if (this.type == 142) { num168 = 589; single135 = 7f; num169 = 22; num170 = 1; num171 = 10; num172 = 1; single134 = 2f; single136 = 10f; } if (Main.expertMode) { num169 = (int)((float)num169 * Main.expertNPCDamage); } num169 = (int)((float)num169 * single127); this.velocity.X = this.velocity.X * 0.8f; this.ai[1] = this.ai[1] - 1f; this.localAI[3] = this.localAI[3] + 1f; if (this.localAI[3] == (float)num170 && Main.netMode != 1) { Vector2 unitY = -Vector2.UnitY; if (num160 == 1 && this.spriteDirection == 1 && num162 != -1) { unitY = base.DirectionTo(Main.npc[num162].Center + new Vector2(0f, -single136 * MathHelper.Clamp(base.Distance(Main.npc[num162].Center) / dangerDetectRange1, 0f, 1f))); } if (num160 == -1 && this.spriteDirection == -1 && num161 != -1) { unitY = base.DirectionTo(Main.npc[num161].Center + new Vector2(0f, -single136 * MathHelper.Clamp(base.Distance(Main.npc[num161].Center) / dangerDetectRange1, 0f, 1f))); } if (unitY.HasNaNs() || Math.Sign(unitY.X) != this.spriteDirection) { unitY = new Vector2((float)this.spriteDirection, -1f); } unitY = unitY * single135; unitY = unitY + Utils.RandomVector2(Main.rand, -single137, single137); int num173 = 1000; if (this.type != 124) { num173 = (this.type != 142 ? Projectile.NewProjectile(base.Center.X + (float)(this.spriteDirection * 16), base.Center.Y - 2f, unitY.X, unitY.Y, num168, num169, single134, Main.myPlayer, 0f, 0f) : Projectile.NewProjectile(base.Center.X + (float)(this.spriteDirection * 16), base.Center.Y - 2f, unitY.X, unitY.Y, num168, num169, single134, Main.myPlayer, 0f, (float)Main.rand.Next(5))); } else { num173 = Projectile.NewProjectile(base.Center.X + (float)(this.spriteDirection * 16), base.Center.Y - 2f, unitY.X, unitY.Y, num168, num169, single134, Main.myPlayer, 0f, (float)this.whoAmI); } Main.projectile[num173].npcProj = true; Main.projectile[num173].noDropItem = true; } if (this.ai[1] <= 0f && !false) { float[] singleArray = this.ai; float ai_0 = 8; if (this.localAI[2] != 8f || !flag48) { ai_0 = 0; } singleArray[0] = ai_0; this.ai[1] = (float)(num171 + Main.rand.Next(num172)); this.ai[2] = 0f; float[] singleArray1 = this.localAI; float[] singleArray2 = this.localAI; float single138 = (float)(num171 / 2 + Main.rand.Next(num172)); single1 = single138; singleArray2[3] = single138; singleArray1[1] = single1; this.netUpdate = true; } } else if (this.ai[0] == 12f) { int num174 = 0; int num175 = 0; float single139 = 0f; int num176 = 0; int num177 = 0; int num178 = 0; float single140 = 0f; int num179 = 0; bool flag56 = false; float single141 = 0f; if ((float)NPCID.Sets.AttackTime[this.type] == this.ai[1]) { this.frameCounter = 0; this.localAI[3] = 0f; } int num180 = -1; if (num160 == 1 && this.spriteDirection == 1) { num180 = num162; } if (num160 == -1 && this.spriteDirection == -1) { num180 = num161; } if (this.type == 19) { num174 = 14; single139 = 13f; num175 = 24; num177 = 14; num178 = 4; single140 = 3f; num176 = 1; single141 = 0.5f; if ((float)NPCID.Sets.AttackTime[this.type] == this.ai[1]) { this.frameCounter = 0; this.localAI[3] = 0f; } if (Main.hardMode) { num175 = 15; if (this.localAI[3] > (float)num176) { num176 = 10; flag56 = true; } if (this.localAI[3] > (float)num176) { num176 = 20; flag56 = true; } if (this.localAI[3] > (float)num176) { num176 = 30; flag56 = true; } } } else if (this.type == 227) { num174 = 587; single139 = 10f; num175 = 8; num177 = 10; num178 = 1; single140 = 1.75f; num176 = 1; single141 = 0.5f; if (this.localAI[3] > (float)num176) { num176 = 12; flag56 = true; } if (this.localAI[3] > (float)num176) { num176 = 24; flag56 = true; } if (Main.hardMode) { num175 = num175 + 2; } } else if (this.type == 368) { num174 = 14; single139 = 13f; num175 = 24; num177 = 12; num178 = 5; single140 = 2f; num176 = 1; single141 = 0.2f; if (Main.hardMode) { num175 = 30; num174 = 357; } } else if (this.type == 22) { single139 = 10f; num175 = 8; num176 = 1; if (!Main.hardMode) { num174 = 1; num177 = 30; num178 = 20; } else { num174 = 2; num177 = 15; num178 = 10; num175 = num175 + 6; } single140 = 2.75f; num179 = 4; single141 = 0.7f; } else if (this.type == 228) { num174 = 267; single139 = 14f; num175 = 20; num176 = 1; num177 = 10; num178 = 1; single140 = 3f; num179 = 6; single141 = 0.4f; } else if (this.type == 178) { num174 = 242; single139 = 13f; num175 = 15; num177 = 10; num178 = 1; single140 = 2f; num176 = 1; if (this.localAI[3] > (float)num176) { num176 = 8; flag56 = true; } if (this.localAI[3] > (float)num176) { num176 = 16; flag56 = true; } single141 = 0.3f; } else if (this.type == 229) { num174 = 14; single139 = 14f; num175 = 24; num177 = 10; num178 = 1; single140 = 2f; num176 = 1; single141 = 0.7f; if (this.localAI[3] > (float)num176) { num176 = 16; flag56 = true; } if (this.localAI[3] > (float)num176) { num176 = 24; flag56 = true; } if (this.localAI[3] > (float)num176) { num176 = 32; flag56 = true; } if (this.localAI[3] > (float)num176) { num176 = 40; flag56 = true; } if (this.localAI[3] > (float)num176) { num176 = 48; flag56 = true; } if (this.localAI[3] == 0f && num180 != -1 && base.Distance(Main.npc[num180].Center) < (float)NPCID.Sets.PrettySafe[this.type]) { single141 = 0.1f; num174 = 162; num175 = 50; single140 = 10f; single139 = 24f; } } else if (this.type == 209) { Random random1 = Main.rand; numArray = new int[] { 134, 133, 135 }; num174 = Utils.SelectRandom<int>(random1, numArray); num176 = 1; if (num174 == 135) { single139 = 12f; num175 = 30; num177 = 30; num178 = 10; single140 = 7f; single141 = 0.2f; } else if (num174 == 133) { single139 = 10f; num175 = 25; num177 = 10; num178 = 1; single140 = 6f; single141 = 0.2f; } else if (num174 == 134) { single139 = 13f; num175 = 20; num177 = 20; num178 = 10; single140 = 4f; single141 = 0.1f; } } if (Main.expertMode) { num175 = (int)((float)num175 * Main.expertNPCDamage); } num175 = (int)((float)num175 * single127); this.velocity.X = this.velocity.X * 0.8f; this.ai[1] = this.ai[1] - 1f; this.localAI[3] = this.localAI[3] + 1f; if (this.localAI[3] == (float)num176 && Main.netMode != 1) { Vector2 zero1 = Vector2.Zero; if (num180 != -1) { zero1 = base.DirectionTo(Main.npc[num180].Center + new Vector2(0f, (float)(-num179))); } if (zero1.HasNaNs() || Math.Sign(zero1.X) != this.spriteDirection) { zero1 = new Vector2((float)this.spriteDirection, 0f); } zero1 = zero1 * single139; zero1 = zero1 + Utils.RandomVector2(Main.rand, -single141, single141); int num181 = 1000; num181 = (this.type != 227 ? Projectile.NewProjectile(base.Center.X + (float)(this.spriteDirection * 16), base.Center.Y - 2f, zero1.X, zero1.Y, num174, num175, single140, Main.myPlayer, 0f, 0f) : Projectile.NewProjectile(base.Center.X + (float)(this.spriteDirection * 16), base.Center.Y - 2f, zero1.X, zero1.Y, num174, num175, single140, Main.myPlayer, 0f, (float)Main.rand.Next(12) / 6f)); Main.projectile[num181].npcProj = true; Main.projectile[num181].noDropItem = true; } if (this.localAI[3] == (float)num176 && flag56 && num180 != -1) { Vector2 vector251 = base.DirectionTo(Main.npc[num180].Center); if (vector251.Y <= 0.5f && vector251.Y >= -0.5f) { this.ai[2] = vector251.Y; } } if (this.ai[1] <= 0f && !false) { float[] singleArray3 = this.ai; float array3_0 = 8; if (this.localAI[2] != 8f || !flag48) { array3_0 = 0; } singleArray3[0] = (float)array3_0; this.ai[1] = (float)(num177 + Main.rand.Next(num178)); this.ai[2] = 0f; float[] singleArray4 = this.localAI; float[] singleArray5 = this.localAI; float single142 = (float)(num177 / 2 + Main.rand.Next(num178)); single1 = single142; singleArray5[3] = single142; singleArray4[1] = single1; this.netUpdate = true; } } else if (this.ai[0] == 13f) { this.velocity.X = this.velocity.X * 0.8f; if ((float)NPCID.Sets.AttackTime[this.type] == this.ai[1]) { this.frameCounter = 0; } this.ai[1] = this.ai[1] - 1f; this.localAI[3] = this.localAI[3] + 1f; if (this.localAI[3] == 1f && Main.netMode != 1) { Vector2 vector252 = base.DirectionTo(Main.npc[(int)this.ai[2]].Center + new Vector2(0f, -20f)); if (vector252.HasNaNs() || Math.Sign(vector252.X) == -this.spriteDirection) { vector252 = new Vector2((float)this.spriteDirection, -1f); } vector252 = vector252 * 8f; int num182 = Projectile.NewProjectile(base.Center.X + (float)(this.spriteDirection * 16), base.Center.Y - 2f, vector252.X, vector252.Y, 584, 0, 0f, Main.myPlayer, this.ai[2], 0f); Main.projectile[num182].npcProj = true; Main.projectile[num182].noDropItem = true; } if (this.ai[1] <= 0f) { this.ai[0] = 0f; this.ai[1] = (float)(10 + Main.rand.Next(10)); this.ai[2] = 0f; this.localAI[3] = (float)(5 + Main.rand.Next(10)); this.netUpdate = true; } } else if (this.ai[0] == 14f) { int num183 = 0; int num184 = 0; float single143 = 0f; int num185 = 0; int num186 = 0; int num187 = 0; float single144 = 0f; float single145 = 0f; float dangerDetectRange2 = (float)NPCID.Sets.DangerDetectRange[this.type]; float single146 = 1f; float single147 = 0f; if ((float)NPCID.Sets.AttackTime[this.type] == this.ai[1]) { this.frameCounter = 0; this.localAI[3] = 0f; } int num188 = -1; if (num160 == 1 && this.spriteDirection == 1) { num188 = num162; } if (num160 == -1 && this.spriteDirection == -1) { num188 = num161; } if (this.type == 54) { num183 = 585; single143 = 10f; num184 = 16; num185 = 30; num186 = 20; num187 = 15; single144 = 2f; single147 = 1f; } else if (this.type == 108) { num183 = 15; single143 = 6f; num184 = 18; num185 = 15; num186 = 15; num187 = 5; single144 = 3f; single145 = 20f; } else if (this.type == 160) { num183 = 590; num184 = 40; num185 = 15; num186 = 10; num187 = 1; single144 = 3f; while (this.localAI[3] > (float)num185) { num185 = num185 + 15; } } else if (this.type == 20) { num183 = 586; num185 = 24; num186 = 10; num187 = 1; single144 = 3f; } if (Main.expertMode) { num184 = (int)((float)num184 * Main.expertNPCDamage); } num184 = (int)((float)num184 * single127); this.velocity.X = this.velocity.X * 0.8f; this.ai[1] = this.ai[1] - 1f; this.localAI[3] = this.localAI[3] + 1f; if (this.localAI[3] == (float)num185 && Main.netMode != 1) { Vector2 zero2 = Vector2.Zero; if (num188 != -1) { zero2 = base.DirectionTo(Main.npc[num188].Center + new Vector2(0f, -single145 * MathHelper.Clamp(base.Distance(Main.npc[num188].Center) / dangerDetectRange2, 0f, 1f))); } if (zero2.HasNaNs() || Math.Sign(zero2.X) != this.spriteDirection) { zero2 = new Vector2((float)this.spriteDirection, 0f); } zero2 = zero2 * single143; zero2 = zero2 + Utils.RandomVector2(Main.rand, -single147, single147); if (this.type == 108) { Random random2 = Main.rand; numArray = new int[] { 1, 1, 1, 1, 2, 2, 3 }; int num189 = Utils.SelectRandom<int>(random2, numArray); for (int q2 = 0; q2 < num189; q2++) { Vector2 vector253 = Utils.RandomVector2(Main.rand, -3.4f, 3.4f); int num190 = Projectile.NewProjectile(base.Center.X + (float)(this.spriteDirection * 16), base.Center.Y - 2f, zero2.X + vector253.X, zero2.Y + vector253.Y, num183, num184, single144, Main.myPlayer, 0f, 0f); Main.projectile[num190].npcProj = true; Main.projectile[num190].noDropItem = true; } } else if (this.type == 160) { if (num188 != -1) { Vector2 size = (Main.npc[num188].position - (Main.npc[num188].Size * 2f)) + ((Main.npc[num188].Size * Utils.RandomVector2(Main.rand, 0f, 1f)) * 5f); int num191 = 10; while (num191 > 0 && WorldGen.SolidTile(Framing.GetTileSafely((int)size.X / 16, (int)size.Y / 16))) { num191--; size = (Main.npc[num188].position - (Main.npc[num188].Size * 2f)) + ((Main.npc[num188].Size * Utils.RandomVector2(Main.rand, 0f, 1f)) * 5f); } int num192 = Projectile.NewProjectile(size.X, size.Y, 0f, 0f, num183, num184, single144, Main.myPlayer, 0f, 0f); Main.projectile[num192].npcProj = true; Main.projectile[num192].noDropItem = true; } } else if (this.type != 20) { int num193 = Projectile.NewProjectile(base.Center.X + (float)(this.spriteDirection * 16), base.Center.Y - 2f, zero2.X, zero2.Y, num183, num184, single144, Main.myPlayer, 0f, 0f); Main.projectile[num193].npcProj = true; Main.projectile[num193].noDropItem = true; } else { int num194 = Projectile.NewProjectile(base.Center.X + (float)(this.spriteDirection * 16), base.Center.Y - 2f, zero2.X, zero2.Y, num183, num184, single144, Main.myPlayer, 0f, (float)this.whoAmI); Main.projectile[num194].npcProj = true; Main.projectile[num194].noDropItem = true; } } if (this.ai[1] <= 0f && !false) { float[] singleArray6 = this.ai; float ai_0 = 8; if (this.localAI[2] != 8f || !flag48) { ai_0 = 0; } singleArray6[0] = ai_0; this.ai[1] = (float)(num186 + Main.rand.Next(num187)); this.ai[2] = 0f; float[] singleArray7 = this.localAI; float[] singleArray8 = this.localAI; float single148 = (float)(num186 / 2 + Main.rand.Next(num187)); single1 = single148; singleArray8[3] = single148; singleArray7[1] = single1; this.netUpdate = true; } } else if (this.ai[0] == 15f) { int num195 = 0; int num196 = 0; if ((float)NPCID.Sets.AttackTime[this.type] == this.ai[1]) { this.frameCounter = 0; this.localAI[3] = 0f; } int num197 = 0; float single149 = 0f; int num198 = 0; int num199 = 0; if (num160 == 1) { int num200 = this.spriteDirection; } if (num160 == -1) { int num201 = this.spriteDirection; } if (this.type == 207) { num197 = 11; int num202 = 32; num199 = num202; num198 = num202; num195 = 12; num196 = 6; single149 = 4.25f; } else if (this.type == 441) { num197 = 9; int num203 = 28; num199 = num203; num198 = num203; num195 = 9; num196 = 3; single149 = 3.5f; } else if (this.type == 353) { num197 = 10; int num204 = 32; num199 = num204; num198 = num204; num195 = 15; num196 = 8; single149 = 5f; } if (Main.expertMode) { num197 = (int)((float)num197 * Main.expertNPCDamage); } num197 = (int)((float)num197 * single127); this.velocity.X = this.velocity.X * 0.8f; this.ai[1] = this.ai[1] - 1f; if (Main.netMode != 1) { Tuple<Vector2, float> swingStats = this.GetSwingStats(NPCID.Sets.AttackTime[this.type] * 2, (int)this.ai[1], this.spriteDirection, num198, num199); Rectangle rectangle4 = new Rectangle((int)swingStats.Item1.X, (int)swingStats.Item1.Y, num198, num199); if (this.spriteDirection == -1) { rectangle4.X = rectangle4.X - num198; } rectangle4.Y = rectangle4.Y - num199; this.TweakSwingStats(NPCID.Sets.AttackTime[this.type] * 2, (int)this.ai[1], this.spriteDirection, ref rectangle4); int num205 = Main.myPlayer; for (int r2 = 0; r2 < 200; r2++) { NPC nPC76 = Main.npc[r2]; if (nPC76.active && nPC76.immune[num205] == 0 && !nPC76.dontTakeDamage && !nPC76.friendly && nPC76.damage > 0 && rectangle4.Intersects(nPC76.Hitbox) && (nPC76.noTileCollide || Collision.CanHit(this.position, this.width, this.height, nPC76.position, nPC76.width, nPC76.height))) { nPC76.StrikeNPCNoInteraction(num197, single149, this.spriteDirection, false, false, false); if (Main.netMode != 0) { NetMessage.SendData(28, -1, -1, "", r2, (float)num197, single149, (float)this.spriteDirection, 0, 0, 0); } nPC76.netUpdate = true; nPC76.immune[num205] = (int)this.ai[1] + 2; } } } if (this.ai[1] <= 0f) { bool flag57 = false; if (flag48) { if (!Collision.CanHit(base.Center, 0, 0, base.Center + ((Vector2.UnitX * (float)(-num160)) * 32f), 0, 0) || this.localAI[2] == 8f) { flag57 = true; } if (flag57) { int attackTime = NPCID.Sets.AttackTime[this.type]; int num206 = (num160 == 1 ? num162 : num161); int num207 = (num160 == 1 ? num161 : num162); if (num206 != -1 && !Collision.CanHit(base.Center, 0, 0, Main.npc[num206].Center, 0, 0)) { num206 = (num207 == -1 || !Collision.CanHit(base.Center, 0, 0, Main.npc[num207].Center, 0, 0) ? -1 : num207); } if (num206 == -1) { flag57 = false; } else { this.ai[0] = 15f; this.ai[1] = (float)attackTime; this.ai[2] = 0f; this.localAI[3] = 0f; this.direction = (this.position.X < Main.npc[num206].position.X ? 1 : -1); this.netUpdate = true; } } } if (!flag57) { float[] singleArray9 = this.ai; float ai_0 = 8; if (this.localAI[2] != 8f || !flag48) { ai_0 = 0; } singleArray9[0] = ai_0; this.ai[1] = (float)(num195 + Main.rand.Next(num196)); this.ai[2] = 0f; float[] singleArray10 = this.localAI; float[] singleArray11 = this.localAI; float single150 = (float)(num195 / 2 + Main.rand.Next(num196)); single1 = single150; singleArray11[3] = single150; singleArray10[1] = single1; this.netUpdate = true; } } } if (Main.netMode != 1 && (this.townNPC || this.type == 453) && !flag45) { bool flag58 = (this.ai[0] >= 2f ? false : !flag48); if (this.ai[0] < 2f || this.ai[0] == 8f) { flag5 = (flag48 ? true : flag49); } else { flag5 = false; } bool flag59 = flag5; if (this.localAI[1] > 0f) { this.localAI[1] = this.localAI[1] - 1f; } if (this.localAI[1] > 0f) { flag59 = false; } if (flag59 && this.type == 124 && this.localAI[0] == 1f) { flag59 = false; } if (flag59 && this.type == 20) { flag59 = false; int num208 = 0; while (num208 < 200) { NPC nPC77 = Main.npc[num208]; if (!nPC77.active || !nPC77.townNPC || base.Distance(nPC77.Center) > 1200f || nPC77.HasBuff(165) != -1) { num208++; } else { flag59 = true; break; } } } if (flag58 && this.ai[0] == 0f && this.velocity.Y == 0f && Main.rand.Next(300) == 0) { int num209 = 420; num209 = (Main.rand.Next(2) != 0 ? num209 * Main.rand.Next(1, 3) : num209 * Main.rand.Next(1, 4)); int num210 = 100; int num211 = 20; int num212 = 0; while (num212 < 200) { NPC nPC78 = Main.npc[num212]; bool flag60 = ((nPC78.ai[0] != 1f || !nPC78.closeDoor) && (nPC78.ai[0] != 1f || nPC78.ai[1] <= 200f) ? nPC78.ai[0] > 1f : true); if (nPC78 == this || !nPC78.active || !nPC78.CanTalk || flag60 || nPC78.Distance(base.Center) >= (float)num210 || nPC78.Distance(base.Center) <= (float)num211 || !Collision.CanHit(base.Center, 0, 0, nPC78.Center, 0, 0)) { num212++; } else { int directionInt = (this.position.X < nPC78.position.X).ToDirectionInt(); this.ai[0] = 3f; this.ai[1] = (float)num209; this.ai[2] = (float)num212; this.direction = directionInt; this.netUpdate = true; nPC78.ai[0] = 4f; nPC78.ai[1] = (float)num209; nPC78.ai[2] = (float)this.whoAmI; nPC78.direction = -directionInt; nPC78.netUpdate = true; goto Label5; } } } else if (flag58 && this.ai[0] == 0f && this.velocity.Y == 0f && Main.rand.Next(1800) == 0) { int num213 = 420; num213 = (Main.rand.Next(2) != 0 ? num213 * Main.rand.Next(1, 3) : num213 * Main.rand.Next(1, 4)); int num214 = 100; int num215 = 20; int num216 = 0; while (num216 < 200) { NPC nPC79 = Main.npc[num216]; bool flag61 = ((nPC79.ai[0] != 1f || !nPC79.closeDoor) && (nPC79.ai[0] != 1f || nPC79.ai[1] <= 200f) ? nPC79.ai[0] > 1f : true); if (nPC79 == this || !nPC79.active || !nPC79.CanTalk || flag61 || nPC79.Distance(base.Center) >= (float)num214 || nPC79.Distance(base.Center) <= (float)num215 || !Collision.CanHit(base.Center, 0, 0, nPC79.Center, 0, 0)) { num216++; } else { int directionInt1 = (this.position.X < nPC79.position.X).ToDirectionInt(); this.ai[0] = 16f; this.ai[1] = (float)num213; this.ai[2] = (float)num216; this.localAI[2] = (float)Main.rand.Next(4); this.localAI[3] = (float)Main.rand.Next(3 - (int)this.localAI[2]); this.direction = directionInt1; this.netUpdate = true; nPC79.ai[0] = 17f; nPC79.ai[1] = (float)num213; nPC79.ai[2] = (float)this.whoAmI; nPC79.localAI[2] = 0f; nPC79.localAI[3] = 0f; nPC79.direction = -directionInt1; nPC79.netUpdate = true; goto Label5; } } } else if (flag58 && this.ai[0] == 0f && this.velocity.Y == 0f && Main.rand.Next(1200) == 0 && this.type == 208) { int num217 = 300; int num218 = 150; int num219 = 0; while (num219 < 255) { Player player1 = Main.player[num219]; if (!player1.active || player1.dead || player1.Distance(base.Center) >= (float)num218 || !Collision.CanHitLine(base.Top, 0, 0, player1.Top, 0, 0)) { num219++; } else { int directionInt2 = (this.position.X < player1.position.X).ToDirectionInt(); this.ai[0] = 6f; this.ai[1] = (float)num217; this.ai[2] = (float)num219; this.direction = directionInt2; this.netUpdate = true; goto Label5; } } } else if (flag58 && this.ai[0] == 0f && this.velocity.Y == 0f && Main.rand.Next(1800) == 0) { this.ai[0] = 2f; this.ai[1] = (float)(45 * Main.rand.Next(1, 2)); this.netUpdate = true; } else if (flag58 && this.ai[0] == 0f && this.velocity.Y == 0f && Main.rand.Next(600) == 0 && this.type == 229 && !flag49) { this.ai[0] = 11f; this.ai[1] = (float)(30 * Main.rand.Next(1, 4)); this.netUpdate = true; } else if (flag58 && this.ai[0] == 0f && this.velocity.Y == 0f && Main.rand.Next(1200) == 0) { int num220 = 220; int num221 = 150; int num222 = 0; while (num222 < 255) { Player player2 = Main.player[num222]; if (!player2.active || player2.dead || player2.Distance(base.Center) >= (float)num221 || !Collision.CanHitLine(base.Top, 0, 0, player2.Top, 0, 0)) { num222++; } else { int directionInt3 = (this.position.X < player2.position.X).ToDirectionInt(); this.ai[0] = 7f; this.ai[1] = (float)num220; this.ai[2] = (float)num222; this.direction = directionInt3; this.netUpdate = true; goto Label5; } } } else if (flag58 && this.ai[0] == 1f && this.velocity.Y == 0f && Main.rand.Next(300) == 0) { Point point = base.Center.ToTileCoordinates(); bool flag62 = WorldGen.InWorld(point.X, point.Y, 1); if (flag62) { int num223 = 0; while (num223 < 200) { if (!Main.npc[num223].active || Main.npc[num223].aiStyle != 7 || !Main.npc[num223].townNPC || Main.npc[num223].ai[0] != 5f || !(Main.npc[num223].Center.ToTileCoordinates() == point)) { num223++; } else { flag62 = false; break; } } } if (flag62) { Tile tile2 = Main.tile[point.X, point.Y]; flag62 = tile2.type == 15; if (flag62 && tile2.frameY == 1080) { flag62 = false; } if (flag62) { this.ai[0] = 5f; this.ai[1] = (float)(900 + Main.rand.Next(10800)); this.direction = (tile2.frameX == 0 ? -1 : 1); base.Bottom = new Vector2((float)(point.X * 16 + 8 + 2 * this.direction), (float)(point.Y * 16 + 32)); this.velocity = Vector2.Zero; this.localAI[3] = 0f; this.netUpdate = true; } } } else if (flag58 && this.ai[0] == 1f && this.velocity.Y == 0f && Main.rand.Next(600) == 0 && Utils.PlotTileLine(base.Top, base.Bottom, (float)this.width, new Utils.PerLinePoint(DelegateMethods.SearchAvoidedByNPCs))) { Point tileCoordinates1 = (base.Center + new Vector2((float)(this.direction * 10), 0f)).ToTileCoordinates(); bool flag63 = WorldGen.InWorld(tileCoordinates1.X, tileCoordinates1.Y, 1); if (flag63) { Tile tileSafely3 = Framing.GetTileSafely(tileCoordinates1.X, tileCoordinates1.Y); if (!tileSafely3.nactive() || !TileID.Sets.InteractibleByNPCs[tileSafely3.type]) { flag63 = false; } } if (flag63) { this.ai[0] = 9f; this.ai[1] = (float)(40 + Main.rand.Next(90)); this.velocity = Vector2.Zero; this.localAI[3] = 0f; this.netUpdate = true; } } Label5: if (this.ai[0] < 2f && this.velocity.Y == 0f && this.type == 18) { int num224 = -1; for (int s2 = 0; s2 < 200; s2++) { NPC nPC80 = Main.npc[s2]; if (nPC80.active && nPC80.townNPC && nPC80.life != nPC80.lifeMax && (num224 == -1 || nPC80.lifeMax - nPC80.life > Main.npc[num224].lifeMax - Main.npc[num224].life) && Collision.CanHitLine(this.position, this.width, this.height, nPC80.position, nPC80.width, nPC80.height) && base.Distance(nPC80.Center) < 500f) { num224 = s2; } } if (num224 != -1) { this.ai[0] = 13f; this.ai[1] = 34f; this.ai[2] = (float)num224; this.localAI[3] = 0f; this.direction = (this.position.X < Main.npc[num224].position.X ? 1 : -1); this.netUpdate = true; } } if (flag59 && this.velocity.Y == 0f && NPCID.Sets.AttackType[this.type] == 0 && NPCID.Sets.AttackAverageChance[this.type] > 0 && Main.rand.Next(NPCID.Sets.AttackAverageChance[this.type] * 2) == 0) { int attackTime1 = NPCID.Sets.AttackTime[this.type]; int num225 = (num160 == 1 ? num162 : num161); int num226 = (num160 == 1 ? num161 : num162); if (num225 != -1 && !Collision.CanHit(base.Center, 0, 0, Main.npc[num225].Center, 0, 0)) { num225 = (num226 == -1 || !Collision.CanHit(base.Center, 0, 0, Main.npc[num226].Center, 0, 0) ? -1 : num226); } if (num225 != -1) { this.localAI[2] = this.ai[0]; this.ai[0] = 10f; this.ai[1] = (float)attackTime1; this.ai[2] = 0f; this.localAI[3] = 0f; this.direction = (this.position.X < Main.npc[num225].position.X ? 1 : -1); this.netUpdate = true; } } else if (flag59 && this.velocity.Y == 0f && NPCID.Sets.AttackType[this.type] == 1 && NPCID.Sets.AttackAverageChance[this.type] > 0 && Main.rand.Next(NPCID.Sets.AttackAverageChance[this.type] * 2) == 0) { int attackTime2 = NPCID.Sets.AttackTime[this.type]; int num227 = (num160 == 1 ? num162 : num161); int num228 = (num160 == 1 ? num161 : num162); if (num227 != -1 && !Collision.CanHitLine(base.Center, 0, 0, Main.npc[num227].Center, 0, 0)) { num227 = (num228 == -1 || !Collision.CanHitLine(base.Center, 0, 0, Main.npc[num228].Center, 0, 0) ? -1 : num228); } if (num227 != -1) { Vector2 vector254 = base.DirectionTo(Main.npc[num227].Center); if (vector254.Y <= 0.5f && vector254.Y >= -0.5f) { this.localAI[2] = this.ai[0]; this.ai[0] = 12f; this.ai[1] = (float)attackTime2; this.ai[2] = vector254.Y; this.localAI[3] = 0f; this.direction = (this.position.X < Main.npc[num227].position.X ? 1 : -1); this.netUpdate = true; } } } if (flag59 && this.velocity.Y == 0f && NPCID.Sets.AttackType[this.type] == 2 && NPCID.Sets.AttackAverageChance[this.type] > 0 && Main.rand.Next(NPCID.Sets.AttackAverageChance[this.type] * 2) == 0) { int attackTime3 = NPCID.Sets.AttackTime[this.type]; int num229 = (num160 == 1 ? num162 : num161); int num230 = (num160 == 1 ? num161 : num162); if (num229 != -1 && !Collision.CanHitLine(base.Center, 0, 0, Main.npc[num229].Center, 0, 0)) { num229 = (num230 == -1 || !Collision.CanHitLine(base.Center, 0, 0, Main.npc[num230].Center, 0, 0) ? -1 : num230); } if (num229 != -1) { this.localAI[2] = this.ai[0]; this.ai[0] = 14f; this.ai[1] = (float)attackTime3; this.ai[2] = 0f; this.localAI[3] = 0f; this.direction = (this.position.X < Main.npc[num229].position.X ? 1 : -1); this.netUpdate = true; } else if (this.type == 20) { this.localAI[2] = this.ai[0]; this.ai[0] = 14f; this.ai[1] = (float)attackTime3; this.ai[2] = 0f; this.localAI[3] = 0f; this.netUpdate = true; } } if (flag59 && this.velocity.Y == 0f && NPCID.Sets.AttackType[this.type] == 3 && NPCID.Sets.AttackAverageChance[this.type] > 0 && Main.rand.Next(NPCID.Sets.AttackAverageChance[this.type] * 2) == 0) { int attackTime4 = NPCID.Sets.AttackTime[this.type]; int num231 = (num160 == 1 ? num162 : num161); int num232 = (num160 == 1 ? num161 : num162); if (num231 != -1 && !Collision.CanHit(base.Center, 0, 0, Main.npc[num231].Center, 0, 0)) { num231 = (num232 == -1 || !Collision.CanHit(base.Center, 0, 0, Main.npc[num232].Center, 0, 0) ? -1 : num232); } if (num231 != -1) { this.localAI[2] = this.ai[0]; this.ai[0] = 15f; this.ai[1] = (float)attackTime4; this.ai[2] = 0f; this.localAI[3] = 0f; this.direction = (this.position.X < Main.npc[num231].position.X ? 1 : -1); this.netUpdate = true; return; } } } } else if (this.aiStyle == 8) { this.TargetClosest(true); this.velocity.X = this.velocity.X * 0.93f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } if (this.ai[0] == 0f) { this.ai[0] = 500f; } if (this.type == 172) { if (this.alpha < 255) { NPC nPC81 = this; nPC81.alpha = nPC81.alpha + 1; } if (this.justHit) { this.alpha = 0; } } if (this.ai[2] != 0f && this.ai[3] != 0f) { if (this.type == 172) { this.alpha = 255; } this.position.X = this.ai[2] * 16f - (float)(this.width / 2) + 8f; this.position.Y = this.ai[3] * 16f - (float)this.height; this.velocity.X = 0f; this.velocity.Y = 0f; this.ai[2] = 0f; this.ai[3] = 0f; } this.ai[0] = this.ai[0] + 1f; if (this.type == 283 || this.type == 284) { if (this.ai[0] == 50f || this.ai[0] == 100f || this.ai[0] == 150f || this.ai[0] == 200f || this.ai[0] == 250f) { this.ai[1] = 30f; this.netUpdate = true; } if (this.ai[0] >= 400f) { this.ai[0] = 700f; } } else if (this.type == 172) { if (this.ai[0] == 75f || this.ai[0] == 150f || this.ai[0] == 225f || this.ai[0] == 300f || this.ai[0] == 375f || this.ai[0] == 450f) { this.ai[1] = 30f; this.netUpdate = true; } } else if (this.type == 533) { if (this.ai[0] == 180f) { this.ai[1] = 181f; this.netUpdate = true; } } else if (this.type == 281 || this.type == 282) { if (this.ai[0] == 20f || this.ai[0] == 40f || this.ai[0] == 60f || this.ai[0] == 120f || this.ai[0] == 140f || this.ai[0] == 160f || this.ai[0] == 220f || this.ai[0] == 240f || this.ai[0] == 260f) { this.ai[1] = 30f; this.netUpdate = true; } if (this.ai[0] >= 460f) { this.ai[0] = 700f; } } else if (this.ai[0] == 100f || this.ai[0] == 200f || this.ai[0] == 300f) { this.ai[1] = 30f; this.netUpdate = true; } if ((this.type == 285 || this.type == 286) && this.ai[0] > 400f) { this.ai[0] = 650f; } if (this.type == 533 && this.ai[0] >= 360f) { this.ai[0] = 650f; } if (this.ai[0] >= 650f && Main.netMode != 1) { this.ai[0] = 1f; int x59 = (int)Main.player[this.target].position.X / 16; int y55 = (int)Main.player[this.target].position.Y / 16; int x60 = (int)this.position.X / 16; int y56 = (int)this.position.Y / 16; int num281 = 20; int num282 = 0; bool flag64 = false; if (Math.Abs(this.position.X - Main.player[this.target].position.X) + Math.Abs(this.position.Y - Main.player[this.target].position.Y) > 2000f) { num282 = 100; flag64 = true; } Label2: while (!flag64 && num282 < 100) { num282++; int num283 = Main.rand.Next(x59 - num281, x59 + num281); int num284 = Main.rand.Next(y55 - num281, y55 + num281); for (int v2 = num284; v2 < y55 + num281; v2++) { if ((v2 < y55 - 4 || v2 > y55 + 4 || num283 < x59 - 4 || num283 > x59 + 4) && (v2 < y56 - 1 || v2 > y56 + 1 || num283 < x60 - 1 || num283 > x60 + 1) && Main.tile[num283, v2].nactive()) { bool flag65 = true; if ((this.type == 32 || this.type >= 281 && this.type <= 286) && !Main.wallDungeon[Main.tile[num283, v2 - 1].wall]) { flag65 = false; } else if (Main.tile[num283, v2 - 1].lava()) { flag65 = false; } if (flag65 && Main.tileSolid[Main.tile[num283, v2].type] && !Collision.SolidTiles(num283 - 1, num283 + 1, v2 - 4, v2 - 1)) { this.ai[1] = 20f; this.ai[2] = (float)num283; this.ai[3] = (float)v2; flag64 = true; goto Label2; } } } } this.netUpdate = true; } if (this.ai[1] > 0f) { this.ai[1] = this.ai[1] - 1f; if (this.type == 533) { if (this.ai[1] % 30f == 0f && this.ai[1] / 30f < 5f) { if (Main.netMode != 1) { Point point1 = base.Center.ToTileCoordinates(); Point tileCoordinates2 = Main.player[this.target].Center.ToTileCoordinates(); Vector2 center21 = Main.player[this.target].Center - base.Center; int num285 = 6; int num286 = 6; int num287 = 0; int num288 = 2; int num289 = 0; bool flag66 = false; if (center21.Length() > 2000f) { flag66 = true; } do { Label4: if (flag66) { break; } if (num289 < 50) { num289++; num1 = Main.rand.Next(tileCoordinates2.X - num285, tileCoordinates2.X + num285 + 1); num2 = Main.rand.Next(tileCoordinates2.Y - num285, tileCoordinates2.Y + num285 + 1); if ((num2 < tileCoordinates2.Y - num287 || num2 > tileCoordinates2.Y + num287 || num1 < tileCoordinates2.X - num287 || num1 > tileCoordinates2.X + num287) && (num2 < point1.Y - num286 || num2 > point1.Y + num286 || num1 < point1.X - num286 || num1 > point1.X + num286) && !Main.tile[num1, num2].nactive()) { flag = true; if (flag && Main.tile[num1, num2].lava()) { flag = false; } if (!flag || !Collision.SolidTiles(num1 - num288, num1 + num288, num2 - num288, num2 + num288)) { continue; } flag = false; } else { goto Label4; } } else { break; } } while (!flag); Projectile.NewProjectile((float)(num1 * 16 + 8), (float)(num2 * 16 + 8), 0f, 0f, 596, 0, 1f, Main.myPlayer, (float)this.target, 0f); flag66 = true; } } } else if (this.ai[1] == 25f) { if (this.type < 281 || this.type > 286) { if (Main.netMode != 1) { if (this.type == 29 || this.type == 45) { NPC.NewNPC((int)this.position.X + this.width / 2, (int)this.position.Y - 8, 30, 0, 0f, 0f, 0f, 0f, 255); } else if (this.type == 32) { NPC.NewNPC((int)this.position.X + this.width / 2, (int)this.position.Y - 8, 33, 0, 0f, 0f, 0f, 0f, 255); } else if (this.type != 172) { NPC.NewNPC((int)this.position.X + this.width / 2 + this.direction * 8, (int)this.position.Y + 20, 25, 0, 0f, 0f, 0f, 0f, 255); } else { float single151 = 10f; Vector2 vector271 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x61 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector271.X + (float)Main.rand.Next(-10, 11); float y57 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector271.Y + (float)Main.rand.Next(-10, 11); float single152 = (float)Math.Sqrt((double)(x61 * x61 + y57 * y57)); single152 = single151 / single152; x61 = x61 * single152; y57 = y57 * single152; int num290 = 40; int num291 = 129; int num292 = Projectile.NewProjectile(vector271.X, vector271.Y, x61, y57, num291, num290, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num292].timeLeft = 300; this.localAI[0] = 0f; } } } else if (Main.netMode != 1) { float single153 = 6f; if (this.type == 285 || this.type == 286) { single153 = 8f; } if (this.type == 281 || this.type == 282) { single153 = 4f; } Vector2 vector272 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y); float x62 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector272.X; float y58 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector272.Y; if (this.type == 283 || this.type == 284) { x62 = x62 + (float)Main.rand.Next(-30, 31); y58 = y58 + (float)Main.rand.Next(-30, 31); x62 = x62 - Main.player[this.target].velocity.X * 10f; y58 = y58 - Main.player[this.target].velocity.Y * 10f; } float single154 = (float)Math.Sqrt((double)(x62 * x62 + y58 * y58)); single154 = single153 / single154; x62 = x62 * single154; y58 = y58 * single154; int num293 = 30; int num294 = 290; if (this.type == 285 || this.type == 286) { num294 = 291; num293 = 40; } if (this.type == 281 || this.type == 282) { num294 = 293; num293 = 40; } if (Main.expertMode) { num293 = (int)((double)num293 * 0.8); } int num295 = Projectile.NewProjectile(vector272.X, vector272.Y, x62, y58, num294, num293, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num295].timeLeft = 300; if (num294 == 291) { Main.projectile[num295].ai[0] = Main.player[this.target].Center.X; Main.projectile[num295].ai[1] = Main.player[this.target].Center.Y; Main.projectile[num295].netUpdate = true; } this.localAI[0] = 0f; } } } if (this.type == 29 || this.type == 45) { if (Main.rand.Next(5) == 0) { return; } } else if (this.type != 32) { if (this.type == 172) { int num299 = 1; if (this.alpha == 255) { num299 = 2; } return; } if (this.type == 283 || this.type == 284) { if (Main.rand.Next(2) == 0) { return; } } else if (this.type == 285 || this.type == 286) { if (Main.rand.Next(2) == 0) { return; } } else if (this.type != 281 && this.type != 282) { if (Main.rand.Next(2) == 0) { return; } } else if (Main.rand.Next(2) == 0) { return; } } else if (Main.rand.Next(3) != 0) { return; } } else if (this.aiStyle == 9) { if (this.type == 516) { if (this.alpha < 220) { NPC nPC82 = this; nPC82.alpha = nPC82.alpha + 40; } if (this.ai[0] == 0f) { this.ai[0] = 1f; Vector2 unitY1 = Main.player[this.target].Center - base.Center; unitY1.Normalize(); if (unitY1.HasNaNs()) { unitY1 = -Vector2.UnitY; } Vector2 vector280 = unitY1.RotatedByRandom(1.57079637050629); vector24 = new Vector2(); unitY1 = vector280.RotatedBy(-0.785398185253143, vector24); if (unitY1.Y > 0.2f) { unitY1.Y = 0.2f; } this.velocity = unitY1 * (6f + Main.rand.NextFloat() * 4f); } if (this.collideX || this.collideY || base.Distance(Main.player[this.target].Center) < 20f) { this.StrikeNPCNoInteraction(9999, 0f, this.direction, false, false, false); } } if (this.target == 255) { this.TargetClosest(true); float single155 = 6f; if (this.type == 25) { single155 = 5f; } if (this.type == 112) { single155 = 7f; } Vector2 vector281 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x63 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector281.X; float y59 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector281.Y; float single156 = (float)Math.Sqrt((double)(x63 * x63 + y59 * y59)); single156 = single155 / single156; this.velocity.X = x63 * single156; this.velocity.Y = y59 * single156; } if (this.type == 112) { this.ai[0] = this.ai[0] + 1f; if (this.ai[0] > 3f) { this.ai[0] = 3f; } if (this.ai[0] == 2f) { NPC nPC83 = this; nPC83.position = nPC83.position + this.velocity; } } if (this.type == 112 && Collision.SolidCollision(this.position, this.width, this.height)) { int num321 = Main.netMode; this.StrikeNPCNoInteraction(999, 0f, 0, false, false, false); } if (this.timeLeft > 100) { this.timeLeft = 100; } if (this.type != 516) { for (int y210 = 0; y210 < 2; y210++) { if (this.type == 30) { this.alpha = 255; } else if (this.type != 112) { } } NPC nPC84 = this; nPC84.rotation = nPC84.rotation + 0.4f * (float)this.direction; return; } NPC nPC85 = this; nPC85.rotation = nPC85.rotation + 0.1f * (float)this.direction; float single157 = 15f; float single158 = 0.0833333358f; Vector2 center22 = base.Center; Vector2 center23 = Main.player[this.target].Center; Vector2 vector288 = center23 - center22; vector288.Normalize(); if (vector288.HasNaNs()) { vector288 = new Vector2((float)this.direction, 0f); } this.velocity = ((this.velocity * (single157 - 1f)) + (vector288 * (this.velocity.Length() + single158))) / single157; if (this.velocity.Length() < 6f) { NPC nPC86 = this; nPC86.velocity = nPC86.velocity * 1.05f; return; } } else if (this.aiStyle == 10) { float single159 = 1f; float single160 = 0.011f; this.TargetClosest(true); Vector2 vector289 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x65 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector289.X; float y61 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector289.Y; float single161 = (float)Math.Sqrt((double)(x65 * x65 + y61 * y61)); float single162 = single161; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] > 600f) { single160 = single160 * 8f; single159 = 4f; if (this.ai[1] > 650f) { this.ai[1] = 0f; } } else if (single162 < 250f) { this.ai[0] = this.ai[0] + 0.9f; if (this.ai[0] <= 0f) { this.velocity.Y = this.velocity.Y - 0.019f; } else { this.velocity.Y = this.velocity.Y + 0.019f; } if (this.ai[0] < -100f || this.ai[0] > 100f) { this.velocity.X = this.velocity.X + 0.019f; } else { this.velocity.X = this.velocity.X - 0.019f; } if (this.ai[0] > 200f) { this.ai[0] = -200f; } } if (single162 > 350f) { single159 = 5f; single160 = 0.3f; } else if (single162 > 300f) { single159 = 3f; single160 = 0.2f; } else if (single162 > 250f) { single159 = 1.5f; single160 = 0.1f; } single161 = single159 / single161; x65 = x65 * single161; y61 = y61 * single161; if (Main.player[this.target].dead) { x65 = (float)this.direction * single159 / 2f; y61 = -single159 / 2f; } if (this.velocity.X < x65) { this.velocity.X = this.velocity.X + single160; } else if (this.velocity.X > x65) { this.velocity.X = this.velocity.X - single160; } if (this.velocity.Y < y61) { this.velocity.Y = this.velocity.Y + single160; } else if (this.velocity.Y > y61) { this.velocity.Y = this.velocity.Y - single160; } if (x65 > 0f) { this.spriteDirection = -1; this.rotation = (float)Math.Atan2((double)y61, (double)x65); } if (x65 < 0f) { this.spriteDirection = 1; this.rotation = (float)Math.Atan2((double)y61, (double)x65) + 3.14f; } if (this.type == 289) { if (this.justHit) { this.ai[2] = 0f; this.ai[3] = 0f; } vector289 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); x65 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector289.X; y61 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector289.Y; single161 = (float)Math.Sqrt((double)(x65 * x65 + y61 * y61)); if (single161 > 500f) { this.ai[2] = 0f; this.ai[3] = 0f; return; } this.ai[2] = this.ai[2] + 1f; if (this.ai[3] != 0f) { if (this.ai[2] > 40f) { this.ai[3] = 0f; } if (Main.netMode != 1 && this.ai[2] == 20f) { float single163 = 6f; int num335 = 25; int num336 = 299; single161 = single163 / single161; x65 = x65 * single161; y61 = y61 * single161; Projectile.NewProjectile(vector289.X, vector289.Y, x65, y61, num336, num335, 0f, Main.myPlayer, 0f, 0f); return; } } else if (this.ai[2] > 120f) { this.ai[2] = 0f; this.ai[3] = 1f; this.netUpdate = true; return; } } } else if (this.aiStyle == 11) { this.defense = this.defDefense; if (this.ai[0] == 0f && Main.netMode != 1) { this.TargetClosest(true); this.ai[0] = 1f; if (this.type != 68) { int num337 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)this.position.Y + this.height / 2, 36, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num337].ai[0] = -1f; Main.npc[num337].ai[1] = (float)this.whoAmI; Main.npc[num337].target = this.target; Main.npc[num337].netUpdate = true; num337 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)this.position.Y + this.height / 2, 36, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num337].ai[0] = 1f; Main.npc[num337].ai[1] = (float)this.whoAmI; Main.npc[num337].ai[3] = 150f; Main.npc[num337].target = this.target; Main.npc[num337].netUpdate = true; } } if (this.type == 68 && this.ai[1] != 3f && this.ai[1] != 2f) { this.ai[1] = 2f; } if (Main.player[this.target].dead || Math.Abs(this.position.X - Main.player[this.target].position.X) > 2000f || Math.Abs(this.position.Y - Main.player[this.target].position.Y) > 2000f) { this.TargetClosest(true); if (Main.player[this.target].dead || Math.Abs(this.position.X - Main.player[this.target].position.X) > 2000f || Math.Abs(this.position.Y - Main.player[this.target].position.Y) > 2000f) { this.ai[1] = 3f; } } if (Main.dayTime && this.ai[1] != 3f && this.ai[1] != 2f) { this.ai[1] = 2f; } int num338 = 0; if (Main.expertMode) { for (int c2 = 0; c2 < 200; c2++) { if (Main.npc[c2].active && Main.npc[c2].type == this.type + 1) { num338++; } } NPC nPC87 = this; nPC87.defense = nPC87.defense + num338 * 25; if ((num338 < 2 || (double)this.life < (double)this.lifeMax * 0.75) && this.ai[1] == 0f) { float single164 = 80f; if (num338 == 0) { single164 = single164 / 2f; } if (Main.netMode != 1 && this.ai[2] % single164 == 0f) { Vector2 center24 = base.Center; float x66 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - center24.X; float y62 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - center24.Y; Math.Sqrt((double)(x66 * x66 + y62 * y62)); if (Collision.CanHit(center24, 1, 1, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { float single165 = 3f; if (num338 == 0) { single165 = single165 + 2f; } float x67 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - center24.X + (float)Main.rand.Next(-20, 21); float y63 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - center24.Y + (float)Main.rand.Next(-20, 21); float single166 = (float)Math.Sqrt((double)(x67 * x67 + y63 * y63)); single166 = single165 / single166; x67 = x67 * single166; y63 = y63 * single166; Vector2 vector290 = new Vector2(x67 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f, y63 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f); vector290.Normalize(); vector290 = vector290 * single165; vector290 = vector290 + this.velocity; x67 = vector290.X; y63 = vector290.Y; int num339 = 17; int num340 = 270; center24 = center24 + (vector290 * 5f); int num341 = Projectile.NewProjectile(center24.X, center24.Y, x67, y63, num340, num339, 0f, Main.myPlayer, -1f, 0f); Main.projectile[num341].timeLeft = 300; } } } } if (this.ai[1] == 0f) { this.damage = this.defDamage; this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= 800f) { this.ai[2] = 0f; this.ai[1] = 1f; this.TargetClosest(true); this.netUpdate = true; } this.rotation = this.velocity.X / 15f; float single167 = 0.02f; float single168 = 2f; float single169 = 0.05f; float single170 = 8f; if (Main.expertMode) { single167 = 0.03f; single168 = 4f; single169 = 0.07f; single170 = 9.5f; } if (this.position.Y > Main.player[this.target].position.Y - 250f) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.98f; } this.velocity.Y = this.velocity.Y - single167; if (this.velocity.Y > single168) { this.velocity.Y = single168; } } else if (this.position.Y < Main.player[this.target].position.Y - 250f) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.98f; } this.velocity.Y = this.velocity.Y + single167; if (this.velocity.Y < -single168) { this.velocity.Y = -single168; } } if (this.position.X + (float)(this.width / 2) > Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2)) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.98f; } this.velocity.X = this.velocity.X - single169; if (this.velocity.X > single170) { this.velocity.X = single170; } } if (this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2)) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.98f; } this.velocity.X = this.velocity.X + single169; if (this.velocity.X < -single170) { this.velocity.X = -single170; } } } else if (this.ai[1] == 1f) { NPC nPC88 = this; nPC88.defense = nPC88.defense - 10; this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= 400f) { this.ai[2] = 0f; this.ai[1] = 0f; } NPC nPC89 = this; nPC89.rotation = nPC89.rotation + (float)this.direction * 0.3f; Vector2 vector291 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x68 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector291.X; float y64 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector291.Y; float single171 = (float)Math.Sqrt((double)(x68 * x68 + y64 * y64)); float single172 = 1.5f; if (Main.expertMode) { this.damage = (int)((double)this.defDamage * 1.3); single172 = 4f; if (single171 > 150f) { single172 = single172 * 1.05f; } if (single171 > 200f) { single172 = single172 * 1.1f; } if (single171 > 250f) { single172 = single172 * 1.1f; } if (single171 > 300f) { single172 = single172 * 1.1f; } if (single171 > 350f) { single172 = single172 * 1.1f; } if (single171 > 400f) { single172 = single172 * 1.1f; } if (single171 > 450f) { single172 = single172 * 1.1f; } if (single171 > 500f) { single172 = single172 * 1.1f; } if (single171 > 550f) { single172 = single172 * 1.1f; } if (single171 > 600f) { single172 = single172 * 1.1f; } if (num338 == 0) { single172 = single172 * 1.2f; } else if (num338 == 1) { single172 = single172 * 1.1f; } } single171 = single172 / single171; this.velocity.X = x68 * single171; this.velocity.Y = y64 * single171; } else if (this.ai[1] == 2f) { this.damage = 1000; this.defense = 9999; NPC nPC90 = this; nPC90.rotation = nPC90.rotation + (float)this.direction * 0.3f; Vector2 vector292 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x69 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector292.X; float y65 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector292.Y; float single173 = (float)Math.Sqrt((double)(x69 * x69 + y65 * y65)); single173 = 8f / single173; this.velocity.X = x69 * single173; this.velocity.Y = y65 * single173; } else if (this.ai[1] == 3f) { this.velocity.Y = this.velocity.Y + 0.1f; if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.95f; } this.velocity.X = this.velocity.X * 0.95f; if (this.timeLeft > 50) { this.timeLeft = 50; } } if (this.ai[1] != 2f && this.ai[1] != 3f && this.type != 68) { if (num338 == 0 && Main.expertMode) { return; } return; } } else if (this.aiStyle == 12) { this.spriteDirection = -(int)this.ai[0]; if (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].aiStyle != 11) { this.ai[2] = this.ai[2] + 10f; if (this.ai[2] > 50f || Main.netMode != 2) { this.life = -1; this.HitEffect(0, 10); this.active = false; } } if (this.ai[2] == 0f || this.ai[2] == 3f) { if (Main.npc[(int)this.ai[1]].ai[1] == 3f && this.timeLeft > 10) { this.timeLeft = 10; } if (Main.npc[(int)this.ai[1]].ai[1] == 0f) { this.ai[3] = this.ai[3] + 1f; if (Main.expertMode) { this.ai[3] = this.ai[3] + 0.5f; } if (this.ai[3] >= 300f) { this.ai[2] = this.ai[2] + 1f; this.ai[3] = 0f; this.netUpdate = true; } if (Main.expertMode) { if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y + 230f) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y - 0.04f; if (this.velocity.Y > 3f) { this.velocity.Y = 3f; } } else if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y + 230f) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y + 0.04f; if (this.velocity.Y < -3f) { this.velocity.Y = -3f; } } if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0]) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X - 0.07f; if (this.velocity.X > 8f) { this.velocity.X = 8f; } } if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0]) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X + 0.07f; if (this.velocity.X < -8f) { this.velocity.X = -8f; } } } if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y + 230f) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y - 0.04f; if (this.velocity.Y > 3f) { this.velocity.Y = 3f; } } else if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y + 230f) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y + 0.04f; if (this.velocity.Y < -3f) { this.velocity.Y = -3f; } } if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0]) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X - 0.07f; if (this.velocity.X > 8f) { this.velocity.X = 8f; } } if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0]) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X + 0.07f; if (this.velocity.X < -8f) { this.velocity.X = -8f; } } } else { if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y - 100f) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y - 0.07f; if (this.velocity.Y > 6f) { this.velocity.Y = 6f; } } else if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y - 100f) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y + 0.07f; if (this.velocity.Y < -6f) { this.velocity.Y = -6f; } } if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 120f * this.ai[0]) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > 8f) { this.velocity.X = 8f; } } if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 120f * this.ai[0]) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -8f) { this.velocity.X = -8f; } } } Vector2 vector295 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x71 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector295.X; float y67 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector295.Y; Math.Sqrt((double)(x71 * x71 + y67 * y67)); this.rotation = (float)Math.Atan2((double)y67, (double)x71) + 1.57f; return; } if (this.ai[2] == 1f) { Vector2 vector296 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x72 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector296.X; float y68 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector296.Y; float single174 = (float)Math.Sqrt((double)(x72 * x72 + y68 * y68)); this.rotation = (float)Math.Atan2((double)y68, (double)x72) + 1.57f; this.velocity.X = this.velocity.X * 0.95f; this.velocity.Y = this.velocity.Y - 0.1f; if (Main.expertMode) { this.velocity.Y = this.velocity.Y - 0.06f; if (this.velocity.Y < -13f) { this.velocity.Y = -13f; } } else if (this.velocity.Y < -8f) { this.velocity.Y = -8f; } if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y - 200f) { this.TargetClosest(true); this.ai[2] = 2f; vector296 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); x72 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector296.X; y68 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector296.Y; single174 = (float)Math.Sqrt((double)(x72 * x72 + y68 * y68)); single174 = (!Main.expertMode ? 18f / single174 : 21f / single174); this.velocity.X = x72 * single174; this.velocity.Y = y68 * single174; this.netUpdate = true; return; } } else if (this.ai[2] == 2f) { if (this.position.Y > Main.player[this.target].position.Y || this.velocity.Y < 0f) { this.ai[2] = 3f; return; } } else if (this.ai[2] == 4f) { Vector2 vector297 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x73 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector297.X; float y69 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector297.Y; float single175 = (float)Math.Sqrt((double)(x73 * x73 + y69 * y69)); this.rotation = (float)Math.Atan2((double)y69, (double)x73) + 1.57f; this.velocity.Y = this.velocity.Y * 0.95f; this.velocity.X = this.velocity.X + 0.1f * -this.ai[0]; if (Main.expertMode) { this.velocity.X = this.velocity.X + 0.07f * -this.ai[0]; if (this.velocity.X < -12f) { this.velocity.X = -12f; } else if (this.velocity.X > 12f) { this.velocity.X = 12f; } } else if (this.velocity.X < -8f) { this.velocity.X = -8f; } else if (this.velocity.X > 8f) { this.velocity.X = 8f; } if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 500f || this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) + 500f) { this.TargetClosest(true); this.ai[2] = 5f; vector297 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); x73 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector297.X; y69 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector297.Y; single175 = (float)Math.Sqrt((double)(x73 * x73 + y69 * y69)); single175 = (!Main.expertMode ? 17f / single175 : 22f / single175); this.velocity.X = x73 * single175; this.velocity.Y = y69 * single175; this.netUpdate = true; return; } } else if (this.ai[2] == 5f && (this.velocity.X > 0f && this.position.X + (float)(this.width / 2) > Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) || this.velocity.X < 0f && this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2))) { this.ai[2] = 0f; return; } } else if (this.aiStyle == 13) { if (this.ai[0] < 0f || this.ai[0] >= (float)Main.maxTilesX || this.ai[1] < 0f || this.ai[1] >= (float)Main.maxTilesX) { return; } if (Main.tile[(int)this.ai[0], (int)this.ai[1]] == null) { Main.tile[(int)this.ai[0], (int)this.ai[1]] = new Tile(); } if (!Main.tile[(int)this.ai[0], (int)this.ai[1]].active()) { this.life = -1; this.HitEffect(0, 10); this.active = false; return; } this.TargetClosest(true); float single176 = 0.035f; float single177 = 150f; if (this.type == 43) { single177 = 250f; } if (this.type == 101) { single177 = 175f; } if (this.type == 259) { single177 = 100f; } if (this.type == 175) { single177 = 500f; single176 = 0.05f; } if (this.type == 260) { single177 = 350f; single176 = 0.15f; } this.ai[2] = this.ai[2] + 1f; if (this.ai[2] > 300f) { single177 = (float)((int)((double)single177 * 1.3)); if (this.ai[2] > 450f) { this.ai[2] = 0f; } } Vector2 vector298 = new Vector2(this.ai[0] * 16f + 8f, this.ai[1] * 16f + 8f); float x74 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - (float)(this.width / 2) - vector298.X; float y70 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - (float)(this.height / 2) - vector298.Y; float single178 = (float)Math.Sqrt((double)(x74 * x74 + y70 * y70)); if (single178 > single177) { single178 = single177 / single178; x74 = x74 * single178; y70 = y70 * single178; } if (this.position.X < this.ai[0] * 16f + 8f + x74) { this.velocity.X = this.velocity.X + single176; if (this.velocity.X < 0f && x74 > 0f) { this.velocity.X = this.velocity.X + single176 * 1.5f; } } else if (this.position.X > this.ai[0] * 16f + 8f + x74) { this.velocity.X = this.velocity.X - single176; if (this.velocity.X > 0f && x74 < 0f) { this.velocity.X = this.velocity.X - single176 * 1.5f; } } if (this.position.Y < this.ai[1] * 16f + 8f + y70) { this.velocity.Y = this.velocity.Y + single176; if (this.velocity.Y < 0f && y70 > 0f) { this.velocity.Y = this.velocity.Y + single176 * 1.5f; } } else if (this.position.Y > this.ai[1] * 16f + 8f + y70) { this.velocity.Y = this.velocity.Y - single176; if (this.velocity.Y > 0f && y70 < 0f) { this.velocity.Y = this.velocity.Y - single176 * 1.5f; } } if (this.type == 43) { if (this.velocity.X > 3f) { this.velocity.X = 3f; } if (this.velocity.X < -3f) { this.velocity.X = -3f; } if (this.velocity.Y > 3f) { this.velocity.Y = 3f; } if (this.velocity.Y < -3f) { this.velocity.Y = -3f; } } else if (this.type != 175) { if (this.velocity.X > 2f) { this.velocity.X = 2f; } if (this.velocity.X < -2f) { this.velocity.X = -2f; } if (this.velocity.Y > 2f) { this.velocity.Y = 2f; } if (this.velocity.Y < -2f) { this.velocity.Y = -2f; } } else { if (this.velocity.X > 4f) { this.velocity.X = 4f; } if (this.velocity.X < -4f) { this.velocity.X = -4f; } if (this.velocity.Y > 4f) { this.velocity.Y = 4f; } if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } } if (this.type == 259 || this.type == 260) { this.rotation = (float)Math.Atan2((double)y70, (double)x74) + 1.57f; } else { if (x74 > 0f) { this.spriteDirection = 1; this.rotation = (float)Math.Atan2((double)y70, (double)x74); } if (x74 < 0f) { this.spriteDirection = -1; this.rotation = (float)Math.Atan2((double)y70, (double)x74) + 3.14f; } } if (this.collideX) { this.netUpdate = true; this.velocity.X = this.oldVelocity.X * -0.7f; if (this.velocity.X > 0f && this.velocity.X < 2f) { this.velocity.X = 2f; } if (this.velocity.X < 0f && this.velocity.X > -2f) { this.velocity.X = -2f; } } if (this.collideY) { this.netUpdate = true; this.velocity.Y = this.oldVelocity.Y * -0.7f; if (this.velocity.Y > 0f && this.velocity.Y < 2f) { this.velocity.Y = 2f; } if (this.velocity.Y < 0f && this.velocity.Y > -2f) { this.velocity.Y = -2f; } } if (Main.netMode != 1) { if (this.type == 101 && !Main.player[this.target].dead) { if (this.justHit) { this.localAI[0] = 0f; } this.localAI[0] = this.localAI[0] + 1f; if (this.localAI[0] >= 120f) { if (Collision.SolidCollision(this.position, this.width, this.height) || !Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.localAI[0] = 100f; } else { float single179 = 10f; vector298 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); x74 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector298.X + (float)Main.rand.Next(-10, 11); y70 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector298.Y + (float)Main.rand.Next(-10, 11); single178 = (float)Math.Sqrt((double)(x74 * x74 + y70 * y70)); single178 = single179 / single178; x74 = x74 * single178; y70 = y70 * single178; int num344 = 22; if (Main.expertMode) { num344 = (int)((double)num344 * 0.8); } int num345 = 96; int num346 = Projectile.NewProjectile(vector298.X, vector298.Y, x74, y70, num345, num344, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num346].timeLeft = 300; this.localAI[0] = 0f; } } } if (this.type == 260 && !Main.player[this.target].dead) { if (this.justHit) { this.localAI[0] = 0f; } this.localAI[0] = this.localAI[0] + 1f; if (this.localAI[0] >= 150f) { if (Collision.SolidCollision(this.position, this.width, this.height)) { this.localAI[0] = 250f; return; } float single180 = 14f; vector298 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); x74 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector298.X + (float)Main.rand.Next(-10, 11); float single181 = Math.Abs(x74 * 0.1f); if (y70 > 0f) { single181 = 0f; } y70 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector298.Y + (float)Main.rand.Next(-10, 11) - single181; single178 = (float)Math.Sqrt((double)(x74 * x74 + y70 * y70)); single178 = single180 / single178; x74 = x74 * single178; y70 = y70 * single178; int num347 = NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 261, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num347].velocity.X = x74; Main.npc[num347].velocity.Y = y70; Main.npc[num347].netUpdate = true; this.localAI[0] = 0f; return; } } } } else if (this.aiStyle == 14) { this.noGravity = true; if (this.collideX) { this.velocity.X = this.oldVelocity.X * -0.5f; if (this.direction == -1 && this.velocity.X > 0f && this.velocity.X < 2f) { this.velocity.X = 2f; } if (this.direction == 1 && this.velocity.X < 0f && this.velocity.X > -2f) { this.velocity.X = -2f; } } if (this.collideY) { this.velocity.Y = this.oldVelocity.Y * -0.5f; if (this.velocity.Y > 0f && this.velocity.Y < 1f) { this.velocity.Y = 1f; } if (this.velocity.Y < 0f && this.velocity.Y > -1f) { this.velocity.Y = -1f; } } if (this.type != 226) { this.TargetClosest(true); } else { int num354 = 1; int num355 = 1; if (this.velocity.X < 0f) { num354 = -1; } if (this.velocity.Y < 0f) { num355 = -1; } this.TargetClosest(true); if (!Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.direction = num354; this.directionY = num355; } } if (this.type == 158) { if ((double)this.position.Y < Main.worldSurface * 16 && Main.dayTime && !Main.eclipse) { this.directionY = -1; NPC nPC91 = this; nPC91.direction = nPC91.direction * -1; } if (this.direction == -1 && this.velocity.X > -7f) { this.velocity.X = this.velocity.X - 0.2f; if (this.velocity.X > 4f) { this.velocity.X = this.velocity.X - 0.1f; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X + 0.05f; } if (this.velocity.X < -7f) { this.velocity.X = -7f; } } else if (this.direction == 1 && this.velocity.X < 7f) { this.velocity.X = this.velocity.X + 0.2f; if (this.velocity.X < -4f) { this.velocity.X = this.velocity.X + 0.1f; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X - 0.05f; } if (this.velocity.X > 7f) { this.velocity.X = 7f; } } if (this.directionY == -1 && this.velocity.Y > -7f) { this.velocity.Y = this.velocity.Y - 0.2f; if (this.velocity.Y > 4f) { this.velocity.Y = this.velocity.Y - 0.1f; } else if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y + 0.05f; } if (this.velocity.Y < -7f) { this.velocity.Y = -7f; } } else if (this.directionY == 1 && this.velocity.Y < 7f) { this.velocity.Y = this.velocity.Y + 0.2f; if (this.velocity.Y < -4f) { this.velocity.Y = this.velocity.Y + 0.1f; } else if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y - 0.05f; } if (this.velocity.Y > 7f) { this.velocity.Y = 7f; } } } else if (this.type != 226) { if (this.direction == -1 && this.velocity.X > -4f) { this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > 4f) { this.velocity.X = this.velocity.X - 0.1f; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X + 0.05f; } if (this.velocity.X < -4f) { this.velocity.X = -4f; } } else if (this.direction == 1 && this.velocity.X < 4f) { this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -4f) { this.velocity.X = this.velocity.X + 0.1f; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X - 0.05f; } if (this.velocity.X > 4f) { this.velocity.X = 4f; } } if (this.directionY == -1 && (double)this.velocity.Y > -1.5) { this.velocity.Y = this.velocity.Y - 0.04f; if ((double)this.velocity.Y > 1.5) { this.velocity.Y = this.velocity.Y - 0.05f; } else if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y + 0.03f; } if ((double)this.velocity.Y < -1.5) { this.velocity.Y = -1.5f; } } else if (this.directionY == 1 && (double)this.velocity.Y < 1.5) { this.velocity.Y = this.velocity.Y + 0.04f; if ((double)this.velocity.Y < -1.5) { this.velocity.Y = this.velocity.Y + 0.05f; } else if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y - 0.03f; } if ((double)this.velocity.Y > 1.5) { this.velocity.Y = 1.5f; } } } else { if (this.direction == -1 && this.velocity.X > -4f) { this.velocity.X = this.velocity.X - 0.2f; if (this.velocity.X > 4f) { this.velocity.X = this.velocity.X - 0.1f; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X + 0.05f; } if (this.velocity.X < -4f) { this.velocity.X = -4f; } } else if (this.direction == 1 && this.velocity.X < 4f) { this.velocity.X = this.velocity.X + 0.2f; if (this.velocity.X < -4f) { this.velocity.X = this.velocity.X + 0.1f; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X - 0.05f; } if (this.velocity.X > 4f) { this.velocity.X = 4f; } } if (this.directionY == -1 && (double)this.velocity.Y > -2.5) { this.velocity.Y = this.velocity.Y - 0.1f; if ((double)this.velocity.Y > 2.5) { this.velocity.Y = this.velocity.Y - 0.05f; } else if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y + 0.03f; } if ((double)this.velocity.Y < -2.5) { this.velocity.Y = -2.5f; } } else if (this.directionY == 1 && (double)this.velocity.Y < 2.5) { this.velocity.Y = this.velocity.Y + 0.1f; if ((double)this.velocity.Y < -2.5) { this.velocity.Y = this.velocity.Y + 0.05f; } else if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y - 0.03f; } if ((double)this.velocity.Y > 2.5) { this.velocity.Y = 2.5f; } } } if (this.type == 49 || this.type == 51 || this.type == 60 || this.type == 62 || this.type == 66 || this.type == 93 || this.type == 137 || this.type == 150 || this.type == 151 || this.type == 152) { if (this.wet) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.95f; } this.velocity.Y = this.velocity.Y - 0.5f; if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } this.TargetClosest(true); } if (this.type != 60) { if (this.direction == -1 && this.velocity.X > -4f) { this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > 4f) { this.velocity.X = this.velocity.X - 0.1f; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X + 0.05f; } if (this.velocity.X < -4f) { this.velocity.X = -4f; } } else if (this.direction == 1 && this.velocity.X < 4f) { this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -4f) { this.velocity.X = this.velocity.X + 0.1f; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X - 0.05f; } if (this.velocity.X > 4f) { this.velocity.X = 4f; } } if (this.directionY == -1 && (double)this.velocity.Y > -1.5) { this.velocity.Y = this.velocity.Y - 0.04f; if ((double)this.velocity.Y > 1.5) { this.velocity.Y = this.velocity.Y - 0.05f; } else if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y + 0.03f; } if ((double)this.velocity.Y < -1.5) { this.velocity.Y = -1.5f; } } else if (this.directionY == 1 && (double)this.velocity.Y < 1.5) { this.velocity.Y = this.velocity.Y + 0.04f; if ((double)this.velocity.Y < -1.5) { this.velocity.Y = this.velocity.Y + 0.05f; } else if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y - 0.03f; } if ((double)this.velocity.Y > 1.5) { this.velocity.Y = 1.5f; } } } else { if (this.direction == -1 && this.velocity.X > -4f) { this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > 4f) { this.velocity.X = this.velocity.X - 0.07f; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X + 0.03f; } if (this.velocity.X < -4f) { this.velocity.X = -4f; } } else if (this.direction == 1 && this.velocity.X < 4f) { this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -4f) { this.velocity.X = this.velocity.X + 0.07f; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X - 0.03f; } if (this.velocity.X > 4f) { this.velocity.X = 4f; } } if (this.directionY == -1 && (double)this.velocity.Y > -1.5) { this.velocity.Y = this.velocity.Y - 0.04f; if ((double)this.velocity.Y > 1.5) { this.velocity.Y = this.velocity.Y - 0.03f; } else if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y + 0.02f; } if ((double)this.velocity.Y < -1.5) { this.velocity.Y = -1.5f; } } else if (this.directionY == 1 && (double)this.velocity.Y < 1.5) { this.velocity.Y = this.velocity.Y + 0.04f; if ((double)this.velocity.Y < -1.5) { this.velocity.Y = this.velocity.Y + 0.03f; } else if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y - 0.02f; } if ((double)this.velocity.Y > 1.5) { this.velocity.Y = 1.5f; } } } } if (this.type == 158 && Main.netMode != 1) { Vector2 vector2101 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x75 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector2101.X; float y71 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector2101.Y; if ((float)Math.Sqrt((double)(x75 * x75 + y71 * y71)) < 200f && this.position.Y + (float)this.height < Main.player[this.target].position.Y + (float)Main.player[this.target].height && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.Transform(159); } } this.ai[1] = this.ai[1] + 1f; if (this.type == 158) { this.ai[1] = this.ai[1] + 1f; } if (this.ai[1] > 200f) { if (!Main.player[this.target].wet && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.ai[1] = 0f; } float single182 = 0.2f; float single183 = 0.1f; float single184 = 4f; float single185 = 1.5f; if (this.type == 48 || this.type == 62 || this.type == 66) { single182 = 0.12f; single183 = 0.07f; single184 = 3f; single185 = 1.25f; } if (this.ai[1] > 1000f) { this.ai[1] = 0f; } this.ai[2] = this.ai[2] + 1f; if (this.ai[2] > 0f) { if (this.velocity.Y < single185) { this.velocity.Y = this.velocity.Y + single183; } } else if (this.velocity.Y > -single185) { this.velocity.Y = this.velocity.Y - single183; } if (this.ai[2] >= -150f && this.ai[2] <= 150f) { if (this.velocity.X > -single184) { this.velocity.X = this.velocity.X - single182; } } else if (this.velocity.X < single184) { this.velocity.X = this.velocity.X + single182; } if (this.ai[2] > 300f) { this.ai[2] = -300f; } } if (Main.netMode != 1) { if (this.type == 48) { this.ai[0] = this.ai[0] + 1f; if (this.ai[0] != 30f && this.ai[0] != 60f && this.ai[0] != 90f) { if (this.ai[0] >= (float)(400 + Main.rand.Next(400))) { this.ai[0] = 0f; } } else if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { float single186 = 6f; Vector2 vector2102 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x76 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector2102.X + (float)Main.rand.Next(-100, 101); float y72 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector2102.Y + (float)Main.rand.Next(-100, 101); float single187 = (float)Math.Sqrt((double)(x76 * x76 + y72 * y72)); single187 = single186 / single187; x76 = x76 * single187; y72 = y72 * single187; int num356 = 15; int num357 = 38; int num358 = Projectile.NewProjectile(vector2102.X, vector2102.Y, x76, y72, num357, num356, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num358].timeLeft = 300; } } if (this.type == 62 || this.type == 66) { this.ai[0] = this.ai[0] + 1f; if (this.ai[0] != 20f && this.ai[0] != 40f && this.ai[0] != 60f && this.ai[0] != 80f) { if (this.ai[0] >= (float)(300 + Main.rand.Next(300))) { this.ai[0] = 0f; } } else if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { float single188 = 0.2f; Vector2 vector2103 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x77 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector2103.X + (float)Main.rand.Next(-100, 101); float y73 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector2103.Y + (float)Main.rand.Next(-100, 101); float single189 = (float)Math.Sqrt((double)(x77 * x77 + y73 * y73)); single189 = single188 / single189; x77 = x77 * single189; y73 = y73 * single189; int num359 = 21; int num360 = 44; int num361 = Projectile.NewProjectile(vector2103.X, vector2103.Y, x77, y73, num360, num359, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num361].timeLeft = 300; } } if (this.type == 156) { this.ai[0] = this.ai[0] + 1f; if (this.ai[0] != 20f && this.ai[0] != 40f && this.ai[0] != 60f && this.ai[0] != 80f && this.ai[0] != 100f) { if (this.ai[0] >= (float)(250 + Main.rand.Next(250))) { this.ai[0] = 0f; return; } } else if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { float single190 = 0.2f; Vector2 vector2104 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x78 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector2104.X + (float)Main.rand.Next(-50, 51); float y74 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector2104.Y + (float)Main.rand.Next(-50, 51); float single191 = (float)Math.Sqrt((double)(x78 * x78 + y74 * y74)); single191 = single190 / single191; x78 = x78 * single191; y74 = y74 * single191; int num362 = 80; int num363 = 115; vector2104 = vector2104 + (this.velocity * 5f); int num364 = Projectile.NewProjectile(vector2104.X + x78 * 100f, vector2104.Y + y74 * 100f, x78, y74, num363, num362, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num364].timeLeft = 300; return; } } } } else if (this.aiStyle == 15) { float single192 = 1f; bool flag67 = false; bool flag68 = false; this.aiAction = 0; if (this.ai[3] == 0f && this.life > 0) { this.ai[3] = (float)this.lifeMax; } if (this.localAI[3] == 0f && Main.netMode != 1) { this.ai[0] = -100f; this.localAI[3] = 1f; this.TargetClosest(true); this.netUpdate = true; } if (Main.player[this.target].dead) { this.TargetClosest(true); if (Main.player[this.target].dead) { this.timeLeft = 0; if (Main.player[this.target].Center.X >= base.Center.X) { this.direction = -1; } else { this.direction = 1; } } } if (!Main.player[this.target].dead && this.ai[2] >= 300f && this.ai[1] < 5f && this.velocity.Y == 0f) { this.ai[2] = 0f; this.ai[0] = 0f; this.ai[1] = 5f; if (Main.netMode != 1) { this.TargetClosest(false); Point point2 = base.Center.ToTileCoordinates(); Point tileCoordinates3 = Main.player[this.target].Center.ToTileCoordinates(); Vector2 center25 = Main.player[this.target].Center - base.Center; int num365 = 10; int num366 = 0; int num367 = 7; int num368 = 0; bool flag69 = false; if (center25.Length() > 2000f) { flag69 = true; num368 = 100; } while (!flag69 && num368 < 100) { num368++; int num369 = Main.rand.Next(tileCoordinates3.X - num365, tileCoordinates3.X + num365 + 1); int num370 = Main.rand.Next(tileCoordinates3.Y - num365, tileCoordinates3.Y + 1); if (num370 >= tileCoordinates3.Y - num367 && num370 <= tileCoordinates3.Y + num367 && num369 >= tileCoordinates3.X - num367 && num369 <= tileCoordinates3.X + num367 || num370 >= point2.Y - num366 && num370 <= point2.Y + num366 && num369 >= point2.X - num366 && num369 <= point2.X + num366 || Main.tile[num369, num370].nactive()) { continue; } int num371 = num370; int num372 = 0; if ((!Main.tile[num369, num371].nactive() || !Main.tileSolid[Main.tile[num369, num371].type] ? true : Main.tileSolidTop[Main.tile[num369, num371].type])) { while (num372 < 150 && num371 + num372 < Main.maxTilesY) { int num373 = num371 + num372; if ((!Main.tile[num369, num373].nactive() || !Main.tileSolid[Main.tile[num369, num373].type] ? true : Main.tileSolidTop[Main.tile[num369, num373].type])) { num372++; } else { num372--; break; } } } else { num372 = 1; } num370 = num370 + num372; bool flag70 = true; if (flag70 && Main.tile[num369, num370].lava()) { flag70 = false; } if (flag70 && !Collision.CanHitLine(base.Center, 0, 0, Main.player[this.target].Center, 0, 0)) { flag70 = false; } if (!flag70) { continue; } this.localAI[1] = (float)(num369 * 16 + 8); this.localAI[2] = (float)(num370 * 16 + 16); flag69 = true; break; } if (num368 >= 100) { Vector2 bottom = Main.player[Player.FindClosest(this.position, this.width, this.height)].Bottom; this.localAI[1] = bottom.X; this.localAI[2] = bottom.Y; } } } if (!Collision.CanHitLine(base.Center, 0, 0, Main.player[this.target].Center, 0, 0)) { this.ai[2] = this.ai[2] + 1f; } if (Math.Abs(base.Top.Y - Main.player[this.target].Bottom.Y) > 320f) { this.ai[2] = this.ai[2] + 1f; } if (this.ai[1] == 5f) { flag67 = true; this.aiAction = 1; this.ai[0] = this.ai[0] + 1f; single192 = MathHelper.Clamp((60f - this.ai[0]) / 60f, 0f, 1f); single192 = 0.5f + single192 * 0.5f; if (this.ai[0] >= 60f) { flag68 = true; } if (this.ai[0] == 60f) { } if (this.ai[0] >= 60f && Main.netMode != 1) { base.Bottom = new Vector2(this.localAI[1], this.localAI[2]); this.ai[1] = 6f; this.ai[0] = 0f; this.netUpdate = true; } if (Main.netMode == 1 && this.ai[0] >= 120f) { this.ai[1] = 6f; this.ai[0] = 0f; } if (!flag68) { } } else if (this.ai[1] == 6f) { flag67 = true; this.aiAction = 0; this.ai[0] = this.ai[0] + 1f; single192 = MathHelper.Clamp(this.ai[0] / 30f, 0f, 1f); single192 = 0.5f + single192 * 0.5f; if (this.ai[0] >= 30f && Main.netMode != 1) { this.ai[1] = 0f; this.ai[0] = 0f; this.netUpdate = true; this.TargetClosest(true); } if (Main.netMode == 1 && this.ai[0] >= 60f) { this.ai[1] = 0f; this.ai[0] = 0f; this.TargetClosest(true); } } bool flag71 = flag68; bool flag72 = flag71; this.hide = flag71; this.dontTakeDamage = flag72; if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.8f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } if (!flag67) { this.ai[0] = this.ai[0] + 2f; if ((double)this.life < (double)this.lifeMax * 0.8) { this.ai[0] = this.ai[0] + 1f; } if ((double)this.life < (double)this.lifeMax * 0.6) { this.ai[0] = this.ai[0] + 1f; } if ((double)this.life < (double)this.lifeMax * 0.4) { this.ai[0] = this.ai[0] + 2f; } if ((double)this.life < (double)this.lifeMax * 0.2) { this.ai[0] = this.ai[0] + 3f; } if ((double)this.life < (double)this.lifeMax * 0.1) { this.ai[0] = this.ai[0] + 4f; } if (this.ai[0] >= 0f) { this.netUpdate = true; this.TargetClosest(true); if (this.ai[1] == 3f) { this.velocity.Y = -13f; this.velocity.X = this.velocity.X + 3.5f * (float)this.direction; this.ai[0] = -200f; this.ai[1] = 0f; } else if (this.ai[1] != 2f) { this.velocity.Y = -8f; this.velocity.X = this.velocity.X + 4f * (float)this.direction; this.ai[0] = -120f; this.ai[1] = this.ai[1] + 1f; } else { this.velocity.Y = -6f; this.velocity.X = this.velocity.X + 4.5f * (float)this.direction; this.ai[0] = -120f; this.ai[1] = this.ai[1] + 1f; } } else if (this.ai[0] >= -30f) { this.aiAction = 1; } } } else if (this.target < 255 && (this.direction == 1 && this.velocity.X < 3f || this.direction == -1 && this.velocity.X > -3f)) { if ((this.direction != -1 || (double)this.velocity.X >= 0.1) && (this.direction != 1 || (double)this.velocity.X <= -0.1)) { this.velocity.X = this.velocity.X * 0.93f; } else { this.velocity.X = this.velocity.X + 0.2f * (float)this.direction; } } if (this.life > 0) { float single193 = (float)this.life / (float)this.lifeMax; single193 = single193 * 0.5f + 0.75f; single193 = single193 * single192; if (single193 != this.scale) { this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)this.height; this.scale = single193; this.width = (int)(98f * this.scale); this.height = (int)(92f * this.scale); this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)this.height; } if (Main.netMode != 1) { int num377 = (int)((double)this.lifeMax * 0.05); if ((float)(this.life + num377) < this.ai[3]) { this.ai[3] = (float)this.life; int num378 = Main.rand.Next(1, 4); for (int g2 = 0; g2 < num378; g2++) { int x79 = (int)(this.position.X + (float)Main.rand.Next(this.width - 32)); int y75 = (int)(this.position.Y + (float)Main.rand.Next(this.height - 32)); int num379 = 1; if (Main.expertMode && Main.rand.Next(4) == 0) { num379 = 535; } int num380 = NPC.NewNPC(x79, y75, num379, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num380].SetDefaults(num379, -1f); Main.npc[num380].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; Main.npc[num380].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; Main.npc[num380].ai[0] = (float)(-1000 * Main.rand.Next(3)); Main.npc[num380].ai[1] = 0f; if (Main.netMode == 2 && num380 < 200) { NetMessage.SendData(23, -1, -1, "", num380, 0f, 0f, 0f, 0, 0, 0); } } return; } } } } else if (this.aiStyle == 16) { if (this.direction == 0) { this.TargetClosest(true); } if (!this.wet) { if (this.velocity.Y == 0f) { if (this.type == 65) { this.velocity.X = this.velocity.X * 0.94f; if ((double)this.velocity.X > -0.2 && (double)this.velocity.X < 0.2) { this.velocity.X = 0f; } } else if (Main.netMode != 1) { this.velocity.Y = (float)Main.rand.Next(-50, -20) * 0.1f; this.velocity.X = (float)Main.rand.Next(-20, 20) * 0.1f; this.netUpdate = true; } } this.velocity.Y = this.velocity.Y + 0.3f; if (this.velocity.Y > 10f) { this.velocity.Y = 10f; } this.ai[0] = 1f; } else { bool flag73 = false; if (this.type != 55) { this.TargetClosest(false); if (Main.player[this.target].wet && !Main.player[this.target].dead) { flag73 = true; } } if (!flag73) { if (this.collideX) { this.velocity.X = this.velocity.X * -1f; NPC nPC92 = this; nPC92.direction = nPC92.direction * -1; this.netUpdate = true; } if (this.collideY) { this.netUpdate = true; if (this.velocity.Y > 0f) { this.velocity.Y = Math.Abs(this.velocity.Y) * -1f; this.directionY = -1; this.ai[0] = -1f; } else if (this.velocity.Y < 0f) { this.velocity.Y = Math.Abs(this.velocity.Y); this.directionY = 1; this.ai[0] = 1f; } } } if (!flag73) { if (this.type != 157) { this.velocity.X = this.velocity.X + (float)this.direction * 0.1f; if (this.velocity.X < -1f || this.velocity.X > 1f) { this.velocity.X = this.velocity.X * 0.95f; } if (this.ai[0] != -1f) { this.velocity.Y = this.velocity.Y + 0.01f; if ((double)this.velocity.Y > 0.3) { this.ai[0] = -1f; } } else { this.velocity.Y = this.velocity.Y - 0.01f; if ((double)this.velocity.Y < -0.3) { this.ai[0] = 1f; } } } else { if (Main.player[this.target].position.Y <= this.position.Y) { this.directionY = -1; } else { this.directionY = 1; } this.velocity.X = this.velocity.X + (float)this.direction * 0.2f; if (this.velocity.X < -2f || this.velocity.X > 2f) { this.velocity.X = this.velocity.X * 0.95f; } if (this.ai[0] != -1f) { float single194 = 0.6f; if (this.directionY < 0) { single194 = 0.2f; } if (this.directionY > 0) { single194 = 1f; } this.velocity.Y = this.velocity.Y + 0.02f; if (this.velocity.Y > single194) { this.ai[0] = -1f; } } else { float single195 = -0.6f; if (this.directionY < 0) { single195 = -1f; } if (this.directionY > 0) { single195 = -0.2f; } this.velocity.Y = this.velocity.Y - 0.02f; if (this.velocity.Y < single195) { this.ai[0] = 1f; } } } int x80 = (int)(this.position.X + (float)(this.width / 2)) / 16; int y76 = (int)(this.position.Y + (float)(this.height / 2)) / 16; if (Main.tile[x80, y76 - 1] == null) { Main.tile[x80, y76 - 1] = new Tile(); } if (Main.tile[x80, y76 + 1] == null) { Main.tile[x80, y76 + 1] = new Tile(); } if (Main.tile[x80, y76 + 2] == null) { Main.tile[x80, y76 + 2] = new Tile(); } if (Main.tile[x80, y76 - 1].liquid > 128) { if (Main.tile[x80, y76 + 1].active()) { this.ai[0] = -1f; } else if (Main.tile[x80, y76 + 2].active()) { this.ai[0] = -1f; } } if (this.type != 157 && ((double)this.velocity.Y > 0.4 || (double)this.velocity.Y < -0.4)) { this.velocity.Y = this.velocity.Y * 0.95f; } } else { this.TargetClosest(true); if (this.type == 157) { if (this.velocity.X > 0f && this.direction < 0) { this.velocity.X = this.velocity.X * 0.95f; } if (this.velocity.X < 0f && this.direction > 0) { this.velocity.X = this.velocity.X * 0.95f; } this.velocity.X = this.velocity.X + (float)this.direction * 0.25f; this.velocity.Y = this.velocity.Y + (float)this.directionY * 0.2f; if (this.velocity.X > 8f) { this.velocity.X = 7f; } if (this.velocity.X < -8f) { this.velocity.X = -7f; } if (this.velocity.Y > 5f) { this.velocity.Y = 4f; } if (this.velocity.Y < -5f) { this.velocity.Y = -4f; } } else if (this.type == 65 || this.type == 102) { this.velocity.X = this.velocity.X + (float)this.direction * 0.15f; this.velocity.Y = this.velocity.Y + (float)this.directionY * 0.15f; if (this.velocity.X > 5f) { this.velocity.X = 5f; } if (this.velocity.X < -5f) { this.velocity.X = -5f; } if (this.velocity.Y > 3f) { this.velocity.Y = 3f; } if (this.velocity.Y < -3f) { this.velocity.Y = -3f; } } else { this.velocity.X = this.velocity.X + (float)this.direction * 0.1f; this.velocity.Y = this.velocity.Y + (float)this.directionY * 0.1f; if (this.velocity.X > 3f) { this.velocity.X = 3f; } if (this.velocity.X < -3f) { this.velocity.X = -3f; } if (this.velocity.Y > 2f) { this.velocity.Y = 2f; } if (this.velocity.Y < -2f) { this.velocity.Y = -2f; } } } } this.rotation = this.velocity.Y * (float)this.direction * 0.1f; if ((double)this.rotation < -0.2) { this.rotation = -0.2f; } if ((double)this.rotation > 0.2) { this.rotation = 0.2f; return; } } else if (this.aiStyle == 17) { this.noGravity = true; if (this.ai[0] == 0f) { this.noGravity = false; this.TargetClosest(true); if (Main.netMode != 1) { if (this.velocity.X != 0f || this.velocity.Y < 0f || (double)this.velocity.Y > 0.3) { this.ai[0] = 1f; this.netUpdate = true; } else { Rectangle rectangle5 = new Rectangle((int)Main.player[this.target].position.X, (int)Main.player[this.target].position.Y, Main.player[this.target].width, Main.player[this.target].height); Rectangle rectangle6 = new Rectangle((int)this.position.X - 100, (int)this.position.Y - 100, this.width + 200, this.height + 200); if (rectangle6.Intersects(rectangle5) || this.life < this.lifeMax) { this.ai[0] = 1f; this.velocity.Y = this.velocity.Y - 6f; this.netUpdate = true; } } } } else if (!Main.player[this.target].dead) { if (this.collideX) { this.velocity.X = this.oldVelocity.X * -0.5f; if (this.direction == -1 && this.velocity.X > 0f && this.velocity.X < 2f) { this.velocity.X = 2f; } if (this.direction == 1 && this.velocity.X < 0f && this.velocity.X > -2f) { this.velocity.X = -2f; } } if (this.collideY) { this.velocity.Y = this.oldVelocity.Y * -0.5f; if (this.velocity.Y > 0f && this.velocity.Y < 1f) { this.velocity.Y = 1f; } if (this.velocity.Y < 0f && this.velocity.Y > -1f) { this.velocity.Y = -1f; } } this.TargetClosest(true); if (this.direction == -1 && this.velocity.X > -3f) { this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > 3f) { this.velocity.X = this.velocity.X - 0.1f; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X - 0.05f; } if (this.velocity.X < -3f) { this.velocity.X = -3f; } } else if (this.direction == 1 && this.velocity.X < 3f) { this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -3f) { this.velocity.X = this.velocity.X + 0.1f; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X + 0.05f; } if (this.velocity.X > 3f) { this.velocity.X = 3f; } } float single196 = Math.Abs(this.position.X + (float)(this.width / 2) - (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2))); float y77 = Main.player[this.target].position.Y - (float)(this.height / 2); if (single196 > 50f) { y77 = y77 - 100f; } if (this.position.Y >= y77) { this.velocity.Y = this.velocity.Y - 0.05f; if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y - 0.01f; } } else { this.velocity.Y = this.velocity.Y + 0.05f; if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y + 0.01f; } } if (this.velocity.Y < -3f) { this.velocity.Y = -3f; } if (this.velocity.Y > 3f) { this.velocity.Y = 3f; } } if (this.wet) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.95f; } this.velocity.Y = this.velocity.Y - 0.5f; if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } this.TargetClosest(true); return; } } else if (this.aiStyle == 18) { bool flag74 = false; if (!this.wet || this.ai[1] != 1f) { this.dontTakeDamage = false; } else { flag74 = true; } if (Main.expertMode && (this.type == 63 || this.type == 64 || this.type == 103 || this.type == 242)) { if (!this.wet) { this.ai[1] = 0f; this.ai[2] = 0f; } else { if (this.target >= 0 && Main.player[this.target].wet && !Main.player[this.target].dead && (Main.player[this.target].Center - base.Center).Length() < 150f) { if (this.ai[1] != 0f) { this.ai[2] = this.ai[2] - 0.25f; } else { this.ai[2] = this.ai[2] + 2f; } } if (!flag74) { this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= 420f) { this.ai[1] = 1f; this.ai[2] = 0f; } } else { this.dontTakeDamage = true; this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= 120f) { this.ai[1] = 0f; } } } } float single197 = 1f; if (flag74) { single197 = single197 + 0.5f; } if (this.direction == 0) { this.TargetClosest(true); } if (flag74) { return; } if (!this.wet) { NPC x81 = this; x81.rotation = x81.rotation + this.velocity.X * 0.1f; if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.98f; if ((double)this.velocity.X > -0.01 && (double)this.velocity.X < 0.01) { this.velocity.X = 0f; } } this.velocity.Y = this.velocity.Y + 0.2f; if (this.velocity.Y > 10f) { this.velocity.Y = 10f; } this.ai[0] = 1f; return; } if (this.collideX) { this.velocity.X = this.velocity.X * -1f; NPC nPC93 = this; nPC93.direction = nPC93.direction * -1; } if (this.collideY) { if (this.velocity.Y > 0f) { this.velocity.Y = Math.Abs(this.velocity.Y) * -1f; this.directionY = -1; this.ai[0] = -1f; } else if (this.velocity.Y < 0f) { this.velocity.Y = Math.Abs(this.velocity.Y); this.directionY = 1; this.ai[0] = 1f; } } bool flag75 = false; if (!this.friendly) { this.TargetClosest(false); if (Main.player[this.target].wet && !Main.player[this.target].dead) { flag75 = true; } } if (!flag75) { this.localAI[2] = 0f; this.velocity.X = this.velocity.X + (float)this.direction * 0.02f; this.rotation = this.velocity.X * 0.4f; if (this.velocity.X < -1f || this.velocity.X > 1f) { this.velocity.X = this.velocity.X * 0.95f; } if (this.ai[0] != -1f) { this.velocity.Y = this.velocity.Y + 0.01f; if (this.velocity.Y > 1f) { this.ai[0] = -1f; } } else { this.velocity.Y = this.velocity.Y - 0.01f; if (this.velocity.Y < -1f) { this.ai[0] = 1f; } } int x82 = (int)(this.position.X + (float)(this.width / 2)) / 16; int y78 = (int)(this.position.Y + (float)(this.height / 2)) / 16; if (Main.tile[x82, y78 - 1] == null) { Main.tile[x82, y78 - 1] = new Tile(); } if (Main.tile[x82, y78 + 1] == null) { Main.tile[x82, y78 + 1] = new Tile(); } if (Main.tile[x82, y78 + 2] == null) { Main.tile[x82, y78 + 2] = new Tile(); } if (Main.tile[x82, y78 - 1].liquid <= 128) { this.ai[0] = 1f; } else if (Main.tile[x82, y78 + 1].active()) { this.ai[0] = -1f; } else if (Main.tile[x82, y78 + 2].active()) { this.ai[0] = -1f; } if ((double)this.velocity.Y > 1.2 || (double)this.velocity.Y < -1.2) { this.velocity.Y = this.velocity.Y * 0.99f; return; } } else { this.localAI[2] = 1f; this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f; NPC nPC94 = this; nPC94.velocity = nPC94.velocity * 0.98f; float single198 = 0.2f; if (this.type == 103) { NPC nPC95 = this; nPC95.velocity = nPC95.velocity * 0.98f; single198 = 0.6f; } if (this.type == 221) { NPC nPC96 = this; nPC96.velocity = nPC96.velocity * 0.99f; single198 = 1f; } if (this.type == 242) { NPC nPC97 = this; nPC97.velocity = nPC97.velocity * 0.995f; single198 = 3f; } if (this.velocity.X > -single198 && this.velocity.X < single198 && this.velocity.Y > -single198 && this.velocity.Y < single198) { if (this.type == 221) { this.localAI[0] = 1f; } this.TargetClosest(true); float single199 = 7f; if (this.type == 103) { single199 = 9f; } Vector2 vector2105 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x83 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector2105.X; float y79 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector2105.Y; float single200 = (float)Math.Sqrt((double)(x83 * x83 + y79 * y79)); single200 = single199 / single200; x83 = x83 * single200; y79 = y79 * single200; this.velocity.X = x83; this.velocity.Y = y79; return; } } } else if (this.aiStyle != 19) { if (this.aiStyle == 20) { if (this.ai[0] == 0f) { if (Main.netMode == 1) { this.ai[1] = this.position.X + (float)(this.width / 2); this.ai[2] = this.position.Y + (float)(this.height / 2); return; } this.TargetClosest(true); NPC nPC98 = this; nPC98.direction = nPC98.direction * -1; NPC nPC99 = this; nPC99.directionY = nPC99.directionY * -1; this.position.Y = this.position.Y + (float)(this.height / 2 + 8); this.ai[1] = this.position.X + (float)(this.width / 2); this.ai[2] = this.position.Y + (float)(this.height / 2); if (this.direction == 0) { this.direction = 1; } if (this.directionY == 0) { this.directionY = 1; } this.ai[3] = 1f + (float)Main.rand.Next(15) * 0.1f; this.velocity.Y = (float)(this.directionY * 6) * this.ai[3]; this.ai[0] = this.ai[0] + 1f; this.netUpdate = true; return; } float single201 = 6f * this.ai[3]; float single202 = 0.2f * this.ai[3]; float single203 = single201 / single202 / 2f; if (this.ai[0] >= 1f && this.ai[0] < (float)((int)single203)) { this.velocity.Y = (float)this.directionY * single201; this.ai[0] = this.ai[0] + 1f; return; } if (this.ai[0] >= (float)((int)single203)) { this.velocity.Y = 0f; NPC nPC100 = this; nPC100.directionY = nPC100.directionY * -1; this.velocity.X = single201 * (float)this.direction; this.ai[0] = -1f; return; } if (this.directionY > 0) { if (this.velocity.Y >= single201) { NPC nPC101 = this; nPC101.directionY = nPC101.directionY * -1; this.velocity.Y = single201; } } else if (this.directionY < 0 && this.velocity.Y <= -single201) { NPC nPC102 = this; nPC102.directionY = nPC102.directionY * -1; this.velocity.Y = -single201; } if (this.direction > 0) { if (this.velocity.X >= single201) { NPC nPC103 = this; nPC103.direction = nPC103.direction * -1; this.velocity.X = single201; } } else if (this.direction < 0 && this.velocity.X <= -single201) { NPC nPC104 = this; nPC104.direction = nPC104.direction * -1; this.velocity.X = -single201; } this.velocity.X = this.velocity.X + single202 * (float)this.direction; this.velocity.Y = this.velocity.Y + single202 * (float)this.directionY; return; } if (this.aiStyle == 21) { if (this.ai[0] == 0f) { this.TargetClosest(true); this.directionY = 1; this.ai[0] = 1f; } int num381 = 6; if (this.ai[1] != 0f) { NPC nPC105 = this; nPC105.rotation = nPC105.rotation - (float)(this.direction * this.directionY) * 0.13f; if (this.collideX) { this.ai[0] = 2f; } if (!this.collideX && this.ai[0] == 2f) { this.directionY = -this.directionY; this.ai[1] = 0f; this.ai[0] = 1f; } if (this.collideY) { this.direction = -this.direction; this.ai[1] = 0f; } } else { NPC nPC106 = this; nPC106.rotation = nPC106.rotation + (float)(this.direction * this.directionY) * 0.13f; if (this.collideY) { this.ai[0] = 2f; } if (!this.collideY && this.ai[0] == 2f) { this.direction = -this.direction; this.ai[1] = 1f; this.ai[0] = 1f; } if (this.collideX) { this.directionY = -this.directionY; this.ai[1] = 1f; } } this.velocity.X = (float)(num381 * this.direction); this.velocity.Y = (float)(num381 * this.directionY); return; } if (this.aiStyle == 22) { bool flag76 = false; bool flag77 = (this.type != 330 ? false : !Main.pumpkinMoon); if (this.type == 253 && !Main.eclipse) { flag77 = true; } if (this.type == 490 && Main.dayTime) { flag77 = true; } if (this.justHit) { this.ai[2] = 0f; } if (!flag77) { if (this.ai[2] >= 0f) { int num382 = 16; bool flag78 = false; bool flag79 = false; if (this.position.X > this.ai[0] - (float)num382 && this.position.X < this.ai[0] + (float)num382) { flag78 = true; } else if (this.velocity.X < 0f && this.direction > 0 || this.velocity.X > 0f && this.direction < 0) { flag78 = true; } num382 = num382 + 24; if (this.position.Y > this.ai[1] - (float)num382 && this.position.Y < this.ai[1] + (float)num382) { flag79 = true; } if (!flag78 || !flag79) { this.ai[0] = this.position.X; this.ai[1] = this.position.Y; this.ai[2] = 0f; } else { this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= 30f && num382 == 16) { flag76 = true; } if (this.ai[2] >= 60f) { this.ai[2] = -200f; NPC nPC107 = this; nPC107.direction = nPC107.direction * -1; this.velocity.X = this.velocity.X * -1f; this.collideX = false; } } this.TargetClosest(true); } else if (this.type != 253) { if (this.type != 330) { this.ai[2] = this.ai[2] + 1f; } else { this.ai[2] = this.ai[2] + 0.1f; } if (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) <= this.position.X + (float)(this.width / 2)) { this.direction = 1; } else { this.direction = -1; } } else { this.TargetClosest(true); this.ai[2] = this.ai[2] + 2f; } } int x84 = (int)((this.position.X + (float)(this.width / 2)) / 16f) + this.direction * 2; int y80 = (int)((this.position.Y + (float)this.height) / 16f); bool flag80 = true; bool flag81 = false; int num383 = 3; if (this.type == 122) { if (this.justHit) { this.ai[3] = 0f; this.localAI[1] = 0f; } float single205 = 7f; Vector2 vector2106 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x85 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector2106.X; float y81 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector2106.Y; float single206 = (float)Math.Sqrt((double)(x85 * x85 + y81 * y81)); single206 = single205 / single206; x85 = x85 * single206; y81 = y81 * single206; if (Main.netMode != 1 && this.ai[3] == 32f && !Main.player[this.target].npcTypeNoAggro[this.type]) { int num384 = 25; int num385 = 84; Projectile.NewProjectile(vector2106.X, vector2106.Y, x85, y81, num385, num384, 0f, Main.myPlayer, 0f, 0f); } num383 = 8; if (this.ai[3] > 0f) { this.ai[3] = this.ai[3] + 1f; if (this.ai[3] >= 64f) { this.ai[3] = 0f; } } if (Main.netMode != 1 && this.ai[3] == 0f) { this.localAI[1] = this.localAI[1] + 1f; if (this.localAI[1] > 120f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height) && !Main.player[this.target].npcTypeNoAggro[this.type]) { this.localAI[1] = 0f; this.ai[3] = 1f; this.netUpdate = true; } } } else if (this.type == 75) { num383 = 4; } else if (this.type == 169) { this.alpha = 30; if (this.justHit) { this.ai[3] = 0f; this.localAI[1] = 0f; } float single207 = 5f; Vector2 vector2108 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x86 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector2108.X; float y82 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector2108.Y; float single208 = (float)Math.Sqrt((double)(x86 * x86 + y82 * y82)); single208 = single207 / single208; x86 = x86 * single208; y82 = y82 * single208; if (x86 <= 0f) { this.direction = -1; } else { this.direction = 1; } this.spriteDirection = this.direction; if (this.direction >= 0) { this.rotation = (float)Math.Atan2((double)y82, (double)x86); } else { this.rotation = (float)Math.Atan2((double)(-y82), (double)(-x86)); } if (Main.netMode != 1 && this.ai[3] == 16f) { int num390 = 45; int num391 = 128; Projectile.NewProjectile(vector2108.X, vector2108.Y, x86, y82, num391, num390, 0f, Main.myPlayer, 0f, 0f); } num383 = 10; if (this.ai[3] > 0f) { this.ai[3] = this.ai[3] + 1f; if (this.ai[3] >= 64f) { this.ai[3] = 0f; } } if (Main.netMode != 1 && this.ai[3] == 0f) { this.localAI[1] = this.localAI[1] + 1f; if (this.localAI[1] > 120f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.localAI[1] = 0f; this.ai[3] = 1f; this.netUpdate = true; } } } else if (this.type == 268) { this.rotation = this.velocity.X * 0.1f; num383 = (Main.player[this.target].Center.Y >= base.Center.Y ? 6 : 12); if (Main.netMode != 1 && !this.confused) { this.ai[3] = this.ai[3] + 1f; if (this.justHit) { this.ai[3] = -45f; this.localAI[1] = 0f; } if (Main.netMode != 1 && this.ai[3] >= (float)(60 + Main.rand.Next(60))) { this.ai[3] = 0f; if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].head)) { float single209 = 10f; Vector2 vector2109 = new Vector2(this.position.X + (float)this.width * 0.5f - 4f, this.position.Y + (float)this.height * 0.7f); float x87 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector2109.X; float single210 = Math.Abs(x87) * 0.1f; float y83 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector2109.Y - single210; x87 = x87 + (float)Main.rand.Next(-10, 11); y83 = y83 + (float)Main.rand.Next(-30, 21); float single211 = (float)Math.Sqrt((double)(x87 * x87 + y83 * y83)); single211 = single209 / single211; x87 = x87 * single211; y83 = y83 * single211; int num392 = 40; int num393 = 288; Projectile.NewProjectile(vector2109.X, vector2109.Y, x87, y83, num393, num392, 0f, Main.myPlayer, 0f, 0f); } } } } if (this.type == 490) { num383 = 4; if (this.target >= 0) { Vector2 center26 = Main.player[this.target].Center - base.Center; float single212 = center26.Length(); single212 = single212 / 70f; if (single212 > 8f) { single212 = 8f; } num383 = num383 + (int)single212; } } int num394 = y80; while (num394 < y80 + num383) { if (Main.tile[x84, num394] == null) { Main.tile[x84, num394] = new Tile(); } if ((!Main.tile[x84, num394].nactive() || !Main.tileSolid[Main.tile[x84, num394].type]) && Main.tile[x84, num394].liquid <= 0) { num394++; } else { if (num394 <= y80 + 1) { flag81 = true; } flag80 = false; break; } } if (Main.player[this.target].npcTypeNoAggro[this.type]) { bool flag82 = false; int num395 = y80; while (num395 < y80 + num383 - 2) { if (Main.tile[x84, num395] == null) { Main.tile[x84, num395] = new Tile(); } if ((!Main.tile[x84, num395].nactive() || !Main.tileSolid[Main.tile[x84, num395].type]) && Main.tile[x84, num395].liquid <= 0) { num395++; } else { flag82 = true; break; } } this.directionY = (!flag82).ToDirectionInt(); } if (this.type == 169 || this.type == 268) { int num396 = y80 - 3; while (num396 < y80) { if (Main.tile[x84, num396] == null) { Main.tile[x84, num396] = new Tile(); } if ((!Main.tile[x84, num396].nactive() || !Main.tileSolid[Main.tile[x84, num396].type]) && Main.tile[x84, num396].liquid <= 0) { num396++; } else { flag81 = false; flag76 = true; break; } } } if (flag76) { flag81 = false; flag80 = true; if (this.type == 268) { this.velocity.Y = this.velocity.Y + 2f; } } if (!flag80) { if (this.type == 75 || this.type == 169) { if (this.directionY < 0 && this.velocity.Y > 0f || flag81) { this.velocity.Y = this.velocity.Y - 0.2f; } } else if (this.type == 490) { if (this.directionY < 0 && this.velocity.Y > 0f || flag81) { this.velocity.Y = this.velocity.Y - 0.075f; } if (this.velocity.Y < -0.75f) { this.velocity.Y = -0.75f; } } else if (this.directionY < 0 && this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y - 0.1f; } if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } } else if (this.type == 75 || this.type == 169) { this.velocity.Y = this.velocity.Y + 0.2f; if (this.velocity.Y > 2f) { this.velocity.Y = 2f; } } else if (this.type != 490) { this.velocity.Y = this.velocity.Y + 0.1f; if (this.velocity.Y > 3f) { this.velocity.Y = 3f; } } else { this.velocity.Y = this.velocity.Y + 0.03f; if ((double)this.velocity.Y > 0.75) { this.velocity.Y = 0.75f; } } if (this.type == 75 && this.wet) { this.velocity.Y = this.velocity.Y - 0.2f; if (this.velocity.Y < -2f) { this.velocity.Y = -2f; } } if (this.collideX) { this.velocity.X = this.oldVelocity.X * -0.4f; if (this.direction == -1 && this.velocity.X > 0f && this.velocity.X < 1f) { this.velocity.X = 1f; } if (this.direction == 1 && this.velocity.X < 0f && this.velocity.X > -1f) { this.velocity.X = -1f; } } if (this.collideY) { this.velocity.Y = this.oldVelocity.Y * -0.25f; if (this.velocity.Y > 0f && this.velocity.Y < 1f) { this.velocity.Y = 1f; } if (this.velocity.Y < 0f && this.velocity.Y > -1f) { this.velocity.Y = -1f; } } float single213 = 2f; if (this.type == 75) { single213 = 3f; } if (this.type == 253) { single213 = 4f; } if (this.type == 490) { single213 = 1.5f; } if (this.type == 330) { this.alpha = 0; single213 = 4f; if (!flag77) { this.TargetClosest(true); } else if (this.timeLeft > 10) { this.timeLeft = 10; } if (this.direction < 0 && this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.9f; } if (this.direction > 0 && this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.9f; } } if (this.direction == -1 && this.velocity.X > -single213) { this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > single213) { this.velocity.X = this.velocity.X - 0.1f; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X + 0.05f; } if (this.velocity.X < -single213) { this.velocity.X = -single213; } } else if (this.direction == 1 && this.velocity.X < single213) { this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -single213) { this.velocity.X = this.velocity.X + 0.1f; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X - 0.05f; } if (this.velocity.X > single213) { this.velocity.X = single213; } } single213 = (this.type != 490 ? 1.5f : 1f); if (this.directionY == -1 && this.velocity.Y > -single213) { this.velocity.Y = this.velocity.Y - 0.04f; if (this.velocity.Y > single213) { this.velocity.Y = this.velocity.Y - 0.05f; } else if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y + 0.03f; } if (this.velocity.Y < -single213) { this.velocity.Y = -single213; } } else if (this.directionY == 1 && this.velocity.Y < single213) { this.velocity.Y = this.velocity.Y + 0.04f; if (this.velocity.Y < -single213) { this.velocity.Y = this.velocity.Y + 0.05f; } else if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y - 0.03f; } if (this.velocity.Y > single213) { this.velocity.Y = single213; } } } else if (this.aiStyle == 23) { this.noGravity = true; this.noTileCollide = true; if (this.target < 0 || this.target == 255 || Main.player[this.target].dead) { this.TargetClosest(true); } if (this.ai[0] == 0f) { float single214 = 9f; Vector2 vector2110 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x88 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector2110.X; float y84 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector2110.Y; float single215 = (float)Math.Sqrt((double)(x88 * x88 + y84 * y84)); single215 = single214 / single215; x88 = x88 * single215; y84 = y84 * single215; this.velocity.X = x88; this.velocity.Y = y84; this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 0.785f; this.ai[0] = 1f; this.ai[1] = 0f; this.netUpdate = true; return; } if (this.ai[0] != 1f) { if (this.justHit) { this.ai[0] = 2f; this.ai[1] = 0f; } NPC nPC108 = this; nPC108.velocity = nPC108.velocity * 0.96f; this.ai[1] = this.ai[1] + 1f; float single216 = this.ai[1] / 120f; single216 = 0.1f + single216 * 0.4f; NPC nPC109 = this; nPC109.rotation = nPC109.rotation + single216 * (float)this.direction; if (this.ai[1] >= 120f) { this.netUpdate = true; this.ai[0] = 0f; this.ai[1] = 0f; return; } } else { if (this.justHit) { this.ai[0] = 2f; this.ai[1] = 0f; } NPC nPC110 = this; nPC110.velocity = nPC110.velocity * 0.99f; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= 100f) { this.netUpdate = true; this.ai[0] = 2f; this.ai[1] = 0f; this.velocity.X = 0f; this.velocity.Y = 0f; return; } } } else if (this.aiStyle == 24) { this.noGravity = true; if (this.ai[0] == 0f) { this.noGravity = false; this.TargetClosest(true); if (Main.netMode != 1) { if (this.velocity.X != 0f || this.velocity.Y < 0f || (double)this.velocity.Y > 0.3) { this.ai[0] = 1f; this.netUpdate = true; this.direction = -this.direction; } else { Rectangle rectangle7 = new Rectangle((int)Main.player[this.target].position.X, (int)Main.player[this.target].position.Y, Main.player[this.target].width, Main.player[this.target].height); Rectangle rectangle8 = new Rectangle((int)this.position.X - 100, (int)this.position.Y - 100, this.width + 200, this.height + 200); if (rectangle8.Intersects(rectangle7) || this.life < this.lifeMax) { this.ai[0] = 1f; this.velocity.Y = this.velocity.Y - 6f; this.netUpdate = true; this.direction = -this.direction; } } } } else if (!Main.player[this.target].dead) { if (this.collideX) { NPC nPC111 = this; nPC111.direction = nPC111.direction * -1; this.velocity.X = this.oldVelocity.X * -0.5f; if (this.direction == -1 && this.velocity.X > 0f && this.velocity.X < 2f) { this.velocity.X = 2f; } if (this.direction == 1 && this.velocity.X < 0f && this.velocity.X > -2f) { this.velocity.X = -2f; } } if (this.collideY) { this.velocity.Y = this.oldVelocity.Y * -0.5f; if (this.velocity.Y > 0f && this.velocity.Y < 1f) { this.velocity.Y = 1f; } if (this.velocity.Y < 0f && this.velocity.Y > -1f) { this.velocity.Y = -1f; } } if (this.direction == -1 && this.velocity.X > -3f) { this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > 3f) { this.velocity.X = this.velocity.X - 0.1f; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X - 0.05f; } if (this.velocity.X < -3f) { this.velocity.X = -3f; } } else if (this.direction == 1 && this.velocity.X < 3f) { this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -3f) { this.velocity.X = this.velocity.X + 0.1f; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X + 0.05f; } if (this.velocity.X > 3f) { this.velocity.X = 3f; } } int x89 = (int)((this.position.X + (float)(this.width / 2)) / 16f) + this.direction; int y85 = (int)((this.position.Y + (float)this.height) / 16f); bool flag83 = true; int num397 = 15; bool flag84 = false; int num398 = y85; while (num398 < y85 + num397) { if (Main.tile[x89, num398] == null) { Main.tile[x89, num398] = new Tile(); } if ((!Main.tile[x89, num398].nactive() || !Main.tileSolid[Main.tile[x89, num398].type]) && Main.tile[x89, num398].liquid <= 0) { num398++; } else { if (num398 < y85 + 5) { flag84 = true; } flag83 = false; break; } } if (!flag83) { this.velocity.Y = this.velocity.Y - 0.1f; } else { this.velocity.Y = this.velocity.Y + 0.05f; } if (flag84) { this.velocity.Y = this.velocity.Y - 0.2f; } if (this.velocity.Y > 2f) { this.velocity.Y = 2f; } if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } } if (this.wet) { this.ai[1] = 0f; if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.95f; } this.velocity.Y = this.velocity.Y - 0.5f; if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } this.TargetClosest(true); return; } } else if (this.aiStyle == 25) { bool flag85 = (this.type != 341 ? false : !Main.snowMoon); if (this.ai[3] == 0f) { this.position.X = this.position.X + 8f; if (this.position.Y / 16f > (float)(Main.maxTilesY - 200)) { this.ai[3] = 3f; } else if ((double)(this.position.Y / 16f) <= Main.worldSurface) { this.ai[3] = 1f; } else { this.TargetClosest(true); if (!Main.player[this.target].ZoneSnow) { this.ai[3] = 2f; } else { this.ai[3] = 4f; } } } if (this.type == 341) { this.ai[3] = 1f; } if (this.ai[0] != 0f) { if (this.velocity.Y == 0f) { this.ai[2] = this.ai[2] + 1f; int num399 = 20; if (this.ai[1] == 0f) { num399 = 12; } if (this.ai[2] < (float)num399) { this.velocity.X = this.velocity.X * 0.9f; return; } this.ai[2] = 0f; if (!flag85) { this.TargetClosest(true); } if (this.direction == 0) { this.direction = -1; } this.spriteDirection = this.direction; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] != 2f) { this.velocity.X = (float)this.direction * 3.5f; this.velocity.Y = -4f; } else { this.velocity.X = (float)this.direction * 2.5f; this.velocity.Y = -8f; this.ai[1] = 0f; } this.netUpdate = true; return; } if (this.direction == 1 && this.velocity.X < 1f) { this.velocity.X = this.velocity.X + 0.1f; return; } if (this.direction == -1 && this.velocity.X > -1f) { this.velocity.X = this.velocity.X - 0.1f; return; } } else { if (!flag85) { this.TargetClosest(true); } if (Main.netMode != 1) { if (this.velocity.X != 0f || this.velocity.Y < 0f || (double)this.velocity.Y > 0.3) { this.ai[0] = 1f; this.netUpdate = true; return; } Rectangle rectangle9 = new Rectangle((int)Main.player[this.target].position.X, (int)Main.player[this.target].position.Y, Main.player[this.target].width, Main.player[this.target].height); Rectangle rectangle10 = new Rectangle((int)this.position.X - 100, (int)this.position.Y - 100, this.width + 200, this.height + 200); if (rectangle10.Intersects(rectangle9) || this.life < this.lifeMax) { this.ai[0] = 1f; this.netUpdate = true; return; } } } } else if (this.aiStyle == 26) { int num400 = 30; int num401 = 10; bool flag86 = false; bool flag87 = false; bool flag88 = false; if (this.velocity.Y == 0f && (this.velocity.X > 0f && this.direction < 0 || this.velocity.X < 0f && this.direction > 0)) { flag87 = true; this.ai[3] = this.ai[3] + 1f; } if (this.position.X == this.oldPosition.X || this.ai[3] >= (float)num400 || flag87) { this.ai[3] = this.ai[3] + 1f; flag88 = true; } else if (this.ai[3] > 0f) { this.ai[3] = this.ai[3] - 1f; } if (this.ai[3] > (float)(num400 * num401)) { this.ai[3] = 0f; } if (this.justHit) { this.ai[3] = 0f; } if (this.ai[3] == (float)num400) { this.netUpdate = true; } Vector2 vector2111 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x90 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector2111.X; float y86 = Main.player[this.target].position.Y - vector2111.Y; float single217 = (float)Math.Sqrt((double)(x90 * x90 + y86 * y86)); if (single217 < 200f && !flag88) { this.ai[3] = 0f; } if (this.type == 410) { this.ai[1] = this.ai[1] + 1f; bool flag89 = this.ai[1] >= 240f; if (!flag89 && this.velocity.Y == 0f) { int num402 = 0; while (num402 < 255) { if (!Main.player[num402].active || Main.player[num402].dead || Main.player[num402].Distance(base.Center) >= 800f || Main.player[num402].Center.Y >= base.Center.Y || Math.Abs(Main.player[num402].Center.X - base.Center.X) >= 20f) { num402++; } else { flag89 = true; break; } } } if (flag89 && Main.netMode != 1) { for (int h2 = 0; h2 < 3; h2++) { Projectile.NewProjectile(base.Center.X, base.Center.Y, (Main.rand.NextFloat() - 0.5f) * 2f, -4f - 10f * Main.rand.NextFloat(), 538, 50, 0f, Main.myPlayer, 0f, 0f); } this.HitEffect(9999, 10); this.active = false; return; } } else if (this.type == 423) { if (this.ai[2] != 1f) { this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= 180f && single217 < 500f && this.velocity.Y == 0f) { flag86 = true; this.ai[1] = 0f; this.ai[2] = 1f; this.netUpdate = true; } else if (this.velocity.Y == 0f && single217 < 100f && Math.Abs(this.velocity.X) > 3f && (base.Center.X < Main.player[this.target].Center.X && this.velocity.X > 0f || base.Center.X > Main.player[this.target].Center.X && this.velocity.X < 0f)) { this.velocity.Y = this.velocity.Y - 4f; } } else { this.ai[1] = this.ai[1] + 1f; this.velocity.X = this.velocity.X * 0.7f; if (this.velocity.X > -0.5f && this.velocity.X < 0.5f) { this.velocity.X = 0f; } if (this.ai[1] == 30f && Main.netMode != 1) { int num403 = (Main.expertMode ? 35 : 50); Projectile.NewProjectile(base.Center.X + (float)(this.spriteDirection * -20), base.Center.Y, (float)(this.spriteDirection * -7), 0f, 575, num403, 0f, Main.myPlayer, (float)this.target, 0f); } if (this.ai[1] >= 60f) { this.ai[1] = (float)(-Main.rand.Next(320, 601)); this.ai[2] = 0f; } } } else if ((this.type == 155 || this.type == 329) && this.velocity.Y == 0f && single217 < 100f && Math.Abs(this.velocity.X) > 3f && (this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) && this.velocity.X > 0f || this.position.X + (float)(this.width / 2) > Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) && this.velocity.X < 0f)) { this.velocity.Y = this.velocity.Y - 4f; } if (this.ai[3] >= (float)num400) { if (this.velocity.X != 0f) { this.ai[0] = 0f; } else if (this.velocity.Y == 0f) { this.ai[0] = this.ai[0] + 1f; if (this.ai[0] >= 2f) { NPC nPC112 = this; nPC112.direction = nPC112.direction * -1; this.spriteDirection = this.direction; this.ai[0] = 0f; } } this.directionY = -1; if (this.direction == 0) { this.direction = 1; } } else if (this.type != 329 && this.type != 315 || Main.pumpkinMoon) { this.TargetClosest(true); } else if (this.timeLeft > 10) { this.timeLeft = 10; } float single218 = 6f; float single219 = 0.07f; if (!flag86 && (this.velocity.Y == 0f || this.wet || this.velocity.X <= 0f && this.direction < 0 || this.velocity.X >= 0f && this.direction > 0)) { if (this.type == 155) { if (this.velocity.X > 0f && this.direction < 0) { this.velocity.X = this.velocity.X * 0.95f; } if (this.velocity.X < 0f && this.direction > 0) { this.velocity.X = this.velocity.X * 0.95f; } } else if (this.type == 329) { if (this.velocity.X > 0f && this.direction < 0) { this.velocity.X = this.velocity.X * 0.9f; } if (this.velocity.X < 0f && this.direction > 0) { this.velocity.X = this.velocity.X * 0.9f; } if (this.direction > 0 && this.velocity.X < 3f) { this.velocity.X = this.velocity.X + 0.1f; } if (this.direction < 0 && this.velocity.X > -3f) { this.velocity.X = this.velocity.X - 0.1f; } } else if (this.type == 315) { if (this.velocity.X > 0f && this.direction < 0) { this.velocity.X = this.velocity.X * 0.95f; } if (this.velocity.X < 0f && this.direction > 0) { this.velocity.X = this.velocity.X * 0.95f; } if (this.velocity.X < -single218 || this.velocity.X > single218) { if (this.velocity.Y == 0f) { NPC nPC113 = this; nPC113.velocity = nPC113.velocity * 0.8f; } } else if (this.velocity.X < single218 && this.direction == 1) { this.velocity.X = this.velocity.X + 0.07f; if (this.velocity.X > single218) { this.velocity.X = single218; } } else if (this.velocity.X > -single218 && this.direction == -1) { this.velocity.X = this.velocity.X - 0.07f; if (this.velocity.X < -single218) { this.velocity.X = -single218; } } } else if (this.type == 410) { if (Math.Sign(this.velocity.X) != this.direction) { this.velocity.X = this.velocity.X * 0.9f; } single218 = 6f; single219 = 0.2f; } else if (this.type == 423) { if (Math.Sign(this.velocity.X) != this.direction) { this.velocity.X = this.velocity.X * 0.85f; } single218 = 10f; single219 = 0.2f; } if (this.velocity.X < -single218 || this.velocity.X > single218) { if (this.velocity.Y == 0f) { NPC nPC114 = this; nPC114.velocity = nPC114.velocity * 0.8f; } } else if (this.velocity.X < single218 && this.direction == 1) { this.velocity.X = this.velocity.X + single219; if (this.velocity.X > single218) { this.velocity.X = single218; } } else if (this.velocity.X > -single218 && this.direction == -1) { this.velocity.X = this.velocity.X - single219; if (this.velocity.X < -single218) { this.velocity.X = -single218; } } } if (this.velocity.Y >= 0f) { int num404 = 0; if (this.velocity.X < 0f) { num404 = -1; } if (this.velocity.X > 0f) { num404 = 1; } Vector2 x91 = this.position; x91.X = x91.X + this.velocity.X; int x92 = (int)((x91.X + (float)(this.width / 2) + (float)((this.width / 2 + 1) * num404)) / 16f); int y87 = (int)((x91.Y + (float)this.height - 1f) / 16f); if (Main.tile[x92, y87] == null) { Main.tile[x92, y87] = new Tile(); } if (Main.tile[x92, y87 - 1] == null) { Main.tile[x92, y87 - 1] = new Tile(); } if (Main.tile[x92, y87 - 2] == null) { Main.tile[x92, y87 - 2] = new Tile(); } if (Main.tile[x92, y87 - 3] == null) { Main.tile[x92, y87 - 3] = new Tile(); } if (Main.tile[x92, y87 + 1] == null) { Main.tile[x92, y87 + 1] = new Tile(); } if ((float)(x92 * 16) < x91.X + (float)this.width && (float)(x92 * 16 + 16) > x91.X && (Main.tile[x92, y87].nactive() && !Main.tile[x92, y87].topSlope() && !Main.tile[x92, y87 - 1].topSlope() && Main.tileSolid[Main.tile[x92, y87].type] && !Main.tileSolidTop[Main.tile[x92, y87].type] || Main.tile[x92, y87 - 1].halfBrick() && Main.tile[x92, y87 - 1].nactive()) && (!Main.tile[x92, y87 - 1].nactive() || !Main.tileSolid[Main.tile[x92, y87 - 1].type] || Main.tileSolidTop[Main.tile[x92, y87 - 1].type] || Main.tile[x92, y87 - 1].halfBrick() && (!Main.tile[x92, y87 - 4].nactive() || !Main.tileSolid[Main.tile[x92, y87 - 4].type] || Main.tileSolidTop[Main.tile[x92, y87 - 4].type])) && (!Main.tile[x92, y87 - 2].nactive() || !Main.tileSolid[Main.tile[x92, y87 - 2].type] || Main.tileSolidTop[Main.tile[x92, y87 - 2].type]) && (!Main.tile[x92, y87 - 3].nactive() || !Main.tileSolid[Main.tile[x92, y87 - 3].type] || Main.tileSolidTop[Main.tile[x92, y87 - 3].type]) && (!Main.tile[x92 - num404, y87 - 3].nactive() || !Main.tileSolid[Main.tile[x92 - num404, y87 - 3].type])) { float single220 = (float)(y87 * 16); if (Main.tile[x92, y87].halfBrick()) { single220 = single220 + 8f; } if (Main.tile[x92, y87 - 1].halfBrick()) { single220 = single220 - 8f; } if (single220 < x91.Y + (float)this.height) { float y88 = x91.Y + (float)this.height - single220; if ((double)y88 <= 16.1) { NPC y89 = this; y89.gfxOffY = y89.gfxOffY + (this.position.Y + (float)this.height - single220); this.position.Y = single220 - (float)this.height; if (y88 >= 9f) { this.stepSpeed = 2f; } else { this.stepSpeed = 1f; } } } } } if (this.velocity.Y == 0f) { int x93 = (int)((this.position.X + (float)(this.width / 2) + (float)((this.width / 2 + 2) * this.direction) + this.velocity.X * 5f) / 16f); int y90 = (int)((this.position.Y + (float)this.height - 15f) / 16f); if (Main.tile[x93, y90] == null) { Main.tile[x93, y90] = new Tile(); } if (Main.tile[x93, y90 - 1] == null) { Main.tile[x93, y90 - 1] = new Tile(); } if (Main.tile[x93, y90 - 2] == null) { Main.tile[x93, y90 - 2] = new Tile(); } if (Main.tile[x93, y90 - 3] == null) { Main.tile[x93, y90 - 3] = new Tile(); } if (Main.tile[x93, y90 + 1] == null) { Main.tile[x93, y90 + 1] = new Tile(); } if (Main.tile[x93 + this.direction, y90 - 1] == null) { Main.tile[x93 + this.direction, y90 - 1] = new Tile(); } if (Main.tile[x93 + this.direction, y90 + 1] == null) { Main.tile[x93 + this.direction, y90 + 1] = new Tile(); } if (Main.tile[x93 - this.direction, y90 + 1] == null) { Main.tile[x93 - this.direction, y90 + 1] = new Tile(); } int num405 = this.spriteDirection; if (this.type == 423 || this.type == 410) { num405 = num405 * -1; } if (this.velocity.X < 0f && num405 == -1 || this.velocity.X > 0f && num405 == 1) { bool flag90 = (this.type == 410 ? true : this.type == 423); float single221 = 3f; if (Main.tile[x93, y90 - 2].nactive() && Main.tileSolid[Main.tile[x93, y90 - 2].type]) { if (!Main.tile[x93, y90 - 3].nactive() || !Main.tileSolid[Main.tile[x93, y90 - 3].type]) { this.velocity.Y = -7.5f; this.netUpdate = true; } else { this.velocity.Y = -8.5f; this.netUpdate = true; } } else if (Main.tile[x93, y90 - 1].nactive() && !Main.tile[x93, y90 - 1].topSlope() && Main.tileSolid[Main.tile[x93, y90 - 1].type]) { this.velocity.Y = -7f; this.netUpdate = true; } else if (this.position.Y + (float)this.height - (float)(y90 * 16) > 20f && Main.tile[x93, y90].nactive() && !Main.tile[x93, y90].topSlope() && Main.tileSolid[Main.tile[x93, y90].type]) { this.velocity.Y = -6f; this.netUpdate = true; } else if ((this.directionY < 0 || Math.Abs(this.velocity.X) > single221) && (!flag90 || !Main.tile[x93, y90 + 1].nactive() || !Main.tileSolid[Main.tile[x93, y90 + 1].type]) && (!Main.tile[x93, y90 + 2].nactive() || !Main.tileSolid[Main.tile[x93, y90 + 2].type]) && (!Main.tile[x93 + this.direction, y90 + 3].nactive() || !Main.tileSolid[Main.tile[x93 + this.direction, y90 + 3].type])) { this.velocity.Y = -8f; this.netUpdate = true; } } } } else if (this.aiStyle == 27) { if (this.position.X < 160f || this.position.X > (float)((Main.maxTilesX - 10) * 16)) { this.active = false; } if (this.localAI[0] == 0f) { this.localAI[0] = 1f; Main.wofB = -1; Main.wofT = -1; } this.ai[1] = this.ai[1] + 1f; if (this.ai[2] == 0f) { if ((double)this.life < (double)this.lifeMax * 0.5) { this.ai[1] = this.ai[1] + 1f; } if ((double)this.life < (double)this.lifeMax * 0.2) { this.ai[1] = this.ai[1] + 1f; } if (this.ai[1] > 2700f) { this.ai[2] = 1f; } } if (this.ai[2] > 0f && this.ai[1] > 60f) { int num406 = 3; if ((double)this.life < (double)this.lifeMax * 0.3) { num406++; } this.ai[2] = this.ai[2] + 1f; this.ai[1] = 0f; if (this.ai[2] > (float)num406) { this.ai[2] = 0f; } if (Main.netMode != 1) { int num407 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)(this.height / 2) + 20f), 117, 1, 0f, 0f, 0f, 0f, 255); Main.npc[num407].velocity.X = (float)(this.direction * 8); } } this.localAI[3] = this.localAI[3] + 1f; if (this.localAI[3] >= (float)(600 + Main.rand.Next(1000))) { this.localAI[3] = (float)(-Main.rand.Next(200)); } Main.wof = this.whoAmI; int x94 = (int)(this.position.X / 16f); int x95 = (int)((this.position.X + (float)this.width) / 16f); int y91 = (int)((this.position.Y + (float)(this.height / 2)) / 16f); int num408 = 0; int num409 = y91 + 7; while (num408 < 15 && num409 > Main.maxTilesY - 200) { num409++; for (int k3 = x94; k3 <= x95; k3++) { try { if (WorldGen.SolidTile(k3, num409) || Main.tile[k3, num409].liquid > 0) { num408++; } } catch { num408 = num408 + 15; } } } num409 = num409 + 4; if (Main.wofB == -1) { Main.wofB = num409 * 16; } else if (Main.wofB > num409 * 16) { Main.wofB = Main.wofB - 1; if (Main.wofB < num409 * 16) { Main.wofB = num409 * 16; } } else if (Main.wofB < num409 * 16) { Main.wofB = Main.wofB + 1; if (Main.wofB > num409 * 16) { Main.wofB = num409 * 16; } } num408 = 0; num409 = y91 - 7; while (num408 < 15 && num409 < Main.maxTilesY - 10) { num409--; for (int l3 = x94; l3 <= x95; l3++) { try { if (WorldGen.SolidTile(l3, num409) || Main.tile[l3, num409].liquid > 0) { num408++; } } catch { num408 = num408 + 15; } } } num409 = num409 - 4; if (Main.wofT == -1) { Main.wofT = num409 * 16; } else if (Main.wofT > num409 * 16) { Main.wofT = Main.wofT - 1; if (Main.wofT < num409 * 16) { Main.wofT = num409 * 16; } } else if (Main.wofT < num409 * 16) { Main.wofT = Main.wofT + 1; if (Main.wofT > num409 * 16) { Main.wofT = num409 * 16; } } float single222 = (float)((Main.wofB + Main.wofT) / 2 - this.height / 2); if (this.position.Y > single222 + 1f) { this.velocity.Y = -1f; } else if (this.position.Y < single222 - 1f) { this.velocity.Y = 1f; } this.velocity.Y = 0f; this.position.Y = single222; float single223 = 1.5f; if ((double)this.life < (double)this.lifeMax * 0.75) { single223 = single223 + 0.25f; } if ((double)this.life < (double)this.lifeMax * 0.5) { single223 = single223 + 0.4f; } if ((double)this.life < (double)this.lifeMax * 0.25) { single223 = single223 + 0.5f; } if ((double)this.life < (double)this.lifeMax * 0.1) { single223 = single223 + 0.6f; } if ((double)this.life < (double)this.lifeMax * 0.66 && Main.expertMode) { single223 = single223 + 0.3f; } if ((double)this.life < (double)this.lifeMax * 0.33 && Main.expertMode) { single223 = single223 + 0.3f; } if ((double)this.life < (double)this.lifeMax * 0.05 && Main.expertMode) { single223 = single223 + 0.6f; } if ((double)this.life < (double)this.lifeMax * 0.035 && Main.expertMode) { single223 = single223 + 0.6f; } if ((double)this.life < (double)this.lifeMax * 0.025 && Main.expertMode) { single223 = single223 + 0.6f; } if (Main.expertMode) { single223 = single223 * 1.35f; single223 = single223 + 0.35f; } if (this.velocity.X == 0f) { this.TargetClosest(true); this.velocity.X = (float)this.direction; } if (this.velocity.X >= 0f) { this.velocity.X = single223; this.direction = 1; } else { this.velocity.X = -single223; this.direction = -1; } this.spriteDirection = this.direction; Vector2 vector2115 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x96 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector2115.X; float y92 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector2115.Y; float single224 = (float)Math.Sqrt((double)(x96 * x96 + y92 * y92)); x96 = x96 * single224; y92 = y92 * single224; if (this.direction > 0) { if (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) <= this.position.X + (float)(this.width / 2)) { this.rotation = 0f; } else { this.rotation = (float)Math.Atan2((double)(-y92), (double)(-x96)) + 3.14f; } } else if (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) >= this.position.X + (float)(this.width / 2)) { this.rotation = 0f; } else { this.rotation = (float)Math.Atan2((double)y92, (double)x96) + 3.14f; } if (Main.expertMode && Main.netMode != 1) { int num410 = (int)(1f + (float)this.life / (float)this.lifeMax * 10f); num410 = num410 * num410; if (num410 < 400) { num410 = (num410 * 19 + 400) / 20; } if (num410 < 60) { num410 = (num410 * 3 + 60) / 4; } if (num410 < 20) { num410 = (num410 + 20) / 2; } num410 = (int)((double)num410 * 0.7); if (Main.rand.Next(num410) == 0) { int num411 = 0; float[] singleArray12 = new float[10]; for (int m3 = 0; m3 < 200; m3++) { if (num411 < 10 && Main.npc[m3].active && Main.npc[m3].type == 115) { singleArray12[num411] = Main.npc[m3].ai[0]; num411++; } } int num412 = 1 + num411 * 2; if (num411 < 10 && Main.rand.Next(num412) <= 1) { int num413 = -1; int num414 = 0; while (num414 < 1000) { int num415 = Main.rand.Next(10); float single225 = (float)num415 * 0.1f - 0.05f; bool flag91 = true; int num416 = 0; while (num416 < num411) { if (single225 != singleArray12[num416]) { num416++; } else { flag91 = false; break; } } if (!flag91) { num414++; } else { num413 = num415; break; } } if (num413 >= 0) { int num417 = NPC.NewNPC((int)this.position.X, (int)single222, 115, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num417].ai[0] = (float)num413 * 0.1f - 0.05f; } } } } if (this.localAI[0] == 1f && Main.netMode != 1) { this.localAI[0] = 2f; single222 = (float)((Main.wofB + Main.wofT) / 2); single222 = (single222 + (float)Main.wofT) / 2f; int num418 = NPC.NewNPC((int)this.position.X, (int)single222, 114, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num418].ai[0] = 1f; single222 = (float)((Main.wofB + Main.wofT) / 2); single222 = (single222 + (float)Main.wofB) / 2f; num418 = NPC.NewNPC((int)this.position.X, (int)single222, 114, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num418].ai[0] = -1f; single222 = (float)((Main.wofB + Main.wofT) / 2); single222 = (single222 + (float)Main.wofB) / 2f; for (int n3 = 0; n3 < 11; n3++) { num418 = NPC.NewNPC((int)this.position.X, (int)single222, 115, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num418].ai[0] = (float)n3 * 0.1f - 0.05f; } return; } } else if (this.aiStyle != 28) { if (this.aiStyle == 29) { if (this.justHit) { this.ai[1] = 10f; } if (Main.wof < 0) { this.active = false; return; } this.TargetClosest(true); float single226 = 0.1f; float single227 = 300f; if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.25) { this.damage = (int)(75f * Main.damageMultiplier); this.defense = 40; if (Main.expertMode) { single226 = single226 + 0.1f; } else { single227 = 900f; } } else if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.5) { this.damage = (int)(60f * Main.damageMultiplier); this.defense = 30; if (Main.expertMode) { single226 = single226 + 0.066f; } else { single227 = 700f; } } else if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.75) { this.damage = (int)(45f * Main.damageMultiplier); this.defense = 20; if (Main.expertMode) { single226 = single226 + 0.033f; } else { single227 = 500f; } } if (Main.expertMode) { this.defense = this.defDefense; if (this.whoAmI % 4 == 0) { single227 = single227 * 1.75f; } if (this.whoAmI % 4 == 1) { single227 = single227 * 1.5f; } if (this.whoAmI % 4 == 2) { single227 = single227 * 1.25f; } if (this.whoAmI % 3 == 0) { single227 = single227 * 1.5f; } if (this.whoAmI % 3 == 1) { single227 = single227 * 1.25f; } single227 = single227 * 0.75f; } float x97 = Main.npc[Main.wof].position.X + (float)(Main.npc[Main.wof].width / 2); float y93 = Main.npc[Main.wof].position.Y; float single228 = (float)(Main.wofB - Main.wofT); y93 = (float)Main.wofT + single228 * this.ai[0]; this.ai[2] = this.ai[2] + 1f; if (this.ai[2] > 100f) { single227 = (float)((int)(single227 * 1.3f)); if (this.ai[2] > 200f) { this.ai[2] = 0f; } } Vector2 vector2116 = new Vector2(x97, y93); float x98 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - (float)(this.width / 2) - vector2116.X; float y94 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - (float)(this.height / 2) - vector2116.Y; float single229 = (float)Math.Sqrt((double)(x98 * x98 + y94 * y94)); if (this.ai[1] == 0f) { if (single229 > single227) { single229 = single227 / single229; x98 = x98 * single229; y94 = y94 * single229; } if (this.position.X < x97 + x98) { this.velocity.X = this.velocity.X + single226; if (this.velocity.X < 0f && x98 > 0f) { this.velocity.X = this.velocity.X + single226 * 2.5f; } } else if (this.position.X > x97 + x98) { this.velocity.X = this.velocity.X - single226; if (this.velocity.X > 0f && x98 < 0f) { this.velocity.X = this.velocity.X - single226 * 2.5f; } } if (this.position.Y < y93 + y94) { this.velocity.Y = this.velocity.Y + single226; if (this.velocity.Y < 0f && y94 > 0f) { this.velocity.Y = this.velocity.Y + single226 * 2.5f; } } else if (this.position.Y > y93 + y94) { this.velocity.Y = this.velocity.Y - single226; if (this.velocity.Y > 0f && y94 < 0f) { this.velocity.Y = this.velocity.Y - single226 * 2.5f; } } float single230 = 4f; if (Main.expertMode && Main.wof >= 0) { float single231 = 1.5f; float single232 = (float)(Main.npc[Main.wof].life / Main.npc[Main.wof].lifeMax); if ((double)single232 < 0.75) { single231 = single231 + 0.7f; } if ((double)single232 < 0.5) { single231 = single231 + 0.7f; } if ((double)single232 < 0.25) { single231 = single231 + 0.9f; } if ((double)single232 < 0.1) { single231 = single231 + 0.9f; } single231 = single231 * 1.25f; single231 = single231 + 0.3f; single230 = single230 + single231 * 0.35f; if (base.Center.X < Main.npc[Main.wof].Center.X && Main.npc[Main.wof].velocity.X > 0f) { single230 = single230 + 6f; } if (base.Center.X > Main.npc[Main.wof].Center.X && Main.npc[Main.wof].velocity.X < 0f) { single230 = single230 + 6f; } } if (this.velocity.X > single230) { this.velocity.X = single230; } if (this.velocity.X < -single230) { this.velocity.X = -single230; } if (this.velocity.Y > single230) { this.velocity.Y = single230; } if (this.velocity.Y < -single230) { this.velocity.Y = -single230; } } else if (this.ai[1] <= 0f) { this.ai[1] = 0f; } else { this.ai[1] = this.ai[1] - 1f; } if (x98 > 0f) { this.spriteDirection = 1; this.rotation = (float)Math.Atan2((double)y94, (double)x98); } if (x98 < 0f) { this.spriteDirection = -1; this.rotation = (float)Math.Atan2((double)y94, (double)x98) + 3.14f; } return; } if (this.aiStyle == 30) { if (this.target < 0 || this.target == 255 || Main.player[this.target].dead || !Main.player[this.target].active) { this.TargetClosest(true); } bool flag92 = Main.player[this.target].dead; float x99 = this.position.X + (float)(this.width / 2) - Main.player[this.target].position.X - (float)(Main.player[this.target].width / 2); float y95 = this.position.Y + (float)this.height - 59f - Main.player[this.target].position.Y - (float)(Main.player[this.target].height / 2); float single233 = (float)Math.Atan2((double)y95, (double)x99) + 1.57f; if (single233 < 0f) { single233 = single233 + 6.283f; } else if ((double)single233 > 6.283) { single233 = single233 - 6.283f; } float single234 = 0.1f; if (this.rotation < single233) { if ((double)(single233 - this.rotation) <= 3.1415) { NPC nPC115 = this; nPC115.rotation = nPC115.rotation + single234; } else { NPC nPC116 = this; nPC116.rotation = nPC116.rotation - single234; } } else if (this.rotation > single233) { if ((double)(this.rotation - single233) <= 3.1415) { NPC nPC117 = this; nPC117.rotation = nPC117.rotation - single234; } else { NPC nPC118 = this; nPC118.rotation = nPC118.rotation + single234; } } if (this.rotation > single233 - single234 && this.rotation < single233 + single234) { this.rotation = single233; } if (this.rotation < 0f) { NPC nPC119 = this; nPC119.rotation = nPC119.rotation + 6.283f; } else if ((double)this.rotation > 6.283) { NPC nPC120 = this; nPC120.rotation = nPC120.rotation - 6.283f; } if (this.rotation > single233 - single234 && this.rotation < single233 + single234) { this.rotation = single233; } if (Main.netMode != 1 && !Main.dayTime && !flag92 && this.timeLeft < 10) { for (int o3 = 0; o3 < 200; o3++) { if (o3 != this.whoAmI && Main.npc[o3].active && (Main.npc[o3].type == 125 || Main.npc[o3].type == 126) && Main.npc[o3].timeLeft - 1 > this.timeLeft) { this.timeLeft = Main.npc[o3].timeLeft - 1; } } } if (Main.dayTime || flag92) { this.velocity.Y = this.velocity.Y - 0.04f; if (this.timeLeft > 10) { this.timeLeft = 10; return; } } else if (this.ai[0] == 0f) { if (this.ai[1] == 0f) { float single235 = 7f; float single236 = 0.1f; if (Main.expertMode) { single235 = 8.25f; single236 = 0.115f; } int num422 = 1; if (this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)Main.player[this.target].width) { num422 = -1; } Vector2 y96 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x101 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) + (float)(num422 * 300) - y96.X; float y97 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - 300f - y96.Y; float single237 = (float)Math.Sqrt((double)(x101 * x101 + y97 * y97)); float single238 = single237; single237 = single235 / single237; x101 = x101 * single237; y97 = y97 * single237; if (this.velocity.X < x101) { this.velocity.X = this.velocity.X + single236; if (this.velocity.X < 0f && x101 > 0f) { this.velocity.X = this.velocity.X + single236; } } else if (this.velocity.X > x101) { this.velocity.X = this.velocity.X - single236; if (this.velocity.X > 0f && x101 < 0f) { this.velocity.X = this.velocity.X - single236; } } if (this.velocity.Y < y97) { this.velocity.Y = this.velocity.Y + single236; if (this.velocity.Y < 0f && y97 > 0f) { this.velocity.Y = this.velocity.Y + single236; } } else if (this.velocity.Y > y97) { this.velocity.Y = this.velocity.Y - single236; if (this.velocity.Y > 0f && y97 < 0f) { this.velocity.Y = this.velocity.Y - single236; } } this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= 600f) { this.ai[1] = 1f; this.ai[2] = 0f; this.ai[3] = 0f; this.target = 255; this.netUpdate = true; } else if (this.position.Y + (float)this.height < Main.player[this.target].position.Y && single238 < 400f) { if (!Main.player[this.target].dead) { this.ai[3] = this.ai[3] + 1f; if (Main.expertMode && (double)this.life < (double)this.lifeMax * 0.9) { this.ai[3] = this.ai[3] + 0.3f; } if (Main.expertMode && (double)this.life < (double)this.lifeMax * 0.8) { this.ai[3] = this.ai[3] + 0.3f; } if (Main.expertMode && (double)this.life < (double)this.lifeMax * 0.7) { this.ai[3] = this.ai[3] + 0.3f; } if (Main.expertMode && (double)this.life < (double)this.lifeMax * 0.6) { this.ai[3] = this.ai[3] + 0.3f; } } if (this.ai[3] >= 60f) { this.ai[3] = 0f; y96 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); x101 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - y96.X; y97 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - y96.Y; if (Main.netMode != 1) { float single239 = 9f; int num423 = 20; int num424 = 83; if (Main.expertMode) { single239 = 10.5f; num423 = 18; } single237 = (float)Math.Sqrt((double)(x101 * x101 + y97 * y97)); single237 = single239 / single237; x101 = x101 * single237; y97 = y97 * single237; x101 = x101 + (float)Main.rand.Next(-40, 41) * 0.08f; y97 = y97 + (float)Main.rand.Next(-40, 41) * 0.08f; y96.X = y96.X + x101 * 15f; y96.Y = y96.Y + y97 * 15f; Projectile.NewProjectile(y96.X, y96.Y, x101, y97, num424, num423, 0f, Main.myPlayer, 0f, 0f); } } } } else if (this.ai[1] == 1f) { this.rotation = single233; float single240 = 12f; if (Main.expertMode) { single240 = 15f; } Vector2 vector2118 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x102 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector2118.X; float y98 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector2118.Y; float single241 = (float)Math.Sqrt((double)(x102 * x102 + y98 * y98)); single241 = single240 / single241; this.velocity.X = x102 * single241; this.velocity.Y = y98 * single241; this.ai[1] = 2f; } else if (this.ai[1] == 2f) { this.ai[2] = this.ai[2] + 1f; if (this.ai[2] < 25f) { this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 1.57f; } else { this.velocity.X = this.velocity.X * 0.96f; this.velocity.Y = this.velocity.Y * 0.96f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1) { this.velocity.Y = 0f; } } if (this.ai[2] >= 70f) { this.ai[3] = this.ai[3] + 1f; this.ai[2] = 0f; this.target = 255; this.rotation = single233; if (this.ai[3] < 4f) { this.ai[1] = 1f; } else { this.ai[1] = 0f; this.ai[3] = 0f; } } } if ((double)this.life < (double)this.lifeMax * 0.4) { this.ai[0] = 1f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; return; } } else if (this.ai[0] == 1f || this.ai[0] == 2f) { if (this.ai[0] != 1f) { this.ai[2] = this.ai[2] - 0.005f; if (this.ai[2] < 0f) { this.ai[2] = 0f; } } else { this.ai[2] = this.ai[2] + 0.005f; if ((double)this.ai[2] > 0.5) { this.ai[2] = 0.5f; } } NPC nPC121 = this; nPC121.rotation = nPC121.rotation + this.ai[2]; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] == 100f) { this.ai[0] = this.ai[0] + 1f; this.ai[1] = 0f; if (this.ai[0] == 3f) { this.ai[2] = 0f; } } if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1) { this.velocity.Y = 0f; return; } } else { this.damage = (int)((double)this.defDamage * 1.5); this.defense = this.defDefense + 10; this.soundHit = 4; if (this.ai[1] != 0f) { int num429 = 1; if (this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)Main.player[this.target].width) { num429 = -1; } float single242 = 8f; float single243 = 0.2f; if (Main.expertMode) { single242 = 9.5f; single243 = 0.25f; } Vector2 y99 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x103 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) + (float)(num429 * 340) - y99.X; float y100 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - y99.Y; float single244 = (float)Math.Sqrt((double)(x103 * x103 + y100 * y100)); single244 = single242 / single244; x103 = x103 * single244; y100 = y100 * single244; if (this.velocity.X < x103) { this.velocity.X = this.velocity.X + single243; if (this.velocity.X < 0f && x103 > 0f) { this.velocity.X = this.velocity.X + single243; } } else if (this.velocity.X > x103) { this.velocity.X = this.velocity.X - single243; if (this.velocity.X > 0f && x103 < 0f) { this.velocity.X = this.velocity.X - single243; } } if (this.velocity.Y < y100) { this.velocity.Y = this.velocity.Y + single243; if (this.velocity.Y < 0f && y100 > 0f) { this.velocity.Y = this.velocity.Y + single243; } } else if (this.velocity.Y > y100) { this.velocity.Y = this.velocity.Y - single243; if (this.velocity.Y > 0f && y100 < 0f) { this.velocity.Y = this.velocity.Y - single243; } } y99 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); x103 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - y99.X; y100 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - y99.Y; this.rotation = (float)Math.Atan2((double)y100, (double)x103) - 1.57f; if (Main.netMode != 1) { this.localAI[1] = this.localAI[1] + 1f; if ((double)this.life < (double)this.lifeMax * 0.75) { this.localAI[1] = this.localAI[1] + 0.5f; } if ((double)this.life < (double)this.lifeMax * 0.5) { this.localAI[1] = this.localAI[1] + 0.75f; } if ((double)this.life < (double)this.lifeMax * 0.25) { this.localAI[1] = this.localAI[1] + 1f; } if ((double)this.life < (double)this.lifeMax * 0.1) { this.localAI[1] = this.localAI[1] + 1.5f; } if (Main.expertMode) { this.localAI[1] = this.localAI[1] + 1f; } if (this.localAI[1] > 60f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.localAI[1] = 0f; float single245 = 9f; int num430 = 18; int num431 = 100; if (Main.expertMode) { num430 = 16; } single244 = (float)Math.Sqrt((double)(x103 * x103 + y100 * y100)); single244 = single245 / single244; x103 = x103 * single244; y100 = y100 * single244; y99.X = y99.X + x103 * 15f; y99.Y = y99.Y + y100 * 15f; Projectile.NewProjectile(y99.X, y99.Y, x103, y100, num431, num430, 0f, Main.myPlayer, 0f, 0f); } } this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= 180f) { this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; this.TargetClosest(true); this.netUpdate = true; return; } } else { float single246 = 8f; float single247 = 0.15f; if (Main.expertMode) { single246 = 9.5f; single247 = 0.175f; } Vector2 y101 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x104 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - y101.X; float y102 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - 300f - y101.Y; float single248 = (float)Math.Sqrt((double)(x104 * x104 + y102 * y102)); single248 = single246 / single248; x104 = x104 * single248; y102 = y102 * single248; if (this.velocity.X < x104) { this.velocity.X = this.velocity.X + single247; if (this.velocity.X < 0f && x104 > 0f) { this.velocity.X = this.velocity.X + single247; } } else if (this.velocity.X > x104) { this.velocity.X = this.velocity.X - single247; if (this.velocity.X > 0f && x104 < 0f) { this.velocity.X = this.velocity.X - single247; } } if (this.velocity.Y < y102) { this.velocity.Y = this.velocity.Y + single247; if (this.velocity.Y < 0f && y102 > 0f) { this.velocity.Y = this.velocity.Y + single247; } } else if (this.velocity.Y > y102) { this.velocity.Y = this.velocity.Y - single247; if (this.velocity.Y > 0f && y102 < 0f) { this.velocity.Y = this.velocity.Y - single247; } } this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= 300f) { this.ai[1] = 1f; this.ai[2] = 0f; this.ai[3] = 0f; this.TargetClosest(true); this.netUpdate = true; } y101 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); x104 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - y101.X; y102 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - y101.Y; this.rotation = (float)Math.Atan2((double)y102, (double)x104) - 1.57f; if (Main.netMode != 1) { this.localAI[1] = this.localAI[1] + 1f; if ((double)this.life < (double)this.lifeMax * 0.75) { this.localAI[1] = this.localAI[1] + 1f; } if ((double)this.life < (double)this.lifeMax * 0.5) { this.localAI[1] = this.localAI[1] + 1f; } if ((double)this.life < (double)this.lifeMax * 0.25) { this.localAI[1] = this.localAI[1] + 1f; } if ((double)this.life < (double)this.lifeMax * 0.1) { this.localAI[1] = this.localAI[1] + 2f; } if (this.localAI[1] > 180f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.localAI[1] = 0f; float single249 = 8.5f; int num432 = 25; int num433 = 100; if (Main.expertMode) { single249 = 10f; num432 = 21; } single248 = (float)Math.Sqrt((double)(x104 * x104 + y102 * y102)); single248 = single249 / single248; x104 = x104 * single248; y102 = y102 * single248; y101.X = y101.X + x104 * 15f; y101.Y = y101.Y + y102 * 15f; Projectile.NewProjectile(y101.X, y101.Y, x104, y102, num433, num432, 0f, Main.myPlayer, 0f, 0f); return; } } } } } else if (this.aiStyle == 31) { if (this.target < 0 || this.target == 255 || Main.player[this.target].dead || !Main.player[this.target].active) { this.TargetClosest(true); } bool flag93 = Main.player[this.target].dead; float x105 = this.position.X + (float)(this.width / 2) - Main.player[this.target].position.X - (float)(Main.player[this.target].width / 2); float y103 = this.position.Y + (float)this.height - 59f - Main.player[this.target].position.Y - (float)(Main.player[this.target].height / 2); float single250 = (float)Math.Atan2((double)y103, (double)x105) + 1.57f; if (single250 < 0f) { single250 = single250 + 6.283f; } else if ((double)single250 > 6.283) { single250 = single250 - 6.283f; } float single251 = 0.15f; if (this.rotation < single250) { if ((double)(single250 - this.rotation) <= 3.1415) { NPC nPC122 = this; nPC122.rotation = nPC122.rotation + single251; } else { NPC nPC123 = this; nPC123.rotation = nPC123.rotation - single251; } } else if (this.rotation > single250) { if ((double)(this.rotation - single250) <= 3.1415) { NPC nPC124 = this; nPC124.rotation = nPC124.rotation - single251; } else { NPC nPC125 = this; nPC125.rotation = nPC125.rotation + single251; } } if (this.rotation > single250 - single251 && this.rotation < single250 + single251) { this.rotation = single250; } if (this.rotation < 0f) { NPC nPC126 = this; nPC126.rotation = nPC126.rotation + 6.283f; } else if ((double)this.rotation > 6.283) { NPC nPC127 = this; nPC127.rotation = nPC127.rotation - 6.283f; } if (this.rotation > single250 - single251 && this.rotation < single250 + single251) { this.rotation = single250; } if (Main.netMode != 1 && !Main.dayTime && !flag93 && this.timeLeft < 10) { for (int r3 = 0; r3 < 200; r3++) { if (r3 != this.whoAmI && Main.npc[r3].active && (Main.npc[r3].type == 125 || Main.npc[r3].type == 126) && Main.npc[r3].timeLeft - 1 > this.timeLeft) { this.timeLeft = Main.npc[r3].timeLeft - 1; } } } if (Main.dayTime || flag93) { this.velocity.Y = this.velocity.Y - 0.04f; if (this.timeLeft > 10) { this.timeLeft = 10; return; } } else if (this.ai[0] == 0f) { if (this.ai[1] == 0f) { this.TargetClosest(true); float single252 = 12f; float single253 = 0.4f; int num437 = 1; if (this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)Main.player[this.target].width) { num437 = -1; } Vector2 y104 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x107 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) + (float)(num437 * 400) - y104.X; float y105 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - y104.Y; float single254 = (float)Math.Sqrt((double)(x107 * x107 + y105 * y105)); single254 = single252 / single254; x107 = x107 * single254; y105 = y105 * single254; if (this.velocity.X < x107) { this.velocity.X = this.velocity.X + single253; if (this.velocity.X < 0f && x107 > 0f) { this.velocity.X = this.velocity.X + single253; } } else if (this.velocity.X > x107) { this.velocity.X = this.velocity.X - single253; if (this.velocity.X > 0f && x107 < 0f) { this.velocity.X = this.velocity.X - single253; } } if (this.velocity.Y < y105) { this.velocity.Y = this.velocity.Y + single253; if (this.velocity.Y < 0f && y105 > 0f) { this.velocity.Y = this.velocity.Y + single253; } } else if (this.velocity.Y > y105) { this.velocity.Y = this.velocity.Y - single253; if (this.velocity.Y > 0f && y105 < 0f) { this.velocity.Y = this.velocity.Y - single253; } } this.ai[2] = this.ai[2] + 1f; if (this.ai[2] < 600f) { if (!Main.player[this.target].dead) { this.ai[3] = this.ai[3] + 1f; if (Main.expertMode && (double)this.life < (double)this.lifeMax * 0.8) { this.ai[3] = this.ai[3] + 0.5f; } } if (this.ai[3] >= 60f) { this.ai[3] = 0f; y104 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); x107 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - y104.X; y105 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - y104.Y; if (Main.netMode != 1) { float single255 = 12f; int num438 = 25; int num439 = 96; if (Main.expertMode) { single255 = 13.5f; num438 = 21; } single254 = (float)Math.Sqrt((double)(x107 * x107 + y105 * y105)); single254 = single255 / single254; x107 = x107 * single254; y105 = y105 * single254; x107 = x107 + (float)Main.rand.Next(-40, 41) * 0.05f; y105 = y105 + (float)Main.rand.Next(-40, 41) * 0.05f; y104.X = y104.X + x107 * 4f; y104.Y = y104.Y + y105 * 4f; Projectile.NewProjectile(y104.X, y104.Y, x107, y105, num439, num438, 0f, Main.myPlayer, 0f, 0f); } } } else { this.ai[1] = 1f; this.ai[2] = 0f; this.ai[3] = 0f; this.target = 255; this.netUpdate = true; } } else if (this.ai[1] == 1f) { this.rotation = single250; float single256 = 13f; if (Main.expertMode) { if ((double)this.life < (double)this.lifeMax * 0.9) { single256 = single256 + 0.5f; } if ((double)this.life < (double)this.lifeMax * 0.8) { single256 = single256 + 0.5f; } if ((double)this.life < (double)this.lifeMax * 0.7) { single256 = single256 + 0.5f; } if ((double)this.life < (double)this.lifeMax * 0.6) { single256 = single256 + 0.5f; } if ((double)this.life < (double)this.lifeMax * 0.5) { single256 = single256 + 0.5f; } } Vector2 vector2122 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x108 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector2122.X; float y106 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector2122.Y; float single257 = (float)Math.Sqrt((double)(x108 * x108 + y106 * y106)); single257 = single256 / single257; this.velocity.X = x108 * single257; this.velocity.Y = y106 * single257; this.ai[1] = 2f; } else if (this.ai[1] == 2f) { this.ai[2] = this.ai[2] + 1f; if (this.ai[2] < 8f) { this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 1.57f; } else { this.velocity.X = this.velocity.X * 0.9f; this.velocity.Y = this.velocity.Y * 0.9f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1) { this.velocity.Y = 0f; } } if (this.ai[2] >= 42f) { this.ai[3] = this.ai[3] + 1f; this.ai[2] = 0f; this.target = 255; this.rotation = single250; if (this.ai[3] < 10f) { this.ai[1] = 1f; } else { this.ai[1] = 0f; this.ai[3] = 0f; } } } if ((double)this.life < (double)this.lifeMax * 0.4) { this.ai[0] = 1f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; return; } } else if (this.ai[0] == 1f || this.ai[0] == 2f) { if (this.ai[0] != 1f) { this.ai[2] = this.ai[2] - 0.005f; if (this.ai[2] < 0f) { this.ai[2] = 0f; } } else { this.ai[2] = this.ai[2] + 0.005f; if ((double)this.ai[2] > 0.5) { this.ai[2] = 0.5f; } } NPC nPC128 = this; nPC128.rotation = nPC128.rotation + this.ai[2]; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] == 100f) { this.ai[0] = this.ai[0] + 1f; this.ai[1] = 0f; if (this.ai[0] == 3f) { this.ai[2] = 0f; } } if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1) { this.velocity.Y = 0f; return; } } else { this.soundHit = 4; this.damage = (int)((double)this.defDamage * 1.5); this.defense = this.defDefense + 18; if (this.ai[1] != 0f) { if (this.ai[1] == 1f) { this.rotation = single250; float single258 = 14f; if (Main.expertMode) { single258 = single258 + 2f; } Vector2 vector2125 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x109 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector2125.X; float y107 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector2125.Y; float single259 = (float)Math.Sqrt((double)(x109 * x109 + y107 * y107)); single259 = single258 / single259; this.velocity.X = x109 * single259; this.velocity.Y = y107 * single259; this.ai[1] = 2f; return; } if (this.ai[1] == 2f) { this.ai[2] = this.ai[2] + 1f; if (Main.expertMode) { this.ai[2] = this.ai[2] + 0.5f; } if (this.ai[2] < 50f) { this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 1.57f; } else { this.velocity.X = this.velocity.X * 0.93f; this.velocity.Y = this.velocity.Y * 0.93f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1) { this.velocity.Y = 0f; } } if (this.ai[2] >= 80f) { this.ai[3] = this.ai[3] + 1f; this.ai[2] = 0f; this.target = 255; this.rotation = single250; if (this.ai[3] < 6f) { this.ai[1] = 1f; return; } this.ai[1] = 0f; this.ai[3] = 0f; return; } } } else { float single260 = 4f; float single261 = 0.1f; int num444 = 1; if (this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)Main.player[this.target].width) { num444 = -1; } Vector2 y108 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x111 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) + (float)(num444 * 180) - y108.X; float y109 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - y108.Y; float single262 = (float)Math.Sqrt((double)(x111 * x111 + y109 * y109)); if (Main.expertMode) { if (single262 > 300f) { single260 = single260 + 0.5f; } if (single262 > 400f) { single260 = single260 + 0.5f; } if (single262 > 500f) { single260 = single260 + 0.5f; } if (single262 > 600f) { single260 = single260 + 0.5f; } if (single262 > 700f) { single260 = single260 + 0.5f; } if (single262 > 800f) { single260 = single260 + 0.5f; } } single262 = single260 / single262; x111 = x111 * single262; y109 = y109 * single262; if (this.velocity.X < x111) { this.velocity.X = this.velocity.X + single261; if (this.velocity.X < 0f && x111 > 0f) { this.velocity.X = this.velocity.X + single261; } } else if (this.velocity.X > x111) { this.velocity.X = this.velocity.X - single261; if (this.velocity.X > 0f && x111 < 0f) { this.velocity.X = this.velocity.X - single261; } } if (this.velocity.Y < y109) { this.velocity.Y = this.velocity.Y + single261; if (this.velocity.Y < 0f && y109 > 0f) { this.velocity.Y = this.velocity.Y + single261; } } else if (this.velocity.Y > y109) { this.velocity.Y = this.velocity.Y - single261; if (this.velocity.Y > 0f && y109 < 0f) { this.velocity.Y = this.velocity.Y - single261; } } this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= 400f) { this.ai[1] = 1f; this.ai[2] = 0f; this.ai[3] = 0f; this.target = 255; this.netUpdate = true; } if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.localAI[2] = this.localAI[2] + 1f; if (this.localAI[2] > 22f) { this.localAI[2] = 0f; } if (Main.netMode != 1) { this.localAI[1] = this.localAI[1] + 1f; if ((double)this.life < (double)this.lifeMax * 0.75) { this.localAI[1] = this.localAI[1] + 1f; } if ((double)this.life < (double)this.lifeMax * 0.5) { this.localAI[1] = this.localAI[1] + 1f; } if ((double)this.life < (double)this.lifeMax * 0.25) { this.localAI[1] = this.localAI[1] + 1f; } if ((double)this.life < (double)this.lifeMax * 0.1) { this.localAI[1] = this.localAI[1] + 2f; } if (this.localAI[1] > 8f) { this.localAI[1] = 0f; float single263 = 6f; int num445 = 30; if (Main.expertMode) { num445 = 26; } int num446 = 101; y108 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); x111 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - y108.X; y109 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - y108.Y; single262 = (float)Math.Sqrt((double)(x111 * x111 + y109 * y109)); single262 = single263 / single262; x111 = x111 * single262; y109 = y109 * single262; y109 = y109 + (float)Main.rand.Next(-40, 41) * 0.01f; x111 = x111 + (float)Main.rand.Next(-40, 41) * 0.01f; y109 = y109 + this.velocity.Y * 0.5f; x111 = x111 + this.velocity.X * 0.5f; y108.X = y108.X - x111 * 1f; y108.Y = y108.Y - y109 * 1f; Projectile.NewProjectile(y108.X, y108.Y, x111, y109, num446, num445, 0f, Main.myPlayer, 0f, 0f); return; } } } } } } else if (this.aiStyle == 32) { this.damage = this.defDamage; this.defense = this.defDefense; if (this.ai[0] == 0f && Main.netMode != 1) { this.TargetClosest(true); this.ai[0] = 1f; int num447 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)this.position.Y + this.height / 2, 128, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num447].ai[0] = -1f; Main.npc[num447].ai[1] = (float)this.whoAmI; Main.npc[num447].target = this.target; Main.npc[num447].netUpdate = true; num447 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)this.position.Y + this.height / 2, 129, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num447].ai[0] = 1f; Main.npc[num447].ai[1] = (float)this.whoAmI; Main.npc[num447].target = this.target; Main.npc[num447].netUpdate = true; num447 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)this.position.Y + this.height / 2, 130, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num447].ai[0] = -1f; Main.npc[num447].ai[1] = (float)this.whoAmI; Main.npc[num447].target = this.target; Main.npc[num447].ai[3] = 150f; Main.npc[num447].netUpdate = true; num447 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)this.position.Y + this.height / 2, 131, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num447].ai[0] = 1f; Main.npc[num447].ai[1] = (float)this.whoAmI; Main.npc[num447].target = this.target; Main.npc[num447].netUpdate = true; Main.npc[num447].ai[3] = 150f; } if (Main.player[this.target].dead || Math.Abs(this.position.X - Main.player[this.target].position.X) > 6000f || Math.Abs(this.position.Y - Main.player[this.target].position.Y) > 6000f) { this.TargetClosest(true); if (Main.player[this.target].dead || Math.Abs(this.position.X - Main.player[this.target].position.X) > 6000f || Math.Abs(this.position.Y - Main.player[this.target].position.Y) > 6000f) { this.ai[1] = 3f; } } if (Main.dayTime && this.ai[1] != 3f && this.ai[1] != 2f) { this.ai[1] = 2f; } if (this.ai[1] != 0f) { if (this.ai[1] == 1f) { NPC nPC129 = this; nPC129.defense = nPC129.defense * 2; NPC nPC130 = this; nPC130.damage = nPC130.damage * 2; this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= 400f) { this.ai[2] = 0f; this.ai[1] = 0f; } NPC nPC131 = this; nPC131.rotation = nPC131.rotation + (float)this.direction * 0.3f; Vector2 vector2126 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x112 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector2126.X; float y111 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector2126.Y; float single264 = (float)Math.Sqrt((double)(x112 * x112 + y111 * y111)); single264 = 2f / single264; this.velocity.X = x112 * single264; this.velocity.Y = y111 * single264; return; } if (this.ai[1] == 2f) { this.damage = 1000; this.defense = 9999; NPC nPC132 = this; nPC132.rotation = nPC132.rotation + (float)this.direction * 0.3f; Vector2 vector2127 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x113 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector2127.X; float y112 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector2127.Y; float single265 = (float)Math.Sqrt((double)(x113 * x113 + y112 * y112)); float single266 = 10f; single266 = single266 + single265 / 100f; if (single266 < 8f) { single266 = 8f; } if (single266 > 32f) { single266 = 32f; } single265 = single266 / single265; this.velocity.X = x113 * single265; this.velocity.Y = y112 * single265; return; } if (this.ai[1] == 3f) { this.velocity.Y = this.velocity.Y + 0.1f; if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.95f; } this.velocity.X = this.velocity.X * 0.95f; if (this.timeLeft > 500) { this.timeLeft = 500; return; } } } else { this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= 600f) { this.ai[2] = 0f; this.ai[1] = 1f; this.TargetClosest(true); this.netUpdate = true; } this.rotation = this.velocity.X / 15f; if (this.position.Y > Main.player[this.target].position.Y - 200f) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.98f; } this.velocity.Y = this.velocity.Y - 0.1f; if (this.velocity.Y > 2f) { this.velocity.Y = 2f; } } else if (this.position.Y < Main.player[this.target].position.Y - 500f) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.98f; } this.velocity.Y = this.velocity.Y + 0.1f; if (this.velocity.Y < -2f) { this.velocity.Y = -2f; } } if (this.position.X + (float)(this.width / 2) > Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) + 100f) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.98f; } this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > 8f) { this.velocity.X = 8f; } } if (this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - 100f) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.98f; } this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -8f) { this.velocity.X = -8f; return; } } } } else if (this.aiStyle == 33) { Vector2 vector2128 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x114 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector2128.X; float y113 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector2128.Y; float single267 = (float)Math.Sqrt((double)(x114 * x114 + y113 * y113)); if (this.ai[2] != 99f) { if (single267 > 800f) { this.ai[2] = 99f; } } else if (single267 < 400f) { this.ai[2] = 0f; } this.spriteDirection = -(int)this.ai[0]; if (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].aiStyle != 32) { this.ai[2] = this.ai[2] + 10f; if (this.ai[2] > 50f || Main.netMode != 2) { this.life = -1; this.HitEffect(0, 10); this.active = false; } } if (this.ai[2] != 99f) { if (this.ai[2] == 0f || this.ai[2] == 3f) { if (Main.npc[(int)this.ai[1]].ai[1] == 3f && this.timeLeft > 10) { this.timeLeft = 10; } if (Main.npc[(int)this.ai[1]].ai[1] == 0f) { this.ai[3] = this.ai[3] + 1f; if (this.ai[3] >= 300f) { this.ai[2] = this.ai[2] + 1f; this.ai[3] = 0f; this.netUpdate = true; } if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y + 320f) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y - 0.04f; if (this.velocity.Y > 3f) { this.velocity.Y = 3f; } } else if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y + 260f) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y + 0.04f; if (this.velocity.Y < -3f) { this.velocity.Y = -3f; } } if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2)) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X - 0.3f; if (this.velocity.X > 12f) { this.velocity.X = 12f; } } if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 250f) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X + 0.3f; if (this.velocity.X < -12f) { this.velocity.X = -12f; } } } else { this.TargetClosest(true); if (!Main.player[this.target].dead) { Vector2 vector2129 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x115 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector2129.X; float y114 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector2129.Y; float single268 = (float)Math.Sqrt((double)(x115 * x115 + y114 * y114)); single268 = 7f / single268; x115 = x115 * single268; y114 = y114 * single268; this.rotation = (float)Math.Atan2((double)y114, (double)x115) - 1.57f; if (this.velocity.X > x115) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.97f; } this.velocity.X = this.velocity.X - 0.05f; } if (this.velocity.X < x115) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.97f; } this.velocity.X = this.velocity.X + 0.05f; } if (this.velocity.Y > y114) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.97f; } this.velocity.Y = this.velocity.Y - 0.05f; } if (this.velocity.Y < y114) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.97f; } this.velocity.Y = this.velocity.Y + 0.05f; } } else { this.velocity.Y = this.velocity.Y + 0.1f; if (this.velocity.Y > 16f) { this.velocity.Y = 16f; } } this.ai[3] = this.ai[3] + 1f; if (this.ai[3] >= 600f) { this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; } } Vector2 vector2130 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x116 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector2130.X; float y115 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector2130.Y; Math.Sqrt((double)(x116 * x116 + y115 * y115)); this.rotation = (float)Math.Atan2((double)y115, (double)x116) + 1.57f; return; } if (this.ai[2] == 1f) { Vector2 vector2131 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x117 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector2131.X; float y116 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector2131.Y; float single269 = (float)Math.Sqrt((double)(x117 * x117 + y116 * y116)); this.rotation = (float)Math.Atan2((double)y116, (double)x117) + 1.57f; this.velocity.X = this.velocity.X * 0.95f; this.velocity.Y = this.velocity.Y - 0.1f; if (this.velocity.Y < -8f) { this.velocity.Y = -8f; } if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y - 200f) { this.TargetClosest(true); this.ai[2] = 2f; vector2131 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); x117 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector2131.X; y116 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector2131.Y; single269 = (float)Math.Sqrt((double)(x117 * x117 + y116 * y116)); single269 = 22f / single269; this.velocity.X = x117 * single269; this.velocity.Y = y116 * single269; this.netUpdate = true; return; } } else if (this.ai[2] != 2f) { if (this.ai[2] == 4f) { this.TargetClosest(true); Vector2 vector2132 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x118 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector2132.X; float y117 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector2132.Y; float single270 = (float)Math.Sqrt((double)(x118 * x118 + y117 * y117)); single270 = 7f / single270; x118 = x118 * single270; y117 = y117 * single270; if (this.velocity.X > x118) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.97f; } this.velocity.X = this.velocity.X - 0.05f; } if (this.velocity.X < x118) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.97f; } this.velocity.X = this.velocity.X + 0.05f; } if (this.velocity.Y > y117) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.97f; } this.velocity.Y = this.velocity.Y - 0.05f; } if (this.velocity.Y < y117) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.97f; } this.velocity.Y = this.velocity.Y + 0.05f; } this.ai[3] = this.ai[3] + 1f; if (this.ai[3] >= 600f) { this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; } vector2132 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); x118 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector2132.X; y117 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector2132.Y; single270 = (float)Math.Sqrt((double)(x118 * x118 + y117 * y117)); this.rotation = (float)Math.Atan2((double)y117, (double)x118) + 1.57f; return; } if (this.ai[2] == 5f && (this.velocity.X > 0f && this.position.X + (float)(this.width / 2) > Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) || this.velocity.X < 0f && this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2))) { this.ai[2] = 0f; return; } } else if (this.position.Y > Main.player[this.target].position.Y || this.velocity.Y < 0f) { this.ai[2] = 3f; return; } } else { if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y - 0.1f; if (this.velocity.Y > 8f) { this.velocity.Y = 8f; } } else if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y + 0.1f; if (this.velocity.Y < -8f) { this.velocity.Y = -8f; } } if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2)) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X - 0.5f; if (this.velocity.X > 12f) { this.velocity.X = 12f; } } if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2)) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X + 0.5f; if (this.velocity.X < -12f) { this.velocity.X = -12f; return; } } } } else if (this.aiStyle == 34) { this.spriteDirection = -(int)this.ai[0]; Vector2 vector2133 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x119 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector2133.X; float y118 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector2133.Y; float single271 = (float)Math.Sqrt((double)(x119 * x119 + y118 * y118)); if (this.ai[2] != 99f) { if (single271 > 800f) { this.ai[2] = 99f; } } else if (single271 < 400f) { this.ai[2] = 0f; } if (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].aiStyle != 32) { this.ai[2] = this.ai[2] + 10f; if (this.ai[2] > 50f || Main.netMode != 2) { this.life = -1; this.HitEffect(0, 10); this.active = false; } } if (this.ai[2] != 99f) { if (this.ai[2] == 0f || this.ai[2] == 3f) { if (Main.npc[(int)this.ai[1]].ai[1] == 3f && this.timeLeft > 10) { this.timeLeft = 10; } if (Main.npc[(int)this.ai[1]].ai[1] == 0f) { this.ai[3] = this.ai[3] + 1f; if (this.ai[3] >= 600f) { this.ai[2] = this.ai[2] + 1f; this.ai[3] = 0f; this.netUpdate = true; } if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y + 300f) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y - 0.1f; if (this.velocity.Y > 3f) { this.velocity.Y = 3f; } } else if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y + 230f) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y + 0.1f; if (this.velocity.Y < -3f) { this.velocity.Y = -3f; } } if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) + 250f) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.94f; } this.velocity.X = this.velocity.X - 0.3f; if (this.velocity.X > 9f) { this.velocity.X = 9f; } } if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2)) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.94f; } this.velocity.X = this.velocity.X + 0.2f; if (this.velocity.X < -8f) { this.velocity.X = -8f; } } } else { this.TargetClosest(true); this.TargetClosest(true); if (!Main.player[this.target].dead) { Vector2 vector2134 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x120 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector2134.X; float y119 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector2134.Y; float single272 = (float)Math.Sqrt((double)(x120 * x120 + y119 * y119)); single272 = 12f / single272; x120 = x120 * single272; y119 = y119 * single272; this.rotation = (float)Math.Atan2((double)y119, (double)x120) - 1.57f; if (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) >= 2f) { NPC nPC133 = this; nPC133.velocity = nPC133.velocity * 0.97f; } else { this.rotation = (float)Math.Atan2((double)y119, (double)x120) - 1.57f; this.velocity.X = x120; this.velocity.Y = y119; this.netUpdate = true; } this.ai[3] = this.ai[3] + 1f; if (this.ai[3] >= 600f) { this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; } } else { this.velocity.Y = this.velocity.Y + 0.1f; if (this.velocity.Y > 16f) { this.velocity.Y = 16f; } } } Vector2 vector2135 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x121 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector2135.X; float y120 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector2135.Y; Math.Sqrt((double)(x121 * x121 + y120 * y120)); this.rotation = (float)Math.Atan2((double)y120, (double)x121) + 1.57f; return; } if (this.ai[2] == 1f) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.9f; } Vector2 vector2136 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x122 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 280f * this.ai[0] - vector2136.X; float y121 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector2136.Y; float single273 = (float)Math.Sqrt((double)(x122 * x122 + y121 * y121)); this.rotation = (float)Math.Atan2((double)y121, (double)x122) + 1.57f; this.velocity.X = (this.velocity.X * 5f + Main.npc[(int)this.ai[1]].velocity.X) / 6f; this.velocity.X = this.velocity.X + 0.5f; this.velocity.Y = this.velocity.Y - 0.5f; if (this.velocity.Y < -9f) { this.velocity.Y = -9f; } if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y - 280f) { this.TargetClosest(true); this.ai[2] = 2f; vector2136 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); x122 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector2136.X; y121 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector2136.Y; single273 = (float)Math.Sqrt((double)(x122 * x122 + y121 * y121)); single273 = 20f / single273; this.velocity.X = x122 * single273; this.velocity.Y = y121 * single273; this.netUpdate = true; return; } } else if (this.ai[2] == 2f) { if (this.position.Y > Main.player[this.target].position.Y || this.velocity.Y < 0f) { if (this.ai[3] >= 4f) { this.ai[2] = 3f; this.ai[3] = 0f; return; } this.ai[2] = 1f; this.ai[3] = this.ai[3] + 1f; return; } } else if (this.ai[2] == 4f) { Vector2 vector2137 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x123 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector2137.X; float y122 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector2137.Y; float single274 = (float)Math.Sqrt((double)(x123 * x123 + y122 * y122)); this.rotation = (float)Math.Atan2((double)y122, (double)x123) + 1.57f; this.velocity.Y = (this.velocity.Y * 5f + Main.npc[(int)this.ai[1]].velocity.Y) / 6f; this.velocity.X = this.velocity.X + 0.5f; if (this.velocity.X > 12f) { this.velocity.X = 12f; } if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 500f || this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) + 500f) { this.TargetClosest(true); this.ai[2] = 5f; vector2137 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); x123 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector2137.X; y122 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector2137.Y; single274 = (float)Math.Sqrt((double)(x123 * x123 + y122 * y122)); single274 = 17f / single274; this.velocity.X = x123 * single274; this.velocity.Y = y122 * single274; this.netUpdate = true; return; } } else if (this.ai[2] == 5f && this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - 100f) { if (this.ai[3] >= 4f) { this.ai[2] = 0f; this.ai[3] = 0f; return; } this.ai[2] = 4f; this.ai[3] = this.ai[3] + 1f; return; } } else { if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y - 0.1f; if (this.velocity.Y > 8f) { this.velocity.Y = 8f; } } else if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y + 0.1f; if (this.velocity.Y < -8f) { this.velocity.Y = -8f; } } if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2)) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X - 0.5f; if (this.velocity.X > 12f) { this.velocity.X = 12f; } } if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2)) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X + 0.5f; if (this.velocity.X < -12f) { this.velocity.X = -12f; return; } } } } else if (this.aiStyle == 35) { this.spriteDirection = -(int)this.ai[0]; if (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].aiStyle != 32) { this.ai[2] = this.ai[2] + 10f; if (this.ai[2] > 50f || Main.netMode != 2) { this.life = -1; this.HitEffect(0, 10); this.active = false; } } if (this.ai[2] == 0f) { if (Main.npc[(int)this.ai[1]].ai[1] == 3f && this.timeLeft > 10) { this.timeLeft = 10; } if (Main.npc[(int)this.ai[1]].ai[1] == 0f) { this.ai[3] = this.ai[3] + 1f; if (this.ai[3] >= 1100f) { this.localAI[0] = 0f; this.ai[2] = 1f; this.ai[3] = 0f; this.netUpdate = true; } if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y - 150f) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y - 0.04f; if (this.velocity.Y > 3f) { this.velocity.Y = 3f; } } else if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y - 150f) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y + 0.04f; if (this.velocity.Y < -3f) { this.velocity.Y = -3f; } } if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) + 200f) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X - 0.2f; if (this.velocity.X > 8f) { this.velocity.X = 8f; } } if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) + 160f) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X + 0.2f; if (this.velocity.X < -8f) { this.velocity.X = -8f; } } } else { this.localAI[0] = this.localAI[0] + 2f; if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y - 100f) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y - 0.07f; if (this.velocity.Y > 6f) { this.velocity.Y = 6f; } } else if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y - 100f) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y + 0.07f; if (this.velocity.Y < -6f) { this.velocity.Y = -6f; } } if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 120f * this.ai[0]) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > 8f) { this.velocity.X = 8f; } } if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 120f * this.ai[0]) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -8f) { this.velocity.X = -8f; } } } Vector2 y123 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x124 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - y123.X; float y124 = Main.npc[(int)this.ai[1]].position.Y + 230f - y123.Y; float single275 = (float)Math.Sqrt((double)(x124 * x124 + y124 * y124)); this.rotation = (float)Math.Atan2((double)y124, (double)x124) + 1.57f; if (Main.netMode != 1) { this.localAI[0] = this.localAI[0] + 1f; if (this.localAI[0] > 140f) { this.localAI[0] = 0f; float single276 = 12f; int num448 = 0; int num449 = 102; single275 = single276 / single275; x124 = -x124 * single275; y124 = -y124 * single275; x124 = x124 + (float)Main.rand.Next(-40, 41) * 0.01f; y124 = y124 + (float)Main.rand.Next(-40, 41) * 0.01f; y123.X = y123.X + x124 * 4f; y123.Y = y123.Y + y124 * 4f; Projectile.NewProjectile(y123.X, y123.Y, x124, y124, num449, num448, 0f, Main.myPlayer, 0f, 0f); return; } } } else if (this.ai[2] == 1f) { this.ai[3] = this.ai[3] + 1f; if (this.ai[3] >= 300f) { this.localAI[0] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; } Vector2 x125 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x126 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - x125.X; float y125 = Main.npc[(int)this.ai[1]].position.Y - x125.Y; y125 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - 80f - x125.Y; float single277 = (float)Math.Sqrt((double)(x126 * x126 + y125 * y125)); single277 = 6f / single277; x126 = x126 * single277; y125 = y125 * single277; if (this.velocity.X > x126) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.9f; } this.velocity.X = this.velocity.X - 0.04f; } if (this.velocity.X < x126) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.9f; } this.velocity.X = this.velocity.X + 0.04f; } if (this.velocity.Y > y125) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.9f; } this.velocity.Y = this.velocity.Y - 0.08f; } if (this.velocity.Y < y125) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.9f; } this.velocity.Y = this.velocity.Y + 0.08f; } this.TargetClosest(true); x125 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); x126 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - x125.X; y125 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - x125.Y; single277 = (float)Math.Sqrt((double)(x126 * x126 + y125 * y125)); this.rotation = (float)Math.Atan2((double)y125, (double)x126) - 1.57f; if (Main.netMode != 1) { this.localAI[0] = this.localAI[0] + 1f; if (this.localAI[0] > 40f) { this.localAI[0] = 0f; float single278 = 10f; int num450 = 0; int num451 = 102; single277 = single278 / single277; x126 = x126 * single277; y125 = y125 * single277; x126 = x126 + (float)Main.rand.Next(-40, 41) * 0.01f; y125 = y125 + (float)Main.rand.Next(-40, 41) * 0.01f; x125.X = x125.X + x126 * 4f; x125.Y = x125.Y + y125 * 4f; Projectile.NewProjectile(x125.X, x125.Y, x126, y125, num451, num450, 0f, Main.myPlayer, 0f, 0f); return; } } } } else if (this.aiStyle == 36) { this.spriteDirection = -(int)this.ai[0]; if (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].aiStyle != 32) { this.ai[2] = this.ai[2] + 10f; if (this.ai[2] > 50f || Main.netMode != 2) { this.life = -1; this.HitEffect(0, 10); this.active = false; } } if (this.ai[2] == 0f || this.ai[2] == 3f) { if (Main.npc[(int)this.ai[1]].ai[1] == 3f && this.timeLeft > 10) { this.timeLeft = 10; } if (Main.npc[(int)this.ai[1]].ai[1] == 0f) { this.ai[3] = this.ai[3] + 1f; if (this.ai[3] >= 800f) { this.ai[2] = this.ai[2] + 1f; this.ai[3] = 0f; this.netUpdate = true; } if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y - 100f) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y - 0.1f; if (this.velocity.Y > 3f) { this.velocity.Y = 3f; } } else if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y - 100f) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y + 0.1f; if (this.velocity.Y < -3f) { this.velocity.Y = -3f; } } if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 180f * this.ai[0]) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X - 0.14f; if (this.velocity.X > 8f) { this.velocity.X = 8f; } } if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 180f * this.ai[0]) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X + 0.14f; if (this.velocity.X < -8f) { this.velocity.X = -8f; } } } else { this.localAI[0] = this.localAI[0] + 3f; if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y - 100f) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y - 0.07f; if (this.velocity.Y > 6f) { this.velocity.Y = 6f; } } else if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y - 100f) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y + 0.07f; if (this.velocity.Y < -6f) { this.velocity.Y = -6f; } } if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 120f * this.ai[0]) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > 8f) { this.velocity.X = 8f; } } if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 120f * this.ai[0]) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -8f) { this.velocity.X = -8f; } } } this.TargetClosest(true); Vector2 y126 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x127 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - y126.X; float y127 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - y126.Y; float single279 = (float)Math.Sqrt((double)(x127 * x127 + y127 * y127)); this.rotation = (float)Math.Atan2((double)y127, (double)x127) - 1.57f; if (Main.netMode != 1) { this.localAI[0] = this.localAI[0] + 1f; if (this.localAI[0] > 200f) { this.localAI[0] = 0f; float single280 = 8f; int num452 = 25; int num453 = 100; single279 = single280 / single279; x127 = x127 * single279; y127 = y127 * single279; x127 = x127 + (float)Main.rand.Next(-40, 41) * 0.05f; y127 = y127 + (float)Main.rand.Next(-40, 41) * 0.05f; y126.X = y126.X + x127 * 8f; y126.Y = y126.Y + y127 * 8f; Projectile.NewProjectile(y126.X, y126.Y, x127, y127, num453, num452, 0f, Main.myPlayer, 0f, 0f); return; } } } else if (this.ai[2] == 1f) { this.ai[3] = this.ai[3] + 1f; if (this.ai[3] >= 200f) { this.localAI[0] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; } Vector2 x128 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x129 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - 350f - x128.X; float y128 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - 20f - x128.Y; float single281 = (float)Math.Sqrt((double)(x129 * x129 + y128 * y128)); single281 = 7f / single281; x129 = x129 * single281; y128 = y128 * single281; if (this.velocity.X > x129) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.9f; } this.velocity.X = this.velocity.X - 0.1f; } if (this.velocity.X < x129) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.9f; } this.velocity.X = this.velocity.X + 0.1f; } if (this.velocity.Y > y128) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.9f; } this.velocity.Y = this.velocity.Y - 0.03f; } if (this.velocity.Y < y128) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.9f; } this.velocity.Y = this.velocity.Y + 0.03f; } this.TargetClosest(true); x128 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); x129 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - x128.X; y128 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - x128.Y; single281 = (float)Math.Sqrt((double)(x129 * x129 + y128 * y128)); this.rotation = (float)Math.Atan2((double)y128, (double)x129) - 1.57f; if (Main.netMode == 1) { this.localAI[0] = this.localAI[0] + 1f; if (this.localAI[0] > 80f) { this.localAI[0] = 0f; float single282 = 10f; int num454 = 25; int num455 = 100; single281 = single282 / single281; x129 = x129 * single281; y128 = y128 * single281; x129 = x129 + (float)Main.rand.Next(-40, 41) * 0.05f; y128 = y128 + (float)Main.rand.Next(-40, 41) * 0.05f; x128.X = x128.X + x129 * 8f; x128.Y = x128.Y + y128 * 8f; Projectile.NewProjectile(x128.X, x128.Y, x129, y128, num455, num454, 0f, Main.myPlayer, 0f, 0f); return; } } } } else if (this.aiStyle == 37) { if (this.ai[3] > 0f) { this.realLife = (int)this.ai[3]; } if (this.target < 0 || this.target == 255 || Main.player[this.target].dead) { this.TargetClosest(true); } if (this.type >= 134 && this.type <= 136) { this.velocity.Length(); if (this.type == 134 || this.type != 134 && Main.npc[(int)this.ai[1]].alpha < 128) { NPC nPC134 = this; nPC134.alpha = nPC134.alpha - 42; if (this.alpha < 0) { this.alpha = 0; } } } if (this.type > 134) { bool flag94 = false; if (this.ai[1] <= 0f) { flag94 = true; } else if (Main.npc[(int)this.ai[1]].life <= 0) { flag94 = true; } if (flag94) { this.life = 0; this.HitEffect(0, 10); this.checkDead(); } } if (Main.netMode != 1) { if (this.ai[0] == 0f && this.type == 134) { this.ai[3] = (float)this.whoAmI; this.realLife = this.whoAmI; int num459 = 0; int num460 = this.whoAmI; int num461 = 80; for (int v3 = 0; v3 <= num461; v3++) { int num462 = 135; if (v3 == num461) { num462 = 136; } num459 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), num462, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num459].ai[3] = (float)this.whoAmI; Main.npc[num459].realLife = this.whoAmI; Main.npc[num459].ai[1] = (float)num460; Main.npc[num460].ai[0] = (float)num459; NetMessage.SendData(23, -1, -1, "", num459, 0f, 0f, 0f, 0, 0, 0); num460 = num459; } } if (this.type == 135) { this.localAI[0] = this.localAI[0] + (float)Main.rand.Next(4); if (this.localAI[0] >= (float)Main.rand.Next(1400, 26000)) { this.localAI[0] = 0f; this.TargetClosest(true); if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { float single283 = 8f; Vector2 y129 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)(this.height / 2)); float x130 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - y129.X + (float)Main.rand.Next(-20, 21); float y130 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - y129.Y + (float)Main.rand.Next(-20, 21); float single284 = (float)Math.Sqrt((double)(x130 * x130 + y130 * y130)); single284 = single283 / single284; x130 = x130 * single284; y130 = y130 * single284; x130 = x130 + (float)Main.rand.Next(-20, 21) * 0.05f; y130 = y130 + (float)Main.rand.Next(-20, 21) * 0.05f; int num463 = 22; if (Main.expertMode) { num463 = 18; } int num464 = 100; y129.X = y129.X + x130 * 5f; y129.Y = y129.Y + y130 * 5f; int num465 = Projectile.NewProjectile(y129.X, y129.Y, x130, y130, num464, num463, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num465].timeLeft = 300; this.netUpdate = true; } } } } int x131 = (int)(this.position.X / 16f) - 1; int x132 = (int)((this.position.X + (float)this.width) / 16f) + 2; int y131 = (int)(this.position.Y / 16f) - 1; int y132 = (int)((this.position.Y + (float)this.height) / 16f) + 2; if (x131 < 0) { x131 = 0; } if (x132 > Main.maxTilesX) { x132 = Main.maxTilesX; } if (y131 < 0) { y131 = 0; } if (y132 > Main.maxTilesY) { y132 = Main.maxTilesY; } bool flag95 = false; if (!flag95) { for (int w3 = x131; w3 < x132; w3++) { for (int x310 = y131; x310 < y132; x310++) { if (Main.tile[w3, x310] != null && (Main.tile[w3, x310].nactive() && (Main.tileSolid[Main.tile[w3, x310].type] || Main.tileSolidTop[Main.tile[w3, x310].type] && Main.tile[w3, x310].frameY == 0) || Main.tile[w3, x310].liquid > 64)) { vector23.X = (float)(w3 * 16); vector23.Y = (float)(x310 * 16); if (this.position.X + (float)this.width > vector23.X && this.position.X < vector23.X + 16f && this.position.Y + (float)this.height > vector23.Y && this.position.Y < vector23.Y + 16f) { flag95 = true; break; } } } } } if (flag95) { this.localAI[1] = 0f; } else { this.localAI[1] = 1f; if (this.type == 134) { Rectangle rectangle11 = new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height); int num466 = 1000; bool flag96 = true; if (this.position.Y > Main.player[this.target].position.Y) { for (int y310 = 0; y310 < 255; y310++) { if (Main.player[y310].active) { Rectangle rectangle12 = new Rectangle((int)Main.player[y310].position.X - num466, (int)Main.player[y310].position.Y - num466, num466 * 2, num466 * 2); if (rectangle11.Intersects(rectangle12)) { flag96 = false; break; } } } if (flag96) { flag95 = true; } } } } float single285 = 16f; if (Main.dayTime || Main.player[this.target].dead) { flag95 = false; this.velocity.Y = this.velocity.Y + 1f; if ((double)this.position.Y > Main.worldSurface * 16) { this.velocity.Y = this.velocity.Y + 1f; single285 = 32f; } if ((double)this.position.Y > Main.rockLayer * 16) { for (int a3 = 0; a3 < 200; a3++) { if (Main.npc[a3].aiStyle == this.aiStyle) { Main.npc[a3].active = false; } } } } float single286 = 0.1f; float single287 = 0.15f; Vector2 x133 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x134 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2); float y133 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2); x134 = (float)((int)(x134 / 16f) * 16); y133 = (float)((int)(y133 / 16f) * 16); x133.X = (float)((int)(x133.X / 16f) * 16); x133.Y = (float)((int)(x133.Y / 16f) * 16); x134 = x134 - x133.X; y133 = y133 - x133.Y; float single288 = (float)Math.Sqrt((double)(x134 * x134 + y133 * y133)); if (this.ai[1] > 0f && this.ai[1] < (float)((int)Main.npc.Length)) { try { x133 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); x134 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - x133.X; y133 = Main.npc[(int)this.ai[1]].position.Y + (float)(Main.npc[(int)this.ai[1]].height / 2) - x133.Y; } catch (Exception ex) { #if DEBUG Console.WriteLine(ex); System.Diagnostics.Debugger.Break(); #endif } this.rotation = (float)Math.Atan2((double)y133, (double)x134) + 1.57f; single288 = (float)Math.Sqrt((double)(x134 * x134 + y133 * y133)); int num467 = (int)(44f * this.scale); single288 = (single288 - (float)num467) / single288; x134 = x134 * single288; y133 = y133 * single288; this.velocity = Vector2.Zero; this.position.X = this.position.X + x134; this.position.Y = this.position.Y + y133; return; } if (flag95) { if (this.soundDelay == 0) { float single289 = single288 / 40f; if (single289 < 10f) { single289 = 10f; } if (single289 > 20f) { single289 = 20f; } this.soundDelay = (int)single289; } single288 = (float)Math.Sqrt((double)(x134 * x134 + y133 * y133)); float single290 = Math.Abs(x134); float single291 = Math.Abs(y133); float single292 = single285 / single288; x134 = x134 * single292; y133 = y133 * single292; if ((this.velocity.X > 0f && x134 > 0f || this.velocity.X < 0f && x134 < 0f) && (this.velocity.Y > 0f && y133 > 0f || this.velocity.Y < 0f && y133 < 0f)) { if (this.velocity.X < x134) { this.velocity.X = this.velocity.X + single287; } else if (this.velocity.X > x134) { this.velocity.X = this.velocity.X - single287; } if (this.velocity.Y < y133) { this.velocity.Y = this.velocity.Y + single287; } else if (this.velocity.Y > y133) { this.velocity.Y = this.velocity.Y - single287; } } if (this.velocity.X > 0f && x134 > 0f || this.velocity.X < 0f && x134 < 0f || this.velocity.Y > 0f && y133 > 0f || this.velocity.Y < 0f && y133 < 0f) { if (this.velocity.X < x134) { this.velocity.X = this.velocity.X + single286; } else if (this.velocity.X > x134) { this.velocity.X = this.velocity.X - single286; } if (this.velocity.Y < y133) { this.velocity.Y = this.velocity.Y + single286; } else if (this.velocity.Y > y133) { this.velocity.Y = this.velocity.Y - single286; } if ((double)Math.Abs(y133) < (double)single285 * 0.2 && (this.velocity.X > 0f && x134 < 0f || this.velocity.X < 0f && x134 > 0f)) { if (this.velocity.Y <= 0f) { this.velocity.Y = this.velocity.Y - single286 * 2f; } else { this.velocity.Y = this.velocity.Y + single286 * 2f; } } if ((double)Math.Abs(x134) < (double)single285 * 0.2 && (this.velocity.Y > 0f && y133 < 0f || this.velocity.Y < 0f && y133 > 0f)) { if (this.velocity.X <= 0f) { this.velocity.X = this.velocity.X - single286 * 2f; } else { this.velocity.X = this.velocity.X + single286 * 2f; } } } else if (single290 <= single291) { if (this.velocity.Y < y133) { this.velocity.Y = this.velocity.Y + single286 * 1.1f; } else if (this.velocity.Y > y133) { this.velocity.Y = this.velocity.Y - single286 * 1.1f; } if ((double)(Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) < (double)single285 * 0.5) { if (this.velocity.X <= 0f) { this.velocity.X = this.velocity.X - single286; } else { this.velocity.X = this.velocity.X + single286; } } } else { if (this.velocity.X < x134) { this.velocity.X = this.velocity.X + single286 * 1.1f; } else if (this.velocity.X > x134) { this.velocity.X = this.velocity.X - single286 * 1.1f; } if ((double)(Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) < (double)single285 * 0.5) { if (this.velocity.Y <= 0f) { this.velocity.Y = this.velocity.Y - single286; } else { this.velocity.Y = this.velocity.Y + single286; } } } } else { this.TargetClosest(true); this.velocity.Y = this.velocity.Y + 0.15f; if (this.velocity.Y > single285) { this.velocity.Y = single285; } if ((double)(Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) < (double)single285 * 0.4) { if (this.velocity.X >= 0f) { this.velocity.X = this.velocity.X + single286 * 1.1f; } else { this.velocity.X = this.velocity.X - single286 * 1.1f; } } else if (this.velocity.Y != single285) { if (this.velocity.Y > 4f) { if (this.velocity.X >= 0f) { this.velocity.X = this.velocity.X - single286 * 0.9f; } else { this.velocity.X = this.velocity.X + single286 * 0.9f; } } } else if (this.velocity.X < x134) { this.velocity.X = this.velocity.X + single286; } else if (this.velocity.X > x134) { this.velocity.X = this.velocity.X - single286; } } this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f; if (this.type == 134) { if (!flag95) { if (this.localAI[0] != 0f) { this.netUpdate = true; } this.localAI[0] = 0f; } else { if (this.localAI[0] != 1f) { this.netUpdate = true; } this.localAI[0] = 1f; } if ((this.velocity.X > 0f && this.oldVelocity.X < 0f || this.velocity.X < 0f && this.oldVelocity.X > 0f || this.velocity.Y > 0f && this.oldVelocity.Y < 0f || this.velocity.Y < 0f && this.oldVelocity.Y > 0f) && !this.justHit) { this.netUpdate = true; return; } } } else if (this.aiStyle == 38) { float single293 = 4f; float single294 = 1f; if (this.type == 143) { single293 = 3f; single294 = 0.7f; } if (this.type == 145) { single293 = 3.5f; single294 = 0.8f; } if (this.type == 143) { this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= 120f) { this.ai[2] = 0f; if (Main.netMode != 1) { Vector2 vector2139 = new Vector2(this.position.X + (float)this.width * 0.5f - (float)(this.direction * 12), this.position.Y + (float)this.height * 0.5f); float single295 = (float)(12 * this.spriteDirection); float single296 = 0f; if (Main.netMode != 1) { int num468 = 25; int num469 = 110; int num470 = Projectile.NewProjectile(vector2139.X, vector2139.Y, single295, single296, num469, num468, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num470].ai[0] = 2f; Main.projectile[num470].timeLeft = 300; Main.projectile[num470].friendly = false; NetMessage.SendData(27, -1, -1, "", num470, 0f, 0f, 0f, 0, 0, 0); this.netUpdate = true; } } } } if (this.type == 144 && this.ai[1] >= 3f) { this.TargetClosest(true); this.spriteDirection = this.direction; if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.9f; this.ai[2] = this.ai[2] + 1f; if ((double)this.velocity.X > -0.3 && (double)this.velocity.X < 0.3) { this.velocity.X = 0f; } if (this.ai[2] >= 200f) { this.ai[2] = 0f; this.ai[1] = 0f; } } } else if (this.type != 145 || this.ai[1] < 3f) { if (this.velocity.Y == 0f) { if (this.localAI[2] == this.position.X) { NPC nPC135 = this; nPC135.direction = nPC135.direction * -1; this.ai[3] = 60f; } this.localAI[2] = this.position.X; if (this.ai[3] == 0f) { this.TargetClosest(true); } this.ai[0] = this.ai[0] + 1f; if (this.ai[0] <= 2f) { this.velocity.Y = -6f; this.velocity.X = this.velocity.X + (float)this.direction * single294 * 0.9f; } else { this.ai[0] = 0f; this.ai[1] = this.ai[1] + 1f; this.velocity.Y = -8.2f; this.velocity.X = this.velocity.X + (float)this.direction * single294 * 1.1f; } this.spriteDirection = this.direction; } this.velocity.X = this.velocity.X + (float)this.direction * single294 * 0.01f; } else { this.TargetClosest(true); if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.9f; this.ai[2] = this.ai[2] + 1f; if ((double)this.velocity.X > -0.3 && (double)this.velocity.X < 0.3) { this.velocity.X = 0f; } if (this.ai[2] >= 16f) { this.ai[2] = 0f; this.ai[1] = 0f; } } if (this.velocity.X == 0f && this.velocity.Y == 0f && this.ai[2] == 8f) { float single297 = 10f; Vector2 vector2140 = new Vector2(this.position.X + (float)this.width * 0.5f - (float)(this.direction * 12), this.position.Y + (float)this.height * 0.25f); float x135 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector2140.X; float y134 = Main.player[this.target].position.Y - vector2140.Y; float single298 = (float)Math.Sqrt((double)(x135 * x135 + y134 * y134)); single298 = single297 / single298; x135 = x135 * single298; y134 = y134 * single298; if (Main.netMode != 1) { int num471 = 35; int num472 = 109; int num473 = Projectile.NewProjectile(vector2140.X, vector2140.Y, x135, y134, num472, num471, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num473].ai[0] = 2f; Main.projectile[num473].timeLeft = 300; Main.projectile[num473].friendly = false; NetMessage.SendData(27, -1, -1, "", num473, 0f, 0f, 0f, 0, 0, 0); this.netUpdate = true; } } } if (this.ai[3] > 0f) { this.ai[3] = this.ai[3] - 1f; } if (this.velocity.X > single293 && this.direction > 0) { this.velocity.X = 4f; } if (this.velocity.X < -single293 && this.direction < 0) { this.velocity.X = -4f; return; } } else if (this.aiStyle == 39) { if (this.target < 0 || Main.player[this.target].dead || this.direction == 0) { this.TargetClosest(true); } bool flag97 = true; int num474 = 0; if (this.velocity.X < 0f) { num474 = -1; } if (this.velocity.X > 0f) { num474 = 1; } Vector2 x136 = this.position; x136.X = x136.X + this.velocity.X; int x137 = (int)((x136.X + (float)(this.width / 2) + (float)((this.width / 2 + 1) * num474)) / 16f); int y135 = (int)((x136.Y + (float)this.height - 1f) / 16f); if ((float)(x137 * 16) < x136.X + (float)this.width && (float)(x137 * 16 + 16) > x136.X && (Main.tile[x137, y135].nactive() && !Main.tile[x137, y135].topSlope() && !Main.tile[x137, y135 - 1].topSlope() && (Main.tileSolid[Main.tile[x137, y135].type] && !Main.tileSolidTop[Main.tile[x137, y135].type] || flag97 && Main.tileSolidTop[Main.tile[x137, y135].type] && (!Main.tileSolid[Main.tile[x137, y135 - 1].type] || !Main.tile[x137, y135 - 1].nactive()) && Main.tile[x137, y135].type != 16 && Main.tile[x137, y135].type != 18 && Main.tile[x137, y135].type != 134) || Main.tile[x137, y135 - 1].halfBrick() && Main.tile[x137, y135 - 1].nactive()) && (!Main.tile[x137, y135 - 1].nactive() || !Main.tileSolid[Main.tile[x137, y135 - 1].type] || Main.tileSolidTop[Main.tile[x137, y135 - 1].type] || Main.tile[x137, y135 - 1].halfBrick() && (!Main.tile[x137, y135 - 4].nactive() || !Main.tileSolid[Main.tile[x137, y135 - 4].type] || Main.tileSolidTop[Main.tile[x137, y135 - 4].type])) && (!Main.tile[x137, y135 - 2].nactive() || !Main.tileSolid[Main.tile[x137, y135 - 2].type] || Main.tileSolidTop[Main.tile[x137, y135 - 2].type]) && (!Main.tile[x137, y135 - 3].nactive() || !Main.tileSolid[Main.tile[x137, y135 - 3].type] || Main.tileSolidTop[Main.tile[x137, y135 - 3].type]) && (!Main.tile[x137 - num474, y135 - 3].nactive() || !Main.tileSolid[Main.tile[x137 - num474, y135 - 3].type] || Main.tileSolidTop[Main.tile[x137 - num474, y135 - 3].type])) { float single299 = (float)(y135 * 16); if (Main.tile[x137, y135].halfBrick()) { single299 = single299 + 8f; } if (Main.tile[x137, y135 - 1].halfBrick()) { single299 = single299 - 8f; } if (single299 < x136.Y + (float)this.height) { float y136 = x136.Y + (float)this.height - single299; if ((double)y136 <= 16.1) { NPC nPC136 = this; nPC136.gfxOffY = nPC136.gfxOffY + (this.position.Y + (float)this.height - single299); this.position.Y = single299 - (float)this.height; if (y136 >= 9f) { this.stepSpeed = 1.5f; } else { this.stepSpeed = 0.75f; } } } } if (this.justHit && this.type != 417) { this.ai[0] = 0f; this.ai[1] = 0f; this.TargetClosest(true); } if (this.ai[0] == 0f) { if (this.velocity.X < 0f) { this.direction = -1; } else if (this.velocity.X > 0f) { this.direction = 1; } this.spriteDirection = this.direction; Vector2 vector2142 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x138 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector2142.X; float y137 = Main.player[this.target].position.Y - vector2142.Y; float single300 = (float)Math.Sqrt((double)(x138 * x138 + y137 * y137)); bool flag98 = Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height); if (this.type < 496 || this.type > 497) { if (single300 > 200f && flag98) { this.ai[1] = this.ai[1] + 4f; } if (single300 > 600f && (flag98 || this.position.Y + (float)this.height > Main.player[this.target].position.Y - 200f)) { this.ai[1] = this.ai[1] + 10f; } if (this.wet) { this.ai[1] = 1000f; } } else { if (single300 > 200f && flag98) { this.ai[1] = this.ai[1] + 2f; } if (single300 > 600f && (flag98 || this.position.Y + (float)this.height > Main.player[this.target].position.Y - 200f)) { this.ai[1] = this.ai[1] + 4f; } } this.defense = this.defDefense; this.damage = this.defDamage; if (this.type < 496 || this.type > 497) { this.knockBackResist = 0.3f * Main.knockBackMultiplier; } else { this.knockBackResist = 0.75f * Main.knockBackMultiplier; } this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= 400f) { this.ai[1] = 0f; this.ai[0] = 1f; } if (!this.justHit && this.velocity.X != this.oldVelocity.X) { NPC nPC137 = this; nPC137.direction = nPC137.direction * -1; } if (this.velocity.Y == 0f && Main.player[this.target].position.Y < this.position.Y + (float)this.height) { if (this.direction <= 0) { x1 = (int)(((double)this.position.X + (double)this.width * 0.5) / 16); x = x1 - 3; } else { x = (int)(((double)this.position.X + (double)this.width * 0.5) / 16); x1 = x + 3; } int y138 = (int)((this.position.Y + (float)this.height + 2f) / 16f) - 1; int num478 = y138 + 4; bool flag99 = false; for (int b3 = x; b3 <= x1; b3++) { for (int c3 = y138; c3 <= num478; c3++) { if (Main.tile[b3, c3] != null && Main.tile[b3, c3].nactive() && Main.tileSolid[Main.tile[b3, c3].type]) { flag99 = true; } } } if (!flag99) { NPC nPC138 = this; nPC138.direction = nPC138.direction * -1; this.velocity.X = 0.1f * (float)this.direction; } } if (this.type < 496 || this.type > 497) { float single301 = 1f; if (single300 < 400f) { if (this.velocity.X < -single301 || this.velocity.X > single301) { if (this.velocity.Y == 0f) { NPC nPC139 = this; nPC139.velocity = nPC139.velocity * 0.8f; return; } } else if (this.velocity.X < single301 && this.direction == 1) { this.velocity.X = this.velocity.X + 0.07f; if (this.velocity.X > single301) { this.velocity.X = single301; return; } } else if (this.velocity.X > -single301 && this.direction == -1) { this.velocity.X = this.velocity.X - 0.07f; if (this.velocity.X < -single301) { this.velocity.X = -single301; return; } } } else if (this.velocity.X < -1.5f || this.velocity.X > 1.5f) { if (this.velocity.Y == 0f) { NPC nPC140 = this; nPC140.velocity = nPC140.velocity * 0.8f; return; } } else if (this.velocity.X < 1.5f && this.direction == 1) { this.velocity.X = this.velocity.X + 0.07f; if (this.velocity.X > 1.5f) { this.velocity.X = 1.5f; return; } } else if (this.velocity.X > -1.5f && this.direction == -1) { this.velocity.X = this.velocity.X - 0.07f; if (this.velocity.X < -1.5f) { this.velocity.X = -1.5f; return; } } } else { float single302 = 0.5f; if (this.velocity.X < -single302 || this.velocity.X > single302) { if (this.velocity.Y == 0f) { NPC nPC141 = this; nPC141.velocity = nPC141.velocity * 0.8f; return; } } else if (this.velocity.X < single302 && this.direction == 1) { this.velocity.X = this.velocity.X + 0.07f; if (this.velocity.X > single302) { this.velocity.X = single302; return; } } else if (this.velocity.X > -single302 && this.direction == -1) { this.velocity.X = this.velocity.X - 0.07f; if (this.velocity.X < -single302) { this.velocity.X = -single302; return; } } } } else if (this.ai[0] != 1f) { if (this.ai[0] == 3f) { if (Main.expertMode) { if (this.type < 496 || this.type > 497) { this.damage = (int)((double)(this.defDamage * 2) * 0.9); } else { this.damage = (int)((double)this.defDamage * 1.5 * 0.9); } } else if (this.type < 496 || this.type > 497) { this.damage = this.defDamage * 2; } else { this.damage = (int)((double)this.defDamage * 1.5); } this.defense = this.defDefense * 2; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] != 1f) { if (this.position.X + (float)this.width > Main.player[this.target].position.X && this.position.X < Main.player[this.target].position.X + (float)Main.player[this.target].width && this.position.Y < Main.player[this.target].position.Y + (float)Main.player[this.target].height) { this.velocity.X = this.velocity.X * 0.8f; this.ai[3] = 0f; if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y + 0.2f; } } if (this.ai[3] != 0f) { this.velocity.X = this.ai[3]; this.velocity.Y = this.velocity.Y - 0.22f; } if (this.ai[1] >= 90f) { this.noGravity = false; this.ai[1] = 0f; this.ai[0] = 4f; } } else { this.netUpdate = true; this.TargetClosest(true); this.ai[2] = this.ai[2] + 0.3f; NPC nPC142 = this; nPC142.rotation = nPC142.rotation + this.ai[2] * (float)this.direction; this.ai[1] = this.ai[1] + 1f; bool flag100 = Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height); float single303 = 10f; if (!flag100) { single303 = 6f; } if (this.type >= 496 && this.type <= 497) { single303 = single303 * 0.75f; } Vector2 vector2144 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x139 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector2144.X; float single304 = Math.Abs(x139) * 0.2f; if (this.directionY > 0) { single304 = 0f; } float y139 = Main.player[this.target].position.Y - vector2144.Y - single304; float single305 = (float)Math.Sqrt((double)(x139 * x139 + y139 * y139)); this.netUpdate = true; single305 = single303 / single305; x139 = x139 * single305; y139 = y139 * single305; if (!flag100) { y139 = -10f; } this.velocity.X = x139; this.velocity.Y = y139; this.ai[3] = this.velocity.X; } if (this.wet && this.directionY < 0) { this.velocity.Y = this.velocity.Y - 0.3f; } NPC nPC143 = this; nPC143.rotation = nPC143.rotation + this.ai[2] * (float)this.direction; return; } if (this.ai[0] != 4f) { if (this.ai[0] == 6f) { this.damage = (int)((float)(this.defDamage * 2) * Main.damageMultiplier); this.defense = this.defDefense * 2; this.knockBackResist = 0f; this.ai[1] = this.ai[1] + 1f; if (this.ai[3] > 0f) { if (this.ai[3] == 1f) { } this.ai[3] = this.ai[3] + 1f; if (this.ai[3] >= 10f) { this.ai[3] = 0f; } } if (this.ai[1] != 1f) { if (this.position.X + (float)this.width > Main.player[this.target].position.X && this.position.X < Main.player[this.target].position.X + (float)Main.player[this.target].width && this.position.Y < Main.player[this.target].position.Y + (float)Main.player[this.target].height) { this.velocity.X = this.velocity.X * 0.9f; if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y + 0.2f; } } if (this.ai[2] == 0f || this.ai[1] >= 1200f) { this.ai[1] = 0f; this.ai[0] = 5f; } } else { this.netUpdate = true; this.TargetClosest(true); bool flag101 = Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height); float single306 = 16f; if (!flag101) { single306 = 10f; } Vector2 vector2147 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x140 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector2147.X; float single307 = Math.Abs(x140) * 0.2f; if (this.directionY > 0) { single307 = 0f; } float y140 = Main.player[this.target].position.Y - vector2147.Y - single307; float single308 = (float)Math.Sqrt((double)(x140 * x140 + y140 * y140)); this.netUpdate = true; single308 = single306 / single308; x140 = x140 * single308; y140 = y140 * single308; if (!flag101) { y140 = -12f; } this.velocity.X = x140; this.velocity.Y = y140; } if (this.wet && this.directionY < 0) { this.velocity.Y = this.velocity.Y - 0.3f; } NPC nPC144 = this; nPC144.rotation = nPC144.rotation + MathHelper.Clamp(this.velocity.X / 10f * (float)this.direction, -0.314159274f, 0.314159274f); return; } if (this.ai[0] == 5f) { this.rotation = 0f; this.velocity.X = 0f; if (this.type < 496 || this.type > 497) { this.ai[1] = this.ai[1] + 1f; } else { this.ai[1] = this.ai[1] + 0.5f; } if (this.ai[1] >= 30f) { this.TargetClosest(true); this.netUpdate = true; this.ai[1] = 0f; this.ai[0] = 0f; } if (this.wet) { this.ai[0] = 3f; this.ai[1] = 0f; return; } } } else { if (this.wet && this.directionY < 0) { this.velocity.Y = this.velocity.Y - 0.3f; } this.velocity.X = this.velocity.X * 0.96f; if (this.ai[2] > 0f) { this.ai[2] = this.ai[2] - 0.01f; NPC nPC145 = this; nPC145.rotation = nPC145.rotation + this.ai[2] * (float)this.direction; } else if (this.velocity.Y >= 0f) { this.rotation = 0f; } if (this.ai[2] <= 0f && (this.velocity.Y == 0f || this.wet)) { this.netUpdate = true; this.rotation = 0f; this.ai[2] = 0f; this.ai[1] = 0f; this.ai[0] = 5f; return; } } } else { this.velocity.X = this.velocity.X * 0.5f; if (this.type < 496 || this.type > 497) { this.ai[1] = this.ai[1] + 1f; } else { this.ai[1] = this.ai[1] + 0.5f; } if (this.ai[1] >= 30f) { this.netUpdate = true; this.TargetClosest(true); this.ai[1] = 0f; this.ai[2] = 0f; this.ai[0] = 3f; if (this.type == 417) { this.ai[0] = 6f; this.ai[2] = (float)Main.rand.Next(2, 5); return; } } } } else if (this.aiStyle == 40) { if (this.target < 0 || this.target == 255 || Main.player[this.target].dead) { this.TargetClosest(true); } float single309 = 2f; float single310 = 0.08f; if (this.type == 531) { single309 = 4f; single310 = 0.16f; } Vector2 x141 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x142 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2); float y141 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2); x142 = (float)((int)(x142 / 8f) * 8); y141 = (float)((int)(y141 / 8f) * 8); x141.X = (float)((int)(x141.X / 8f) * 8); x141.Y = (float)((int)(x141.Y / 8f) * 8); x142 = x142 - x141.X; y141 = y141 - x141.Y; float single311 = (float)Math.Sqrt((double)(x142 * x142 + y141 * y141)); if (single311 != 0f) { single311 = single309 / single311; x142 = x142 * single311; y141 = y141 * single311; } else { x142 = this.velocity.X; y141 = this.velocity.Y; } if (Main.player[this.target].dead) { x142 = (float)this.direction * single309 / 2f; y141 = -single309 / 2f; } this.spriteDirection = -1; if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { if (this.velocity.X < x142) { this.velocity.X = this.velocity.X + single310; if (this.velocity.X < 0f && x142 > 0f) { this.velocity.X = this.velocity.X + single310; } } else if (this.velocity.X > x142) { this.velocity.X = this.velocity.X - single310; if (this.velocity.X > 0f && x142 < 0f) { this.velocity.X = this.velocity.X - single310; } } if (this.velocity.Y < y141) { this.velocity.Y = this.velocity.Y + single310; if (this.velocity.Y < 0f && y141 > 0f) { this.velocity.Y = this.velocity.Y + single310; } } else if (this.velocity.Y > y141) { this.velocity.Y = this.velocity.Y - single310; if (this.velocity.Y > 0f && y141 < 0f) { this.velocity.Y = this.velocity.Y - single310; } } this.rotation = (float)Math.Atan2((double)y141, (double)x142); } else { this.ai[0] = this.ai[0] + 1f; if (this.ai[0] <= 0f) { this.velocity.Y = this.velocity.Y - 0.023f; } else { this.velocity.Y = this.velocity.Y + 0.023f; } if (this.ai[0] < -100f || this.ai[0] > 100f) { this.velocity.X = this.velocity.X + 0.023f; } else { this.velocity.X = this.velocity.X - 0.023f; } if (this.ai[0] > 200f) { this.ai[0] = -200f; } this.velocity.X = this.velocity.X + x142 * 0.007f; this.velocity.Y = this.velocity.Y + y141 * 0.007f; this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X); if ((double)this.velocity.X > 1.5) { this.velocity.X = this.velocity.X * 0.9f; } if ((double)this.velocity.X < -1.5) { this.velocity.X = this.velocity.X * 0.9f; } if ((double)this.velocity.Y > 1.5) { this.velocity.Y = this.velocity.Y * 0.9f; } if ((double)this.velocity.Y < -1.5) { this.velocity.Y = this.velocity.Y * 0.9f; } if (this.velocity.X > 3f) { this.velocity.X = 3f; } if (this.velocity.X < -3f) { this.velocity.X = -3f; } if (this.velocity.Y > 3f) { this.velocity.Y = 3f; } if (this.velocity.Y < -3f) { this.velocity.Y = -3f; } } if (this.type == 531) { NPC nPC146 = this; nPC146.rotation = nPC146.rotation + 1.57079637f; } float single312 = 0.5f; if (this.collideX) { this.netUpdate = true; this.velocity.X = this.oldVelocity.X * -single312; if (this.direction == -1 && this.velocity.X > 0f && this.velocity.X < 2f) { this.velocity.X = 2f; } if (this.direction == 1 && this.velocity.X < 0f && this.velocity.X > -2f) { this.velocity.X = -2f; } } if (this.collideY) { this.netUpdate = true; this.velocity.Y = this.oldVelocity.Y * -single312; if (this.velocity.Y > 0f && (double)this.velocity.Y < 1.5) { this.velocity.Y = 2f; } if (this.velocity.Y < 0f && (double)this.velocity.Y > -1.5) { this.velocity.Y = -2f; } } if ((this.velocity.X > 0f && this.oldVelocity.X < 0f || this.velocity.X < 0f && this.oldVelocity.X > 0f || this.velocity.Y > 0f && this.oldVelocity.Y < 0f || this.velocity.Y < 0f && this.oldVelocity.Y > 0f) && !this.justHit) { this.netUpdate = true; } if (Main.netMode != 1) { if (Main.netMode != 1 && Main.expertMode && this.target >= 0 && (this.type == 163 || this.type == 238) && Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.localAI[0] = this.localAI[0] + 1f; if (this.justHit) { this.localAI[0] = this.localAI[0] - (float)Main.rand.Next(20, 60); if (this.localAI[0] < 0f) { this.localAI[0] = 0f; } } if (this.localAI[0] > (float)Main.rand.Next(180, 900)) { this.localAI[0] = 0f; Vector2 center31 = Main.player[this.target].Center - base.Center; center31.Normalize(); center31 = center31 * 8f; Projectile.NewProjectile(base.Center.X, base.Center.Y, center31.X, center31.Y, 472, 18, 0f, Main.myPlayer, 0f, 0f); } } int x143 = (int)base.Center.X / 16; int y142 = (int)base.Center.Y / 16; bool flag102 = false; for (int g3 = x143 - 1; g3 <= x143 + 1; g3++) { for (int h3 = y142 - 1; h3 <= y142 + 1; h3++) { if (Main.tile[g3, h3] == null) { return; } if (Main.tile[g3, h3].wall > 0) { flag102 = true; } } } if (!flag102) { if (this.type == 237) { this.Transform(236); return; } if (this.type == 238) { this.Transform(163); return; } if (this.type == 240) { this.Transform(239); return; } if (this.type == 531) { this.Transform(530); return; } this.Transform(164); return; } } } else if (this.aiStyle == 41) { if (this.ai[2] > 1f) { this.ai[2] = this.ai[2] - 1f; } if (this.ai[2] == 0f) { this.ai[0] = -100f; this.ai[2] = 1f; this.TargetClosest(true); this.spriteDirection = this.direction; } if (this.type == 378) { Vector2 vector2148 = new Vector2(-6f, -10f); if (this.ai[1] == 5f) { this.velocity = Vector2.Zero; this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 160; this.height = 160; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.dontTakeDamage = true; if (this.ai[2] == 1f) { this.life = -1; this.HitEffect(0, 10); this.active = false; } return; } } if (this.type == 378 && this.ai[1] != 5f) { if (this.wet || Vector2.Distance(base.Center, Main.player[this.target].Center) < 64f) { this.ai[1] = 5f; this.ai[2] = 3f; this.netUpdate = true; return; } } else if (this.wet && this.type != 177) { if (this.collideX) { NPC nPC147 = this; nPC147.direction = nPC147.direction * -this.direction; this.spriteDirection = this.direction; } if (this.collideY) { this.TargetClosest(true); if (this.oldVelocity.Y >= 0f) { this.velocity.Y = this.velocity.Y - 2f; } else { this.velocity.Y = 5f; } this.spriteDirection = this.direction; } if (this.velocity.Y > 4f) { this.velocity.Y = this.velocity.Y * 0.95f; } this.velocity.Y = this.velocity.Y - 0.3f; if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } } if (this.velocity.Y == 0f) { if (this.ai[3] == this.position.X) { NPC nPC148 = this; nPC148.direction = nPC148.direction * -1; this.ai[2] = 300f; } this.ai[3] = 0f; this.velocity.X = this.velocity.X * 0.8f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } if (this.type != 177) { this.ai[0] = this.ai[0] + 5f; } else { this.ai[0] = this.ai[0] + 2f; } Vector2 vector2154 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x144 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector2154.X; float y143 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector2154.Y; float single313 = (float)Math.Sqrt((double)(x144 * x144 + y143 * y143)); float single314 = 400f / single313; single314 = (this.type != 177 ? single314 * 10f : single314 * 5f); if (single314 > 30f) { single314 = 30f; } this.ai[0] = this.ai[0] + (float)((int)single314); if (this.ai[0] >= 0f) { this.netUpdate = true; if (this.ai[2] == 1f) { this.TargetClosest(true); } if (this.type == 177) { if (this.ai[1] != 2f) { this.velocity.Y = -7.5f; this.velocity.X = this.velocity.X + (float)(4 * this.direction); if (single313 < 350f && single313 > 200f) { this.velocity.X = this.velocity.X + (float)this.direction; } this.ai[0] = -120f; this.ai[1] = this.ai[1] + 1f; } else { this.velocity.Y = -11.5f; this.velocity.X = this.velocity.X + 2f * (float)this.direction; if (single313 < 350f && single313 > 200f) { this.velocity.X = this.velocity.X + (float)this.direction; } this.ai[0] = -200f; this.ai[1] = 0f; this.ai[3] = this.position.X; } } else if (this.ai[1] != 3f) { this.velocity.Y = -5f; this.velocity.X = this.velocity.X + (float)(5 * this.direction); if (single313 < 350f && single313 > 200f) { this.velocity.X = this.velocity.X + (float)this.direction; } this.ai[0] = -120f; this.ai[1] = this.ai[1] + 1f; } else { this.velocity.Y = -9f; this.velocity.X = this.velocity.X + (float)(3 * this.direction); if (single313 < 350f && single313 > 200f) { this.velocity.X = this.velocity.X + (float)this.direction; } this.ai[0] = -200f; this.ai[1] = 0f; this.ai[3] = this.position.X; } } else if (this.ai[0] >= -30f) { this.aiAction = 1; } this.spriteDirection = this.direction; return; } if (this.target < 255) { if (this.type == 177) { bool flag103 = false; if (this.position.Y + (float)this.height < Main.player[this.target].position.Y && this.position.X + (float)this.width > Main.player[this.target].position.X && this.position.X < Main.player[this.target].position.X + (float)Main.player[this.target].width) { flag103 = true; this.velocity.X = this.velocity.X * 0.92f; if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.9f; this.velocity.Y = this.velocity.Y + 0.1f; } } if (!flag103 && (this.direction == 1 && this.velocity.X < 4f || this.direction == -1 && this.velocity.X > -4f)) { if ((this.direction != -1 || (double)this.velocity.X >= 0.1) && (this.direction != 1 || (double)this.velocity.X <= -0.1)) { this.velocity.X = this.velocity.X * 0.93f; return; } this.velocity.X = this.velocity.X + 0.2f * (float)this.direction; return; } } else if (this.direction == 1 && this.velocity.X < 3f || this.direction == -1 && this.velocity.X > -3f) { if ((this.direction != -1 || (double)this.velocity.X >= 0.1) && (this.direction != 1 || (double)this.velocity.X <= -0.1)) { this.velocity.X = this.velocity.X * 0.93f; return; } this.velocity.X = this.velocity.X + 0.2f * (float)this.direction; return; } } } else if (this.aiStyle == 42) { this.TargetClosest(true); if (this.ai[0] != 0f) { this.ai[0] = this.ai[0] + 1f; if (this.ai[0] >= 21f) { this.ai[0] = 21f; this.Transform(196); return; } } else { if (this.target >= 0) { Vector2 vector2155 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x145 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector2155.X; float y144 = Main.player[this.target].position.Y - vector2155.Y; if ((float)Math.Sqrt((double)(x145 * x145 + y144 * y144)) < 200f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.ai[0] = 1f; } } if (this.velocity.X != 0f || this.velocity.Y < 0f || this.velocity.Y > 2f || this.life != this.lifeMax) { this.ai[0] = 1f; return; } } } else if (this.aiStyle == 43) { int num498 = 0; for (int l4 = 0; l4 < 255; l4++) { if (Main.player[l4].active && !Main.player[l4].dead && (base.Center - Main.player[l4].Center).Length() < 1000f) { num498++; } } if (Main.expertMode) { int num499 = (int)(20f * (1f - (float)this.life / (float)this.lifeMax)); this.defense = this.defDefense + num499; } if (this.target < 0 || this.target == 255 || Main.player[this.target].dead || !Main.player[this.target].active) { this.TargetClosest(true); } if (Main.player[this.target].dead && Main.expertMode) { if ((double)this.position.Y < Main.worldSurface * 16 + 2000) { this.velocity.Y = this.velocity.Y + 0.04f; } if (this.position.X >= (float)(Main.maxTilesX * 8)) { this.velocity.X = this.velocity.X + 0.04f; } else { this.velocity.X = this.velocity.X - 0.04f; } if (this.timeLeft > 10) { this.timeLeft = 10; return; } } else if (this.ai[0] == -1f) { if (Main.netMode != 1) { float single315 = this.ai[1]; do { num3 = Main.rand.Next(3); if (num3 != 1) { if (num3 != 2) { continue; } num3 = 3; } else { num3 = 2; } } while ((float)num3 == single315); this.ai[0] = (float)num3; this.ai[1] = 0f; this.ai[2] = 0f; return; } } else if (this.ai[0] == 0f) { int num500 = 2; if (Main.expertMode) { if (this.life < this.lifeMax / 2) { num500++; } if (this.life < this.lifeMax / 3) { num500++; } if (this.life < this.lifeMax / 5) { num500++; } } if (this.ai[1] > (float)(2 * num500) && this.ai[1] % 2f == 0f) { this.ai[0] = -1f; this.ai[1] = 0f; this.ai[2] = 0f; this.netUpdate = true; return; } if (this.ai[1] % 2f == 0f) { this.TargetClosest(true); if (Math.Abs(this.position.Y + (float)(this.height / 2) - (Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2))) < 20f) { this.localAI[0] = 1f; this.ai[1] = this.ai[1] + 1f; this.ai[2] = 0f; float single316 = 12f; if (Main.expertMode) { single316 = 16f; if ((double)this.life < (double)this.lifeMax * 0.75) { single316 = single316 + 2f; } if ((double)this.life < (double)this.lifeMax * 0.5) { single316 = single316 + 2f; } if ((double)this.life < (double)this.lifeMax * 0.25) { single316 = single316 + 2f; } if ((double)this.life < (double)this.lifeMax * 0.1) { single316 = single316 + 2f; } } Vector2 vector2156 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x146 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector2156.X; float y145 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector2156.Y; float single317 = (float)Math.Sqrt((double)(x146 * x146 + y145 * y145)); single317 = single316 / single317; this.velocity.X = x146 * single317; this.velocity.Y = y145 * single317; this.spriteDirection = this.direction; return; } this.localAI[0] = 0f; float single318 = 12f; float single319 = 0.15f; if (Main.expertMode) { if ((double)this.life < (double)this.lifeMax * 0.75) { single318 = single318 + 1f; single319 = single319 + 0.05f; } if ((double)this.life < (double)this.lifeMax * 0.5) { single318 = single318 + 1f; single319 = single319 + 0.05f; } if ((double)this.life < (double)this.lifeMax * 0.25) { single318 = single318 + 2f; single319 = single319 + 0.05f; } if ((double)this.life < (double)this.lifeMax * 0.1) { single318 = single318 + 2f; single319 = single319 + 0.1f; } } if (this.position.Y + (float)(this.height / 2) >= Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2)) { this.velocity.Y = this.velocity.Y - single319; } else { this.velocity.Y = this.velocity.Y + single319; } if (this.velocity.Y < -12f) { this.velocity.Y = -single318; } if (this.velocity.Y > 12f) { this.velocity.Y = single318; } if (Math.Abs(this.position.X + (float)(this.width / 2) - (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2))) > 600f) { this.velocity.X = this.velocity.X + 0.15f * (float)this.direction; } else if (Math.Abs(this.position.X + (float)(this.width / 2) - (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2))) >= 300f) { this.velocity.X = this.velocity.X * 0.8f; } else { this.velocity.X = this.velocity.X - 0.15f * (float)this.direction; } if (this.velocity.X < -16f) { this.velocity.X = -16f; } if (this.velocity.X > 16f) { this.velocity.X = 16f; } this.spriteDirection = this.direction; return; } if (this.velocity.X >= 0f) { this.direction = 1; } else { this.direction = -1; } this.spriteDirection = this.direction; int num501 = 600; if (Main.expertMode) { if ((double)this.life < (double)this.lifeMax * 0.1) { num501 = 300; } else if ((double)this.life < (double)this.lifeMax * 0.25) { num501 = 450; } else if ((double)this.life < (double)this.lifeMax * 0.5) { num501 = 500; } else if ((double)this.life < (double)this.lifeMax * 0.75) { num501 = 550; } } int num502 = 1; if (this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2)) { num502 = -1; } if (this.direction == num502 && Math.Abs(this.position.X + (float)(this.width / 2) - (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2))) > (float)num501) { this.ai[2] = 1f; } if (this.ai[2] != 1f) { this.localAI[0] = 1f; return; } this.TargetClosest(true); this.spriteDirection = this.direction; this.localAI[0] = 0f; NPC nPC149 = this; nPC149.velocity = nPC149.velocity * 0.9f; float single320 = 0.1f; if (Main.expertMode) { if (this.life < this.lifeMax / 2) { NPC nPC150 = this; nPC150.velocity = nPC150.velocity * 0.9f; single320 = single320 + 0.05f; } if (this.life < this.lifeMax / 3) { NPC nPC151 = this; nPC151.velocity = nPC151.velocity * 0.9f; single320 = single320 + 0.05f; } if (this.life < this.lifeMax / 5) { NPC nPC152 = this; nPC152.velocity = nPC152.velocity * 0.9f; single320 = single320 + 0.05f; } } if (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) < single320) { this.ai[2] = 0f; this.ai[1] = this.ai[1] + 1f; return; } } else if (this.ai[0] == 2f) { this.TargetClosest(true); this.spriteDirection = this.direction; float single321 = 12f; float single322 = 0.07f; if (Main.expertMode) { single322 = 0.1f; } Vector2 vector2157 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x147 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector2157.X; float y146 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - 200f - vector2157.Y; float single323 = (float)Math.Sqrt((double)(x147 * x147 + y146 * y146)); if (single323 < 200f) { this.ai[0] = 1f; this.ai[1] = 0f; this.netUpdate = true; return; } single323 = single321 / single323; if (this.velocity.X < x147) { this.velocity.X = this.velocity.X + single322; if (this.velocity.X < 0f && x147 > 0f) { this.velocity.X = this.velocity.X + single322; } } else if (this.velocity.X > x147) { this.velocity.X = this.velocity.X - single322; if (this.velocity.X > 0f && x147 < 0f) { this.velocity.X = this.velocity.X - single322; } } if (this.velocity.Y < y146) { this.velocity.Y = this.velocity.Y + single322; if (this.velocity.Y < 0f && y146 > 0f) { this.velocity.Y = this.velocity.Y + single322; return; } } else if (this.velocity.Y > y146) { this.velocity.Y = this.velocity.Y - single322; if (this.velocity.Y > 0f && y146 < 0f) { this.velocity.Y = this.velocity.Y - single322; return; } } } else if (this.ai[0] == 1f) { this.localAI[0] = 0f; this.TargetClosest(true); Vector2 vector2158 = new Vector2(this.position.X + (float)(this.width / 2) + (float)(Main.rand.Next(20) * this.direction), this.position.Y + (float)this.height * 0.8f); Vector2 vector2159 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x148 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector2159.X; float y147 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector2159.Y; float single324 = (float)Math.Sqrt((double)(x148 * x148 + y147 * y147)); this.ai[1] = this.ai[1] + 1f; if (Main.expertMode) { this.ai[1] = this.ai[1] + (float)(num498 / 2); if ((double)this.life < (double)this.lifeMax * 0.75) { this.ai[1] = this.ai[1] + 0.25f; } if ((double)this.life < (double)this.lifeMax * 0.5) { this.ai[1] = this.ai[1] + 0.25f; } if ((double)this.life < (double)this.lifeMax * 0.25) { this.ai[1] = this.ai[1] + 0.25f; } if ((double)this.life < (double)this.lifeMax * 0.1) { this.ai[1] = this.ai[1] + 0.25f; } } bool flag104 = false; if (this.ai[1] > 40f) { this.ai[1] = 0f; this.ai[2] = this.ai[2] + 1f; flag104 = true; } if (Collision.CanHit(vector2158, 1, 1, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height) && flag104) { if (Main.netMode != 1) { int num503 = Main.rand.Next(210, 212); int num504 = NPC.NewNPC((int)vector2158.X, (int)vector2158.Y, num503, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num504].velocity.X = (float)Main.rand.Next(-200, 201) * 0.002f; Main.npc[num504].velocity.Y = (float)Main.rand.Next(-200, 201) * 0.002f; Main.npc[num504].localAI[0] = 60f; Main.npc[num504].netUpdate = true; } } if (single324 > 400f || !Collision.CanHit(new Vector2(vector2158.X, vector2158.Y - 30f), 1, 1, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { float single325 = 14f; float single326 = 0.1f; vector2159 = vector2158; x148 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector2159.X; y147 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector2159.Y; single324 = (float)Math.Sqrt((double)(x148 * x148 + y147 * y147)); single324 = single325 / single324; if (this.velocity.X < x148) { this.velocity.X = this.velocity.X + single326; if (this.velocity.X < 0f && x148 > 0f) { this.velocity.X = this.velocity.X + single326; } } else if (this.velocity.X > x148) { this.velocity.X = this.velocity.X - single326; if (this.velocity.X > 0f && x148 < 0f) { this.velocity.X = this.velocity.X - single326; } } if (this.velocity.Y < y147) { this.velocity.Y = this.velocity.Y + single326; if (this.velocity.Y < 0f && y147 > 0f) { this.velocity.Y = this.velocity.Y + single326; } } else if (this.velocity.Y > y147) { this.velocity.Y = this.velocity.Y - single326; if (this.velocity.Y > 0f && y147 < 0f) { this.velocity.Y = this.velocity.Y - single326; } } } else { NPC nPC153 = this; nPC153.velocity = nPC153.velocity * 0.9f; } this.spriteDirection = this.direction; if (this.ai[2] > 5f) { this.ai[0] = -1f; this.ai[1] = 1f; this.netUpdate = true; return; } } else if (this.ai[0] == 3f) { float single327 = 4f; float single328 = 0.05f; if (Main.expertMode) { single328 = 0.075f; single327 = 6f; } Vector2 vector2160 = new Vector2(this.position.X + (float)(this.width / 2) + (float)(Main.rand.Next(20) * this.direction), this.position.Y + (float)this.height * 0.8f); Vector2 vector2161 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x149 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector2161.X; float y148 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - 300f - vector2161.Y; float single329 = (float)Math.Sqrt((double)(x149 * x149 + y148 * y148)); this.ai[1] = this.ai[1] + 1f; bool flag105 = false; if (!Main.expertMode) { if (this.ai[1] % 40f == 39f) { flag105 = true; } } else if ((double)this.life < (double)this.lifeMax * 0.1) { if (this.ai[1] % 15f == 14f) { flag105 = true; } } else if (this.life < this.lifeMax / 3) { if (this.ai[1] % 25f == 24f) { flag105 = true; } } else if (this.life < this.lifeMax / 2) { if (this.ai[1] % 30f == 29f) { flag105 = true; } } else if (this.ai[1] % 35f == 34f) { flag105 = true; } if (flag105 && this.position.Y + (float)this.height < Main.player[this.target].position.Y && Collision.CanHit(vector2160, 1, 1, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { if (Main.netMode != 1) { float single330 = 8f; if (Main.expertMode) { single330 = single330 + 2f; } if (Main.expertMode && (double)this.life < (double)this.lifeMax * 0.1) { single330 = single330 + 3f; } float x150 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector2160.X + (float)Main.rand.Next(-80, 81); float y149 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector2160.Y + (float)Main.rand.Next(-40, 41); float single331 = (float)Math.Sqrt((double)(x150 * x150 + y149 * y149)); single331 = single330 / single331; x150 = x150 * single331; y149 = y149 * single331; int num505 = 11; int num506 = 55; int num507 = Projectile.NewProjectile(vector2160.X, vector2160.Y, x150, y149, num506, num505, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num507].timeLeft = 300; } } if (!Collision.CanHit(new Vector2(vector2160.X, vector2160.Y - 30f), 1, 1, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { single327 = 14f; single328 = 0.1f; vector2161 = vector2160; x149 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector2161.X; y148 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector2161.Y; single329 = (float)Math.Sqrt((double)(x149 * x149 + y148 * y148)); single329 = single327 / single329; if (this.velocity.X < x149) { this.velocity.X = this.velocity.X + single328; if (this.velocity.X < 0f && x149 > 0f) { this.velocity.X = this.velocity.X + single328; } } else if (this.velocity.X > x149) { this.velocity.X = this.velocity.X - single328; if (this.velocity.X > 0f && x149 < 0f) { this.velocity.X = this.velocity.X - single328; } } if (this.velocity.Y < y148) { this.velocity.Y = this.velocity.Y + single328; if (this.velocity.Y < 0f && y148 > 0f) { this.velocity.Y = this.velocity.Y + single328; } } else if (this.velocity.Y > y148) { this.velocity.Y = this.velocity.Y - single328; if (this.velocity.Y > 0f && y148 < 0f) { this.velocity.Y = this.velocity.Y - single328; } } } else if (single329 > 100f) { this.TargetClosest(true); this.spriteDirection = this.direction; single329 = single327 / single329; if (this.velocity.X < x149) { this.velocity.X = this.velocity.X + single328; if (this.velocity.X < 0f && x149 > 0f) { this.velocity.X = this.velocity.X + single328 * 2f; } } else if (this.velocity.X > x149) { this.velocity.X = this.velocity.X - single328; if (this.velocity.X > 0f && x149 < 0f) { this.velocity.X = this.velocity.X - single328 * 2f; } } if (this.velocity.Y < y148) { this.velocity.Y = this.velocity.Y + single328; if (this.velocity.Y < 0f && y148 > 0f) { this.velocity.Y = this.velocity.Y + single328 * 2f; } } else if (this.velocity.Y > y148) { this.velocity.Y = this.velocity.Y - single328; if (this.velocity.Y > 0f && y148 < 0f) { this.velocity.Y = this.velocity.Y - single328 * 2f; } } } if (this.ai[1] > 800f) { this.ai[0] = -1f; this.ai[1] = 3f; this.netUpdate = true; return; } } } else if (this.aiStyle == 44) { this.noGravity = true; if (this.collideX) { if (this.oldVelocity.X <= 0f) { this.direction = 1; } else { this.direction = -1; } this.velocity.X = (float)this.direction; } if (this.collideY) { if (this.oldVelocity.Y <= 0f) { this.directionY = 1; } else { this.directionY = -1; } this.velocity.Y = (float)this.directionY; } int num508 = this.target; int num509 = this.direction; if (this.target == 255 || Main.player[this.target].dead || Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[0] = 90f; this.TargetClosest(true); } else if (this.ai[0] > 0f) { this.ai[0] = this.ai[0] - 1f; this.TargetClosest(true); } if (this.netUpdate && num508 == this.target && num509 == this.direction) { this.netUpdate = false; } float single332 = 0.05f; float single333 = 0.01f; float single334 = 3f; float single335 = 1f; float single336 = 30f; float single337 = 100f; float single338 = Math.Abs(this.position.X + (float)(this.width / 2) - (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2))); float y150 = Main.player[this.target].position.Y - (float)(this.height / 2); if (this.type == 509) { single332 = 0.09f; single333 = 0.03f; single334 = 5f; single335 = 2f; single336 = 40f; single337 = 150f; y150 = Main.player[this.target].Center.Y - (float)(this.height / 2); this.rotation = this.velocity.X * 0.1f; for (int m4 = 0; m4 < 200; m4++) { if (m4 != this.whoAmI && Main.npc[m4].active && Main.npc[m4].type == this.type && Math.Abs(this.position.X - Main.npc[m4].position.X) + Math.Abs(this.position.Y - Main.npc[m4].position.Y) < (float)this.width) { if (this.position.X >= Main.npc[m4].position.X) { this.velocity.X = this.velocity.X + 0.05f; } else { this.velocity.X = this.velocity.X - 0.05f; } if (this.position.Y >= Main.npc[m4].position.Y) { this.velocity.Y = this.velocity.Y + 0.05f; } else { this.velocity.Y = this.velocity.Y - 0.05f; } } } } if (this.ai[0] <= 0f) { single334 = single334 * 0.8f; single332 = single332 * 0.7f; y150 = base.Center.Y + (float)(this.directionY * 1000); if (this.velocity.X < 0f) { this.direction = -1; } else if (this.velocity.X > 0f || this.direction == 0) { this.direction = 1; } } if (single338 > single336) { if (this.direction == -1 && this.velocity.X > -single334) { this.velocity.X = this.velocity.X - single332; if (this.velocity.X > single334) { this.velocity.X = this.velocity.X - single332; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X - single332 / 2f; } if (this.velocity.X < -single334) { this.velocity.X = -single334; } } else if (this.direction == 1 && this.velocity.X < single334) { this.velocity.X = this.velocity.X + single332; if (this.velocity.X < -single334) { this.velocity.X = this.velocity.X + single332; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X + single332 / 2f; } if (this.velocity.X > single334) { this.velocity.X = single334; } } } if (single338 > single337) { y150 = y150 - single337 / 2f; } if (this.position.Y >= y150) { this.velocity.Y = this.velocity.Y - single333; if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y - single333; } } else { this.velocity.Y = this.velocity.Y + single333; if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y + single333; } } if (this.velocity.Y < -single335) { this.velocity.Y = -single335; } if (this.velocity.Y > single335) { this.velocity.Y = single335; return; } } else if (this.aiStyle != 45) { if (this.aiStyle == 46) { this.noTileCollide = true; if (NPC.golemBoss < 0) { this.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); return; } float single339 = 12f; Vector2 vector2162 = new Vector2(base.Center.X, base.Center.Y); float x151 = Main.npc[NPC.golemBoss].Center.X - vector2162.X; float y151 = Main.npc[NPC.golemBoss].Center.Y - vector2162.Y; y151 = y151 - 57f; x151 = x151 - 3f; float single340 = (float)Math.Sqrt((double)(x151 * x151 + y151 * y151)); if (single340 >= 20f) { single340 = single339 / single340; this.velocity.X = x151 * single340; this.velocity.Y = y151 * single340; this.rotation = (float)this.velocity.X * 0.1f; } else { this.rotation = 0f; this.velocity.X = x151; this.velocity.Y = y151; } if (this.alpha > 0) { NPC nPC154 = this; nPC154.alpha = nPC154.alpha - 10; if (this.alpha < 0) { this.alpha = 0; } this.ai[1] = 30f; } if (this.ai[0] == 0f) { this.ai[1] = this.ai[1] + 1f; int num510 = 300; if (this.ai[1] < 20f || this.ai[1] > (float)(num510 - 20)) { this.localAI[0] = 1f; } else { this.localAI[0] = 0f; } if (this.ai[1] >= (float)num510) { this.TargetClosest(true); this.ai[1] = 0f; Vector2 vector2163 = new Vector2(base.Center.X, base.Center.Y + 10f); float single341 = 8f; float x152 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector2163.X; float y152 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector2163.Y; float single342 = (float)Math.Sqrt((double)(x152 * x152 + y152 * y152)); single342 = single341 / single342; x152 = x152 * single342; y152 = y152 * single342; int num511 = 18; int num512 = 258; if (Main.netMode != 1) { Projectile.NewProjectile(vector2163.X, vector2163.Y, x152, y152, num512, num511, 0f, Main.myPlayer, 0f, 0f); } } } else if (this.ai[0] == 1f) { this.TargetClosest(true); Vector2 x153 = new Vector2(base.Center.X, base.Center.Y + 10f); if (Main.player[this.target].Center.X < base.Center.X - (float)this.width) { this.localAI[1] = -1f; x153.X = x153.X - 40f; } else if (Main.player[this.target].Center.X <= base.Center.X + (float)this.width) { this.localAI[1] = 0f; } else { this.localAI[1] = 1f; x153.X = x153.X + 40f; } this.ai[1] = this.ai[1] + 1f; if ((double)this.life < (double)this.lifeMax * 0.4) { this.ai[1] = this.ai[1] + 1f; } if ((double)this.life < (double)this.lifeMax * 0.2) { this.ai[1] = this.ai[1] + 1f; } int num513 = 300; if (this.ai[1] < 20f || this.ai[1] > (float)(num513 - 20)) { this.localAI[0] = 1f; } else { this.localAI[0] = 0f; } if (this.ai[1] >= (float)num513) { this.TargetClosest(true); this.ai[1] = 0f; float single343 = 8f; float x154 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - x153.X; float y153 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - x153.Y; float single344 = (float)Math.Sqrt((double)(x154 * x154 + y153 * y153)); single344 = single343 / single344; x154 = x154 * single344; y153 = y153 * single344; int num514 = 24; int num515 = 258; if (Main.netMode != 1) { Projectile.NewProjectile(x153.X, x153.Y, x154, y153, num515, num514, 0f, Main.myPlayer, 0f, 0f); } } this.ai[2] = this.ai[2] + 1f; if (this.life < this.lifeMax / 3) { this.ai[2] = this.ai[2] + 1f; } if (this.life < this.lifeMax / 4) { this.ai[2] = this.ai[2] + 1f; } if (this.life < this.lifeMax / 5) { this.ai[2] = this.ai[2] + 1f; } if (!Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[2] = this.ai[2] + 4f; } if (this.ai[2] > (float)(60 + Main.rand.Next(600))) { this.ai[2] = 0f; int num516 = 28; int num517 = 259; if (this.localAI[1] == 0f) { for (int n4 = 0; n4 < 2; n4++) { x153 = new Vector2(base.Center.X, base.Center.Y - 22f); if (n4 != 0) { x153.X = x153.X + 18f; } else { x153.X = x153.X - 18f; } float single345 = 11f; float x155 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - x153.X; float y154 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - x153.Y; float single346 = (float)Math.Sqrt((double)(x155 * x155 + y154 * y154)); single346 = single345 / single346; x155 = x155 * single346; y154 = y154 * single346; x153.X = x153.X + x155 * 3f; x153.Y = x153.Y + y154 * 3f; if (Main.netMode != 1) { int num518 = Projectile.NewProjectile(x153.X, x153.Y, x155, y154, num517, num516, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num518].timeLeft = 300; } } } else if (this.localAI[1] != 0f) { x153 = new Vector2(base.Center.X, base.Center.Y - 22f); if (this.localAI[1] == -1f) { x153.X = x153.X - 30f; } else if (this.localAI[1] == 1f) { x153.X = x153.X + 30f; } float single347 = 12f; float x156 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - x153.X; float y155 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - x153.Y; float single348 = (float)Math.Sqrt((double)(x156 * x156 + y155 * y155)); single348 = single347 / single348; x156 = x156 * single348; y155 = y155 * single348; x153.X = x153.X + x156 * 3f; x153.Y = x153.Y + y155 * 3f; if (Main.netMode != 1) { int num519 = Projectile.NewProjectile(x153.X, x153.Y, x156, y155, num517, num516, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num519].timeLeft = 300; } } } } if (this.life < this.lifeMax / 2) { this.ai[0] = 1f; return; } this.ai[0] = 0f; return; } if (this.aiStyle == 47) { if (NPC.golemBoss < 0) { this.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); return; } if (this.alpha > 0) { NPC nPC155 = this; nPC155.alpha = nPC155.alpha - 10; if (this.alpha < 0) { this.alpha = 0; } this.ai[1] = 0f; } if (this.ai[0] == 0f) { this.noTileCollide = true; float single349 = 14f; if (this.life < this.lifeMax / 2) { single349 = single349 + 3f; } if (this.life < this.lifeMax / 4) { single349 = single349 + 3f; } if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax) { single349 = single349 + 8f; } Vector2 vector2164 = new Vector2(base.Center.X, base.Center.Y); float x157 = Main.npc[NPC.golemBoss].Center.X - vector2164.X; float y156 = Main.npc[NPC.golemBoss].Center.Y - vector2164.Y; y156 = y156 - 9f; x157 = (this.type != 247 ? x157 + 78f : x157 - 84f); float single350 = (float)Math.Sqrt((double)(x157 * x157 + y156 * y156)); if (single350 >= 12f + single349) { single350 = single349 / single350; this.velocity.X = x157 * single350; this.velocity.Y = y156 * single350; this.rotation = (float)Math.Atan2((double)(-this.velocity.Y), (double)(-this.velocity.X)); if (this.type == 247) { this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X); return; } } else { this.rotation = 0f; this.velocity.X = x157; this.velocity.Y = y156; this.ai[1] = this.ai[1] + 1f; if (this.life < this.lifeMax / 2) { this.ai[1] = this.ai[1] + 1f; } if (this.life < this.lifeMax / 4) { this.ai[1] = this.ai[1] + 1f; } if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax) { this.ai[1] = this.ai[1] + 10f; } if (this.ai[1] >= 60f) { this.TargetClosest(true); if ((this.type != 247 || base.Center.X + 100f <= Main.player[this.target].Center.X) && (this.type != 248 || base.Center.X - 100f >= Main.player[this.target].Center.X)) { this.ai[1] = 0f; return; } this.ai[1] = 0f; this.ai[0] = 1f; return; } } } else if (this.ai[0] == 1f) { this.noTileCollide = true; this.collideX = false; this.collideY = false; float single351 = 12f; if (this.life < this.lifeMax / 2) { single351 = single351 + 4f; } if (this.life < this.lifeMax / 4) { single351 = single351 + 4f; } if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax) { single351 = single351 + 10f; } Vector2 vector2165 = new Vector2(base.Center.X, base.Center.Y); float x158 = Main.player[this.target].Center.X - vector2165.X; float y157 = Main.player[this.target].Center.Y - vector2165.Y; float single352 = (float)Math.Sqrt((double)(x158 * x158 + y157 * y157)); single352 = single351 / single352; this.velocity.X = x158 * single352; this.velocity.Y = y157 * single352; this.ai[0] = 2f; this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X); if (this.type == 247) { this.rotation = (float)Math.Atan2((double)(-this.velocity.Y), (double)(-this.velocity.X)); return; } } else if (this.ai[0] == 2f) { if (Math.Abs(this.velocity.X) <= Math.Abs(this.velocity.Y)) { if (this.velocity.Y > 0f && base.Center.Y > Main.player[this.target].Center.Y) { this.noTileCollide = false; } if (this.velocity.Y < 0f && base.Center.Y < Main.player[this.target].Center.Y) { this.noTileCollide = false; } } else { if (this.velocity.X > 0f && base.Center.X > Main.player[this.target].Center.X) { this.noTileCollide = false; } if (this.velocity.X < 0f && base.Center.X < Main.player[this.target].Center.X) { this.noTileCollide = false; } } Vector2 vector2166 = new Vector2(base.Center.X, base.Center.Y); float x159 = Main.npc[NPC.golemBoss].Center.X - vector2166.X; float y158 = Main.npc[NPC.golemBoss].Center.Y - vector2166.Y; x159 = x159 + Main.npc[NPC.golemBoss].velocity.X; y158 = y158 + Main.npc[NPC.golemBoss].velocity.Y; y158 = y158 - 9f; x159 = (this.type != 247 ? x159 + 78f : x159 - 84f); float single353 = (float)Math.Sqrt((double)(x159 * x159 + y158 * y158)); if (Main.npc[NPC.golemBoss].life >= Main.npc[NPC.golemBoss].lifeMax) { bool flag106 = this.justHit; if (flag106) { int num520 = 0; while (num520 < 200) { if (!Main.npc[num520].active || Main.npc[num520].type != 246) { num520++; } else { if (Main.npc[num520].life >= Main.npc[num520].lifeMax / 2) { break; } if (this.knockBackResist == 0f) { flag106 = false; } this.knockBackResist = 0f; break; } } } if (single353 > 600f || this.collideX || this.collideY || flag106) { this.noTileCollide = true; this.ai[0] = 0f; return; } } else { this.knockBackResist = 0f; if (single353 > 700f || this.collideX || this.collideY) { this.noTileCollide = true; this.ai[0] = 0f; return; } } } else if (this.ai[0] == 3f) { this.noTileCollide = true; float single354 = 12f; float single355 = 0.4f; Vector2 vector2167 = new Vector2(base.Center.X, base.Center.Y); float x160 = Main.player[this.target].Center.X - vector2167.X; float y159 = Main.player[this.target].Center.Y - vector2167.Y; float single356 = (float)Math.Sqrt((double)(x160 * x160 + y159 * y159)); single356 = single354 / single356; x160 = x160 * single356; y159 = y159 * single356; if (this.velocity.X < x160) { this.velocity.X = this.velocity.X + single355; if (this.velocity.X < 0f && x160 > 0f) { this.velocity.X = this.velocity.X + single355 * 2f; } } else if (this.velocity.X > x160) { this.velocity.X = this.velocity.X - single355; if (this.velocity.X > 0f && x160 < 0f) { this.velocity.X = this.velocity.X - single355 * 2f; } } if (this.velocity.Y < y159) { this.velocity.Y = this.velocity.Y + single355; if (this.velocity.Y < 0f && y159 > 0f) { this.velocity.Y = this.velocity.Y + single355 * 2f; } } else if (this.velocity.Y > y159) { this.velocity.Y = this.velocity.Y - single355; if (this.velocity.Y > 0f && y159 < 0f) { this.velocity.Y = this.velocity.Y - single355 * 2f; } } this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X); if (this.type == 247) { this.rotation = (float)Math.Atan2((double)(-this.velocity.Y), (double)(-this.velocity.X)); return; } } } else if (this.aiStyle == 48) { bool flag107 = false; if (Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.noTileCollide = false; } else { this.noTileCollide = true; flag107 = true; } if (NPC.golemBoss < 0) { this.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); return; } this.TargetClosest(true); float single357 = 7f; float single358 = 0.05f; Vector2 vector2168 = new Vector2(base.Center.X, base.Center.Y); float x161 = Main.player[this.target].Center.X - vector2168.X; float y160 = Main.player[this.target].Center.Y - vector2168.Y - 300f; float single359 = (float)Math.Sqrt((double)(x161 * x161 + y160 * y160)); single359 = single357 / single359; x161 = x161 * single359; y160 = y160 * single359; if (this.velocity.X < x161) { this.velocity.X = this.velocity.X + single358; if (this.velocity.X < 0f && x161 > 0f) { this.velocity.X = this.velocity.X + single358; } } else if (this.velocity.X > x161) { this.velocity.X = this.velocity.X - single358; if (this.velocity.X > 0f && x161 < 0f) { this.velocity.X = this.velocity.X - single358; } } if (this.velocity.Y < y160) { this.velocity.Y = this.velocity.Y + single358; if (this.velocity.Y < 0f && y160 > 0f) { this.velocity.Y = this.velocity.Y + single358; } } else if (this.velocity.Y > y160) { this.velocity.Y = this.velocity.Y - single358; if (this.velocity.Y > 0f && y160 < 0f) { this.velocity.Y = this.velocity.Y - single358; } } this.ai[1] = this.ai[1] + 1f; if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.8) { this.ai[1] = this.ai[1] + 1f; } if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.6) { this.ai[1] = this.ai[1] + 1f; } if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.2) { this.ai[1] = this.ai[1] + 1f; } if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.1) { this.ai[1] = this.ai[1] + 1f; } int num521 = 360; if (this.ai[1] < 20f || this.ai[1] > (float)(num521 - 20)) { this.localAI[0] = 1f; } else { this.localAI[0] = 0f; } if (flag107) { this.ai[1] = 20f; } if (this.ai[1] >= (float)num521) { this.TargetClosest(true); this.ai[1] = 0f; Vector2 vector2169 = new Vector2(base.Center.X, base.Center.Y - 10f); float single360 = 8f; int num522 = 20; int num523 = 258; float x162 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector2169.X; float y161 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector2169.Y; float single361 = (float)Math.Sqrt((double)(x162 * x162 + y161 * y161)); single361 = single360 / single361; x162 = x162 * single361; y161 = y161 * single361; if (Main.netMode != 1) { Projectile.NewProjectile(vector2169.X, vector2169.Y, x162, y161, num523, num522, 0f, Main.myPlayer, 0f, 0f); } } this.ai[2] = this.ai[2] + 1f; if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax / 1.25) { this.ai[2] = this.ai[2] + 1f; } if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax / 1.5) { this.ai[2] = this.ai[2] + 1f; } if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 2) { this.ai[2] = this.ai[2] + 1f; } if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 3) { this.ai[2] = this.ai[2] + 1f; } if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 4) { this.ai[2] = this.ai[2] + 1f; } if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 5) { this.ai[2] = this.ai[2] + 1f; } if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 6) { this.ai[2] = this.ai[2] + 1f; } if (!Collision.CanHit(Main.npc[NPC.golemBoss].Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[2] = this.ai[2] + 4f; } if (this.ai[2] > (float)(100 + Main.rand.Next(4800))) { this.ai[2] = 0f; for (int o4 = 0; o4 < 2; o4++) { Vector2 y162 = new Vector2(base.Center.X, base.Center.Y - 50f); if (o4 == 0) { y162.X = y162.X - 14f; } else if (o4 == 1) { y162.X = y162.X + 14f; } float single362 = 11f; int num524 = 24; int num525 = 259; if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.5) { num524++; single362 = single362 + 0.25f; } if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.4) { num524++; single362 = single362 + 0.25f; } if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.3) { num524++; single362 = single362 + 0.25f; } if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.2) { num524++; single362 = single362 + 0.25f; } if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.1) { num524++; single362 = single362 + 0.25f; } float x163 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - y162.X; float y163 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - y162.Y; float single363 = (float)Math.Sqrt((double)(x163 * x163 + y163 * y163)); single363 = single362 / single363; x163 = x163 * single363; y163 = y163 * single363; y162.X = y162.X + x163 * 3f; y162.Y = y162.Y + y163 * 3f; if (Main.netMode != 1) { int num526 = Projectile.NewProjectile(y162.X, y162.Y, x163, y163, num525, num524, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num526].timeLeft = 300; } } return; } } else if (this.aiStyle != 49) { if (this.aiStyle == 50) { if (this.timeLeft > 5) { this.timeLeft = 5; } this.noTileCollide = true; this.velocity.Y = this.velocity.Y + 0.02f; if (this.velocity.Y < 0f && !Main.expertMode) { this.velocity.Y = this.velocity.Y * 0.99f; } if (this.velocity.Y > 1f) { this.velocity.Y = 1f; } this.TargetClosest(true); if (this.position.X + (float)this.width < Main.player[this.target].position.X) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.98f; } if (Main.expertMode && this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.98f; } this.velocity.X = this.velocity.X + 0.1f; if (Main.expertMode) { this.velocity.X = this.velocity.X + 0.1f; } } else if (this.position.X > Main.player[this.target].position.X + (float)Main.player[this.target].width) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.98f; } if (Main.expertMode && this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.98f; } this.velocity.X = this.velocity.X - 0.1f; if (Main.expertMode) { this.velocity.X = this.velocity.X + 0.1f; } } if (this.velocity.X > 5f || this.velocity.X < -5f) { this.velocity.X = this.velocity.X * 0.97f; } this.rotation = this.velocity.X * 0.2f; return; } if (this.aiStyle == 51) { bool flag108 = false; bool flag109 = false; this.TargetClosest(true); if (Main.player[this.target].dead) { flag109 = true; flag108 = true; } if (Main.netMode != 1 && Math.Abs(base.Center.X - Main.player[this.target].Center.X) + Math.Abs(base.Center.Y - Main.player[this.target].Center.Y) > (float)6000) { this.active = false; this.life = 0; if (Main.netMode == 2) { NetMessage.SendData(23, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } NPC.plantBoss = this.whoAmI; if (this.localAI[0] == 0f && Main.netMode != 1) { this.localAI[0] = 1f; NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 263, this.whoAmI, 0f, 0f, 0f, 0f, 255); NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 263, this.whoAmI, 0f, 0f, 0f, 0f, 255); NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 263, this.whoAmI, 0f, 0f, 0f, 0f, 255); } int[] numArray2 = new int[3]; float x164 = 0f; float y164 = 0f; int num527 = 0; for (int p4 = 0; p4 < 200; p4++) { if (Main.npc[p4].active && Main.npc[p4].aiStyle == 52) { x164 = x164 + Main.npc[p4].Center.X; y164 = y164 + Main.npc[p4].Center.Y; numArray2[num527] = p4; num527++; if (num527 > 2) { break; } } } x164 = x164 / (float)num527; y164 = y164 / (float)num527; float single364 = 2.5f; float single365 = 0.025f; if (this.life < this.lifeMax / 2) { single364 = 5f; single365 = 0.05f; } if (this.life < this.lifeMax / 4) { single364 = 7f; } if (!Main.player[this.target].ZoneJungle || (double)Main.player[this.target].position.Y < Main.worldSurface * 16 || Main.player[this.target].position.Y > (float)((Main.maxTilesY - 200) * 16)) { flag108 = true; single364 = single364 + 8f; single365 = 0.15f; } if (Main.expertMode) { single364 = single364 + 1f; single364 = single364 * 1.1f; single365 = single365 + 0.01f; single365 = single365 * 1.1f; } Vector2 vector2170 = new Vector2(x164, y164); float x165 = Main.player[this.target].Center.X - vector2170.X; float y165 = Main.player[this.target].Center.Y - vector2170.Y; if (flag109) { y165 = y165 * -1f; x165 = x165 * -1f; single364 = single364 + 8f; } float single366 = (float)Math.Sqrt((double)(x165 * x165 + y165 * y165)); int num528 = 500; if (flag108) { num528 = num528 + 350; } if (Main.expertMode) { num528 = num528 + 150; } if (single366 >= (float)num528) { single366 = (float)num528 / single366; x165 = x165 * single366; y165 = y165 * single366; } x164 = x164 + x165; y164 = y164 + y165; vector2170 = new Vector2(base.Center.X, base.Center.Y); x165 = x164 - vector2170.X; y165 = y164 - vector2170.Y; single366 = (float)Math.Sqrt((double)(x165 * x165 + y165 * y165)); if (single366 >= single364) { single366 = single364 / single366; x165 = x165 * single366; y165 = y165 * single366; } else { x165 = this.velocity.X; y165 = this.velocity.Y; } if (this.velocity.X < x165) { this.velocity.X = this.velocity.X + single365; if (this.velocity.X < 0f && x165 > 0f) { this.velocity.X = this.velocity.X + single365 * 2f; } } else if (this.velocity.X > x165) { this.velocity.X = this.velocity.X - single365; if (this.velocity.X > 0f && x165 < 0f) { this.velocity.X = this.velocity.X - single365 * 2f; } } if (this.velocity.Y < y165) { this.velocity.Y = this.velocity.Y + single365; if (this.velocity.Y < 0f && y165 > 0f) { this.velocity.Y = this.velocity.Y + single365 * 2f; } } else if (this.velocity.Y > y165) { this.velocity.Y = this.velocity.Y - single365; if (this.velocity.Y > 0f && y165 < 0f) { this.velocity.Y = this.velocity.Y - single365 * 2f; } } Vector2 vector2171 = new Vector2(base.Center.X, base.Center.Y); float x166 = Main.player[this.target].Center.X - vector2171.X; float y166 = Main.player[this.target].Center.Y - vector2171.Y; this.rotation = (float)Math.Atan2((double)y166, (double)x166) + 1.57f; if (this.life <= this.lifeMax / 2) { this.defense = 10; this.damage = (int)(70f * Main.damageMultiplier); if (flag108) { NPC nPC156 = this; nPC156.defense = nPC156.defense * 4; NPC nPC157 = this; nPC157.damage = nPC157.damage * 2; } if (Main.netMode != 1) { if (this.localAI[0] == 1f) { this.localAI[0] = 2f; for (int q4 = 0; q4 < 8; q4++) { NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 264, this.whoAmI, 0f, 0f, 0f, 0f, 255); } if (Main.expertMode) { for (int r4 = 0; r4 < 200; r4++) { if (Main.npc[r4].active && Main.npc[r4].aiStyle == 52) { for (int s4 = 0; s4 < 3; s4++) { int num529 = NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 264, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num529].ai[3] = (float)(r4 + 1); } } } } } else if (Main.expertMode && Main.rand.Next(60) == 0) { int num530 = 0; for (int t4 = 0; t4 < 200; t4++) { if (Main.npc[t4].active && Main.npc[t4].type == 264 && Main.npc[t4].ai[3] == 0f) { num530++; } } if (num530 < 8 && Main.rand.Next((num530 + 1) * 10) <= 1) { NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 264, this.whoAmI, 0f, 0f, 0f, 0f, 255); } } } if (this.localAI[2] == 0f) { this.localAI[2] = 1f; } this.localAI[1] = this.localAI[1] + 1f; if ((double)this.life < (double)this.lifeMax * 0.4) { this.localAI[1] = this.localAI[1] + 1f; } if ((double)this.life < (double)this.lifeMax * 0.3) { this.localAI[1] = this.localAI[1] + 1f; } if ((double)this.life < (double)this.lifeMax * 0.2) { this.localAI[1] = this.localAI[1] + 1f; } if ((double)this.life < (double)this.lifeMax * 0.1) { this.localAI[1] = this.localAI[1] + 1f; } if (this.localAI[1] >= 350f) { float single367 = 8f; Vector2 vector2172 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x167 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector2172.X + (float)Main.rand.Next(-10, 11); float single368 = Math.Abs(x167 * 0.2f); float y167 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector2172.Y + (float)Main.rand.Next(-10, 11); if (y167 > 0f) { single368 = 0f; } y167 = y167 - single368; float single369 = (float)Math.Sqrt((double)(x167 * x167 + y167 * y167)); single369 = single367 / single369; x167 = x167 * single369; y167 = y167 * single369; int num531 = NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 265, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num531].velocity.X = x167; Main.npc[num531].velocity.Y = y167; Main.npc[num531].netUpdate = true; this.localAI[1] = 0f; return; } } else { this.defense = 36; this.damage = (int)(50f * Main.damageMultiplier); if (flag108) { NPC nPC158 = this; nPC158.defense = nPC158.defense * 2; NPC nPC159 = this; nPC159.damage = nPC159.damage * 2; } if (Main.netMode != 1) { this.localAI[1] = this.localAI[1] + 1f; if ((double)this.life < (double)this.lifeMax * 0.9) { this.localAI[1] = this.localAI[1] + 1f; } if ((double)this.life < (double)this.lifeMax * 0.8) { this.localAI[1] = this.localAI[1] + 1f; } if ((double)this.life < (double)this.lifeMax * 0.7) { this.localAI[1] = this.localAI[1] + 1f; } if ((double)this.life < (double)this.lifeMax * 0.6) { this.localAI[1] = this.localAI[1] + 1f; } if (flag108) { this.localAI[1] = this.localAI[1] + 3f; } if (Main.expertMode) { this.localAI[1] = this.localAI[1] + 1f; } if (Main.expertMode && this.justHit && Main.rand.Next(2) == 0) { this.localAI[3] = 1f; } if (this.localAI[1] > 80f) { this.localAI[1] = 0f; bool flag110 = Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height); if (this.localAI[3] > 0f) { flag110 = true; this.localAI[3] = 0f; } if (flag110) { Vector2 x168 = new Vector2(base.Center.X, base.Center.Y); float single370 = 15f; if (Main.expertMode) { single370 = 17f; } float x169 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - x168.X; float y168 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - x168.Y; float single371 = (float)Math.Sqrt((double)(x169 * x169 + y168 * y168)); single371 = single370 / single371; x169 = x169 * single371; y168 = y168 * single371; int num532 = 22; int num533 = 275; int num534 = 4; int num535 = 8; if (Main.expertMode) { num534 = 2; num535 = 6; } if ((double)this.life < (double)this.lifeMax * 0.8 && Main.rand.Next(num534) == 0) { num532 = 27; this.localAI[1] = -30f; num533 = 276; } else if ((double)this.life < (double)this.lifeMax * 0.8 && Main.rand.Next(num535) == 0) { num532 = 31; this.localAI[1] = -120f; num533 = 277; } if (flag108) { num532 = num532 * 2; } if (Main.expertMode) { num532 = (int)((double)num532 * 0.9); } x168.X = x168.X + x169 * 3f; x168.Y = x168.Y + y168 * 3f; int num536 = Projectile.NewProjectile(x168.X, x168.Y, x169, y168, num533, num532, 0f, Main.myPlayer, 0f, 0f); if (num533 != 277) { Main.projectile[num536].timeLeft = 300; return; } } } } } } else if (this.aiStyle == 52) { bool flag111 = false; bool flag112 = false; if (NPC.plantBoss < 0) { this.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); this.netUpdate = true; return; } if (Main.player[Main.npc[NPC.plantBoss].target].dead) { flag112 = true; } if (NPC.plantBoss != -1 && !Main.player[Main.npc[NPC.plantBoss].target].ZoneJungle || (double)Main.player[Main.npc[NPC.plantBoss].target].position.Y < Main.worldSurface * 16 || Main.player[Main.npc[NPC.plantBoss].target].position.Y > (float)((Main.maxTilesY - 200) * 16) || flag112) { this.localAI[0] = this.localAI[0] - 4f; flag111 = true; } if (Main.netMode == 1) { if (this.ai[0] == 0f) { this.ai[0] = (float)((int)(base.Center.X / 16f)); } if (this.ai[1] == 0f) { this.ai[1] = (float)((int)(base.Center.X / 16f)); } } if (Main.netMode != 1) { if (this.ai[0] == 0f || this.ai[1] == 0f) { this.localAI[0] = 0f; } this.localAI[0] = this.localAI[0] - 1f; if (Main.npc[NPC.plantBoss].life < Main.npc[NPC.plantBoss].lifeMax / 2) { this.localAI[0] = this.localAI[0] - 2f; } if (Main.npc[NPC.plantBoss].life < Main.npc[NPC.plantBoss].lifeMax / 4) { this.localAI[0] = this.localAI[0] - 2f; } if (flag111) { this.localAI[0] = this.localAI[0] - 6f; } if (!flag112 && this.localAI[0] <= 0f && this.ai[0] != 0f) { for (int u4 = 0; u4 < 200; u4++) { if (u4 != this.whoAmI && Main.npc[u4].active && Main.npc[u4].type == this.type && (Main.npc[u4].velocity.X != 0f || Main.npc[u4].velocity.Y != 0f)) { this.localAI[0] = (float)Main.rand.Next(60, 300); } } } if (this.localAI[0] <= 0f) { this.localAI[0] = (float)Main.rand.Next(300, 600); bool flag113 = false; int num537 = 0; while (!flag113 && num537 <= 1000) { num537++; int x170 = (int)(Main.player[Main.npc[NPC.plantBoss].target].Center.X / 16f); int y169 = (int)(Main.player[Main.npc[NPC.plantBoss].target].Center.Y / 16f); if (this.ai[0] == 0f) { x170 = (int)((Main.player[Main.npc[NPC.plantBoss].target].Center.X + Main.npc[NPC.plantBoss].Center.X) / 32f); y169 = (int)((Main.player[Main.npc[NPC.plantBoss].target].Center.Y + Main.npc[NPC.plantBoss].Center.Y) / 32f); } if (flag112) { x170 = (int)Main.npc[NPC.plantBoss].position.X / 16; y169 = (int)(Main.npc[NPC.plantBoss].position.Y + 400f) / 16; } int num538 = 20; num538 = num538 + (int)(100f * ((float)num537 / 1000f)); int num539 = x170 + Main.rand.Next(-num538, num538 + 1); int num540 = y169 + Main.rand.Next(-num538, num538 + 1); if (Main.npc[NPC.plantBoss].life < Main.npc[NPC.plantBoss].lifeMax / 2 && Main.rand.Next(6) == 0) { this.TargetClosest(true); int x171 = (int)(Main.player[this.target].Center.X / 16f); int y170 = (int)(Main.player[this.target].Center.Y / 16f); if (Main.tile[x171, y170].wall > 0) { num539 = x171; num540 = y170; } } try { if (WorldGen.SolidTile(num539, num540) || Main.tile[num539, num540].wall > 0 && (num537 > 500 || Main.npc[NPC.plantBoss].life < Main.npc[NPC.plantBoss].lifeMax / 2)) { flag113 = true; this.ai[0] = (float)num539; this.ai[1] = (float)num540; this.netUpdate = true; } } catch (Exception ex) { #if DEBUG Console.WriteLine(ex); System.Diagnostics.Debugger.Break(); #endif } } } } if (this.ai[0] > 0f && this.ai[1] > 0f) { float single372 = 6f; if (Main.npc[NPC.plantBoss].life < Main.npc[NPC.plantBoss].lifeMax / 2) { single372 = 8f; } if (Main.npc[NPC.plantBoss].life < Main.npc[NPC.plantBoss].lifeMax / 4) { single372 = 10f; } if (Main.expertMode) { single372 = single372 + 1f; } if (Main.expertMode && Main.npc[NPC.plantBoss].life < Main.npc[NPC.plantBoss].lifeMax / 2) { single372 = single372 + 1f; } if (flag111) { single372 = single372 * 2f; } if (flag112) { single372 = single372 * 2f; } Vector2 vector2173 = new Vector2(base.Center.X, base.Center.Y); float x172 = this.ai[0] * 16f - 8f - vector2173.X; float y171 = this.ai[1] * 16f - 8f - vector2173.Y; float single373 = (float)Math.Sqrt((double)(x172 * x172 + y171 * y171)); if (single373 >= 12f + single372) { single373 = single372 / single373; this.velocity.X = x172 * single373; this.velocity.Y = y171 * single373; } else { this.velocity.X = x172; this.velocity.Y = y171; } Vector2 vector2174 = new Vector2(base.Center.X, base.Center.Y); float x173 = Main.npc[NPC.plantBoss].Center.X - vector2174.X; float y172 = Main.npc[NPC.plantBoss].Center.Y - vector2174.Y; this.rotation = (float)Math.Atan2((double)y172, (double)x173) - 1.57f; return; } } else if (this.aiStyle == 53) { if (NPC.plantBoss < 0) { this.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); this.netUpdate = true; return; } int num541 = NPC.plantBoss; if (this.ai[3] > 0f) { num541 = (int)this.ai[3] - 1; } if (Main.netMode != 1) { this.localAI[0] = this.localAI[0] - 1f; if (this.localAI[0] <= 0f) { this.localAI[0] = (float)Main.rand.Next(120, 480); this.ai[0] = (float)Main.rand.Next(-100, 101); this.ai[1] = (float)Main.rand.Next(-100, 101); this.netUpdate = true; } } this.TargetClosest(true); float single374 = 0.2f; float single375 = 200f; if ((double)Main.npc[NPC.plantBoss].life < (double)Main.npc[NPC.plantBoss].lifeMax * 0.25) { single375 = single375 + 100f; } if ((double)Main.npc[NPC.plantBoss].life < (double)Main.npc[NPC.plantBoss].lifeMax * 0.1) { single375 = single375 + 100f; } if (Main.expertMode) { float single376 = 1f - (float)this.life / (float)this.lifeMax; single375 = single375 + single376 * 300f; single374 = single374 + 0.3f; } if (!Main.npc[num541].active || NPC.plantBoss < 0) { this.active = false; return; } float x174 = Main.npc[num541].position.X + (float)(Main.npc[num541].width / 2); float y173 = Main.npc[num541].position.Y + (float)(Main.npc[num541].height / 2); Vector2 vector2175 = new Vector2(x174, y173); float single377 = x174 + this.ai[0]; float single378 = y173 + this.ai[1]; float x175 = single377 - vector2175.X; float y174 = single378 - vector2175.Y; float single379 = (float)Math.Sqrt((double)(x175 * x175 + y174 * y174)); single379 = single375 / single379; x175 = x175 * single379; y174 = y174 * single379; if (this.position.X < x174 + x175) { this.velocity.X = this.velocity.X + single374; if (this.velocity.X < 0f && x175 > 0f) { this.velocity.X = this.velocity.X * 0.9f; } } else if (this.position.X > x174 + x175) { this.velocity.X = this.velocity.X - single374; if (this.velocity.X > 0f && x175 < 0f) { this.velocity.X = this.velocity.X * 0.9f; } } if (this.position.Y < y173 + y174) { this.velocity.Y = this.velocity.Y + single374; if (this.velocity.Y < 0f && y174 > 0f) { this.velocity.Y = this.velocity.Y * 0.9f; } } else if (this.position.Y > y173 + y174) { this.velocity.Y = this.velocity.Y - single374; if (this.velocity.Y > 0f && y174 < 0f) { this.velocity.Y = this.velocity.Y * 0.9f; } } if (this.velocity.X > 8f) { this.velocity.X = 8f; } if (this.velocity.X < -8f) { this.velocity.X = -8f; } if (this.velocity.Y > 8f) { this.velocity.Y = 8f; } if (this.velocity.Y < -8f) { this.velocity.Y = -8f; } if (x175 > 0f) { this.spriteDirection = 1; this.rotation = (float)Math.Atan2((double)y174, (double)x175); } if (x175 < 0f) { this.spriteDirection = -1; this.rotation = (float)Math.Atan2((double)y174, (double)x175) + 3.14f; return; } } else if (this.aiStyle == 54) { NPC.crimsonBoss = this.whoAmI; if (Main.netMode != 1 && this.localAI[0] == 0f) { this.localAI[0] = 1f; for (int v4 = 0; v4 < 20; v4++) { float x176 = base.Center.X; float y175 = base.Center.Y; x176 = x176 + (float)Main.rand.Next(-this.width, this.width); y175 = y175 + (float)Main.rand.Next(-this.height, this.height); int num542 = NPC.NewNPC((int)x176, (int)y175, 267, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num542].velocity = new Vector2((float)Main.rand.Next(-30, 31) * 0.1f, (float)Main.rand.Next(-30, 31) * 0.1f); Main.npc[num542].netUpdate = true; } } if (Main.netMode != 1) { this.TargetClosest(true); if (Math.Abs(base.Center.X - Main.player[this.target].Center.X) + Math.Abs(base.Center.Y - Main.player[this.target].Center.Y) > (float)6000) { this.active = false; this.life = 0; if (Main.netMode == 2) { NetMessage.SendData(23, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } } if (this.ai[0] >= 0f) { this.TargetClosest(true); Vector2 vector2176 = new Vector2(base.Center.X, base.Center.Y); float x177 = Main.player[this.target].Center.X - vector2176.X; float y176 = Main.player[this.target].Center.Y - vector2176.Y; float single380 = (float)Math.Sqrt((double)(x177 * x177 + y176 * y176)); float single381 = 1f; if (single380 >= single381) { single380 = single381 / single380; this.velocity.X = x177 * single380; this.velocity.Y = y176 * single380; } else { this.velocity.X = x177; this.velocity.Y = y176; } if (this.ai[0] == 0f) { if (Main.netMode != 1) { int num543 = 0; for (int w4 = 0; w4 < 200; w4++) { if (Main.npc[w4].active && Main.npc[w4].type == 267) { num543++; } } if (num543 == 0) { this.ai[0] = -1f; this.localAI[1] = 0f; this.alpha = 0; this.netUpdate = true; } this.localAI[1] = this.localAI[1] + 1f; if (this.localAI[1] >= (float)(120 + Main.rand.Next(300))) { this.localAI[1] = 0f; this.TargetClosest(true); int num544 = 0; do { num544++; int x178 = (int)Main.player[this.target].Center.X / 16; int y177 = (int)Main.player[this.target].Center.Y / 16; x178 = x178 + Main.rand.Next(-50, 51); y177 = y177 + Main.rand.Next(-50, 51); if (WorldGen.SolidTile(x178, y177) || !Collision.CanHit(new Vector2((float)(x178 * 16), (float)(y177 * 16)), 1, 1, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { continue; } this.ai[0] = 1f; this.ai[1] = (float)x178; this.ai[2] = (float)y177; this.netUpdate = true; return; } while (num544 <= 100); return; } } } else if (this.ai[0] == 1f) { NPC nPC160 = this; nPC160.alpha = nPC160.alpha + 5; if (this.alpha >= 255) { this.alpha = 255; this.position.X = this.ai[1] * 16f - (float)(this.width / 2); this.position.Y = this.ai[2] * 16f - (float)(this.height / 2); this.ai[0] = 2f; return; } } else if (this.ai[0] == 2f) { NPC nPC161 = this; nPC161.alpha = nPC161.alpha - 5; if (this.alpha <= 0) { this.alpha = 0; this.ai[0] = 0f; return; } } } else { if (this.localAI[2] == 0f) { this.localAI[2] = 1f; } this.dontTakeDamage = false; this.knockBackResist = 0.5f; if (Main.expertMode) { NPC nPC162 = this; nPC162.knockBackResist = nPC162.knockBackResist * Main.expertKnockBack; } this.TargetClosest(true); Vector2 vector2178 = new Vector2(base.Center.X, base.Center.Y); float x179 = Main.player[this.target].Center.X - vector2178.X; float y178 = Main.player[this.target].Center.Y - vector2178.Y; float single382 = (float)Math.Sqrt((double)(x179 * x179 + y178 * y178)); single382 = 8f / single382; x179 = x179 * single382; y178 = y178 * single382; this.velocity.X = (this.velocity.X * 50f + x179) / 51f; this.velocity.Y = (this.velocity.Y * 50f + y178) / 51f; if (this.ai[0] != -1f) { if (this.ai[0] == -2f) { NPC nPC163 = this; nPC163.velocity = nPC163.velocity * 0.9f; if (Main.netMode == 0) { this.ai[3] = this.ai[3] + 25f; } else { this.ai[3] = this.ai[3] + 15f; } if (this.ai[3] >= 255f) { this.ai[3] = 255f; this.position.X = this.ai[1] * 16f - (float)(this.width / 2); this.position.Y = this.ai[2] * 16f - (float)(this.height / 2); this.ai[0] = -3f; this.netUpdate = true; this.netSpam = 0; } this.alpha = (int)this.ai[3]; return; } if (this.ai[0] == -3f) { if (Main.netMode == 0) { this.ai[3] = this.ai[3] - 25f; } else { this.ai[3] = this.ai[3] - 15f; } if (this.ai[3] <= 0f) { this.ai[3] = 0f; this.ai[0] = -1f; this.netUpdate = true; this.netSpam = 0; } this.alpha = (int)this.ai[3]; return; } } else if (Main.netMode != 1) { this.localAI[1] = this.localAI[1] + 1f; if (this.justHit) { this.localAI[1] = this.localAI[1] - (float)Main.rand.Next(5); } int num547 = 60 + Main.rand.Next(120); if (Main.netMode != 0) { num547 = num547 + Main.rand.Next(30, 90); } if (this.localAI[1] >= (float)num547) { this.localAI[1] = 0f; this.TargetClosest(true); int num548 = 0; do { num548++; int x180 = (int)Main.player[this.target].Center.X / 16; int y179 = (int)Main.player[this.target].Center.Y / 16; x180 = (Main.rand.Next(2) != 0 ? x180 - Main.rand.Next(7, 13) : x180 + Main.rand.Next(7, 13)); y179 = (Main.rand.Next(2) != 0 ? y179 - Main.rand.Next(7, 13) : y179 + Main.rand.Next(7, 13)); if (WorldGen.SolidTile(x180, y179)) { continue; } this.ai[3] = 0f; this.ai[0] = -2f; this.ai[1] = (float)x180; this.ai[2] = (float)y179; this.netUpdate = true; this.netSpam = 0; return; } while (num548 <= 100); return; } } } } else if (this.aiStyle != 55) { if (this.aiStyle == 56) { this.TargetClosest(true); Vector2 vector2179 = new Vector2(base.Center.X, base.Center.Y); float x181 = Main.player[this.target].Center.X - vector2179.X; float y180 = Main.player[this.target].Center.Y - vector2179.Y; float single383 = (float)Math.Sqrt((double)(x181 * x181 + y180 * y180)); single383 = 12f / single383; x181 = x181 * single383; y180 = y180 * single383; this.velocity.X = (this.velocity.X * 100f + x181) / 101f; this.velocity.Y = (this.velocity.Y * 100f + y180) / 101f; this.rotation = (float)Math.Atan2((double)y180, (double)x181) - 1.57f; return; } if (this.aiStyle != 57) { if (this.aiStyle == 58) { this.localAI[0] = this.localAI[0] + 1f; if (this.localAI[0] > 6f) { this.localAI[0] = 0f; this.localAI[1] = this.localAI[1] + 1f; if (this.localAI[1] > 4f) { this.localAI[1] = 0f; } } if (Main.netMode != 1) { this.localAI[2] = this.localAI[2] + 1f; if (this.localAI[2] > 300f) { this.ai[3] = (float)Main.rand.Next(3); this.localAI[2] = 0f; } else if (this.ai[3] == 0f && this.localAI[2] % 30f == 0f && this.localAI[2] > 30f) { float single384 = 5f; Vector2 vector2181 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f + 30f); if (!WorldGen.SolidTile((int)vector2181.X / 16, (int)vector2181.Y / 16)) { float x182 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector2181.X; float y181 = Main.player[this.target].position.Y - vector2181.Y; x182 = x182 + (float)Main.rand.Next(-50, 51); y181 = y181 + (float)Main.rand.Next(50, 201); y181 = y181 * 0.2f; float single385 = (float)Math.Sqrt((double)(x182 * x182 + y181 * y181)); single385 = single384 / single385; x182 = x182 * single385; y181 = y181 * single385; x182 = x182 * (1f + (float)Main.rand.Next(-30, 31) * 0.01f); y181 = y181 * (1f + (float)Main.rand.Next(-30, 31) * 0.01f); Projectile.NewProjectile(vector2181.X, vector2181.Y, x182, y181, Main.rand.Next(326, 329), 40, 0f, Main.myPlayer, 0f, 0f); } } } if (this.ai[0] == 0f && Main.netMode != 1) { this.TargetClosest(true); this.ai[0] = 1f; int num552 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)this.position.Y + this.height / 2, 328, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num552].ai[0] = -1f; Main.npc[num552].ai[1] = (float)this.whoAmI; Main.npc[num552].target = this.target; Main.npc[num552].netUpdate = true; num552 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)this.position.Y + this.height / 2, 328, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num552].ai[0] = 1f; Main.npc[num552].ai[1] = (float)this.whoAmI; Main.npc[num552].ai[3] = 150f; Main.npc[num552].target = this.target; Main.npc[num552].netUpdate = true; } if (Main.player[this.target].dead || Math.Abs(this.position.X - Main.player[this.target].position.X) > 2000f || Math.Abs(this.position.Y - Main.player[this.target].position.Y) > 2000f) { this.TargetClosest(true); if (Main.player[this.target].dead || Math.Abs(this.position.X - Main.player[this.target].position.X) > 2000f || Math.Abs(this.position.Y - Main.player[this.target].position.Y) > 2000f) { this.ai[1] = 2f; } } if (Main.dayTime) { this.velocity.Y = this.velocity.Y + 0.3f; this.velocity.X = this.velocity.X * 0.9f; } else if (this.ai[1] == 0f) { this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= 300f) { if (this.ai[3] == 1f) { this.ai[2] = 0f; this.ai[1] = 1f; this.TargetClosest(true); this.netUpdate = true; } else { this.ai[1] = 0f; this.ai[2] = 0f; } } Vector2 vector2182 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x183 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector2182.X; float y182 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - 200f - vector2182.Y; float single386 = (float)Math.Sqrt((double)(x183 * x183 + y182 * y182)); float single387 = 6f; if (this.ai[3] == 1f) { if (single386 > 900f) { single387 = 12f; } else if (single386 > 600f) { single387 = 10f; } else if (single386 > 300f) { single387 = 8f; } } if (single386 > 50f) { single386 = single387 / single386; this.velocity.X = (this.velocity.X * 14f + x183 * single386) / 15f; this.velocity.Y = (this.velocity.Y * 14f + y182 * single386) / 15f; } } else if (this.ai[1] == 1f) { this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= 600f || this.ai[3] != 1f) { this.ai[2] = 0f; this.ai[1] = 0f; } Vector2 vector2183 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x184 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector2183.X; float y183 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector2183.Y; float single388 = (float)Math.Sqrt((double)(x184 * x184 + y183 * y183)); single388 = 16f / single388; this.velocity.X = (this.velocity.X * 49f + x184 * single388) / 50f; this.velocity.Y = (this.velocity.Y * 49f + y183 * single388) / 50f; } else if (this.ai[1] == 2f) { this.ai[1] = 3f; this.velocity.Y = this.velocity.Y + 0.1f; if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.95f; } this.velocity.X = this.velocity.X * 0.95f; if (this.timeLeft > 500) { this.timeLeft = 500; } } this.rotation = this.velocity.X * -0.02f; return; } if (this.aiStyle == 59) { this.spriteDirection = -(int)this.ai[0]; if (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].aiStyle != 58) { this.ai[2] = this.ai[2] + 10f; if (this.ai[2] > 50f || Main.netMode != 2) { this.life = -1; this.HitEffect(0, 10); this.active = false; } } if (Main.netMode != 1 && Main.npc[(int)this.ai[1]].ai[3] == 2f) { this.localAI[1] = this.localAI[1] + 1f; if (this.localAI[1] > 90f) { this.localAI[1] = 0f; float single389 = 0.01f; Vector2 vector2184 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f + 30f); float x185 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector2184.X; float y184 = Main.player[this.target].position.Y - vector2184.Y; float single390 = (float)Math.Sqrt((double)(x185 * x185 + y184 * y184)); single390 = single389 / single390; x185 = x185 * single390; y184 = y184 * single390; Projectile.NewProjectile(base.Center.X, base.Center.Y, x185, y184, 329, 60, 0f, Main.myPlayer, this.rotation, (float)this.spriteDirection); } } if (Main.dayTime) { this.velocity.Y = this.velocity.Y + 0.3f; this.velocity.X = this.velocity.X * 0.9f; return; } if (this.ai[2] == 0f || this.ai[2] == 3f) { if (Main.npc[(int)this.ai[1]].ai[1] == 3f && this.timeLeft > 10) { this.timeLeft = 10; } this.ai[3] = this.ai[3] + 1f; if (this.ai[3] >= 180f) { this.ai[2] = this.ai[2] + 1f; this.ai[3] = 0f; this.netUpdate = true; } Vector2 vector2185 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x186 = (Main.player[this.target].Center.X + Main.npc[(int)this.ai[1]].Center.X) / 2f; float y185 = (Main.player[this.target].Center.Y + Main.npc[(int)this.ai[1]].Center.Y) / 2f; x186 = x186 + (-170f * this.ai[0] - vector2185.X); y185 = y185 + (90f - vector2185.Y); if (Math.Abs(Main.player[this.target].Center.X - Main.npc[(int)this.ai[1]].Center.X) + Math.Abs(Main.player[this.target].Center.Y - Main.npc[(int)this.ai[1]].Center.Y) > 700f) { x186 = Main.npc[(int)this.ai[1]].Center.X - 170f * this.ai[0] - vector2185.X; y185 = Main.npc[(int)this.ai[1]].Center.Y + 90f - vector2185.Y; } float single391 = (float)Math.Sqrt((double)(x186 * x186 + y185 * y185)); float single392 = 6f; if (single391 > 1000f) { single392 = 21f; } else if (single391 > 800f) { single392 = 18f; } else if (single391 > 600f) { single392 = 15f; } else if (single391 > 400f) { single392 = 12f; } else if (single391 > 200f) { single392 = 9f; } if (this.ai[0] < 0f && base.Center.X > Main.npc[(int)this.ai[1]].Center.X) { x186 = x186 - 4f; } if (this.ai[0] > 0f && base.Center.X < Main.npc[(int)this.ai[1]].Center.X) { x186 = x186 + 4f; } single391 = single392 / single391; this.velocity.X = (this.velocity.X * 14f + x186 * single391) / 15f; this.velocity.Y = (this.velocity.Y * 14f + y185 * single391) / 15f; single391 = (float)Math.Sqrt((double)(x186 * x186 + y185 * y185)); if (single391 > 20f) { this.rotation = (float)Math.Atan2((double)y185, (double)x186) + 1.57f; return; } } else if (this.ai[2] == 1f) { Vector2 vector2186 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x187 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector2186.X; float y186 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector2186.Y; float single393 = (float)Math.Sqrt((double)(x187 * x187 + y186 * y186)); this.rotation = (float)Math.Atan2((double)y186, (double)x187) + 1.57f; this.velocity.X = this.velocity.X * 0.95f; this.velocity.Y = this.velocity.Y - 0.3f; if (this.velocity.Y < -14f) { this.velocity.Y = -14f; } if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y - 200f) { this.TargetClosest(true); this.ai[2] = 2f; vector2186 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); x187 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector2186.X; y186 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector2186.Y; single393 = (float)Math.Sqrt((double)(x187 * x187 + y186 * y186)); single393 = 18f / single393; this.velocity.X = x187 * single393; this.velocity.Y = y186 * single393; this.netUpdate = true; return; } } else if (this.ai[2] == 2f) { float single394 = Math.Abs(base.Center.X - Main.npc[(int)this.ai[1]].Center.X) + Math.Abs(base.Center.Y - Main.npc[(int)this.ai[1]].Center.Y); if (this.position.Y > Main.player[this.target].position.Y || this.velocity.Y < 0f || single394 > 800f) { this.ai[2] = 3f; return; } } else if (this.ai[2] == 4f) { Vector2 vector2187 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x188 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector2187.X; float y187 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector2187.Y; float single395 = (float)Math.Sqrt((double)(x188 * x188 + y187 * y187)); this.rotation = (float)Math.Atan2((double)y187, (double)x188) + 1.57f; this.velocity.Y = this.velocity.Y * 0.95f; this.velocity.X = this.velocity.X + 0.3f * -this.ai[0]; if (this.velocity.X < -14f) { this.velocity.X = -14f; } if (this.velocity.X > 14f) { this.velocity.X = 14f; } if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 500f || this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) + 500f) { this.TargetClosest(true); this.ai[2] = 5f; vector2187 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); x188 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector2187.X; y187 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector2187.Y; single395 = (float)Math.Sqrt((double)(x188 * x188 + y187 * y187)); single395 = 17f / single395; this.velocity.X = x188 * single395; this.velocity.Y = y187 * single395; this.netUpdate = true; return; } } else if (this.ai[2] == 5f) { float single396 = Math.Abs(base.Center.X - Main.npc[(int)this.ai[1]].Center.X) + Math.Abs(base.Center.Y - Main.npc[(int)this.ai[1]].Center.Y); if (this.velocity.X > 0f && this.position.X + (float)(this.width / 2) > Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) || this.velocity.X < 0f && this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) || single396 > 800f) { this.ai[2] = 0f; return; } } } else if (this.aiStyle == 60) { if (Main.dayTime) { if (this.velocity.X <= 0f) { this.velocity.X = this.velocity.X - 0.25f; } else { this.velocity.X = this.velocity.X + 0.25f; } this.velocity.Y = this.velocity.Y - 0.1f; this.rotation = this.velocity.X * 0.05f; } else if (this.ai[0] == 0f) { if (this.ai[2] == 0f) { this.TargetClosest(true); if (base.Center.X >= Main.player[this.target].Center.X) { this.ai[2] = -1f; } else { this.ai[2] = 1f; } } this.TargetClosest(true); int num553 = 800; float single397 = Math.Abs(base.Center.X - Main.player[this.target].Center.X); if (base.Center.X < Main.player[this.target].Center.X && this.ai[2] < 0f && single397 > (float)num553) { this.ai[2] = 0f; } if (base.Center.X > Main.player[this.target].Center.X && this.ai[2] > 0f && single397 > (float)num553) { this.ai[2] = 0f; } float single398 = 0.45f; float single399 = 7f; if ((double)this.life < (double)this.lifeMax * 0.75) { single398 = 0.55f; single399 = 8f; } if ((double)this.life < (double)this.lifeMax * 0.5) { single398 = 0.7f; single399 = 10f; } if ((double)this.life < (double)this.lifeMax * 0.25) { single398 = 0.8f; single399 = 11f; } this.velocity.X = this.velocity.X + this.ai[2] * single398; if (this.velocity.X > single399) { this.velocity.X = single399; } if (this.velocity.X < -single399) { this.velocity.X = -single399; } float y188 = Main.player[this.target].position.Y - (this.position.Y + (float)this.height); if (y188 < 150f) { this.velocity.Y = this.velocity.Y - 0.2f; } if (y188 > 200f) { this.velocity.Y = this.velocity.Y + 0.2f; } if (this.velocity.Y > 8f) { this.velocity.Y = 8f; } if (this.velocity.Y < -8f) { this.velocity.Y = -8f; } this.rotation = this.velocity.X * 0.05f; if ((single397 < 500f || this.ai[3] < 0f) && this.position.Y < Main.player[this.target].position.Y) { this.ai[3] = this.ai[3] + 1f; int num554 = 13; if ((double)this.life < (double)this.lifeMax * 0.75) { num554 = 12; } if ((double)this.life < (double)this.lifeMax * 0.5) { num554 = 11; } if ((double)this.life < (double)this.lifeMax * 0.25) { num554 = 10; } num554++; if (this.ai[3] > (float)num554) { this.ai[3] = (float)(-num554); } if (this.ai[3] == 0f && Main.netMode != 1) { Vector2 vector2188 = new Vector2(base.Center.X, base.Center.Y); float x189 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector2188.X; float y189 = Main.player[this.target].Center.Y - vector2188.Y; float single400 = (float)Math.Sqrt((double)(x189 * x189 + y189 * y189)); float single401 = 6f; if ((double)this.life < (double)this.lifeMax * 0.75) { single401 = 7f; } if ((double)this.life < (double)this.lifeMax * 0.5) { single401 = 8f; } if ((double)this.life < (double)this.lifeMax * 0.25) { single401 = 9f; } single400 = single401 / single400; x189 = x189 * single400; y189 = y189 * single400; Projectile.NewProjectile(vector2188.X, vector2188.Y, x189, y189, 348, 42, 0f, Main.myPlayer, 0f, 0f); } } else if (this.ai[3] < 0f) { this.ai[3] = this.ai[3] + 1f; } if (Main.netMode != 1) { this.ai[1] = this.ai[1] + (float)Main.rand.Next(1, 4); if (this.ai[1] > 800f && single397 < 600f) { this.ai[0] = -1f; } } } else if (this.ai[0] == 1f) { this.TargetClosest(true); float single402 = 0.15f; float single403 = 7f; if ((double)this.life < (double)this.lifeMax * 0.75) { single402 = 0.17f; single403 = 8f; } if ((double)this.life < (double)this.lifeMax * 0.5) { single402 = 0.2f; single403 = 9f; } if ((double)this.life < (double)this.lifeMax * 0.25) { single402 = 0.25f; single403 = 10f; } single402 = single402 - 0.05f; single403 = single403 - 1f; if (base.Center.X < Main.player[this.target].Center.X) { this.velocity.X = this.velocity.X + single402; if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.98f; } } if (base.Center.X > Main.player[this.target].Center.X) { this.velocity.X = this.velocity.X - single402; if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.98f; } } if (this.velocity.X > single403 || this.velocity.X < -single403) { this.velocity.X = this.velocity.X * 0.95f; } float y190 = Main.player[this.target].position.Y - (this.position.Y + (float)this.height); if (y190 < 180f) { this.velocity.Y = this.velocity.Y - 0.1f; } if (y190 > 200f) { this.velocity.Y = this.velocity.Y + 0.1f; } if (this.velocity.Y > 6f) { this.velocity.Y = 6f; } if (this.velocity.Y < -6f) { this.velocity.Y = -6f; } this.rotation = this.velocity.X * 0.01f; if (Main.netMode != 1) { this.ai[3] = this.ai[3] + 1f; int num555 = 15; if ((double)this.life < (double)this.lifeMax * 0.75) { num555 = 14; } if ((double)this.life < (double)this.lifeMax * 0.5) { num555 = 12; } if ((double)this.life < (double)this.lifeMax * 0.25) { num555 = 10; } if ((double)this.life < (double)this.lifeMax * 0.1) { num555 = 8; } num555 = num555 + 3; if (this.ai[3] >= (float)num555) { this.ai[3] = 0f; Vector2 vector2189 = new Vector2(base.Center.X, this.position.Y + (float)this.height - 14f); if (!WorldGen.SolidTile((int)(vector2189.X / 16f), (int)(vector2189.Y / 16f))) { float y191 = this.velocity.Y; if (y191 < 0f) { y191 = 0f; } y191 = y191 + 3f; float x190 = this.velocity.X * 0.25f; Projectile.NewProjectile(vector2189.X, vector2189.Y, x190, y191, 349, 37, 0f, Main.myPlayer, (float)Main.rand.Next(5), 0f); } } } if (Main.netMode != 1) { this.ai[1] = this.ai[1] + (float)Main.rand.Next(1, 4); if (this.ai[1] > 600f) { this.ai[0] = -1f; } } } else if (this.ai[0] == 2f) { this.TargetClosest(true); Vector2 vector2190 = new Vector2(base.Center.X, base.Center.Y - 20f); float single404 = (float)Main.rand.Next(-1000, 1001); float single405 = (float)Main.rand.Next(-1000, 1001); float single406 = (float)Math.Sqrt((double)(single404 * single404 + single405 * single405)); float single407 = 15f; NPC nPC164 = this; nPC164.velocity = nPC164.velocity * 0.95f; single406 = single407 / single406; single404 = single404 * single406; single405 = single405 * single406; NPC nPC165 = this; nPC165.rotation = nPC165.rotation + 0.2f; vector2190.X = vector2190.X + single404 * 4f; vector2190.Y = vector2190.Y + single405 * 4f; this.ai[3] = this.ai[3] + 1f; int num556 = 7; if ((double)this.life < (double)this.lifeMax * 0.75) { num556--; } if ((double)this.life < (double)this.lifeMax * 0.5) { num556 = num556 - 2; } if ((double)this.life < (double)this.lifeMax * 0.25) { num556 = num556 - 3; } if ((double)this.life < (double)this.lifeMax * 0.1) { num556 = num556 - 4; } if (this.ai[3] > (float)num556) { this.ai[3] = 0f; Projectile.NewProjectile(vector2190.X, vector2190.Y, single404, single405, 349, 35, 0f, Main.myPlayer, 0f, 0f); } if (Main.netMode != 1) { this.ai[1] = this.ai[1] + (float)Main.rand.Next(1, 4); if (this.ai[1] > 500f) { this.ai[0] = -1f; } } } if (this.ai[0] == -1f) { int num557 = Main.rand.Next(3); this.TargetClosest(true); if (Math.Abs(base.Center.X - Main.player[this.target].Center.X) > 1000f) { num557 = 0; } this.ai[0] = (float)num557; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; return; } } else if (this.aiStyle == 61) { float single408 = 2f; this.noGravity = true; this.noTileCollide = true; if (!Main.dayTime) { this.TargetClosest(true); } bool flag114 = false; if ((double)this.life < (double)this.lifeMax * 0.75) { single408 = 3f; } if ((double)this.life < (double)this.lifeMax * 0.5) { single408 = 4f; } if ((double)this.life < (double)this.lifeMax * 0.25) { single408 = 5f; } if (Main.dayTime) { if (this.timeLeft > 10) { this.timeLeft = 10; } single408 = 8f; if (this.velocity.X == 0f) { this.velocity.X = 0.1f; } } else if (this.ai[0] == 0f) { this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= 300f && Main.netMode != 1) { this.TargetClosest(true); this.ai[1] = 0f; this.ai[0] = 1f; this.netUpdate = true; } } else if (this.ai[0] == 1f) { this.ai[1] = this.ai[1] + 1f; flag114 = true; int num558 = 16; if ((double)this.life < (double)this.lifeMax * 0.25) { num558 = 8; } else if ((double)this.life < (double)this.lifeMax * 0.5) { num558 = 11; } else if ((double)this.life < (double)this.lifeMax * 0.75) { num558 = 14; } if (this.ai[1] % (float)num558 == 0f) { Vector2 vector2191 = new Vector2(base.Center.X + (float)(this.direction * 50), base.Center.Y + (float)Main.rand.Next(15, 36)); float x191 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector2191.X; float y192 = Main.player[this.target].Center.Y - vector2191.Y; x191 = x191 + (float)Main.rand.Next(-40, 41); y192 = y192 + (float)Main.rand.Next(-40, 41); float single409 = (float)Math.Sqrt((double)(x191 * x191 + y192 * y192)); single409 = 15f / single409; x191 = x191 * single409; y192 = y192 * single409; x191 = x191 * (1f + (float)Main.rand.Next(-20, 21) * 0.015f); y192 = y192 * (1f + (float)Main.rand.Next(-20, 21) * 0.015f); Projectile.NewProjectile(vector2191.X, vector2191.Y, x191, y192, 180, 36, 0f, Main.myPlayer, 0f, 0f); } if (this.ai[1] > 240f) { this.ai[0] = 0f; this.ai[1] = 0f; } } if (Main.netMode != 1) { int num559 = 600; int num560 = 1200; int num561 = 2700; if ((double)this.life < (double)this.lifeMax * 0.25) { num559 = (int)((double)num559 * 0.5); num560 = (int)((double)num560 * 0.5); num561 = (int)((double)num561 * 0.5); } else if ((double)this.life < (double)this.lifeMax * 0.5) { num559 = (int)((double)num559 * 0.75); num560 = (int)((double)num560 * 0.75); num561 = (int)((double)num561 * 0.75); } else if ((double)this.life < (double)this.lifeMax * 0.75) { num559 = (int)((double)num559 * 0.9); num560 = (int)((double)num560 * 0.9); num561 = (int)((double)num561 * 0.9); } if (Main.rand.Next(num559) == 0) { Vector2 vector2192 = new Vector2(base.Center.X - (float)(this.direction * 24), base.Center.Y - 64f); float single410 = (float)(Main.rand.Next(1, 100) * this.direction); float single411 = 1f; float single412 = (float)Math.Sqrt((double)(single410 * single410 + single411 * single411)); single412 = 1f / single412; single410 = single410 * single412; single411 = single411 * single412; Projectile.NewProjectile(vector2192.X, vector2192.Y, single410, single411, 352, 80, 0f, Main.myPlayer, 0f, 0f); } if (Main.rand.Next(num560) == 0) { this.localAI[1] = 1f; } if (this.localAI[1] >= 1f) { this.localAI[1] = this.localAI[1] + 1f; if (this.localAI[1] % (float)12 == 0f) { Vector2 vector2193 = new Vector2(base.Center.X - (float)(this.direction * 24), base.Center.Y - 64f); float x192 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector2193.X; float y193 = Main.player[this.target].Center.Y - vector2193.Y; x192 = x192 + (float)Main.rand.Next(-50, 51); y193 = y193 + (float)Main.rand.Next(-50, 51); float single413 = (float)Math.Sqrt((double)(x192 * x192 + y193 * y193)); single413 = 12.5f / single413; x192 = x192 * single413; y193 = y193 * single413; x192 = x192 * (1f + (float)Main.rand.Next(-20, 21) * 0.015f); y193 = y193 * (1f + (float)Main.rand.Next(-20, 21) * 0.015f); Projectile.NewProjectile(vector2193.X, vector2193.Y, x192, y193, 350, 42, 0f, Main.myPlayer, 0f, 0f); } if (this.localAI[1] >= 100f) { this.localAI[1] = 0f; } } if (Main.rand.Next(num561) == 0) { this.localAI[2] = 2f; } if (this.localAI[2] > 0f) { this.localAI[2] = this.localAI[2] + 1f; if (this.localAI[2] % (float)9 == 0f) { Vector2 vector2194 = new Vector2(base.Center.X - (float)(this.direction * 24), base.Center.Y - 64f); float single414 = (float)Main.rand.Next(-100, 101); float single415 = -300f; float single416 = (float)Math.Sqrt((double)(single414 * single414 + single415 * single415)); single416 = 11f / single416; single414 = single414 * single416; single415 = single415 * single416; single414 = single414 * (1f + (float)Main.rand.Next(-20, 21) * 0.01f); single415 = single415 * (1f + (float)Main.rand.Next(-20, 21) * 0.01f); Projectile.NewProjectile(vector2194.X, vector2194.Y, single414, single415, 351, 50, 0f, Main.myPlayer, 0f, 0f); } if (this.localAI[2] >= 100f) { this.localAI[2] = 0f; } } } if (Math.Abs(base.Center.X - Main.player[this.target].Center.X) < 50f) { flag114 = true; } if (!flag114) { if (this.direction > 0) { this.velocity.X = (this.velocity.X * 20f + single408) / 21f; } if (this.direction < 0) { this.velocity.X = (this.velocity.X * 20f - single408) / 21f; } } else { this.velocity.X = this.velocity.X * 0.9f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } } int num562 = 80; int num563 = 20; Vector2 vector2195 = new Vector2(base.Center.X - (float)(num562 / 2), this.position.Y + (float)this.height - (float)num563); bool flag115 = false; if (this.position.X < Main.player[this.target].position.X && this.position.X + (float)this.width > Main.player[this.target].position.X + (float)Main.player[this.target].width && this.position.Y + (float)this.height < Main.player[this.target].position.Y + (float)Main.player[this.target].height - 16f) { flag115 = true; } if (flag115) { this.velocity.Y = this.velocity.Y + 0.5f; } else if (!Collision.SolidCollision(vector2195, num562, num563)) { if (this.velocity.Y < 0f) { this.velocity.Y = 0f; } if ((double)this.velocity.Y >= 0.1) { this.velocity.Y = this.velocity.Y + 0.5f; } else { this.velocity.Y = this.velocity.Y + 0.025f; } } else { if (this.velocity.Y > 0f) { this.velocity.Y = 0f; } if ((double)this.velocity.Y <= -0.2) { this.velocity.Y = this.velocity.Y - 0.2f; } else { this.velocity.Y = this.velocity.Y - 0.025f; } if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } } if (this.velocity.Y > 10f) { this.velocity.Y = 10f; return; } } else if (this.aiStyle != 62) { if (this.aiStyle == 63) { this.TargetClosest(true); float single417 = 11f; Vector2 vector2196 = new Vector2(base.Center.X + (float)(this.direction * 20), base.Center.Y + 6f); float x193 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector2196.X; float y194 = Main.player[this.target].Center.Y - vector2196.Y; float single418 = (float)Math.Sqrt((double)(x193 * x193 + y194 * y194)); float single419 = single417 / single418; x193 = x193 * single419; y194 = y194 * single419; if (Main.dayTime) { x193 = -x193; y194 = -y194; } this.ai[0] = this.ai[0] - 1f; if (single418 < 200f || this.ai[0] > 0f) { if (single418 < 200f) { this.ai[0] = 20f; } if (this.velocity.X >= 0f) { this.direction = 1; } else { this.direction = -1; } NPC nPC166 = this; nPC166.rotation = nPC166.rotation + (float)this.direction * 0.3f; return; } this.velocity.X = (this.velocity.X * 50f + x193) / 51f; this.velocity.Y = (this.velocity.Y * 50f + y194) / 51f; if (single418 < 350f) { this.velocity.X = (this.velocity.X * 10f + x193) / 11f; this.velocity.Y = (this.velocity.Y * 10f + y194) / 11f; } if (single418 < 300f) { this.velocity.X = (this.velocity.X * 7f + x193) / 8f; this.velocity.Y = (this.velocity.Y * 7f + y194) / 8f; } this.rotation = this.velocity.X * 0.15f; return; } if (this.aiStyle == 64) { float single420 = this.ai[0]; float single421 = this.ai[1]; if (Main.netMode != 1) { this.localAI[0] = this.localAI[0] - 1f; if (this.ai[3] == 0f) { this.ai[3] = (float)Main.rand.Next(75, 111) * 0.01f; } if (this.localAI[0] <= 0f) { this.TargetClosest(true); this.localAI[0] = (float)Main.rand.Next(60, 180); float single422 = Math.Abs(base.Center.X - Main.player[this.target].Center.X); if (single422 <= 700f || this.localAI[3] != 0f) { this.localAI[3] = 1f; float single423 = (float)Main.rand.Next(5, 151) * 0.01f; int num564 = Main.rand.Next(-100, 101); int num565 = Main.rand.Next(-100, 101); float single424 = single423 / (float)Math.Sqrt((double)(num564 * num564 + num565 * num565)); single420 = (float)num564 * single424; single421 = (float)num565 * single424; } else { float single425 = (float)Main.rand.Next(50, 151) * 0.01f; if (single422 > 1000f) { single425 = (float)Main.rand.Next(150, 201) * 0.01f; } else if (single422 > 850f) { single425 = (float)Main.rand.Next(100, 151) * 0.01f; } int num566 = this.direction * Main.rand.Next(100, 251); int num567 = Main.rand.Next(-50, 51); if (this.position.Y > Main.player[this.target].position.Y - 100f) { num567 = num567 - Main.rand.Next(100, 251); } float single426 = single425 / (float)Math.Sqrt((double)(num566 * num566 + num567 * num567)); single420 = (float)num566 * single426; single421 = (float)num567 * single426; } this.netUpdate = true; } } this.scale = this.ai[3]; if (this.localAI[2] > 0f) { int x194 = (int)base.Center.X / 16; int y195 = (int)base.Center.Y / 16; this.localAI[2] = this.localAI[2] - 1f; } else if (this.localAI[1] <= 0f) { this.localAI[1] = (float)Main.rand.Next(30, 180); if (!Main.dayTime || (double)(this.position.Y / 16f) > Main.worldSurface + 10) { this.localAI[2] = (float)Main.rand.Next(10, 30); } } else { this.localAI[1] = this.localAI[1] - 1f; } int num568 = 80; this.velocity.X = (this.velocity.X * (float)(num568 - 1) + single420) / (float)num568; this.velocity.Y = (this.velocity.Y * (float)(num568 - 1) + single421) / (float)num568; if (this.velocity.Y > 0f) { int num569 = 4; int x195 = (int)base.Center.X / 16; int y196 = (int)base.Center.Y / 16; for (int y410 = y196; y410 < y196 + num569; y410++) { if (Main.tile[x195, y410] != null && (Main.tile[x195, y410].nactive() && Main.tileSolid[Main.tile[x195, y410].type] || Main.tile[x195, y410].liquid > 0)) { single421 = single421 * -1f; if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.9f; } } } } if (this.velocity.Y < 0f) { int num570 = 30; bool flag116 = false; int x196 = (int)base.Center.X / 16; int y197 = (int)base.Center.Y / 16; for (int a4 = y197; a4 < y197 + num570; a4++) { if (Main.tile[x196, a4] != null && Main.tile[x196, a4].nactive() && Main.tileSolid[Main.tile[x196, a4].type]) { flag116 = true; } } if (!flag116) { single421 = single421 * -1f; if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.9f; } } } if (this.collideX) { single420 = (this.velocity.X >= 0f ? -Math.Abs(single420) : Math.Abs(single420)); this.velocity.X = this.velocity.X * -0.2f; } if (this.velocity.X < 0f) { this.direction = -1; } if (this.velocity.X > 0f) { this.direction = 1; } this.ai[0] = single420; this.ai[1] = single421; return; } if (this.aiStyle == 65) { float single427 = this.ai[0]; float single428 = this.ai[1]; if (Main.netMode != 1) { if (this.ai[2] == 0f) { int num571 = 0; int num572 = 4; int num573 = 6; int num574 = 3; int num575 = 7; int num576 = 2; int num577 = 1; int num578 = 5; int num579 = Main.rand.Next(100); if (num579 == 0) { num579 = num578; } else if (num579 < 3) { num579 = num577; } else if (num579 < 9) { num579 = num576; } else if (num579 < 19) { num579 = num575; } else if (num579 < 34) { num579 = num574; } else if (num579 >= 53) { num579 = (num579 >= 75 ? num571 : num572); } else { num579 = num573; } this.ai[2] = (float)(1 + num579); } if (this.ai[3] == 0f) { this.ai[3] = (float)Main.rand.Next(75, 111) * 0.01f; } this.localAI[0] = this.localAI[0] - 1f; if (this.localAI[0] <= 0f) { this.TargetClosest(true); this.localAI[0] = (float)Main.rand.Next(90, 240); float single429 = Math.Abs(base.Center.X - Main.player[this.target].Center.X); if (single429 <= 700f || this.localAI[3] != 0f) { this.localAI[3] = 1f; float single430 = (float)Main.rand.Next(26, 301) * 0.01f; int num580 = Main.rand.Next(-100, 101); int num581 = Main.rand.Next(-100, 101); float single431 = single430 / (float)Math.Sqrt((double)(num580 * num580 + num581 * num581)); single427 = (float)num580 * single431; single428 = (float)num581 * single431; } else { float single432 = (float)Main.rand.Next(50, 151) * 0.01f; if (single429 > 1000f) { single432 = (float)Main.rand.Next(150, 201) * 0.01f; } else if (single429 > 850f) { single432 = (float)Main.rand.Next(100, 151) * 0.01f; } int num582 = this.direction * Main.rand.Next(100, 251); int num583 = Main.rand.Next(-50, 51); if (this.position.Y > Main.player[this.target].position.Y - 100f) { num583 = num583 - Main.rand.Next(100, 251); } float single433 = single432 / (float)Math.Sqrt((double)(num582 * num582 + num583 * num583)); single427 = (float)num582 * single433; single428 = (float)num583 * single433; } this.netUpdate = true; } } this.scale = this.ai[3]; int num584 = 60; this.velocity.X = (this.velocity.X * (float)(num584 - 1) + single427) / (float)num584; this.velocity.Y = (this.velocity.Y * (float)(num584 - 1) + single428) / (float)num584; if (this.velocity.Y > 0f) { int num585 = 3; int x197 = (int)base.Center.X / 16; int y198 = (int)base.Center.Y / 16; for (int b4 = y198; b4 < y198 + num585; b4++) { if (Main.tile[x197, b4] != null && (Main.tile[x197, b4].nactive() && Main.tileSolid[Main.tile[x197, b4].type] || Main.tile[x197, b4].liquid > 0)) { single428 = single428 * -1f; if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.9f; } } } } if (this.velocity.Y < 0f) { int num586 = 30; bool flag117 = false; int x198 = (int)base.Center.X / 16; int y199 = (int)base.Center.Y / 16; for (int c4 = y199; c4 < y199 + num586; c4++) { if (Main.tile[x198, c4] != null && Main.tile[x198, c4].nactive() && Main.tileSolid[Main.tile[x198, c4].type]) { flag117 = true; } } if (!flag117) { single428 = single428 * -1f; if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.9f; } } } if (this.collideX) { single427 = (this.velocity.X >= 0f ? -Math.Abs(single427) : Math.Abs(single427)); this.velocity.X = this.velocity.X * -0.2f; } if (this.velocity.X < 0f) { this.direction = -1; } if (this.velocity.X > 0f) { this.direction = 1; } this.ai[0] = single427; this.ai[1] = single428; if (this.type == 356) { this.catchItem = (short)(1994f + this.ai[2] - 1f); return; } } else if (this.aiStyle == 66) { if (this.type == 357 || this.type == 448 || this.type >= 484 && this.type <= 487) { if (this.localAI[2] >= 90f) { this.friendly = false; } else { this.localAI[2] = this.localAI[2] + 1f; } } if (this.velocity.Y == 0f) { if (this.ai[0] != 1f) { this.velocity.X = 0f; } else { if (this.direction == 0) { this.TargetClosest(true); } if (this.collideX) { NPC nPC167 = this; nPC167.direction = nPC167.direction * -1; } float single435 = 0.2f; if (this.type == 485) { single435 = 0.25f; } if (this.type == 486) { single435 = 0.325f; } if (this.type == 487) { single435 = 0.4f; } this.velocity.X = single435 * (float)this.direction; if (this.type == 374) { this.velocity.X = this.velocity.X * 3f; } } if (Main.netMode != 1) { this.localAI[1] = this.localAI[1] - 1f; if (this.localAI[1] <= 0f) { if (this.ai[0] != 1f) { this.ai[0] = 1f; this.localAI[1] = (float)Main.rand.Next(600, 1800); } else { this.ai[0] = 0f; this.localAI[1] = (float)Main.rand.Next(300, 900); } this.netUpdate = true; } } } if (this.type == 374) { this.spriteDirection = this.direction; bool flag118 = false; int num587 = 0; while (num587 < 255) { Player player3 = Main.player[num587]; if (!player3.active || player3.dead || Vector2.Distance(player3.Center, base.Center) > 160f) { num587++; } else { flag118 = true; break; } } int num588 = 90; if (flag118 && this.ai[1] < (float)num588) { this.ai[1] = this.ai[1] + 1f; } if (this.ai[1] == (float)num588 && Main.netMode != 1) { this.position.Y = this.position.Y + 16f; this.Transform(375); this.netUpdate = true; return; } } } else if (this.aiStyle == 67) { if (this.type == 359) { if (this.ai[3] != 0f) { this.scale = this.ai[3]; int num589 = (int)(12f * this.scale); int num590 = (int)(12f * this.scale); if (num589 != this.width) { this.position.X = this.position.X + (float)(this.width / 2) - (float)num589 - 2f; this.width = num589; } if (num590 != this.height) { this.position.Y = this.position.Y + (float)this.height - (float)num590; this.height = num590; } } if (this.ai[3] == 0f && Main.netMode != 1) { this.ai[3] = (float)Main.rand.Next(80, 111) * 0.01f; this.netUpdate = true; } } float single436 = 0.3f; if (this.type == 360) { single436 = 0.6f; } if (this.ai[0] == 0f) { this.TargetClosest(true); this.directionY = 1; this.ai[0] = 1f; if (this.direction > 0) { this.spriteDirection = 1; } } bool flag119 = false; if (Main.netMode != 1) { if (this.ai[2] == 0f && Main.rand.Next(7200) == 0) { this.ai[2] = 2f; this.netUpdate = true; } if (this.collideX || this.collideY) { this.localAI[3] = 0f; } else { this.localAI[3] = this.localAI[3] + 1f; if (this.localAI[3] > 5f) { this.ai[2] = 2f; this.netUpdate = true; } } } if (this.ai[2] > 0f) { this.ai[1] = 0f; this.ai[0] = 1f; this.directionY = 1; if (this.velocity.Y <= single436) { this.rotation = 0f; } else { NPC nPC168 = this; nPC168.rotation = nPC168.rotation + (float)this.direction * 0.1f; } this.spriteDirection = this.direction; this.velocity.X = single436 * (float)this.direction; this.noGravity = false; int x199 = (int)(base.Center.X + (float)(this.width / 2 * -this.direction)) / 16; int y200 = (int)(this.position.Y + (float)this.height + 8f) / 16; if (Main.tile[x199, y200] != null && !Main.tile[x199, y200].topSlope() && this.collideY) { this.ai[2] = this.ai[2] - 1f; } y200 = (int)(this.position.Y + (float)this.height - 4f) / 16; x199 = (int)(base.Center.X + (float)(this.width / 2 * this.direction)) / 16; if (Main.tile[x199, y200] != null && Main.tile[x199, y200].bottomSlope()) { NPC nPC169 = this; nPC169.direction = nPC169.direction * -1; } if (this.collideX && this.velocity.Y == 0f) { flag119 = true; this.ai[2] = 0f; this.directionY = -1; this.ai[1] = 1f; } if (this.velocity.Y == 0f) { if (this.localAI[1] != this.position.X) { this.localAI[2] = 0f; this.localAI[1] = this.position.X; } else { this.localAI[2] = this.localAI[2] + 1f; if (this.localAI[2] > 10f) { this.direction = 1; this.velocity.X = (float)this.direction * single436; this.localAI[2] = 0f; } } } } if (this.ai[2] == 0f) { this.noGravity = true; if (this.ai[1] != 0f) { if (this.collideX) { this.ai[0] = 2f; } if (!this.collideX && this.ai[0] == 2f) { this.directionY = -this.directionY; this.ai[1] = 0f; this.ai[0] = 1f; } if (this.collideY) { this.direction = -this.direction; this.ai[1] = 0f; } } else { if (this.collideY) { this.ai[0] = 2f; } if (!this.collideY && this.ai[0] == 2f) { this.direction = -this.direction; this.ai[1] = 1f; this.ai[0] = 1f; } if (this.collideX) { this.directionY = -this.directionY; this.ai[1] = 1f; } } if (!flag119) { float single437 = this.rotation; if (this.directionY < 0) { if (this.direction < 0) { if (this.collideX) { this.rotation = 1.57f; this.spriteDirection = -1; } else if (this.collideY) { this.rotation = 3.14f; this.spriteDirection = 1; } } else if (this.collideY) { this.rotation = 3.14f; this.spriteDirection = -1; } else if (this.collideX) { this.rotation = 4.71f; this.spriteDirection = 1; } } else if (this.direction < 0) { if (this.collideY) { this.rotation = 0f; this.spriteDirection = -1; } else if (this.collideX) { this.rotation = 1.57f; this.spriteDirection = 1; } } else if (this.collideX) { this.rotation = 4.71f; this.spriteDirection = -1; } else if (this.collideY) { this.rotation = 0f; this.spriteDirection = 1; } float single438 = this.rotation; this.rotation = single437; if ((double)this.rotation > 6.28) { NPC nPC170 = this; nPC170.rotation = nPC170.rotation - 6.28f; } if (this.rotation < 0f) { NPC nPC171 = this; nPC171.rotation = nPC171.rotation + 6.28f; } float single439 = Math.Abs(this.rotation - single438); float single440 = 0.1f; if (this.rotation > single438) { if ((double)single439 <= 3.14) { NPC nPC172 = this; nPC172.rotation = nPC172.rotation - single440; if (this.rotation < single438) { this.rotation = single438; } } else { NPC nPC173 = this; nPC173.rotation = nPC173.rotation + single440; } } if (this.rotation < single438) { if ((double)single439 <= 3.14) { NPC nPC174 = this; nPC174.rotation = nPC174.rotation + single440; if (this.rotation > single438) { this.rotation = single438; } } else { NPC nPC175 = this; nPC175.rotation = nPC175.rotation - single440; } } } this.velocity.X = single436 * (float)this.direction; this.velocity.Y = single436 * (float)this.directionY; return; } } else if (this.aiStyle == 68) { this.noGravity = true; if (this.ai[0] == 0f) { this.noGravity = false; int num591 = this.direction; int num592 = this.target; this.TargetClosest(true); if (num592 >= 0 && num591 != 0) { this.direction = num591; } if (this.wet) { float single441 = 2f; this.velocity.X = (this.velocity.X * 19f + single441 * (float)this.direction) / 20f; int x200 = (int)(base.Center.X + (float)((this.width / 2 + 8) * this.direction)) / 16; int y201 = (int)(base.Center.Y / 16f); int y202 = (int)(this.position.Y / 16f); int y203 = (int)((this.position.Y + (float)this.height) / 16f); if (Main.tile[x200, y201] == null) { Main.tile[x200, y201] = new Tile(); } if (Main.tile[x200, y203] == null) { Main.tile[x200, y203] = new Tile(); } if (WorldGen.SolidTile(x200, y201) || WorldGen.SolidTile(x200, y202) || WorldGen.SolidTile(x200, y203) || Main.tile[x200, y203].liquid == 0) { NPC nPC176 = this; nPC176.direction = nPC176.direction * -1; } this.spriteDirection = this.direction; if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.5f; } this.noGravity = true; x200 = (int)(base.Center.X / 16f); y201 = (int)(base.Center.Y / 16f); float y204 = this.position.Y + (float)this.height; if (Main.tile[x200, y201 - 1] == null) { Main.tile[x200, y201 - 1] = new Tile(); } if (Main.tile[x200, y201] == null) { Main.tile[x200, y201] = new Tile(); } if (Main.tile[x200, y201 + 1] == null) { Main.tile[x200, y201 + 1] = new Tile(); } if (Main.tile[x200, y201 - 1].liquid > 0) { y204 = (float)(y201 * 16); y204 = y204 - (float)(Main.tile[x200, y201 - 1].liquid / 16); } else if (Main.tile[x200, y201].liquid > 0) { y204 = (float)((y201 + 1) * 16); y204 = y204 - (float)(Main.tile[x200, y201].liquid / 16); } else if (Main.tile[x200, y201 + 1].liquid > 0) { y204 = (float)((y201 + 2) * 16); y204 = y204 - (float)(Main.tile[x200, y201 + 1].liquid / 16); } y204 = y204 - 6f; if (base.Center.Y <= y204) { this.velocity.Y = y204 - base.Center.Y; } else { this.velocity.Y = this.velocity.Y - 0.1f; if (this.velocity.Y < -8f) { this.velocity.Y = -8f; } if (base.Center.Y + this.velocity.Y < y204) { this.velocity.Y = y204 - base.Center.Y; } } } if (Main.netMode != 1) { if (!this.wet) { this.ai[0] = 1f; this.netUpdate = true; this.direction = -this.direction; return; } Rectangle rectangle13 = new Rectangle((int)Main.player[this.target].position.X, (int)Main.player[this.target].position.Y, Main.player[this.target].width, Main.player[this.target].height); Rectangle rectangle14 = new Rectangle((int)this.position.X - 100, (int)this.position.Y - 100, this.width + 200, this.height + 200); if (rectangle14.Intersects(rectangle13) || this.life < this.lifeMax) { this.ai[0] = 1f; this.velocity.Y = this.velocity.Y - 6f; this.netUpdate = true; this.direction = -this.direction; return; } } } else if (!Main.player[this.target].dead) { bool flag120 = false; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= 300f) { flag120 = true; } if (!flag120) { if (this.collideX) { NPC nPC177 = this; nPC177.direction = nPC177.direction * -1; this.velocity.X = this.oldVelocity.X * -0.5f; if (this.direction == -1 && this.velocity.X > 0f && this.velocity.X < 2f) { this.velocity.X = 2f; } if (this.direction == 1 && this.velocity.X < 0f && this.velocity.X > -2f) { this.velocity.X = -2f; } } if (this.collideY) { this.velocity.Y = this.oldVelocity.Y * -0.5f; if (this.velocity.Y > 0f && this.velocity.Y < 1f) { this.velocity.Y = 1f; } if (this.velocity.Y < 0f && this.velocity.Y > -1f) { this.velocity.Y = -1f; } } if (this.direction == -1 && this.velocity.X > -3f) { this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > 3f) { this.velocity.X = this.velocity.X - 0.1f; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X - 0.05f; } if (this.velocity.X < -3f) { this.velocity.X = -3f; } } else if (this.direction == 1 && this.velocity.X < 3f) { this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -3f) { this.velocity.X = this.velocity.X + 0.1f; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X + 0.05f; } if (this.velocity.X > 3f) { this.velocity.X = 3f; } } int x201 = (int)((this.position.X + (float)(this.width / 2)) / 16f) + this.direction; int y205 = (int)((this.position.Y + (float)this.height) / 16f); bool flag121 = true; int num593 = 15; bool flag122 = false; int num594 = y205; while (num594 < y205 + num593) { if (Main.tile[x201, num594] == null) { Main.tile[x201, num594] = new Tile(); } if ((!Main.tile[x201, num594].nactive() || !Main.tileSolid[Main.tile[x201, num594].type]) && Main.tile[x201, num594].liquid <= 0) { num594++; } else { if (num594 < y205 + 5) { flag122 = true; } flag121 = false; break; } } if (!flag121) { this.velocity.Y = this.velocity.Y - 0.1f; } else { this.velocity.Y = this.velocity.Y + 0.1f; } if (flag122) { this.velocity.Y = this.velocity.Y - 0.2f; } if (this.velocity.Y > 3f) { this.velocity.Y = 3f; } if (this.velocity.Y < -4f) { this.velocity.Y = -4f; return; } } else if (this.velocity.Y == 0f || this.collideY || this.wet) { this.velocity.X = 0f; this.velocity.Y = 0f; this.ai[0] = 0f; this.ai[1] = 0f; if (Main.netMode != 1) { if ((this.type == 363 || this.type == 365) && !this.wet) { int num595 = this.direction; this.Transform(this.type - 1); this.TargetClosest(true); this.direction = num595; this.ai[0] = 0f; this.ai[1] = (float)(200 + Main.rand.Next(200)); } this.netUpdate = true; return; } } else { this.velocity.X = this.velocity.X * 0.98f; this.velocity.Y = this.velocity.Y + 0.1f; if (this.velocity.Y > 2f) { this.velocity.Y = 2f; return; } } } } else if (this.aiStyle == 69) { bool flag123 = Main.expertMode; float single442 = (flag123 ? 0.6f * Main.damageMultiplier : 1f); bool flag124 = (double)this.life <= (double)this.lifeMax * 0.5; bool flag125 = (!flag123 ? false : (double)this.life <= (double)this.lifeMax * 0.15); bool flag126 = this.ai[0] > 4f; bool flag127 = this.ai[0] > 9f; bool flag128 = this.ai[3] < 10f; if (flag127) { this.damage = (int)((float)this.defDamage * 1.1f * single442); this.defense = 0; } else if (!flag126) { this.damage = this.defDamage; this.defense = this.defDefense; } else { this.damage = (int)((float)this.defDamage * 1.2f * single442); this.defense = (int)((float)this.defDefense * 0.8f); } int num596 = (flag123 ? 40 : 60); float single443 = (flag123 ? 0.55f : 0.45f); float single444 = (flag123 ? 8.5f : 7.5f); if (flag127) { single443 = 0.7f; single444 = 12f; num596 = 30; } else if (flag126 && flag128) { single443 = (flag123 ? 0.6f : 0.5f); single444 = (flag123 ? 10f : 8f); num596 = (flag123 ? 40 : 20); } else if (flag128 && !flag126 && !flag127) { num596 = 30; } int num597 = (flag123 ? 28 : 30); float single445 = (flag123 ? 17f : 16f); if (flag127) { num597 = 25; single445 = 27f; } else if (flag128 && flag126) { num597 = (flag123 ? 27 : 30); if (flag123) { single445 = 21f; } } int num598 = 80; int num599 = 4; float single446 = 0.3f; float single447 = 5f; int num600 = 90; int num601 = 180; int num602 = 180; int num603 = 30; int num604 = 120; int num605 = 4; float single448 = 6f; float single449 = 20f; float single450 = 6.28318548f / (float)(num604 / 2); int num606 = 75; Vector2 center33 = base.Center; Player player4 = Main.player[this.target]; if (this.target < 0 || this.target == 255 || player4.dead || !player4.active) { this.TargetClosest(true); player4 = Main.player[this.target]; this.netUpdate = true; } if (player4.dead || Vector2.Distance(player4.Center, center33) > 2400f) { this.velocity.Y = this.velocity.Y - 0.4f; if (this.timeLeft > 10) { this.timeLeft = 10; } if (this.ai[0] <= 4f) { this.ai[0] = 0f; } else { this.ai[0] = 5f; } this.ai[2] = 0f; } if (player4.position.Y < 800f || (double)player4.position.Y > Main.worldSurface * 16) { flag4 = true; } else { flag4 = (player4.position.X <= 6400f ? false : player4.position.X < (float)(Main.maxTilesX * 16 - 6400)); } if (flag4) { num596 = 20; this.damage = this.defDamage * 2; this.defense = this.defDefense * 2; this.ai[3] = 0f; single445 = single445 + 6f; } if (this.localAI[0] == 0f) { this.localAI[0] = 1f; this.alpha = 255; this.rotation = 0f; if (Main.netMode != 1) { this.ai[0] = -1f; this.netUpdate = true; } } float single451 = (float)Math.Atan2((double)(player4.Center.Y - center33.Y), (double)(player4.Center.X - center33.X)); if (this.spriteDirection == 1) { single451 = single451 + 3.14159274f; } if (single451 < 0f) { single451 = single451 + 6.28318548f; } if (single451 > 6.28318548f) { single451 = single451 - 6.28318548f; } if (this.ai[0] == -1f) { single451 = 0f; } if (this.ai[0] == 3f) { single451 = 0f; } if (this.ai[0] == 4f) { single451 = 0f; } if (this.ai[0] == 8f) { single451 = 0f; } float single452 = 0.04f; if (this.ai[0] == 1f || this.ai[0] == 6f) { single452 = 0f; } if (this.ai[0] == 7f) { single452 = 0f; } if (this.ai[0] == 3f) { single452 = 0.01f; } if (this.ai[0] == 4f) { single452 = 0.01f; } if (this.ai[0] == 8f) { single452 = 0.01f; } if (this.rotation < single451) { if ((double)(single451 - this.rotation) <= 3.14159265358979) { NPC nPC178 = this; nPC178.rotation = nPC178.rotation + single452; } else { NPC nPC179 = this; nPC179.rotation = nPC179.rotation - single452; } } if (this.rotation > single451) { if ((double)(this.rotation - single451) <= 3.14159265358979) { NPC nPC180 = this; nPC180.rotation = nPC180.rotation - single452; } else { NPC nPC181 = this; nPC181.rotation = nPC181.rotation + single452; } } if (this.rotation > single451 - single452 && this.rotation < single451 + single452) { this.rotation = single451; } if (this.rotation < 0f) { NPC nPC182 = this; nPC182.rotation = nPC182.rotation + 6.28318548f; } if (this.rotation > 6.28318548f) { NPC nPC183 = this; nPC183.rotation = nPC183.rotation - 6.28318548f; } if (this.rotation > single451 - single452 && this.rotation < single451 + single452) { this.rotation = single451; } if (this.ai[0] != -1f && this.ai[0] < 9f) { if (!Collision.SolidCollision(this.position, this.width, this.height)) { NPC nPC184 = this; nPC184.alpha = nPC184.alpha - 15; } else { NPC nPC185 = this; nPC185.alpha = nPC185.alpha + 15; } if (this.alpha < 0) { this.alpha = 0; } if (this.alpha > 150) { this.alpha = 150; } } if (this.ai[0] == -1f) { NPC nPC186 = this; nPC186.velocity = nPC186.velocity * 0.98f; int num607 = Math.Sign(player4.Center.X - center33.X); if (num607 != 0) { this.direction = num607; this.spriteDirection = -this.direction; } if (this.ai[2] > 20f) { this.velocity.Y = -2f; NPC nPC187 = this; nPC187.alpha = nPC187.alpha - 5; if (Collision.SolidCollision(this.position, this.width, this.height)) { NPC nPC188 = this; nPC188.alpha = nPC188.alpha + 15; } if (this.alpha < 0) { this.alpha = 0; } if (this.alpha > 150) { this.alpha = 150; } } this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= (float)num606) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[2] = 0f; this.netUpdate = true; return; } } else if (this.ai[0] == 0f && !player4.dead) { if (this.ai[1] == 0f) { this.ai[1] = (float)(300 * Math.Sign((center33 - player4.Center).X)); } Vector2 center35 = (player4.Center + new Vector2(this.ai[1], -200f)) - center33; Vector2 vector2199 = Vector2.Normalize(center35 - this.velocity) * single444; if (this.velocity.X < vector2199.X) { this.velocity.X = this.velocity.X + single443; if (this.velocity.X < 0f && vector2199.X > 0f) { this.velocity.X = this.velocity.X + single443; } } else if (this.velocity.X > vector2199.X) { this.velocity.X = this.velocity.X - single443; if (this.velocity.X > 0f && vector2199.X < 0f) { this.velocity.X = this.velocity.X - single443; } } if (this.velocity.Y < vector2199.Y) { this.velocity.Y = this.velocity.Y + single443; if (this.velocity.Y < 0f && vector2199.Y > 0f) { this.velocity.Y = this.velocity.Y + single443; } } else if (this.velocity.Y > vector2199.Y) { this.velocity.Y = this.velocity.Y - single443; if (this.velocity.Y > 0f && vector2199.Y < 0f) { this.velocity.Y = this.velocity.Y - single443; } } int num611 = Math.Sign(player4.Center.X - center33.X); if (num611 != 0) { if (this.ai[2] == 0f && num611 != this.direction) { NPC nPC189 = this; nPC189.rotation = nPC189.rotation + 3.14159274f; } this.direction = num611; if (this.spriteDirection != -this.direction) { NPC nPC190 = this; nPC190.rotation = nPC190.rotation + 3.14159274f; } this.spriteDirection = -this.direction; } this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= (float)num596) { int num612 = 0; num6 = (int)this.ai[3]; switch (num6) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: { num612 = 1; break; } case 10: { this.ai[3] = 1f; num612 = 2; break; } case 11: { this.ai[3] = 0f; num612 = 3; break; } } if (flag124) { num612 = 4; } if (num612 == 1) { this.ai[0] = 1f; this.ai[1] = 0f; this.ai[2] = 0f; this.velocity = Vector2.Normalize(player4.Center - center33) * single445; this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X); if (num611 != 0) { this.direction = num611; if (this.spriteDirection == 1) { NPC nPC191 = this; nPC191.rotation = nPC191.rotation + 3.14159274f; } this.spriteDirection = -this.direction; } } else if (num612 == 2) { this.ai[0] = 2f; this.ai[1] = 0f; this.ai[2] = 0f; } else if (num612 == 3) { this.ai[0] = 3f; this.ai[1] = 0f; this.ai[2] = 0f; } else if (num612 == 4) { this.ai[0] = 4f; this.ai[1] = 0f; this.ai[2] = 0f; } this.netUpdate = true; return; } } else if (this.ai[0] == 1f) { this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= (float)num597) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = this.ai[3] + 2f; this.netUpdate = true; return; } } else if (this.ai[0] == 2f) { if (this.ai[1] == 0f) { this.ai[1] = (float)(300 * Math.Sign((center33 - player4.Center).X)); } Vector2 center36 = (player4.Center + new Vector2(this.ai[1], -200f)) - center33; Vector2 vector2202 = Vector2.Normalize(center36 - this.velocity) * single447; if (this.velocity.X < vector2202.X) { this.velocity.X = this.velocity.X + single446; if (this.velocity.X < 0f && vector2202.X > 0f) { this.velocity.X = this.velocity.X + single446; } } else if (this.velocity.X > vector2202.X) { this.velocity.X = this.velocity.X - single446; if (this.velocity.X > 0f && vector2202.X < 0f) { this.velocity.X = this.velocity.X - single446; } } if (this.velocity.Y < vector2202.Y) { this.velocity.Y = this.velocity.Y + single446; if (this.velocity.Y < 0f && vector2202.Y > 0f) { this.velocity.Y = this.velocity.Y + single446; } } else if (this.velocity.Y > vector2202.Y) { this.velocity.Y = this.velocity.Y - single446; if (this.velocity.Y > 0f && vector2202.Y < 0f) { this.velocity.Y = this.velocity.Y - single446; } } if (this.ai[2] % (float)num599 == 0f) { if (Main.netMode != 1) { Vector2 vector2203 = ((Vector2.Normalize(player4.Center - center33) * (float)(this.width + 20)) / 2f) + center33; NPC.NewNPC((int)vector2203.X, (int)vector2203.Y + 45, 371, 0, 0f, 0f, 0f, 0f, 255); } } int num616 = Math.Sign(player4.Center.X - center33.X); if (num616 != 0) { this.direction = num616; if (this.spriteDirection != -this.direction) { NPC nPC192 = this; nPC192.rotation = nPC192.rotation + 3.14159274f; } this.spriteDirection = -this.direction; } this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= (float)num598) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[2] = 0f; this.netUpdate = true; return; } } else if (this.ai[0] == 3f) { NPC nPC193 = this; nPC193.velocity = nPC193.velocity * 0.98f; this.velocity.Y = MathHelper.Lerp(this.velocity.Y, 0f, 0.02f); if (Main.netMode != 1 && this.ai[2] == (float)(num600 - 30)) { Vector2 rotationVector22 = (((this.rotation.ToRotationVector2() * Vector2.UnitX * (float)this.direction) * (float)(this.width + 20)) / 2f) + center33; Projectile.NewProjectile(rotationVector22.X, rotationVector22.Y, (float)(this.direction * 2), 8f, 385, 0, 0f, Main.myPlayer, 0f, 0f); Projectile.NewProjectile(rotationVector22.X, rotationVector22.Y, (float)(-this.direction * 2), 8f, 385, 0, 0f, Main.myPlayer, 0f, 0f); } this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= (float)num600) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[2] = 0f; this.netUpdate = true; return; } } else if (this.ai[0] == 4f) { NPC nPC194 = this; nPC194.velocity = nPC194.velocity * 0.98f; this.velocity.Y = MathHelper.Lerp(this.velocity.Y, 0f, 0.02f); this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= (float)num601) { this.ai[0] = 5f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; return; } } else if (this.ai[0] == 5f && !player4.dead) { if (this.ai[1] == 0f) { this.ai[1] = (float)(300 * Math.Sign((center33 - player4.Center).X)); } Vector2 center37 = (player4.Center + new Vector2(this.ai[1], -200f)) - center33; Vector2 vector2204 = Vector2.Normalize(center37 - this.velocity) * single444; if (this.velocity.X < vector2204.X) { this.velocity.X = this.velocity.X + single443; if (this.velocity.X < 0f && vector2204.X > 0f) { this.velocity.X = this.velocity.X + single443; } } else if (this.velocity.X > vector2204.X) { this.velocity.X = this.velocity.X - single443; if (this.velocity.X > 0f && vector2204.X < 0f) { this.velocity.X = this.velocity.X - single443; } } if (this.velocity.Y < vector2204.Y) { this.velocity.Y = this.velocity.Y + single443; if (this.velocity.Y < 0f && vector2204.Y > 0f) { this.velocity.Y = this.velocity.Y + single443; } } else if (this.velocity.Y > vector2204.Y) { this.velocity.Y = this.velocity.Y - single443; if (this.velocity.Y > 0f && vector2204.Y < 0f) { this.velocity.Y = this.velocity.Y - single443; } } int num617 = Math.Sign(player4.Center.X - center33.X); if (num617 != 0) { if (this.ai[2] == 0f && num617 != this.direction) { NPC nPC195 = this; nPC195.rotation = nPC195.rotation + 3.14159274f; } this.direction = num617; if (this.spriteDirection != -this.direction) { NPC nPC196 = this; nPC196.rotation = nPC196.rotation + 3.14159274f; } this.spriteDirection = -this.direction; } this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= (float)num596) { int num618 = 0; num6 = (int)this.ai[3]; switch (num6) { case 0: case 1: case 2: case 3: case 4: case 5: { num618 = 1; break; } case 6: { this.ai[3] = 1f; num618 = 2; break; } case 7: { this.ai[3] = 0f; num618 = 3; break; } } if (flag125) { num618 = 4; } if (num618 == 1) { this.ai[0] = 6f; this.ai[1] = 0f; this.ai[2] = 0f; this.velocity = Vector2.Normalize(player4.Center - center33) * single445; this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X); if (num617 != 0) { this.direction = num617; if (this.spriteDirection == 1) { NPC nPC197 = this; nPC197.rotation = nPC197.rotation + 3.14159274f; } this.spriteDirection = -this.direction; } } else if (num618 == 2) { this.velocity = Vector2.Normalize(player4.Center - center33) * single449; this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X); if (num617 != 0) { this.direction = num617; if (this.spriteDirection == 1) { NPC nPC198 = this; nPC198.rotation = nPC198.rotation + 3.14159274f; } this.spriteDirection = -this.direction; } this.ai[0] = 7f; this.ai[1] = 0f; this.ai[2] = 0f; } else if (num618 == 3) { this.ai[0] = 8f; this.ai[1] = 0f; this.ai[2] = 0f; } else if (num618 == 4) { this.ai[0] = 9f; this.ai[1] = 0f; this.ai[2] = 0f; } this.netUpdate = true; return; } } else if (this.ai[0] == 6f) { this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= (float)num597) { this.ai[0] = 5f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = this.ai[3] + 2f; this.netUpdate = true; return; } } else if (this.ai[0] == 7f) { if (this.ai[2] % (float)num605 == 0f) { if (Main.netMode != 1) { Vector2 vector2207 = ((Vector2.Normalize(this.velocity) * (float)(this.width + 20)) / 2f) + center33; int num622 = NPC.NewNPC((int)vector2207.X, (int)vector2207.Y + 45, 371, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num622].target = this.target; NPC nPC199 = Main.npc[num622]; Vector2 vector2208 = Vector2.Normalize(this.velocity); double num623 = (double)(1.57079637f * (float)this.direction); vector24 = new Vector2(); nPC199.velocity = vector2208.RotatedBy(num623, vector24) * single448; Main.npc[num622].netUpdate = true; Main.npc[num622].ai[3] = (float)Main.rand.Next(80, 121) / 100f; } } Vector2 vector2209 = this.velocity; double num624 = (double)(-single450 * (float)this.direction); vector24 = new Vector2(); this.velocity = vector2209.RotatedBy(num624, vector24); NPC nPC200 = this; nPC200.rotation = nPC200.rotation - single450 * (float)this.direction; this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= (float)num604) { this.ai[0] = 5f; this.ai[1] = 0f; this.ai[2] = 0f; this.netUpdate = true; return; } } else if (this.ai[0] == 8f) { NPC nPC201 = this; nPC201.velocity = nPC201.velocity * 0.98f; this.velocity.Y = MathHelper.Lerp(this.velocity.Y, 0f, 0.02f); if (Main.netMode != 1 && this.ai[2] == (float)(num600 - 30)) { Projectile.NewProjectile(center33.X, center33.Y, 0f, 0f, 385, 0, 0f, Main.myPlayer, 1f, (float)(this.target + 1)); } this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= (float)num600) { this.ai[0] = 5f; this.ai[1] = 0f; this.ai[2] = 0f; this.netUpdate = true; return; } } else if (this.ai[0] == 9f) { if (this.ai[2] < (float)(num602 - 90)) { if (!Collision.SolidCollision(this.position, this.width, this.height)) { NPC nPC202 = this; nPC202.alpha = nPC202.alpha - 15; } else { NPC nPC203 = this; nPC203.alpha = nPC203.alpha + 15; } if (this.alpha < 0) { this.alpha = 0; } if (this.alpha > 150) { this.alpha = 150; } } else if (this.alpha < 255) { NPC nPC204 = this; nPC204.alpha = nPC204.alpha + 4; if (this.alpha > 255) { this.alpha = 255; } } NPC nPC205 = this; nPC205.velocity = nPC205.velocity * 0.98f; this.velocity.Y = MathHelper.Lerp(this.velocity.Y, 0f, 0.02f); this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= (float)num602) { this.ai[0] = 10f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; return; } } else if (this.ai[0] == 10f && !player4.dead) { this.dontTakeDamage = false; this.chaseable = false; if (this.alpha < 255) { NPC nPC206 = this; nPC206.alpha = nPC206.alpha + 25; if (this.alpha > 255) { this.alpha = 255; } } if (this.ai[1] == 0f) { this.ai[1] = (float)(360 * Math.Sign((center33 - player4.Center).X)); } Vector2 center38 = (player4.Center + new Vector2(this.ai[1], -200f)) - center33; Vector2 vector2210 = Vector2.Normalize(center38 - this.velocity) * single444; this.SimpleFlyMovement(vector2210, single443); int num625 = Math.Sign(player4.Center.X - center33.X); if (num625 != 0) { if (this.ai[2] == 0f && num625 != this.direction) { NPC nPC207 = this; nPC207.rotation = nPC207.rotation + 3.14159274f; for (int g4 = 0; g4 < (int)this.oldPos.Length; g4++) { this.oldPos[g4] = Vector2.Zero; } } this.direction = num625; if (this.spriteDirection != -this.direction) { NPC nPC208 = this; nPC208.rotation = nPC208.rotation + 3.14159274f; } this.spriteDirection = -this.direction; } this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= (float)num596) { int num626 = 0; num6 = (int)this.ai[3]; switch (num6) { case 0: case 2: case 3: case 5: case 6: case 7: { num626 = 1; break; } case 1: case 4: case 8: { num626 = 2; break; } } if (num626 == 1) { this.ai[0] = 11f; this.ai[1] = 0f; this.ai[2] = 0f; this.velocity = Vector2.Normalize(player4.Center - center33) * single445; this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X); if (num625 != 0) { this.direction = num625; if (this.spriteDirection == 1) { NPC nPC209 = this; nPC209.rotation = nPC209.rotation + 3.14159274f; } this.spriteDirection = -this.direction; } } else if (num626 == 2) { this.ai[0] = 12f; this.ai[1] = 0f; this.ai[2] = 0f; } else if (num626 == 3) { this.ai[0] = 13f; this.ai[1] = 0f; this.ai[2] = 0f; } this.netUpdate = true; return; } } else if (this.ai[0] == 11f) { this.dontTakeDamage = false; this.chaseable = true; NPC nPC210 = this; nPC210.alpha = nPC210.alpha - 25; if (this.alpha < 0) { this.alpha = 0; } this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= (float)num597) { this.ai[0] = 10f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = this.ai[3] + 1f; this.netUpdate = true; return; } } else if (this.ai[0] == 12f) { this.dontTakeDamage = true; this.chaseable = false; if (this.alpha < 255) { NPC nPC211 = this; nPC211.alpha = nPC211.alpha + 17; if (this.alpha > 255) { this.alpha = 255; } } NPC nPC212 = this; nPC212.velocity = nPC212.velocity * 0.98f; this.velocity.Y = MathHelper.Lerp(this.velocity.Y, 0f, 0.02f); if (Main.netMode != 1 && this.ai[2] == (float)(num603 / 2)) { if (this.ai[1] == 0f) { this.ai[1] = (float)(300 * Math.Sign((center33 - player4.Center).X)); } Vector2 center39 = player4.Center + new Vector2(-this.ai[1], -200f); Vector2 vector2213 = center39; vector24 = vector2213; base.Center = vector2213; center33 = vector24; int num630 = Math.Sign(player4.Center.X - center33.X); if (num630 != 0) { if (this.ai[2] == 0f && num630 != this.direction) { NPC nPC213 = this; nPC213.rotation = nPC213.rotation + 3.14159274f; for (int i5 = 0; i5 < (int)this.oldPos.Length; i5++) { this.oldPos[i5] = Vector2.Zero; } } this.direction = num630; if (this.spriteDirection != -this.direction) { NPC nPC214 = this; nPC214.rotation = nPC214.rotation + 3.14159274f; } this.spriteDirection = -this.direction; } } this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= (float)num603) { this.ai[0] = 10f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = this.ai[3] + 1f; if (this.ai[3] >= 9f) { this.ai[3] = 0f; } this.netUpdate = true; return; } } else if (this.ai[0] == 13f) { Vector2 vector2214 = this.velocity; double num631 = (double)(-single450 * (float)this.direction); vector24 = new Vector2(); this.velocity = vector2214.RotatedBy(num631, vector24); NPC nPC215 = this; nPC215.rotation = nPC215.rotation - single450 * (float)this.direction; this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= (float)num604) { this.ai[0] = 10f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = this.ai[3] + 1f; this.netUpdate = true; return; } } } else if (this.aiStyle == 70) { if (this.target == 255) { this.TargetClosest(true); this.ai[3] = (float)Main.rand.Next(80, 121) / 100f; float single453 = (float)Main.rand.Next(165, 265) / 15f; this.velocity = Vector2.Normalize((Main.player[this.target].Center - base.Center) + new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101))) * single453; this.netUpdate = true; } Vector2 vector2215 = Vector2.Normalize(Main.player[this.target].Center - base.Center); this.velocity = ((this.velocity * 40f) + (vector2215 * 20f)) / 41f; this.scale = this.ai[3]; NPC nPC216 = this; nPC216.alpha = nPC216.alpha - 30; if (this.alpha < 50) { this.alpha = 50; } this.alpha = 50; this.velocity.X = (this.velocity.X * 50f + Main.windSpeed * 2f + (float)Main.rand.Next(-10, 11) * 0.1f) / 51f; this.velocity.Y = (this.velocity.Y * 50f + -0.25f + (float)Main.rand.Next(-10, 11) * 0.2f) / 51f; if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y - 0.04f; } if (this.ai[0] == 0f) { int num632 = 40; Rectangle rect = this.getRect(); rect.X = rect.X - (num632 + this.width / 2); rect.Y = rect.Y - (num632 + this.height / 2); rect.Width = rect.Width + num632 * 2; rect.Height = rect.Height + num632 * 2; int num633 = 0; while (num633 < 255) { Player player5 = Main.player[num633]; if (!player5.active || player5.dead || !rect.Intersects(player5.getRect())) { num633++; } else { this.ai[0] = 1f; this.ai[1] = 4f; this.netUpdate = true; break; } } } if (this.ai[0] == 0f) { this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= 150f) { this.ai[0] = 1f; this.ai[1] = 4f; } } if (this.ai[0] == 1f) { this.ai[1] = this.ai[1] - 1f; if (this.ai[1] <= 0f) { this.life = 0; this.HitEffect(0, 10); this.active = false; return; } } if (this.justHit || this.ai[0] == 1f) { this.dontTakeDamage = true; this.position = base.Center; int num634 = 100; num6 = num634; this.height = num634; this.width = num6; this.position = new Vector2(this.position.X - (float)(this.width / 2), this.position.Y - (float)(this.height / 2)); if (this.timeLeft > 3) { this.timeLeft = 3; return; } } } else if (this.aiStyle == 71) { this.noTileCollide = true; int num635 = 90; if (this.target < 0 || this.target == 255 || Main.player[this.target].dead) { this.TargetClosest(false); this.direction = 1; this.netUpdate = true; } if (this.ai[0] == 0f) { this.ai[1] = this.ai[1] + 1f; int num636 = this.type; this.noGravity = true; this.dontTakeDamage = true; this.velocity.Y = this.ai[3]; if (this.type == 373) { float single454 = 0.104719758f; float single455 = this.ai[2]; float single456 = (float)(Math.Cos((double)(single454 * this.localAI[1])) - 0.5) * single455; this.position.X = this.position.X - single456 * (float)(-this.direction); this.localAI[1] = this.localAI[1] + 1f; single456 = (float)(Math.Cos((double)(single454 * this.localAI[1])) - 0.5) * single455; this.position.X = this.position.X + single456 * (float)(-this.direction); if (Math.Abs(Math.Cos((double)(single454 * this.localAI[1])) - 0.5) > 0.25) { this.spriteDirection = (Math.Cos((double)(single454 * this.localAI[1])) - 0.5 >= 0 ? -1 : 1); } this.rotation = this.velocity.Y * (float)this.spriteDirection * 0.1f; if ((double)this.rotation < -0.2) { this.rotation = -0.2f; } if ((double)this.rotation > 0.2) { this.rotation = 0.2f; } NPC nPC217 = this; nPC217.alpha = nPC217.alpha - 6; if (this.alpha < 0) { this.alpha = 0; } } if (this.ai[1] >= (float)num635) { this.ai[0] = 1f; this.ai[1] = 0f; if (!Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[1] = 1f; } this.TargetClosest(true); this.spriteDirection = this.direction; Vector2 center40 = Main.player[this.target].Center - base.Center; center40.Normalize(); this.velocity = center40 * 16f; this.rotation = this.velocity.ToRotation(); if (this.direction == -1) { this.rotation = this.rotation + 3.14159274f; } this.netUpdate = true; return; } } else if (this.ai[0] == 1f) { this.noGravity = true; if (Collision.SolidCollision(this.position, this.width, this.height)) { NPC nPC218 = this; nPC218.alpha = nPC218.alpha - 15; if (this.alpha < 150) { this.alpha = 150; } } else if (this.ai[1] < 1f) { this.ai[1] = 1f; } if (this.ai[1] >= 1f) { NPC nPC219 = this; nPC219.alpha = nPC219.alpha - 60; if (this.alpha < 0) { this.alpha = 0; } this.dontTakeDamage = false; this.ai[1] = this.ai[1] + 1f; if (Collision.SolidCollision(this.position, this.width, this.height)) { this.life = 0; this.HitEffect(0, 10); this.active = false; return; } } if (this.ai[1] >= 60f) { this.noGravity = false; } this.rotation = this.velocity.ToRotation(); if (this.direction == -1) { this.rotation = this.rotation + 3.14159274f; return; } } } else if (this.aiStyle == 72) { if (this.type == 384) { int num637 = (int)this.ai[0]; if (!Main.npc[num637].active || Main.npc[num637].type != 383) { this.life = 0; this.HitEffect(0, 10); this.active = false; return; } this.velocity = Vector2.Zero; this.position = Main.npc[num637].Center; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.gfxOffY = Main.npc[num637].gfxOffY; return; } } else if (this.aiStyle == 73) { this.TargetClosest(false); this.spriteDirection = this.direction; this.velocity.X = this.velocity.X * 0.93f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } if (this.type == 387) { float single457 = 120f; float single458 = 60f; if (this.ai[1] < single457) { this.ai[1] = this.ai[1] + 1f; if (this.ai[1] <= 60f) { this.alpha = 255; } else { float single459 = (this.ai[1] - single458) / (single457 - single458); this.alpha = (int)((1f - single459) * 255f); } this.dontTakeDamage = true; this.frameCounter = 0; this.frame.Y = 0; return; } this.dontTakeDamage = false; } if (this.ai[0] < 60f) { this.ai[0] = this.ai[0] + 1f; } if (this.justHit) { this.ai[0] = -30f; } if (this.ai[0] == 60f) { this.ai[0] = -120f; Vector2 center43 = Main.player[this.target].Center; Vector2 center44 = base.Center - (Vector2.UnitY * 10f); Vector2 unitY3 = center43 - center44; unitY3.X = unitY3.X + (float)Main.rand.Next(-100, 101); unitY3.Y = unitY3.Y + (float)Main.rand.Next(-100, 101); unitY3.X = unitY3.X * ((float)Main.rand.Next(70, 131) * 0.01f); unitY3.Y = unitY3.Y * ((float)Main.rand.Next(70, 131) * 0.01f); unitY3.Normalize(); if (float.IsNaN(unitY3.X) || float.IsNaN(unitY3.Y)) { unitY3 = -Vector2.UnitY; } unitY3 = unitY3 * 14f; int num640 = 35; if (Main.expertMode && this.type >= 381 && this.type <= 392) { num640 = (int)((double)num640 * 0.8); } Projectile.NewProjectile(center44.X, center44.Y, unitY3.X, unitY3.Y, 435, num640, 0f, Main.myPlayer, 0f, 0f); return; } } else if (this.aiStyle == 74) { this.TargetClosest(false); this.rotation = this.velocity.ToRotation(); if (Math.Sign(this.velocity.X) != 0) { this.spriteDirection = -Math.Sign(this.velocity.X); } if (this.rotation < -1.57079637f) { NPC nPC220 = this; nPC220.rotation = nPC220.rotation + 3.14159274f; } if (this.rotation > 1.57079637f) { NPC nPC221 = this; nPC221.rotation = nPC221.rotation - 3.14159274f; } if (this.type == 418) { this.spriteDirection = Math.Sign(this.velocity.X); } float single462 = 0.4f; float single463 = 10f; float single464 = 200f; float single465 = 750f; float single466 = 30f; float single467 = 30f; float single468 = 0.95f; int num641 = 50; float single469 = 14f; float single470 = 30f; float single471 = 100f; float single472 = 20f; float single473 = 0f; float single474 = 7f; bool flag129 = true; if (this.type == 418) { single462 = 0.3f; single463 = 8f; single464 = 300f; single465 = 800f; single466 = 60f; single467 = 5f; single468 = 0.8f; num641 = 0; single469 = 10f; single470 = 30f; single471 = 150f; single472 = 60f; single473 = 0.333333343f; single474 = 8f; flag129 = false; } single473 = single473 * single472; if (Main.expertMode) { single462 = single462 * Main.expertKnockBack; } if (this.type == 418) { } if (this.ai[0] == 0f) { this.knockBackResist = single462; float single475 = single463; Vector2 center46 = base.Center; Vector2 center47 = Main.player[this.target].Center; Vector2 vector2218 = center47 - center46; Vector2 unitY4 = vector2218 - (Vector2.UnitY * single464); float single476 = vector2218.Length(); vector2218 = Vector2.Normalize(vector2218) * single475; unitY4 = Vector2.Normalize(unitY4) * single475; bool flag130 = Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1); float single477 = 8f; flag130 = (!flag130 || vector2218.ToRotation() <= 3.14159274f / single477 ? false : vector2218.ToRotation() < 3.14159274f - 3.14159274f / single477); if (single476 > single465 || !flag130) { this.velocity.X = (this.velocity.X * (single466 - 1f) + unitY4.X) / single466; this.velocity.Y = (this.velocity.Y * (single466 - 1f) + unitY4.Y) / single466; } else { this.ai[0] = 1f; this.ai[2] = vector2218.X; this.ai[3] = vector2218.Y; this.netUpdate = true; } } else if (this.ai[0] == 1f) { this.knockBackResist = 0f; NPC nPC222 = this; nPC222.velocity = nPC222.velocity * single468; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= single467) { this.ai[0] = 2f; this.ai[1] = 0f; this.netUpdate = true; Vector2 vector2219 = new Vector2(this.ai[2], this.ai[3]) + (new Vector2((float)Main.rand.Next(-num641, num641 + 1), (float)Main.rand.Next(-num641, num641 + 1)) * 0.04f); vector2219.Normalize(); vector2219 = vector2219 * single469; this.velocity = vector2219; } } else if (this.ai[0] == 2f) { this.knockBackResist = 0f; float single478 = single470; this.ai[1] = this.ai[1] + 1f; bool flag131 = (Vector2.Distance(base.Center, Main.player[this.target].Center) <= single471 ? false : base.Center.Y > Main.player[this.target].Center.Y); if ((this.ai[1] < single478 || !flag131) && this.velocity.Length() >= single474) { Vector2 center48 = base.Center; Vector2 center49 = Main.player[this.target].Center; Vector2 vector2221 = center49 - center48; vector2221.Normalize(); if (vector2221.HasNaNs()) { vector2221 = new Vector2((float)this.direction, 0f); } this.velocity = ((this.velocity * (single472 - 1f)) + (vector2221 * (this.velocity.Length() + single473))) / single472; } else { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; NPC nPC223 = this; nPC223.velocity = nPC223.velocity / 2f; this.netUpdate = true; if (this.type == 418) { this.ai[1] = 45f; this.ai[0] = 4f; } } if (flag129 && Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[0] = 3f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; } } else if (this.ai[0] == 4f) { this.ai[1] = this.ai[1] - 3f; if (this.ai[1] <= 0f) { this.ai[0] = 0f; this.ai[1] = 0f; this.netUpdate = true; } NPC nPC224 = this; nPC224.velocity = nPC224.velocity * 0.95f; } if (flag129 && this.ai[0] != 3f && Vector2.Distance(base.Center, Main.player[this.target].Center) < 64f) { this.ai[0] = 3f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; } if (this.ai[0] == 3f) { this.position = base.Center; int num652 = 192; num6 = num652; this.height = num652; this.width = num6; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.velocity = Vector2.Zero; this.damage = (int)(80f * Main.damageMultiplier); this.alpha = 255; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= 3f) { this.life = 0; this.HitEffect(0, 10); this.active = false; return; } } } else if (this.aiStyle == 75) { int num663 = -1; Vector2 zero4 = Vector2.Zero; int num664 = 0; if (this.type == 390) { if (this.localAI[0] == 0f && Main.netMode != 1) { this.localAI[0] = 1f; int num665 = NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 391, this.whoAmI, 0f, 0f, 0f, 0f, 255); this.ai[0] = (float)num665; this.netUpdate = true; } int num666 = (int)this.ai[0]; if (Main.npc[num666].active && Main.npc[num666].type == 391) { if (this.timeLeft < 60) { this.timeLeft = 60; } num663 = num666; zero4 = Vector2.UnitY * -14f; } } if (this.type == 416) { if (this.localAI[0] == 0f && Main.netMode != 1) { this.localAI[0] = 1f; int num667 = NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 415, this.whoAmI, 0f, 0f, 0f, 0f, 255); this.ai[0] = (float)num667; this.netUpdate = true; } int num668 = (int)this.ai[0]; if (Main.npc[num668].active && Main.npc[num668].type == 415) { if (this.timeLeft < 60) { this.timeLeft = 60; } num663 = num668; zero4 = new Vector2((float)(-Main.npc[num668].spriteDirection * 10), -30f); } } else if (this.type == 392) { int num669 = (int)this.ai[0]; if (Main.npc[num669].active && Main.npc[num669].type == 395) { if (this.timeLeft < 60) { this.timeLeft = 60; } num663 = num669; zero4 = Vector2.UnitY * 2f; zero4 = zero4 * Main.npc[num669].scale; float single479 = Main.npc[num669].rotation; double num670 = (double)single479; vector24 = new Vector2(); zero4 = zero4.RotatedBy(num670, vector24); this.rotation = single479; if (Main.netMode != 1) { bool flag132 = true; if (Main.npc[num669].ai[0] >= 1f || Main.npc[num669].ai[0] < 0f) { flag132 = false; } if (flag132) { for (int n5 = 0; n5 < 2; n5++) { if (Main.npc[(int)this.localAI[n5]].active && Main.npc[(int)this.localAI[n5]].type == 393) { flag132 = false; } } for (int o5 = 2; o5 < 4; o5++) { if (Main.npc[(int)this.localAI[o5]].active && Main.npc[(int)this.localAI[o5]].type == 394) { flag132 = false; } } } if (flag132) { Main.npc[num669].ai[0] = 1f; Main.npc[num669].ai[1] = 0f; Main.npc[num669].ai[2] = 0f; Main.npc[num669].ai[3] = 0f; Main.npc[num669].netUpdate = true; } } } } else if (this.type == 393) { int num671 = (int)this.ai[0]; if (Main.npc[num671].active && Main.npc[num671].type == 395) { if (this.timeLeft < 60) { this.timeLeft = 60; } num663 = num671; zero4 = (Vector2.UnitY * 29f) + ((this.ai[1] == 1f ? Vector2.UnitX : -Vector2.UnitX) * 60f); zero4 = zero4 * Main.npc[num671].scale; float single480 = Main.npc[num671].rotation; double num672 = (double)single480; vector24 = new Vector2(); zero4 = zero4.RotatedBy(num672, vector24); this.rotation = single480; } } else if (this.type == 394) { int num673 = (int)this.ai[0]; if (Main.npc[num673].active && Main.npc[num673].type == 395) { if (this.timeLeft < 60) { this.timeLeft = 60; } num663 = num673; zero4 = (Vector2.UnitY * -13f) + ((this.ai[1] == 1f ? Vector2.UnitX : -Vector2.UnitX) * 49f); zero4 = zero4 * Main.npc[num673].scale; float single481 = Main.npc[num673].rotation; double num674 = (double)single481; vector24 = new Vector2(); zero4 = zero4.RotatedBy(num674, vector24); this.rotation = single481; num664 = (this.ai[1] == 1f ? 1 : -1); } } else if (this.type == 492) { int num675 = (int)this.ai[0]; if (Main.npc[num675].active && Main.npc[num675].type == 491) { if (this.timeLeft < 60) { this.timeLeft = 60; } num663 = num675; zero4 = new Vector2((-122f + 68f * this.ai[1]) * (float)((Main.npc[num675].spriteDirection == 1 ? -1 : 1)), -6f); zero4 = zero4 * Main.npc[num675].scale; float single482 = Main.npc[num675].rotation; double num676 = (double)single482; vector24 = new Vector2(); zero4 = zero4.RotatedBy(num676, vector24); this.rotation = single482; } } if (num663 == -1) { if (this.type == 390) { this.Transform(382); return; } if (this.type == 416) { this.Transform(518); return; } this.life = 0; this.HitEffect(0, 10); this.active = false; return; } NPC nPC225 = Main.npc[num663]; this.velocity = Vector2.Zero; this.position = nPC225.Center; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); NPC nPC226 = this; nPC226.position = nPC226.position + zero4; this.gfxOffY = nPC225.gfxOffY; this.direction = nPC225.direction; if (num664 != 0) { this.spriteDirection = num664; } else { this.spriteDirection = nPC225.spriteDirection; } if (this.type == 390) { this.timeLeft = nPC225.timeLeft; this.velocity = nPC225.velocity; this.target = nPC225.target; if (this.ai[1] < 60f) { this.ai[1] = this.ai[1] + 1f; } if (this.justHit) { this.ai[1] = -30f; } int num677 = 438; int num678 = 30; float single483 = 7f; if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { Vector2 center50 = Main.player[this.target].Center - base.Center; Vector2 vector2226 = Vector2.Normalize(center50); float single484 = center50.Length(); float single485 = 700f; if (this.type == 214) { single485 = 550f; } if (this.type == 215) { single485 = 800f; } if (single484 < single485) { if (this.ai[1] != 60f || Math.Sign(center50.X) != this.direction) { float single486 = this.ai[2]; this.velocity.X = this.velocity.X * 0.5f; this.ai[2] = 3f; if (Math.Abs(vector2226.Y) > Math.Abs(vector2226.X) * 2f) { if (vector2226.Y <= 0f) { this.ai[2] = 5f; } else { this.ai[2] = 1f; } } else if (Math.Abs(vector2226.X) > Math.Abs(vector2226.Y) * 2f) { this.ai[2] = 3f; } else if (vector2226.Y <= 0f) { this.ai[2] = 4f; } else { this.ai[2] = 2f; } if (this.ai[2] != single486) { this.netUpdate = true; } } else { this.ai[1] = -60f; Vector2 center51 = Main.player[this.target].Center; Vector2 center52 = base.Center - (Vector2.UnitY * 4f); Vector2 unitY5 = center51 - center52; unitY5.X = unitY5.X + (float)Main.rand.Next(-50, 51); unitY5.Y = unitY5.Y + (float)Main.rand.Next(-50, 51); unitY5.X = unitY5.X * ((float)Main.rand.Next(80, 121) * 0.01f); unitY5.Y = unitY5.Y * ((float)Main.rand.Next(80, 121) * 0.01f); unitY5.Normalize(); if (float.IsNaN(unitY5.X) || float.IsNaN(unitY5.Y)) { unitY5 = -Vector2.UnitY; } unitY5 = unitY5 * single483; Projectile.NewProjectile(center52.X, center52.Y, unitY5.X, unitY5.Y, num677, num678, 0f, Main.myPlayer, 0f, 0f); this.netUpdate = true; } } } } if (this.type == 492) { this.timeLeft = nPC225.timeLeft; this.velocity = nPC225.velocity; if (this.ai[3] < 240f) { this.ai[3] = this.ai[3] + 1f; } if (this.ai[3] == 2f) { this.TargetClosest(false); } if (!Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { if (this.ai[2] != 0f) { this.netUpdate = true; } this.ai[2] = 0f; } else { Vector2 center53 = Main.player[this.target].Center - base.Center; Vector2.Normalize(center53); if (this.ai[3] < 240f) { float single487 = this.ai[2]; float[] singleArray13 = new float[8]; for (int p5 = 0; p5 < (int)singleArray13.Length; p5++) { Vector2 center54 = base.Center; Vector2 unitY6 = Vector2.UnitY; double num679 = (double)((float)p5 * -0.7853982f); vector24 = new Vector2(); singleArray13[p5] = Vector2.Distance(center54 + (unitY6.RotatedBy(num679, vector24) * 50f), Main.player[this.target].Center); } int num680 = 0; for (int q5 = 1; q5 < (int)singleArray13.Length; q5++) { if (singleArray13[num680] > singleArray13[q5]) { num680 = q5; } } this.ai[2] = (float)(num680 + 1); if (this.spriteDirection == 1) { this.ai[2] = 9f - this.ai[2]; } if (this.ai[2] != single487) { this.netUpdate = true; } } else { this.ai[3] = 0f; Vector2 center55 = Main.player[this.target].Center; Vector2 center56 = base.Center; Vector2 unitY7 = Vector2.Normalize(center55 - center56); if (float.IsNaN(unitY7.X) || float.IsNaN(unitY7.Y)) { unitY7 = Vector2.UnitY; } unitY7 = unitY7 * 14f; unitY7 = unitY7 + (Vector2.UnitY * -5f); if (Main.netMode != 1) { Projectile.NewProjectile(center56.X, center56.Y, unitY7.X, unitY7.Y, 240, 30, 0f, Main.myPlayer, 0f, 0f); } this.netUpdate = true; } } } if (this.type == 394) { this.timeLeft = nPC225.timeLeft; int num681 = 50; if (Main.expertMode) { num681 = 37; } this.ai[3] = nPC225.ai[3]; float single488 = 440f; float single489 = 140f; if (this.ai[3] >= single488 && this.ai[3] < single488 + single489 && (this.ai[3] - single488) % 20f == 0f) { if (Main.netMode != 1) { Vector2 unitX2 = (float)num664 * Vector2.UnitX; vector24 = new Vector2(); unitX2 = unitX2.RotatedBy((Main.rand.NextDouble() - 0.5) * 0.785398185253143, vector24); unitX2 = unitX2 * 8f; Vector2 unitX3 = ((((float)num664 * Vector2.UnitX) * 36f) + base.Center) + (Vector2.UnitY * 8f); Projectile.NewProjectile(unitX3.X, unitX3.Y, unitX2.X, unitX2.Y, 448, num681, 0f, Main.myPlayer, 0f, 20f); } } } if (this.type == 393) { this.timeLeft = nPC225.timeLeft; int num682 = 35; if (Main.expertMode) { num682 = 30; } this.ai[3] = nPC225.ai[3]; float single490 = 280f; float single491 = 140f; bool flag133 = (this.ai[3] < single490 ? false : this.ai[3] < single490 + single491); if (!flag133) { this.TargetClosest(false); Player player6 = Main.player[this.target]; Vector2 unitY8 = player6.Center - base.Center; if (unitY8.Y < 0f) { unitY8.Y = 0f; } unitY8.Normalize(); if (float.IsNaN(unitY8.X) || float.IsNaN(unitY8.Y)) { unitY8 = Vector2.UnitY; } this.ai[2] = unitY8.ToRotation(); } if (flag133 && (this.ai[3] - single490) % 6f == 0f) { if (Main.netMode != 1) { Vector2 rotationVector25 = this.ai[2].ToRotationVector2(); double num683 = (Main.rand.NextDouble() - 0.5) * 0.785398185253143 / 3; vector24 = new Vector2(); rotationVector25 = rotationVector25.RotatedBy(num683, vector24); rotationVector25 = rotationVector25 * 16f; Vector2 center57 = base.Center + (rotationVector25 * 1f); Projectile.NewProjectile(center57.X, center57.Y, rotationVector25.X, rotationVector25.Y, 449, num682, 0f, Main.myPlayer, 0f, 0f); } } } if (this.type == 392) { this.timeLeft = nPC225.timeLeft; int num684 = 70; if (Main.expertMode) { num684 = 50; } this.ai[3] = nPC225.ai[3]; float single492 = 20f; float single493 = 240f; bool flag134 = (this.ai[3] < single492 || this.ai[3] >= single492 + single493 ? false : nPC225.ai[0] == 0f); if (flag134 && this.ai[3] - single492 == 0f) { if (Main.netMode != 1) { Vector2 center58 = base.Center; Projectile.NewProjectile(center58.X, center58.Y, 0f, 0f, 447, num684, 0f, Main.myPlayer, (float)(this.whoAmI + 1), 0f); } } flag134 = false; int num685 = 1000; int num686 = 1000; int num687 = 450; int num688 = 30; if (Main.expertMode) { num688 = 25; } if (nPC225.ai[0] == 2f) { flag134 = true; num686 = 120; num685 = 120; } if (!flag134) { single492 = 280f; single493 = 120f; if (flag134) { flag3 = true; } else { flag3 = (this.ai[3] < single492 ? false : this.ai[3] < single492 + single493); } flag134 = flag3; if (flag134) { num686 = 90; num685 = 60; } } if (!flag134) { single492 = 440f; single493 = 140f; if (flag134) { flag2 = true; } else { flag2 = (this.ai[3] < single492 ? false : this.ai[3] < single492 + single493); } flag134 = flag2; if (flag134) { num686 = 60; num685 = 90; } } bool flag135 = true; bool flag136 = true; bool flag137 = true; bool flag138 = true; if (Main.npc[(int)this.localAI[0]].active && Main.npc[(int)this.localAI[0]].type == 393) { flag135 = false; } if (Main.npc[(int)this.localAI[1]].active && Main.npc[(int)this.localAI[1]].type == 393) { flag136 = false; } if (Main.npc[(int)this.localAI[2]].active && Main.npc[(int)this.localAI[2]].type == 394) { flag137 = false; } if (Main.npc[(int)this.localAI[3]].active && Main.npc[(int)this.localAI[3]].type == 394) { flag138 = false; } if (flag134) { if (flag135 && Main.rand.Next(num685) == 0) { if (Main.netMode != 1) { Vector2 vector2227 = new Vector2(-1f * (float)Main.rand.NextDouble() * 3f, 1f); vector24 = new Vector2(); vector2227 = vector2227.RotatedBy((Main.rand.NextDouble() - 0.5) * 0.785398185253143, vector24); vector2227 = vector2227 * 3f; Vector2 unitX4 = (((-1f * Vector2.UnitX) * (float)Main.rand.Next(50, 70)) + base.Center) + (Vector2.UnitY * (float)Main.rand.Next(30, 45)); Projectile.NewProjectile(unitX4.X, unitX4.Y, vector2227.X, vector2227.Y, num687, num688, 0f, Main.myPlayer, 0f, 0f); } } if (flag136 && Main.rand.Next(num685) == 0) { if (Main.netMode != 1) { Vector2 vector2228 = new Vector2(1f * (float)Main.rand.NextDouble() * 3f, 1f); vector24 = new Vector2(); vector2228 = vector2228.RotatedBy((Main.rand.NextDouble() - 0.5) * 0.785398185253143, vector24); vector2228 = vector2228 * 3f; Vector2 unitX5 = (((1f * Vector2.UnitX) * (float)Main.rand.Next(50, 70)) + base.Center) + (Vector2.UnitY * (float)Main.rand.Next(30, 45)); Projectile.NewProjectile(unitX5.X, unitX5.Y, vector2228.X, vector2228.Y, num687, num688, 0f, Main.myPlayer, 0f, 0f); } } } if (flag134) { if (flag137 && Main.rand.Next(num686) == 0) { if (Main.netMode != 1) { Vector2 vector2229 = new Vector2(-1f * (float)Main.rand.NextDouble() * 2f, -1f); vector24 = new Vector2(); vector2229 = vector2229.RotatedBy((Main.rand.NextDouble() - 0.5) * 0.785398185253143, vector24); vector2229 = vector2229 * 3f; Vector2 unitX6 = (((-1f * Vector2.UnitX) * (float)Main.rand.Next(30, 60)) + base.Center) + (Vector2.UnitY * (float)Main.rand.Next(-30, -10)); Projectile.NewProjectile(unitX6.X, unitX6.Y, vector2229.X, vector2229.Y, num687, num688, 0f, Main.myPlayer, 0f, 0f); } } if (flag138 && Main.rand.Next(num686) == 0) { if (Main.netMode != 1) { Vector2 vector2230 = new Vector2(1f * (float)Main.rand.NextDouble() * 2f, -1f); vector24 = new Vector2(); vector2230 = vector2230.RotatedBy((Main.rand.NextDouble() - 0.5) * 0.785398185253143, vector24); vector2230 = vector2230 * 3f; Vector2 unitX7 = (((1f * Vector2.UnitX) * (float)Main.rand.Next(30, 60)) + base.Center) + (Vector2.UnitY * (float)Main.rand.Next(-30, -10)); Projectile.NewProjectile(unitX7.X, unitX7.Y, vector2230.X, vector2230.Y, num687, num688, 0f, Main.myPlayer, 0f, 0f); } } } if (flag138 && Main.rand.Next(8) == 0) { return; } } } else if (this.aiStyle == 76) { if (this.localAI[3] == 0f && Main.netMode != 1 && this.type == 395) { this.localAI[3] = 1f; int[] numArray3 = new int[4]; int num693 = 0; for (int r5 = 0; r5 < 2; r5++) { int num694 = NPC.NewNPC((int)base.Center.X + r5 * 300 - 150, (int)base.Center.Y, 393, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num694].ai[1] = (float)r5; Main.npc[num694].netUpdate = true; int num695 = num693; num693 = num695 + 1; numArray3[num695] = num694; } for (int s5 = 0; s5 < 2; s5++) { int num696 = NPC.NewNPC((int)base.Center.X + s5 * 300 - 150, (int)base.Center.Y, 394, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num696].ai[1] = (float)s5; Main.npc[num696].netUpdate = true; int num697 = num693; num693 = num697 + 1; numArray3[num697] = num696; } int num698 = NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 392, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num698].ai[0] = (float)this.whoAmI; Main.npc[num698].netUpdate = true; for (int t5 = 0; t5 < 4; t5++) { Main.npc[numArray3[t5]].ai[0] = (float)this.whoAmI; } for (int u5 = 0; u5 < 4; u5++) { Main.npc[num698].localAI[u5] = (float)numArray3[u5]; } } Vector2 center59 = base.Center; Player player7 = Main.player[this.target]; if (this.target < 0 || this.target == 255 || player7.dead || !player7.active) { this.TargetClosest(true); player7 = Main.player[this.target]; this.netUpdate = true; } if ((player7.dead || Vector2.Distance(player7.Center, center59) > 3200f) && this.ai[0] != 1f) { if (this.ai[0] == 0f) { this.ai[0] = -1f; } if (this.ai[0] == 2f) { this.ai[0] = -2f; } this.netUpdate = true; } if (this.ai[0] == -1f || this.ai[0] == -2f) { this.velocity.Y = this.velocity.Y - 0.4f; if (this.timeLeft > 10) { this.timeLeft = 10; } if (!player7.dead) { this.timeLeft = 300; if (this.ai[0] == -2f) { this.ai[0] = 2f; } if (this.ai[0] == 0f) { this.ai[0] = 0f; } this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; return; } } else if (this.ai[0] != 0f) { if (this.ai[0] == 1f) { this.dontTakeDamage = false; NPC nPC227 = this; nPC227.velocity = nPC227.velocity * 0.96f; float single494 = 150f; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= single494) { this.ai[0] = 2f; this.ai[1] = 0f; this.rotation = 0f; this.netUpdate = true; return; } if (this.ai[1] < 40f) { Vector2 unitY9 = Vector2.UnitY; double num699 = (double)(this.ai[1] / 40f * 6.28318548f); vector24 = new Vector2(); this.rotation = unitY9.RotatedBy(num699, vector24).Y * 0.2f; return; } if (this.ai[1] < 80f) { Vector2 unitY10 = Vector2.UnitY; double num700 = (double)(this.ai[1] / 20f * 6.28318548f); vector24 = new Vector2(); this.rotation = unitY10.RotatedBy(num700, vector24).Y * 0.3f; return; } if (this.ai[1] >= 120f) { this.rotation = (this.ai[1] - 120f) / 30f * 6.28318548f; return; } Vector2 unitY11 = Vector2.UnitY; double num701 = (double)(this.ai[1] / 10f * 6.28318548f); vector24 = new Vector2(); this.rotation = unitY11.RotatedBy(num701, vector24).Y * 0.4f; return; } if (this.ai[0] == 2f) { int num702 = 100; float single495 = 3600f; float single496 = 120f; float single497 = 60f; int num703 = 0; if (this.ai[3] % single496 >= single497) { num703 = 1; } int num704 = num703; num703 = 0; this.ai[3] = this.ai[3] + 1f; if (this.ai[3] % single496 >= single497) { num703 = 1; } if (num703 != num704) { if (num703 == 1) { this.ai[2] = (float)((Math.Sign((player7.Center - center59).X) == 1 ? 1 : -1)); if (Main.netMode != 1) { Vector2 center60 = base.Center; Projectile.NewProjectile(center60.X, center60.Y, 0f, 0f, 447, num702, 0f, Main.myPlayer, (float)(this.whoAmI + 1), 0f); } } this.netUpdate = true; } if (this.ai[3] >= single495) { this.ai[0] = 2f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; } else if (num703 != 0) { int x203 = (int)base.Center.X / 16; int y206 = (int)(this.position.Y + (float)this.height) / 16; int num705 = 0; if ((!Main.tile[x203, y206].nactive() || !Main.tileSolid[Main.tile[x203, y206].type] ? true : Main.tileSolidTop[Main.tile[x203, y206].type])) { while (num705 < 150 && y206 + num705 < Main.maxTilesY) { int num706 = y206 + num705; if ((!Main.tile[x203, num706].nactive() || !Main.tileSolid[Main.tile[x203, num706].type] ? true : Main.tileSolidTop[Main.tile[x203, num706].type])) { num705++; } else { num705--; break; } } } else { num705 = 1; } float single498 = (float)(num705 * 16); if (single498 >= 250f) { this.velocity.Y = this.velocity.Y * 0.95f; } else { float single499 = -4f; if (-single499 > single498) { single499 = -single498; } this.velocity.Y = MathHelper.Lerp(this.velocity.Y, single499, 0.05f); } this.velocity.X = 8f * this.ai[2]; } else { Vector2 center61 = (player7.Center + new Vector2(this.ai[2] * 350f, -250f)) - center59; center61.Normalize(); this.velocity = Vector2.Lerp(this.velocity, center61 * 16f, 0.1f); } this.rotation = 0f; return; } } else { int num707 = 0; int num708 = 0; if (this.ai[3] >= 580f) { num707 = 0; } else if (this.ai[3] >= 440f) { num707 = 5; } else if (this.ai[3] >= 420f) { num707 = 4; } else if (this.ai[3] >= 280f) { num707 = 3; } else if (this.ai[3] >= 260f) { num707 = 2; } else if (this.ai[3] >= 20f) { num707 = 1; } this.ai[3] = this.ai[3] + 1f; if (this.ai[3] >= 600f) { this.ai[3] = 0f; } num708 = num707; if (this.ai[3] >= 580f) { num707 = 0; } else if (this.ai[3] >= 440f) { num707 = 5; } else if (this.ai[3] >= 420f) { num707 = 4; } else if (this.ai[3] >= 280f) { num707 = 3; } else if (this.ai[3] >= 260f) { num707 = 2; } else if (this.ai[3] >= 20f) { num707 = 1; } if (num707 != num708) { if (num707 == 0) { this.ai[2] = 0f; } if (num707 == 1) { this.ai[2] = (float)((Math.Sign((player7.Center - center59).X) == 1 ? 1 : -1)); } if (num707 == 2) { this.ai[2] = 0f; } this.netUpdate = true; } if (num707 == 0) { if (this.ai[2] == 0f) { this.ai[2] = (float)(-600 * Math.Sign((center59 - player7.Center).X)); } Vector2 center62 = (player7.Center + new Vector2(this.ai[2], -250f)) - center59; if (center62.Length() >= 50f) { center62.Normalize(); this.velocity = Vector2.Lerp(this.velocity, center62 * 16f, 0.1f); } else { this.ai[3] = 19f; } } if (num707 == 1) { int x204 = (int)base.Center.X / 16; int y207 = (int)(this.position.Y + (float)this.height) / 16; int num709 = 0; if ((!Main.tile[x204, y207].nactive() || !Main.tileSolid[Main.tile[x204, y207].type] ? true : Main.tileSolidTop[Main.tile[x204, y207].type])) { while (num709 < 150 && y207 + num709 < Main.maxTilesY) { int num710 = y207 + num709; if ((!Main.tile[x204, num710].nactive() || !Main.tileSolid[Main.tile[x204, num710].type] ? true : Main.tileSolidTop[Main.tile[x204, num710].type])) { num709++; } else { num709--; break; } } } else { num709 = 1; } float single500 = (float)(num709 * 16); if (single500 >= 250f) { this.velocity.Y = this.velocity.Y * 0.95f; } else { float single501 = -4f; if (-single501 > single500) { single501 = -single500; } this.velocity.Y = MathHelper.Lerp(this.velocity.Y, single501, 0.05f); } this.velocity.X = 3.5f * this.ai[2]; } if (num707 == 2) { if (this.ai[2] == 0f) { this.ai[2] = (float)(300 * Math.Sign((center59 - player7.Center).X)); } Vector2 center63 = (player7.Center + new Vector2(this.ai[2], -170f)) - center59; int x205 = (int)base.Center.X / 16; int y208 = (int)(this.position.Y + (float)this.height) / 16; int num711 = 0; if ((!Main.tile[x205, y208].nactive() || !Main.tileSolid[Main.tile[x205, y208].type] ? true : Main.tileSolidTop[Main.tile[x205, y208].type])) { while (num711 < 150 && y208 + num711 < Main.maxTilesY) { int num712 = y208 + num711; if ((!Main.tile[x205, num712].nactive() || !Main.tileSolid[Main.tile[x205, num712].type] ? true : Main.tileSolidTop[Main.tile[x205, num712].type])) { num711++; } else { num711--; break; } } } else { num711 = 1; } float single502 = (float)(num711 * 16); float single503 = 170f; if (single502 < single503) { center63.Y = center63.Y - (single503 - single502); } if (center63.Length() >= 70f) { center63.Normalize(); this.velocity = Vector2.Lerp(this.velocity, center63 * 20f, 0.1f); } else { this.ai[3] = 279f; } } else if (num707 == 3) { float single504 = 0.85f; int x206 = (int)base.Center.X / 16; int y209 = (int)(this.position.Y + (float)this.height) / 16; int num713 = 0; if ((!Main.tile[x206, y209].nactive() || !Main.tileSolid[Main.tile[x206, y209].type] ? true : Main.tileSolidTop[Main.tile[x206, y209].type])) { while (num713 < 150 && y209 + num713 < Main.maxTilesY) { int num714 = y209 + num713; if ((!Main.tile[x206, num714].nactive() || !Main.tileSolid[Main.tile[x206, num714].type] ? true : Main.tileSolidTop[Main.tile[x206, num714].type])) { num713++; } else { num713--; break; } } } else { num713 = 1; } float single505 = (float)(num713 * 16); if (single505 >= 170f) { this.velocity.Y = this.velocity.Y * single504; } else { float single506 = -4f; if (-single506 > single505) { single506 = -single505; } this.velocity.Y = MathHelper.Lerp(this.velocity.Y, single506, 0.05f); } this.velocity.X = this.velocity.X * single504; } if (num707 == 4) { Vector2 center64 = (player7.Center + new Vector2(0f, -250f)) - center59; if (center64.Length() < 50f) { this.ai[3] = 439f; return; } center64.Normalize(); this.velocity = Vector2.Lerp(this.velocity, center64 * 16f, 0.1f); return; } if (num707 == 5) { NPC nPC228 = this; nPC228.velocity = nPC228.velocity * 0.85f; return; } } } else if (this.aiStyle == 77) { if (this.localAI[3] == 0f) { this.netUpdate = true; this.localAI[3] = 1f; this.ai[0] = -1f; } if (this.ai[0] == -1f) { this.dontTakeDamage = true; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] < 60f) { MoonlordDeathDrama.RequestLight(this.ai[1] / 30f, base.Center); } if (this.ai[1] == 60f) { this.ai[1] = 0f; this.ai[0] = 0f; if (Main.netMode != 1 && this.type == 398) { this.ai[2] = (float)Main.rand.Next(3); this.ai[2] = 0f; this.netUpdate = true; int[] numArray4 = new int[3]; int num715 = 0; for (int v5 = 0; v5 < 2; v5++) { int num716 = NPC.NewNPC((int)base.Center.X + v5 * 800 - 400, (int)base.Center.Y - 100, 397, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num716].ai[2] = (float)v5; Main.npc[num716].netUpdate = true; int num717 = num715; num715 = num717 + 1; numArray4[num717] = num716; } int num718 = NPC.NewNPC((int)base.Center.X, (int)base.Center.Y - 400, 396, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num718].netUpdate = true; int num719 = num715; num715 = num719 + 1; numArray4[num719] = num718; for (int w5 = 0; w5 < 3; w5++) { Main.npc[numArray4[w5]].ai[3] = (float)this.whoAmI; } for (int x510 = 0; x510 < 3; x510++) { this.localAI[x510] = (float)numArray4[x510]; } } } } if (this.ai[0] == 0f) { this.dontTakeDamage = true; this.TargetClosest(false); Vector2 center65 = (Main.player[this.target].Center - base.Center) + new Vector2(0f, 130f); if (center65.Length() > 20f) { Vector2 vector2235 = Vector2.Normalize(center65 - this.velocity) * 8f; Vector2 vector2236 = this.velocity; this.SimpleFlyMovement(vector2235, 0.5f); this.velocity = Vector2.Lerp(this.velocity, vector2236, 0.5f); } if (Main.netMode != 1) { bool flag139 = false; if (this.localAI[0] < 0f || this.localAI[1] < 0f || this.localAI[2] < 0f) { flag139 = true; } else if (!Main.npc[(int)this.localAI[0]].active || Main.npc[(int)this.localAI[0]].type != 397) { flag139 = true; } else if (!Main.npc[(int)this.localAI[1]].active || Main.npc[(int)this.localAI[1]].type != 397) { flag139 = true; } else if (!Main.npc[(int)this.localAI[2]].active || Main.npc[(int)this.localAI[2]].type != 396) { flag139 = true; } if (flag139) { this.life = 0; this.HitEffect(0, 10); this.active = false; } bool flag140 = true; if (Main.npc[(int)this.localAI[0]].ai[0] != -2f) { flag140 = false; } if (Main.npc[(int)this.localAI[1]].ai[0] != -2f) { flag140 = false; } if (Main.npc[(int)this.localAI[2]].ai[0] != -2f) { flag140 = false; } if (flag140) { this.ai[0] = 1f; this.dontTakeDamage = false; this.netUpdate = true; } } } else if (this.ai[0] == 1f) { this.dontTakeDamage = false; this.TargetClosest(false); Vector2 center66 = (Main.player[this.target].Center - base.Center) + new Vector2(0f, 130f); if (center66.Length() > 20f) { Vector2 vector2237 = Vector2.Normalize(center66 - this.velocity) * 8f; Vector2 vector2238 = this.velocity; this.SimpleFlyMovement(vector2237, 0.5f); this.velocity = Vector2.Lerp(this.velocity, vector2238, 0.5f); } } else if (this.ai[0] == 2f) { this.dontTakeDamage = true; Vector2 vector2239 = new Vector2((float)this.direction, -0.5f); this.velocity = Vector2.Lerp(this.velocity, vector2239, 0.98f); this.ai[1] = this.ai[1] + 1f; if (this.ai[1] < 60f) { MoonlordDeathDrama.RequestLight(this.ai[1] / 60f, base.Center); } if (this.ai[1] == 60f) { for (int y510 = 0; y510 < 1000; y510++) { Projectile projectile = Main.projectile[y510]; if (projectile.active && (projectile.type == 456 || projectile.type == 462 || projectile.type == 455 || projectile.type == 452 || projectile.type == 454)) { projectile.Kill(); } } for (int a5 = 0; a5 < 200; a5++) { NPC nPC229 = Main.npc[a5]; if (nPC229.active && nPC229.type == 400) { nPC229.HitEffect(0, 9999); nPC229.active = false; } } } if (this.ai[1] % 3f == 0f && this.ai[1] < 580f && this.ai[1] > 60f) { Vector2 vector2240 = Utils.RandomVector2(Main.rand, -1f, 1f); if (vector2240 != Vector2.Zero) { vector2240.Normalize(); } vector2240 = vector2240 * (20f + Main.rand.NextFloat() * 400f); bool flag141 = true; Point point3 = (base.Center + vector2240).ToTileCoordinates(); if (!WorldGen.InWorld(point3.X, point3.Y, 0)) { flag141 = false; } if (flag141 && WorldGen.SolidTile(point3.X, point3.Y)) { flag141 = false; } float single507 = (float)Main.rand.Next(6, 19); float single508 = 6.28318548f / single507; float single509 = 6.28318548f * Main.rand.NextFloat(); float single510 = 1f + Main.rand.NextFloat() * 2f; float single511 = 1f + Main.rand.NextFloat(); float single512 = 0.4f + Main.rand.NextFloat(); Random random3 = Main.rand; numArray = new int[] { 31, 229 }; int num720 = Utils.SelectRandom<int>(random3, numArray); for (float b5 = 0f; b5 < this.ai[1] / 60f; b5 = b5 + 1f) { Vector2 vector2241 = Utils.RandomVector2(Main.rand, -1f, 1f); if (vector2241 != Vector2.Zero) { vector2241.Normalize(); } vector2241 = vector2241 * (20f + Main.rand.NextFloat() * 800f); Vector2 center67 = base.Center + vector2241; Point tileCoordinates4 = center67.ToTileCoordinates(); bool flag142 = true; if (!WorldGen.InWorld(tileCoordinates4.X, tileCoordinates4.Y, 0)) { flag142 = false; } if (flag142 && WorldGen.SolidTile(tileCoordinates4.X, tileCoordinates4.Y)) { flag142 = false; } } } if (this.ai[1] % 15f == 0f && this.ai[1] < 480f && this.ai[1] >= 90f && Main.netMode != 1) { Vector2 vector2242 = Utils.RandomVector2(Main.rand, -1f, 1f); if (vector2242 != Vector2.Zero) { vector2242.Normalize(); } vector2242 = vector2242 * (20f + Main.rand.NextFloat() * 400f); bool flag143 = true; Vector2 center68 = base.Center + vector2242; Point point4 = center68.ToTileCoordinates(); if (!WorldGen.InWorld(point4.X, point4.Y, 0)) { flag143 = false; } if (flag143 && WorldGen.SolidTile(point4.X, point4.Y)) { flag143 = false; } if (flag143) { float directionInt4 = (float)(Main.rand.Next(4) < 2).ToDirectionInt() * (0.3926991f + 0.7853982f * Main.rand.NextFloat()); Vector2 vector2243 = new Vector2(0f, -Main.rand.NextFloat() * 0.5f - 0.5f); double num721 = (double)directionInt4; vector24 = new Vector2(); Vector2 vector2244 = vector2243.RotatedBy(num721, vector24) * 6f; Projectile.NewProjectile(center68.X, center68.Y, vector2244.X, vector2244.Y, 622, 0, 0f, Main.myPlayer, 0f, 0f); } } if (this.ai[1] >= 480f) { MoonlordDeathDrama.RequestLight((this.ai[1] - 480f) / 120f, base.Center); } if (this.ai[1] >= 600f) { this.life = 0; this.HitEffect(0, 1337); this.checkDead(); return; } } else if (this.ai[0] == 3f) { this.dontTakeDamage = true; Vector2 vector2245 = new Vector2((float)this.direction, -0.5f); this.velocity = Vector2.Lerp(this.velocity, vector2245, 0.98f); this.ai[1] = this.ai[1] + 1f; if (this.ai[1] < 60f) { MoonlordDeathDrama.RequestLight(this.ai[1] / 40f, base.Center); } if (this.ai[1] == 40f) { for (int c5 = 0; c5 < 1000; c5++) { Projectile projectile1 = Main.projectile[c5]; if (projectile1.active && (projectile1.type == 456 || projectile1.type == 462 || projectile1.type == 455 || projectile1.type == 452 || projectile1.type == 454)) { projectile1.active = false; NetMessage.SendData(27, -1, -1, "", c5, 0f, 0f, 0f, 0, 0, 0); } } for (int d5 = 0; d5 < 200; d5++) { NPC nPC230 = Main.npc[d5]; if (nPC230.active && nPC230.type == 400) { nPC230.active = false; if (Main.netMode != 1) { NetMessage.SendData(23, -1, -1, "", nPC230.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } } } if (this.ai[1] == 60f) { for (int f5 = 0; f5 < 200; f5++) { NPC nPC231 = Main.npc[f5]; if (nPC231.active && (nPC231.type == 400 || nPC231.type == 397 || nPC231.type == 396)) { nPC231.active = false; if (Main.netMode != 1) { NetMessage.SendData(23, -1, -1, "", nPC231.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } } this.active = false; NetMessage.SendData(23, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); NPC.LunarApocalypseIsUp = false; if (Main.netMode == 2) { NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0, 0, 0); } return; } } bool flag144 = false; if (Main.player[this.target].active && !Main.player[this.target].dead) { flag144 = true; } if (!flag144) { int num722 = 0; while (num722 < 255) { if (!Main.player[num722].active || Main.player[num722].dead) { num722++; } else { flag144 = true; break; } } } if (!flag144) { this.ai[0] = 3f; this.netUpdate = true; return; } } else if (this.aiStyle == 78) { NPC.InitializeMoonLordAttacks(); if (!Main.npc[(int)this.ai[3]].active || Main.npc[(int)this.ai[3]].type != 398) { this.life = 0; this.HitEffect(0, 10); this.active = false; } bool flag145 = this.ai[2] == 0f; float directionInt5 = (float)(-flag145.ToDirectionInt()); this.spriteDirection = (int)directionInt5; this.dontTakeDamage = this.frameCounter >= 21; Vector2 vector2246 = new Vector2(30f, 66f); float single513 = 0f; float moonLordAttacksArray = 0f; bool flag146 = true; int num723 = 0; if (this.ai[0] != -2f) { float single514 = this.ai[0]; this.ai[1] = this.ai[1] + 1f; int num724 = (int)Main.npc[(int)this.ai[3]].ai[2]; int num725 = (flag145 ? 0 : 1); int num726 = 0; int num727 = 0; while (num726 < 5) { moonLordAttacksArray = (float)NPC.MoonLordAttacksArray[num724, num725, 1, num726]; if (moonLordAttacksArray + (float)num727 > this.ai[1]) { break; } num727 = num727 + (int)moonLordAttacksArray; num726++; } if (num726 == 5) { num726 = 0; this.ai[1] = 0f; moonLordAttacksArray = (float)NPC.MoonLordAttacksArray[num724, num725, 1, num726]; num727 = 0; } this.ai[0] = (float)NPC.MoonLordAttacksArray[num724, num725, 0, num726]; single513 = (float)((int)this.ai[1] - num727); if (this.ai[0] != single514) { this.netUpdate = true; } } if (this.ai[0] == -2f) { this.damage = 80; num723 = 0; this.dontTakeDamage = true; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= 32f) { this.ai[1] = 0f; } if (this.ai[1] < 0f) { this.ai[1] = 0f; } Vector2 center69 = Main.npc[(int)this.ai[3]].Center; Vector2 vector2247 = center69 + new Vector2(350f * directionInt5, -100f); Vector2 center70 = vector2247 - base.Center; if (center70.Length() > 20f) { center70.Normalize(); center70 = center70 * 6f; Vector2 vector2248 = this.velocity; if (center70 != Vector2.Zero) { this.SimpleFlyMovement(center70, 0.3f); } this.velocity = Vector2.Lerp(vector2248, this.velocity, 0.5f); } } else if (this.ai[0] == 0f) { num723 = 3; this.localAI[1] = this.localAI[1] - 0.05f; if (this.localAI[1] < 0f) { this.localAI[1] = 0f; } Vector2 center71 = Main.npc[(int)this.ai[3]].Center; Vector2 vector2249 = center71 + new Vector2(350f * directionInt5, -100f); Vector2 center72 = vector2249 - base.Center; if (center72.Length() > 20f) { center72.Normalize(); center72 = center72 * 6f; Vector2 vector2250 = this.velocity; if (center72 != Vector2.Zero) { this.SimpleFlyMovement(center72, 0.3f); } this.velocity = Vector2.Lerp(vector2250, this.velocity, 0.5f); } } else if (this.ai[0] == 1f) { num723 = 0; int num728 = 7; int num729 = 4; if (single513 >= (float)(num728 * num729 * 2)) { this.localAI[1] = this.localAI[1] - 0.07f; if (this.localAI[1] < 0f) { this.localAI[1] = 0f; } } else if (single513 < (float)(num728 * num729)) { this.localAI[1] = this.localAI[1] + 0.02f; if (this.localAI[1] > 0.75f) { this.localAI[1] = 0.75f; } float single515 = 6.28318548f * (single513 % (float)(num728 * num729)) / (float)(num728 * num729) - 1.57079637f; this.localAI[0] = (new Vector2((float)Math.Cos((double)single515) * vector2246.X, (float)Math.Sin((double)single515) * vector2246.Y)).ToRotation(); } else { this.localAI[1] = this.localAI[1] + 0.05f; if (this.localAI[1] > 0.75f) { this.localAI[1] = 0.75f; } float single516 = 6.28318548f * (single513 % (float)(num728 * num729)) / (float)(num728 * num729) - 1.57079637f; this.localAI[0] = (new Vector2((float)Math.Cos((double)single516) * vector2246.X, (float)Math.Sin((double)single516) * vector2246.Y)).ToRotation(); if (single513 % (float)num729 == 0f) { Vector2 vector2251 = new Vector2(1f * -directionInt5, 3f); Vector2 vector2252 = Utils.Vector2FromElipse(this.localAI[0].ToRotationVector2(), vector2246 * this.localAI[1]); Vector2 center73 = (base.Center + ((Vector2.Normalize(vector2252) * vector2246.Length()) * 0.4f)) + vector2251; Vector2 vector2253 = Vector2.Normalize(vector2252) * 8f; float single517 = (6.28318548f * (float)Main.rand.NextDouble() - 3.14159274f) / 30f + 0.0174532924f * directionInt5; Projectile.NewProjectile(center73.X, center73.Y, vector2253.X, vector2253.Y, 452, 30, 0f, Main.myPlayer, 0f, single517); } } } else if (this.ai[0] == 2f) { this.localAI[1] = this.localAI[1] - 0.05f; if (this.localAI[1] < 0f) { this.localAI[1] = 0f; } Vector2 center74 = Main.npc[(int)this.ai[3]].Center; Vector2 vector2254 = new Vector2(220f * directionInt5, -60f) + center74; vector2254 = vector2254 + new Vector2(directionInt5 * 100f, -50f); Vector2 vector2255 = new Vector2(400f * directionInt5, -60f); if (single513 < 30f) { Vector2 center75 = vector2254 - base.Center; if (center75 != Vector2.Zero) { Vector2 vector2256 = center75; vector2256.Normalize(); this.velocity = Vector2.SmoothStep(this.velocity, vector2256 * Math.Min(8f, center75.Length()), 0.2f); } } else if (single513 < 210f) { num723 = 1; int num730 = (int)single513 - 30; if (num730 % 30 == 0 && Main.netMode != 1) { Vector2 x207 = new Vector2(5f * directionInt5, -8f); int num731 = num730 / 30; x207.X = x207.X + ((float)num731 - 3.5f) * directionInt5 * 3f; x207.Y = x207.Y + ((float)num731 - 4.5f) * 1f; x207 = x207 * 1.2f; Projectile.NewProjectile(base.Center.X, base.Center.Y, x207.X, x207.Y, 454, 50, 1f, Main.myPlayer, 0f, (float)this.whoAmI); } Vector2 vector2257 = Vector2.SmoothStep(vector2254, vector2254 + vector2255, (single513 - 30f) / 180f) - base.Center; if (vector2257 != Vector2.Zero) { Vector2 vector2258 = vector2257; vector2258.Normalize(); this.velocity = Vector2.Lerp(this.velocity, vector2258 * Math.Min(20f, vector2257.Length()), 0.5f); } } else if (single513 < 282f) { num723 = 0; NPC nPC232 = this; nPC232.velocity = nPC232.velocity * 0.9f; } else if (single513 < 287f) { num723 = 1; NPC nPC233 = this; nPC233.velocity = nPC233.velocity * 0.9f; } else if (single513 < 292f) { num723 = 2; NPC nPC234 = this; nPC234.velocity = nPC234.velocity * 0.9f; } else if (single513 >= 300f) { num723 = 3; Vector2 center76 = vector2254 - base.Center; if (center76 != Vector2.Zero) { Vector2 vector2259 = center76; vector2259.Normalize(); this.velocity = Vector2.SmoothStep(this.velocity, vector2259 * Math.Min(8f, center76.Length()), 0.2f); } } else { num723 = 3; if (single513 == 292f && Main.netMode != 1) { int num732 = Player.FindClosest(this.position, this.width, this.height); Vector2 unitY13 = Vector2.Normalize(Main.player[num732].Center - (base.Center + (Vector2.UnitY * -350f))); if (float.IsNaN(unitY13.X) || float.IsNaN(unitY13.Y)) { unitY13 = Vector2.UnitY; } unitY13 = unitY13 * 12f; for (int g5 = 0; g5 < 1000; g5++) { Projectile projectile2 = Main.projectile[g5]; if (projectile2.active && projectile2.type == 454 && projectile2.ai[1] == (float)this.whoAmI && projectile2.ai[0] != -1f) { projectile2.ai[0] = -1f; projectile2.velocity = unitY13; projectile2.netUpdate = true; } } } Vector2 vector2260 = Vector2.SmoothStep(vector2254, vector2254 + vector2255, 1f - (single513 - 270f) / 30f) - base.Center; if (vector2260 != Vector2.Zero) { Vector2 vector2261 = vector2260; vector2261.Normalize(); this.velocity = Vector2.Lerp(this.velocity, vector2261 * Math.Min(14f, vector2260.Length()), 0.1f); } } } else if (this.ai[0] == 3f) { if (single513 == 0f) { this.TargetClosest(false); this.netUpdate = true; } Vector2 center77 = (Main.player[this.target].Center + (Main.player[this.target].velocity * 20f)) - base.Center; this.localAI[0] = this.localAI[0].AngleLerp(center77.ToRotation(), 0.5f); this.localAI[1] = this.localAI[1] + 0.05f; if (this.localAI[1] > 1f) { this.localAI[1] = 1f; } if ((single513 == moonLordAttacksArray - 14f || single513 == moonLordAttacksArray - 7f || single513 == moonLordAttacksArray) && Main.netMode != 1) { Vector2 vector2262 = Utils.Vector2FromElipse(this.localAI[0].ToRotationVector2(), vector2246 * this.localAI[1]); Vector2 vector2263 = Vector2.Normalize(center77) * 8f; Projectile.NewProjectile(base.Center.X + vector2262.X, base.Center.Y + vector2262.Y, vector2263.X, vector2263.Y, 462, 30, 0f, Main.myPlayer, 0f, 0f); } } if (flag146) { Vector2 center78 = Main.npc[(int)this.ai[3]].Center; Vector2 vector2264 = new Vector2(220f * directionInt5, -60f) + center78; Vector2 vector2265 = vector2264 + new Vector2(directionInt5 * 110f, -150f); Vector2 vector2266 = vector2265 + new Vector2(directionInt5 * 370f, 150f); if (vector2265.X > vector2266.X) { Utils.Swap<float>(ref vector2265.X, ref vector2266.X); } if (vector2265.Y > vector2266.Y) { Utils.Swap<float>(ref vector2265.Y, ref vector2266.Y); } Vector2 vector2267 = Vector2.Clamp(base.Center + this.velocity, vector2265, vector2266); if (vector2267 != (base.Center + this.velocity)) { base.Center = vector2267 - this.velocity; } } int num733 = num723 * 7; if ((double)num733 > this.frameCounter) { NPC nPC235 = this; nPC235.frameCounter = nPC235.frameCounter + 1; } if ((double)num733 < this.frameCounter) { NPC nPC236 = this; nPC236.frameCounter = nPC236.frameCounter - 1; } if (this.frameCounter < 0) { this.frameCounter = 0; } if (this.frameCounter > 21) { this.frameCounter = 21; } int num734 = 0; if (flag145) { num734 = 0; } if (num734 == 0) { return; } if (num734 != 1) { if (num734 == 2) { Vector2 vector2268 = new Vector2(30f, 66f); this.TargetClosest(false); Vector2 vector2269 = (Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY)) - base.Center; float single518 = vector2269.Length() / 200f; if (single518 > 1f) { single518 = 1f; } single518 = 1f - single518; single518 = single518 * 2f; if (single518 > 1f) { single518 = 1f; } this.localAI[0] = vector2269.ToRotation(); this.localAI[1] = single518; this.localAI[1] = 1f; return; } if (num734 == 3) { int num735 = 7; int num736 = 4; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= (float)(num735 * num736 * 10)) { this.ai[1] = 0f; return; } if (this.ai[1] < (float)(num735 * num736)) { this.localAI[1] = this.localAI[1] + 0.05f; if (this.localAI[1] > 0.75f) { this.localAI[1] = 0.75f; } float single519 = 6.28318548f * (this.ai[1] % (float)(num735 * num736)) / (float)(num735 * num736) - 1.57079637f; this.localAI[0] = (new Vector2((float)Math.Cos((double)single519) * vector2246.X, (float)Math.Sin((double)single519) * vector2246.Y)).ToRotation(); if (this.ai[1] % (float)num736 == 0f) { Vector2 vector2270 = new Vector2(1f * -directionInt5, 3f); Vector2 vector2271 = Utils.Vector2FromElipse(this.localAI[0].ToRotationVector2(), vector2246 * this.localAI[1]); Vector2 center79 = (base.Center + ((Vector2.Normalize(vector2271) * vector2246.Length()) * 0.4f)) + vector2270; Vector2 vector2272 = Vector2.Normalize(vector2271) * 8f; float single520 = (6.28318548f * (float)Main.rand.NextDouble() - 3.14159274f) / 30f + 0.0174532924f * directionInt5; Projectile.NewProjectile(center79.X, center79.Y, vector2272.X, vector2272.Y, 452, 5, 0f, Main.myPlayer, 0f, single520); return; } } else { this.localAI[1] = this.localAI[1] - 0.07f; if (this.localAI[1] < 0f) { this.localAI[1] = 0f; return; } } } else if (num734 == 4) { Vector2 center80 = Main.npc[(int)this.ai[3]].Center; Vector2 vector2273 = new Vector2(220f * directionInt5, -60f) + center80; vector2273 = vector2273 + new Vector2(directionInt5 * 100f, -50f); Vector2 vector2274 = new Vector2(400f * directionInt5, -60f); this.ai[1] = this.ai[1] + 1f; if (this.ai[1] < 30f) { Vector2 center81 = vector2273 - base.Center; if (center81 != Vector2.Zero) { Vector2 vector2275 = center81; vector2275.Normalize(); this.velocity = Vector2.SmoothStep(this.velocity, vector2275 * Math.Min(8f, center81.Length()), 0.2f); return; } } else if (this.ai[1] >= 210f) { if (this.ai[1] < 270f) { NPC nPC237 = this; nPC237.velocity = nPC237.velocity * 0.9f; return; } if (this.ai[1] >= 300f) { this.ai[1] = 0f; return; } if (this.ai[1] == 270f && Main.netMode != 1) { int num737 = Player.FindClosest(this.position, this.width, this.height); Vector2 unitY14 = Vector2.Normalize(Main.player[num737].Center - (base.Center + (Vector2.UnitY * -350f))); if (float.IsNaN(unitY14.X) || float.IsNaN(unitY14.Y)) { unitY14 = Vector2.UnitY; } unitY14 = unitY14 * 12f; for (int h5 = 0; h5 < 1000; h5++) { Projectile projectile3 = Main.projectile[h5]; if (projectile3.active && projectile3.type == 454 && projectile3.ai[1] == (float)this.whoAmI && projectile3.ai[0] != -1f) { projectile3.ai[0] = -1f; projectile3.velocity = unitY14; projectile3.netUpdate = true; } } } Vector2 vector2276 = Vector2.SmoothStep(vector2273, vector2273 + vector2274, 1f - (this.ai[1] - 270f) / 30f) - base.Center; if (vector2276 != Vector2.Zero) { Vector2 vector2277 = vector2276; vector2277.Normalize(); this.velocity = Vector2.Lerp(this.velocity, vector2277 * Math.Min(14f, vector2276.Length()), 0.1f); return; } } else { int num738 = (int)this.ai[1] - 30; if (num738 % 30 == 0 && Main.netMode != 1) { Vector2 x208 = new Vector2(5f * directionInt5, -8f); int num739 = num738 / 30; x208.X = x208.X + ((float)num739 - 3.5f) * directionInt5 * 3f; x208.Y = x208.Y + ((float)num739 - 4.5f) * 1f; x208 = x208 * 1.2f; Projectile.NewProjectile(base.Center.X, base.Center.Y, x208.X, x208.Y, 454, 1, 1f, Main.myPlayer, 0f, (float)this.whoAmI); } Vector2 vector2278 = Vector2.SmoothStep(vector2273, vector2273 + vector2274, (this.ai[1] - 30f) / 180f) - base.Center; if (vector2278 != Vector2.Zero) { Vector2 vector2279 = vector2278; vector2279.Normalize(); this.velocity = Vector2.Lerp(this.velocity, vector2279 * Math.Min(4f, vector2278.Length()), 0.1f); return; } } } else if (num734 == 5) { this.dontTakeDamage = true; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= 40f) { this.ai[1] = 0f; return; } } } else { if (this.ai[0] == 0f) { float single521 = this.ai[1] + 1f; single1 = single521; this.ai[1] = single521; if (single1 >= 20f) { this.ai[1] = 0f; this.ai[0] = 1f; this.netUpdate = true; } this.velocity = Vector2.UnitX * 4f; return; } if (this.ai[0] == 1f) { float single522 = this.ai[1] + 1f; single1 = single522; this.ai[1] = single522; if (single1 >= 20f) { this.ai[1] = 0f; this.ai[0] = 2f; this.netUpdate = true; } this.velocity = Vector2.UnitX * -4f; return; } if (this.ai[0] == 2f || this.ai[0] == 4f) { float single523 = this.ai[1] + 1f; single1 = single523; this.ai[1] = single523; if (single1 >= 20f) { this.ai[1] = 0f; this.ai[0] = this.ai[0] + 1f; this.netUpdate = true; } this.velocity = (Vector2.UnitY * -4f) * (float)((flag145 ? 1 : -1)); return; } if (this.ai[0] == 3f || this.ai[0] == 5f) { float single524 = this.ai[1] + 1f; single1 = single524; this.ai[1] = single524; if (single1 >= 20f) { this.ai[1] = 0f; this.ai[0] = this.ai[0] + 1f; if (this.ai[0] == 6f) { this.ai[0] = 0f; } this.netUpdate = true; } this.velocity = (Vector2.UnitY * 4f) * (float)((flag145 ? 1 : -1)); return; } } } else if (this.aiStyle != 79) { if (this.aiStyle == 80) { if (this.ai[0] == 0f) { if (this.collideX) { this.direction = 1 - this.direction; } this.velocity.X = 3f * (float)((this.direction == 0 ? -1 : 1)); Point tileCoordinates5 = base.Center.ToTileCoordinates(); int num740 = 30; int num741 = 0; while (num741 < 30) { if (!WorldGen.SolidTile(tileCoordinates5.X, tileCoordinates5.Y + num741)) { num741++; } else { num740 = num741; break; } } if (num740 < 15) { this.velocity.Y = Math.Max(this.velocity.Y - 0.05f, -3.5f); } else if (num740 >= 20) { this.velocity.Y = Math.Min(this.velocity.Y + 0.05f, 1.5f); } else { this.velocity.Y = this.velocity.Y * 0.95f; } if (this.FindClosestPlayer(out single) == -1) { return; } if (single < 352f) { this.ai[0] = 1f; this.ai[1] = 0f; this.netUpdate = true; } } else if (this.ai[0] == 1f) { this.ai[1] = this.ai[1] + 1f; NPC nPC238 = this; nPC238.velocity = nPC238.velocity * 0.95f; if (this.ai[1] >= 60f) { this.ai[1] = 0f; this.ai[0] = 2f; int num742 = this.FindClosestPlayer(); if (num742 == -1) { this.ai[3] = 1f; } else { this.ai[3] = (Main.player[num742].Center.X > base.Center.X ? -1f : 1f); } this.netUpdate = true; } } else if (this.ai[0] == 2f) { this.noTileCollide = true; this.ai[1] = this.ai[1] + 1f; this.velocity.Y = Math.Max(this.velocity.Y - 0.1f, -10f); this.velocity.X = Math.Min(this.velocity.X + this.ai[3] * 0.05f, 4f); if (this.position.Y < (float)(-this.height) || this.ai[1] >= 180f) { Main.StartInvasion(4); this.active = false; this.ai[0] = 3f; this.netUpdate = true; } } skyBlue = Color.SkyBlue; Vector3 vector34 = skyBlue.ToVector3(); if (this.ai[0] == 2f) { skyBlue = Color.Red; vector34 = skyBlue.ToVector3(); } vector34 = vector34 * 0.65f; return; } if (this.aiStyle != 81) { if (this.aiStyle == 82) { float single525 = 90f; Vector2 vector2280 = new Vector2(0f, 216f); int num743 = (int)Math.Abs(this.ai[0]) - 1; int num744 = (int)this.ai[1]; if (!Main.npc[num743].active || Main.npc[num743].type != 396) { this.life = 0; this.HitEffect(0, 10); this.active = false; return; } this.ai[2] = this.ai[2] + 1f; if (this.ai[2] < single525) { this.velocity = Vector2.Zero; base.Center = Vector2.Lerp(Main.projectile[num744].Center, Main.npc[(int)Math.Abs(this.ai[0]) - 1].Center + vector2280, this.ai[2] / single525); return; } if (Main.netMode != 1) { int num749 = (int)Main.npc[num743].ai[3]; int num750 = -1; int num751 = -1; int num752 = num743; for (int k6 = 0; k6 < 200; k6++) { if (Main.npc[k6].active && Main.npc[k6].ai[3] == (float)num749) { if (num750 == -1 && Main.npc[k6].type == 397 && Main.npc[k6].ai[2] == 0f) { num750 = k6; } if (num751 == -1 && Main.npc[k6].type == 397 && Main.npc[k6].ai[2] == 1f) { num751 = k6; } if (num750 != -1 && num751 != -1 && num752 != -1) { break; } } } int num753 = 1000; int num754 = Main.npc[num749].lifeMax - Main.npc[num749].life; int num755 = Main.npc[num750].lifeMax - Main.npc[num750].life; int num756 = Main.npc[num751].lifeMax - Main.npc[num751].life; int num757 = Main.npc[num752].lifeMax - Main.npc[num752].life; if (num757 > 0 && num753 > 0) { int num758 = num757 - num753; if (num758 > 0) { num758 = 0; } int num759 = num753 + num758; num753 = num753 - num759; NPC nPC239 = Main.npc[num752]; nPC239.life = nPC239.life + num759; NPC.HealEffect(Utils.CenteredRectangle(Main.npc[num752].Center, new Vector2(50f)), num759, true); } if (num754 > 0 && num753 > 0) { int num760 = num754 - num753; if (num760 > 0) { num760 = 0; } int num761 = num753 + num760; num753 = num753 - num761; NPC nPC240 = Main.npc[num749]; nPC240.life = nPC240.life + num761; NPC.HealEffect(Utils.CenteredRectangle(Main.npc[num749].Center, new Vector2(50f)), num761, true); } if (num755 > 0 && num753 > 0) { int num762 = num755 - num753; if (num762 > 0) { num762 = 0; } int num763 = num753 + num762; num753 = num753 - num763; NPC nPC241 = Main.npc[num750]; nPC241.life = nPC241.life + num763; NPC.HealEffect(Utils.CenteredRectangle(Main.npc[num750].Center, new Vector2(50f)), num763, true); } if (num756 > 0 && num753 > 0) { int num764 = num756 - num753; if (num764 > 0) { num764 = 0; } int num765 = num753 + num764; num753 = num753 - num765; NPC nPC242 = Main.npc[num751]; nPC242.life = nPC242.life + num765; NPC.HealEffect(Utils.CenteredRectangle(Main.npc[num751].Center, new Vector2(50f)), num765, true); } } this.life = 0; this.HitEffect(0, 10); this.active = false; return; } if (this.aiStyle != 83) { if (this.aiStyle == 84) { bool flag147 = Main.expertMode; bool flag148 = this.life <= this.lifeMax / 2; int num766 = 120; int num767 = 35; if (flag147) { num766 = 90; num767 = 25; } int num768 = 18; int num769 = 3; int num770 = 30; if (flag147) { num768 = 12; num769 = 4; num770 = 20; } int num771 = 80; int num772 = 45; if (flag147) { num771 = 40; num772 = 30; } int num773 = 20; int num774 = 2; if (flag147) { num773 = 30; num774 = 2; } int num775 = 20; int num776 = 3; bool flag149 = this.type == 439; bool flag150 = false; bool flag151 = false; if (flag148) { this.defense = (int)((float)this.defDefense * 0.65f); } if (!flag149) { if ((this.ai[3] < 0f || !Main.npc[(int)this.ai[3]].active ? true : Main.npc[(int)this.ai[3]].type != 439)) { this.life = 0; this.HitEffect(0, 10); this.active = false; return; } this.ai[0] = Main.npc[(int)this.ai[3]].ai[0]; this.ai[1] = Main.npc[(int)this.ai[3]].ai[1]; if (this.ai[0] != 5f) { flag150 = true; flag151 = true; } else if (this.justHit) { this.life = 0; this.HitEffect(0, 10); this.active = false; NetMessage.SendData(23, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); NPC nPC243 = Main.npc[(int)this.ai[3]]; nPC243.ai[0] = 6f; nPC243.ai[1] = 0f; nPC243.netUpdate = true; } } else if (this.ai[0] == 5f && this.ai[1] >= 120f && this.ai[1] < 420f && this.justHit) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[3] = this.ai[3] + 1f; this.velocity = Vector2.Zero; this.netUpdate = true; List<int> nums = new List<int>(); for (int l6 = 0; l6 < 200; l6++) { if (Main.npc[l6].active && Main.npc[l6].type == 440 && Main.npc[l6].ai[3] == (float)this.whoAmI) { nums.Add(l6); } } int num777 = 10; if (Main.expertMode) { num777 = 3; } foreach (int num778 in nums) { NPC nPC244 = Main.npc[num778]; if (nPC244.localAI[1] != this.localAI[1] || num777 <= 0) { if (num777 <= 0) { continue; } num777--; nPC244.life = 0; nPC244.HitEffect(0, 10); nPC244.active = false; } else { num777--; nPC244.life = 0; nPC244.HitEffect(0, 10); nPC244.active = false; NetMessage.SendData(23, -1, -1, "", num778, 0f, 0f, 0f, 0, 0, 0); } } Main.projectile[(int)this.ai[2]].ai[1] = -1f; Main.projectile[(int)this.ai[2]].netUpdate = true; } Vector2 center84 = base.Center; Player player8 = Main.player[this.target]; if (this.target < 0 || this.target == 255 || player8.dead || !player8.active) { this.TargetClosest(false); player8 = Main.player[this.target]; this.netUpdate = true; } if (player8.dead || Vector2.Distance(player8.Center, center84) > 5600f) { this.life = 0; this.HitEffect(0, 10); this.active = false; NetMessage.SendData(28, -1, -1, "", this.whoAmI, -1f, 0f, 0f, 0, 0, 0); (new List<int>()).Add(this.whoAmI); for (int m6 = 0; m6 < 200; m6++) { if (Main.npc[m6].active && Main.npc[m6].type == 440 && Main.npc[m6].ai[3] == (float)this.whoAmI) { Main.npc[m6].life = 0; Main.npc[m6].HitEffect(0, 10); Main.npc[m6].active = false; NetMessage.SendData(28, -1, -1, "", this.whoAmI, -1f, 0f, 0f, 0, 0, 0); } } } float single526 = this.ai[3]; if (this.localAI[0] == 0f) { this.localAI[0] = 1f; this.alpha = 255; this.rotation = 0f; if (Main.netMode != 1) { this.ai[0] = -1f; this.netUpdate = true; } } if (this.ai[0] == -1f) { NPC nPC245 = this; nPC245.alpha = nPC245.alpha - 5; if (this.alpha < 0) { this.alpha = 0; } this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= 420f) { this.ai[0] = 0f; this.ai[1] = 0f; this.netUpdate = true; } else if (this.ai[1] > 360f) { NPC nPC246 = this; nPC246.velocity = nPC246.velocity * 0.95f; this.localAI[2] = 13f; } else if (this.ai[1] > 300f) { this.velocity = -Vector2.UnitY; this.localAI[2] = 10f; } else if (this.ai[1] <= 120f) { this.localAI[2] = 0f; } else { this.localAI[2] = 1f; } flag150 = true; flag151 = true; } if (this.ai[0] == 0f) { if (this.ai[1] == 0f) { this.TargetClosest(false); } this.localAI[2] = 10f; int num779 = Math.Sign(player8.Center.X - center84.X); if (num779 != 0) { int num780 = num779; num6 = num780; this.spriteDirection = num780; this.direction = num6; } this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= 40f && flag149) { int num781 = 0; if (!flag148) { num6 = (int)this.ai[3]; switch (num6) { case 0: { num781 = 0; break; } case 1: { num781 = 1; break; } case 2: { num781 = 0; break; } case 3: { num781 = 2; break; } case 4: { num781 = 0; break; } case 5: { num781 = 3; break; } case 6: { num781 = 0; break; } case 7: { num781 = 1; break; } case 8: { num781 = 0; break; } case 9: { num781 = 2; break; } case 10: { num781 = 0; break; } case 11: { num781 = 4; this.ai[3] = -1f; break; } default: { this.ai[3] = -1f; break; } } } else { num6 = (int)this.ai[3]; switch (num6) { case 0: { num781 = 0; break; } case 1: { num781 = 1; break; } case 2: { num781 = 0; break; } case 3: { num781 = 5; break; } case 4: { num781 = 0; break; } case 5: { num781 = 3; break; } case 6: { num781 = 0; break; } case 7: { num781 = 5; break; } case 8: { num781 = 0; break; } case 9: { num781 = 2; break; } case 10: { num781 = 0; break; } case 11: { num781 = 3; break; } case 12: { num781 = 0; break; } case 13: { num781 = 4; this.ai[3] = -1f; break; } default: { this.ai[3] = -1f; break; } } } int num782 = 6; if (this.life < this.lifeMax / 3) { num782 = 4; } if (this.life < this.lifeMax / 4) { num782 = 3; } if (flag147 && flag148 && Main.rand.Next(num782) == 0 && num781 != 0 && num781 != 4 && num781 != 5 && NPC.CountNPCS(523) < 10) { num781 = 6; } if (num781 == 0) { Vector2 center85 = (player8.Center + new Vector2(0f, -100f)) - center84; float single527 = (float)Math.Ceiling((double)(center85.Length() / 50f)); if (single527 == 0f) { single527 = 1f; } List<int> nums1 = new List<int>(); int num783 = 0; nums1.Add(this.whoAmI); for (int n6 = 0; n6 < 200; n6++) { if (Main.npc[n6].active && Main.npc[n6].type == 440 && Main.npc[n6].ai[3] == (float)this.whoAmI) { nums1.Add(n6); } } bool count = nums1.Count % 2 == 0; foreach (int num784 in nums1) { NPC nPC247 = Main.npc[num784]; Vector2 center86 = nPC247.Center; float single528 = (float)((num783 + count.ToInt() + 1) / 2) * 6.28318548f * 0.4f / (float)nums1.Count; if (num783 % 2 == 1) { single528 = single528 * -1f; } if (nums1.Count == 1) { single528 = 0f; } Vector2 vector2283 = new Vector2(0f, -1f); double num785 = (double)single528; vector24 = new Vector2(); Vector2 vector2284 = vector2283.RotatedBy(num785, vector24) * new Vector2(300f, 200f); Vector2 center87 = (player8.Center + vector2284) - center86; nPC247.ai[0] = 1f; nPC247.ai[1] = single527 * 2f; nPC247.velocity = center87 / single527; if (this.whoAmI >= nPC247.whoAmI) { NPC nPC248 = nPC247; nPC248.position = nPC248.position - nPC247.velocity; } nPC247.netUpdate = true; num783++; } } if (num781 == 1) { this.ai[0] = 3f; this.ai[1] = 0f; } else if (num781 == 2) { this.ai[0] = 2f; this.ai[1] = 0f; } else if (num781 == 3) { this.ai[0] = 4f; this.ai[1] = 0f; } else if (num781 == 4) { this.ai[0] = 5f; this.ai[1] = 0f; } if (num781 == 5) { this.ai[0] = 7f; this.ai[1] = 0f; } if (num781 == 6) { this.ai[0] = 8f; this.ai[1] = 0f; } this.netUpdate = true; } } else if (this.ai[0] == 1f) { flag150 = true; this.localAI[2] = 10f; if ((float)((int)this.ai[1]) % 2f != 0f && this.ai[1] != 1f) { NPC nPC249 = this; nPC249.position = nPC249.position - this.velocity; } this.ai[1] = this.ai[1] - 1f; if (this.ai[1] <= 0f) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[3] = this.ai[3] + 1f; this.velocity = Vector2.Zero; this.netUpdate = true; } } else if (this.ai[0] == 2f) { this.localAI[2] = 11f; Vector2 vector2285 = Vector2.Normalize(player8.Center - center84); if (vector2285.HasNaNs()) { vector2285 = new Vector2((float)this.direction, 0f); } if (this.ai[1] >= 4f && flag149 && (int)(this.ai[1] - 4f) % num766 == 0) { List<int> nums2 = new List<int>(); for (int o6 = 0; o6 < 200; o6++) { if (Main.npc[o6].active && Main.npc[o6].type == 440 && Main.npc[o6].ai[3] == (float)this.whoAmI) { nums2.Add(o6); } } foreach (int num786 in nums2) { NPC nPC250 = Main.npc[num786]; Vector2 center88 = nPC250.Center; int num787 = Math.Sign(player8.Center.X - center88.X); if (num787 != 0) { int num788 = num787; num6 = num788; nPC250.spriteDirection = num788; nPC250.direction = num6; } if (Main.netMode == 1) { continue; } vector2285 = Vector2.Normalize((player8.Center - center88) + (player8.velocity * 20f)); if (vector2285.HasNaNs()) { vector2285 = new Vector2((float)this.direction, 0f); } Vector2 vector2286 = center88 + new Vector2((float)(this.direction * 30), 12f); for (int p6 = 0; p6 < 1; p6++) { Vector2 vector2287 = vector2285 * (6f + (float)Main.rand.NextDouble() * 4f); vector2287 = vector2287.RotatedByRandom(0.523598790168762); Projectile.NewProjectile(vector2286.X, vector2286.Y, vector2287.X, vector2287.Y, 468, 18, 0f, Main.myPlayer, 0f, 0f); } } if (Main.netMode != 1) { vector2285 = Vector2.Normalize((player8.Center - center84) + (player8.velocity * 20f)); if (vector2285.HasNaNs()) { vector2285 = new Vector2((float)this.direction, 0f); } Vector2 center89 = base.Center + new Vector2((float)(this.direction * 30), 12f); for (int q6 = 0; q6 < 1; q6++) { Vector2 vector2288 = vector2285 * 4f; Projectile.NewProjectile(center89.X, center89.Y, vector2288.X, vector2288.Y, 464, num767, 0f, Main.myPlayer, 0f, 1f); } } } this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= (float)(4 + num766)) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[3] = this.ai[3] + 1f; this.velocity = Vector2.Zero; this.netUpdate = true; } } else if (this.ai[0] == 3f) { this.localAI[2] = 11f; Vector2 vector2289 = Vector2.Normalize(player8.Center - center84); if (vector2289.HasNaNs()) { vector2289 = new Vector2((float)this.direction, 0f); } if (this.ai[1] >= 4f && flag149 && (int)(this.ai[1] - 4f) % num768 == 0) { if ((int)(this.ai[1] - 4f) / num768 == 2) { List<int> nums3 = new List<int>(); for (int r6 = 0; r6 < 200; r6++) { if (Main.npc[r6].active && Main.npc[r6].type == 440 && Main.npc[r6].ai[3] == (float)this.whoAmI) { nums3.Add(r6); } } foreach (int num789 in nums3) { NPC nPC251 = Main.npc[num789]; Vector2 center90 = nPC251.Center; int num790 = Math.Sign(player8.Center.X - center90.X); if (num790 != 0) { int num791 = num790; num6 = num791; nPC251.spriteDirection = num791; nPC251.direction = num6; } if (Main.netMode == 1) { continue; } vector2289 = Vector2.Normalize((player8.Center - center90) + (player8.velocity * 20f)); if (vector2289.HasNaNs()) { vector2289 = new Vector2((float)this.direction, 0f); } Vector2 vector2290 = center90 + new Vector2((float)(this.direction * 30), 12f); for (int s6 = 0; s6 < 1; s6++) { Vector2 vector2291 = vector2289 * (6f + (float)Main.rand.NextDouble() * 4f); vector2291 = vector2291.RotatedByRandom(0.523598790168762); Projectile.NewProjectile(vector2290.X, vector2290.Y, vector2291.X, vector2291.Y, 468, 18, 0f, Main.myPlayer, 0f, 0f); } } } int num792 = Math.Sign(player8.Center.X - center84.X); if (num792 != 0) { int num793 = num792; num6 = num793; this.spriteDirection = num793; this.direction = num6; } if (Main.netMode != 1) { vector2289 = Vector2.Normalize((player8.Center - center84) + (player8.velocity * 20f)); if (vector2289.HasNaNs()) { vector2289 = new Vector2((float)this.direction, 0f); } Vector2 center91 = base.Center + new Vector2((float)(this.direction * 30), 12f); for (int t6 = 0; t6 < 1; t6++) { Vector2 vector2292 = vector2289 * (6f + (float)Main.rand.NextDouble() * 4f); vector2292 = vector2292.RotatedByRandom(0.523598790168762); Projectile.NewProjectile(center91.X, center91.Y, vector2292.X, vector2292.Y, 467, num770, 0f, Main.myPlayer, 0f, 0f); } } } this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= (float)(4 + num768 * num769)) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[3] = this.ai[3] + 1f; this.velocity = Vector2.Zero; this.netUpdate = true; } } else if (this.ai[0] == 4f) { if (!flag149) { this.localAI[2] = 11f; } else { this.localAI[2] = 12f; } if (this.ai[1] == 20f && flag149) { List<int> nums4 = new List<int>(); for (int u6 = 0; u6 < 200; u6++) { if (Main.npc[u6].active && Main.npc[u6].type == 440 && Main.npc[u6].ai[3] == (float)this.whoAmI) { nums4.Add(u6); } } foreach (int num794 in nums4) { NPC nPC252 = Main.npc[num794]; Vector2 center92 = nPC252.Center; int num795 = Math.Sign(player8.Center.X - center92.X); if (num795 != 0) { int num796 = num795; num6 = num796; nPC252.spriteDirection = num796; nPC252.direction = num6; } if (Main.netMode == 1) { continue; } Vector2 vector2293 = Vector2.Normalize((player8.Center - center92) + (player8.velocity * 20f)); if (vector2293.HasNaNs()) { vector2293 = new Vector2((float)this.direction, 0f); } Vector2 vector2294 = center92 + new Vector2((float)(this.direction * 30), 12f); for (int v6 = 0; v6 < 1; v6++) { Vector2 vector2295 = vector2293 * (6f + (float)Main.rand.NextDouble() * 4f); vector2295 = vector2295.RotatedByRandom(0.523598790168762); Projectile.NewProjectile(vector2294.X, vector2294.Y, vector2295.X, vector2295.Y, 468, 18, 0f, Main.myPlayer, 0f, 0f); } } if ((int)(this.ai[1] - 20f) % num771 == 0) { Projectile.NewProjectile(base.Center.X, base.Center.Y - 100f, 0f, 0f, 465, num772, 0f, Main.myPlayer, 0f, 0f); } } this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= (float)(20 + num771)) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[3] = this.ai[3] + 1f; this.velocity = Vector2.Zero; this.netUpdate = true; } } else if (this.ai[0] == 5f) { this.localAI[2] = 10f; Vector2 vector2296 = Vector2.Normalize(player8.Center - center84); if (vector2296.HasNaNs()) { vector2296 = new Vector2((float)this.direction, 0f); } if (this.ai[1] >= 0f && this.ai[1] < 30f) { flag150 = true; flag151 = true; float single529 = (this.ai[1] - 0f) / 30f; this.alpha = (int)(single529 * 255f); } else if (this.ai[1] >= 30f && this.ai[1] < 90f) { if (this.ai[1] == 30f && Main.netMode != 1 && flag149) { this.localAI[1] = this.localAI[1] + 1f; Vector2 vector2297 = new Vector2(180f, 0f); List<int> nums5 = new List<int>(); for (int w6 = 0; w6 < 200; w6++) { if (Main.npc[w6].active && Main.npc[w6].type == 440 && Main.npc[w6].ai[3] == (float)this.whoAmI) { nums5.Add(w6); } } int count1 = 6 - nums5.Count; if (count1 > 2) { count1 = 2; } int count2 = nums5.Count + count1 + 1; float[] singleArray14 = new float[count2]; for (int x610 = 0; x610 < (int)singleArray14.Length; x610++) { Vector2 center93 = base.Center; double num797 = (double)((float)x610 * 6.28318548f / (float)count2 - 1.57079637f); vector24 = new Vector2(); singleArray14[x610] = Vector2.Distance(center93 + vector2297.RotatedBy(num797, vector24), player8.Center); } int num798 = 0; for (int y610 = 1; y610 < (int)singleArray14.Length; y610++) { if (singleArray14[num798] > singleArray14[y610]) { num798 = y610; } } num798 = (num798 >= count2 / 2 ? num798 - count2 / 2 : num798 + count2 / 2); int num799 = count1; for (int a6 = 0; a6 < (int)singleArray14.Length; a6++) { if (num798 != a6) { Vector2 center94 = base.Center; double num800 = (double)((float)a6 * 6.28318548f / (float)count2 - 1.57079637f); vector24 = new Vector2(); Vector2 vector2298 = center94 + vector2297.RotatedBy(num800, vector24); int num801 = num799; num799 = num801 - 1; if (num801 <= 0) { int item = nums5[-num799 - 1]; Main.npc[item].Center = vector2298; NetMessage.SendData(23, -1, -1, "", item, 0f, 0f, 0f, 0, 0, 0); } else { int num802 = NPC.NewNPC((int)vector2298.X, (int)vector2298.Y + this.height / 2, 440, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num802].ai[3] = (float)this.whoAmI; Main.npc[num802].netUpdate = true; Main.npc[num802].localAI[1] = this.localAI[1]; } } } this.ai[2] = (float)Projectile.NewProjectile(base.Center.X, base.Center.Y, 0f, 0f, 490, 0, 0f, Main.myPlayer, 0f, (float)this.whoAmI); NPC nPC253 = this; Vector2 center95 = nPC253.Center; double num803 = (double)((float)num798 * 6.28318548f / (float)count2 - 1.57079637f); vector24 = new Vector2(); nPC253.Center = center95 + vector2297.RotatedBy(num803, vector24); this.netUpdate = true; nums5.Clear(); } flag150 = true; flag151 = true; this.alpha = 255; if (!flag149) { Vector2 unitY16 = Main.projectile[(int)Main.npc[(int)this.ai[3]].ai[2]].Center; unitY16 = unitY16 - base.Center; if (unitY16 == Vector2.Zero) { unitY16 = -Vector2.UnitY; } unitY16.Normalize(); if (Math.Abs(unitY16.Y) < 0.77f) { this.localAI[2] = 11f; } else if (unitY16.Y >= 0f) { this.localAI[2] = 10f; } else { this.localAI[2] = 12f; } int num804 = Math.Sign(unitY16.X); if (num804 != 0) { int num805 = num804; num6 = num805; this.spriteDirection = num805; this.direction = num6; } } else { Vector2 unitY17 = Main.projectile[(int)this.ai[2]].Center; unitY17 = unitY17 - base.Center; if (unitY17 == Vector2.Zero) { unitY17 = -Vector2.UnitY; } unitY17.Normalize(); if (Math.Abs(unitY17.Y) < 0.77f) { this.localAI[2] = 11f; } else if (unitY17.Y >= 0f) { this.localAI[2] = 10f; } else { this.localAI[2] = 12f; } int num806 = Math.Sign(unitY17.X); if (num806 != 0) { int num807 = num806; num6 = num807; this.spriteDirection = num807; this.direction = num6; } } } else if (this.ai[1] >= 90f && this.ai[1] < 120f) { flag150 = true; flag151 = true; float single530 = (this.ai[1] - 90f) / 30f; this.alpha = 255 - (int)(single530 * 255f); } else if (this.ai[1] >= 120f && this.ai[1] < 420f) { flag151 = true; this.alpha = 0; if (!flag149) { Vector2 unitY18 = Main.projectile[(int)Main.npc[(int)this.ai[3]].ai[2]].Center; unitY18 = unitY18 - base.Center; if (unitY18 == Vector2.Zero) { unitY18 = -Vector2.UnitY; } unitY18.Normalize(); if (Math.Abs(unitY18.Y) < 0.77f) { this.localAI[2] = 11f; } else if (unitY18.Y >= 0f) { this.localAI[2] = 10f; } else { this.localAI[2] = 12f; } int num808 = Math.Sign(unitY18.X); if (num808 != 0) { int num809 = num808; num6 = num809; this.spriteDirection = num809; this.direction = num6; } } else { Vector2 unitY19 = Main.projectile[(int)this.ai[2]].Center; unitY19 = unitY19 - base.Center; if (unitY19 == Vector2.Zero) { unitY19 = -Vector2.UnitY; } unitY19.Normalize(); if (Math.Abs(unitY19.Y) < 0.77f) { this.localAI[2] = 11f; } else if (unitY19.Y >= 0f) { this.localAI[2] = 10f; } else { this.localAI[2] = 12f; } int num810 = Math.Sign(unitY19.X); if (num810 != 0) { int num811 = num810; num6 = num811; this.spriteDirection = num811; this.direction = num6; } } } this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= 420f) { flag151 = true; this.ai[0] = 0f; this.ai[1] = 0f; this.ai[3] = this.ai[3] + 1f; this.velocity = Vector2.Zero; this.netUpdate = true; } } else if (this.ai[0] == 6f) { this.localAI[2] = 13f; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= 120f) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[3] = this.ai[3] + 1f; this.velocity = Vector2.Zero; this.netUpdate = true; } } else if (this.ai[0] == 7f) { this.localAI[2] = 11f; Vector2 vector2299 = Vector2.Normalize(player8.Center - center84); if (vector2299.HasNaNs()) { vector2299 = new Vector2((float)this.direction, 0f); } if (this.ai[1] >= 4f && flag149 && (int)(this.ai[1] - 4f) % num773 == 0) { if ((int)(this.ai[1] - 4f) / num773 == 2) { List<int> nums6 = new List<int>(); for (int b6 = 0; b6 < 200; b6++) { if (Main.npc[b6].active && Main.npc[b6].type == 440 && Main.npc[b6].ai[3] == (float)this.whoAmI) { nums6.Add(b6); } } foreach (int num812 in nums6) { NPC nPC254 = Main.npc[num812]; Vector2 center96 = nPC254.Center; int num813 = Math.Sign(player8.Center.X - center96.X); if (num813 != 0) { int num814 = num813; num6 = num814; nPC254.spriteDirection = num814; nPC254.direction = num6; } if (Main.netMode == 1) { continue; } vector2299 = Vector2.Normalize((player8.Center - center96) + (player8.velocity * 20f)); if (vector2299.HasNaNs()) { vector2299 = new Vector2((float)this.direction, 0f); } Vector2 vector2300 = center96 + new Vector2((float)(this.direction * 30), 12f); for (int c6 = 0; (float)c6 < 5f; c6++) { Vector2 vector2301 = vector2299 * (6f + (float)Main.rand.NextDouble() * 4f); vector2301 = vector2301.RotatedByRandom(1.25663709640503); Projectile.NewProjectile(vector2300.X, vector2300.Y, vector2301.X, vector2301.Y, 468, 18, 0f, Main.myPlayer, 0f, 0f); } } } int num815 = Math.Sign(player8.Center.X - center84.X); if (num815 != 0) { int num816 = num815; num6 = num816; this.spriteDirection = num816; this.direction = num6; } if (Main.netMode != 1) { vector2299 = Vector2.Normalize((player8.Center - center84) + (player8.velocity * 20f)); if (vector2299.HasNaNs()) { vector2299 = new Vector2((float)this.direction, 0f); } Vector2 center97 = base.Center + new Vector2((float)(this.direction * 30), 12f); float single531 = 8f; float single532 = 0.251327425f; for (int d6 = 0; (float)d6 < 5f; d6++) { Vector2 vector2302 = vector2299 * single531; double num817 = (double)(single532 * (float)d6 - (1.2566371f - single532) / 2f); vector24 = new Vector2(); vector2302 = vector2302.RotatedBy(num817, vector24); float single533 = (Main.rand.NextFloat() - 0.5f) * 0.3f * 6.28318548f / 60f; int num818 = NPC.NewNPC((int)center97.X, (int)center97.Y + 7, 522, 0, 0f, single533, vector2302.X, vector2302.Y, 255); Main.npc[num818].velocity = vector2302; } } } this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= (float)(4 + num773 * num774)) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[3] = this.ai[3] + 1f; this.velocity = Vector2.Zero; this.netUpdate = true; } } else if (this.ai[0] == 8f) { this.localAI[2] = 13f; if (this.ai[1] >= 4f && flag149 && (int)(this.ai[1] - 4f) % num775 == 0) { List<int> nums7 = new List<int>(); for (int e6 = 0; e6 < 200; e6++) { if (Main.npc[e6].active && Main.npc[e6].type == 440 && Main.npc[e6].ai[3] == (float)this.whoAmI) { nums7.Add(e6); } } int count3 = nums7.Count + 1; if (count3 > 3) { count3 = 3; } int num819 = Math.Sign(player8.Center.X - center84.X); if (num819 != 0) { int num820 = num819; num6 = num820; this.spriteDirection = num820; this.direction = num6; } if (Main.netMode != 1) { for (int f6 = 0; f6 < count3; f6++) { Point point5 = base.Center.ToTileCoordinates(); Point tileCoordinates6 = Main.player[this.target].Center.ToTileCoordinates(); Vector2 center98 = Main.player[this.target].Center - base.Center; int num821 = 20; int num822 = 3; int num823 = 7; int num824 = 2; int num825 = 0; bool flag152 = false; if (center98.Length() > 2000f) { flag152 = true; } while (!flag152 && num825 < 100) { num825++; int num826 = Main.rand.Next(tileCoordinates6.X - num821, tileCoordinates6.X + num821 + 1); int num827 = Main.rand.Next(tileCoordinates6.Y - num821, tileCoordinates6.Y + num821 + 1); if (num827 >= tileCoordinates6.Y - num823 && num827 <= tileCoordinates6.Y + num823 && num826 >= tileCoordinates6.X - num823 && num826 <= tileCoordinates6.X + num823 || num827 >= point5.Y - num822 && num827 <= point5.Y + num822 && num826 >= point5.X - num822 && num826 <= point5.X + num822 || Main.tile[num826, num827].nactive()) { continue; } bool flag153 = true; if (flag153 && Collision.SolidTiles(num826 - num824, num826 + num824, num827 - num824, num827 + num824)) { flag153 = false; } if (!flag153) { continue; } NPC.NewNPC(num826 * 16 + 8, num827 * 16 + 8, 523, 0, (float)this.whoAmI, 0f, 0f, 0f, 255); flag152 = true; break; } } } } this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= (float)(4 + num775 * num776)) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[3] = this.ai[3] + 1f; this.velocity = Vector2.Zero; this.netUpdate = true; } } if (!flag149) { this.ai[3] = single526; } this.dontTakeDamage = flag150; this.chaseable = !flag151; return; } if (this.aiStyle == 85) { this.noTileCollide = false; if (this.ai[0] == 0f) { this.TargetClosest(true); if (!Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { Vector2 center99 = Main.player[this.target].Center - base.Center; center99.Y = center99.Y - (float)(Main.player[this.target].height / 4); if (center99.Length() <= 800f) { Vector2 center100 = base.Center; center100.X = Main.player[this.target].Center.X; Vector2 center101 = center100 - base.Center; if (center101.Length() <= 8f || !Collision.CanHit(base.Center, 1, 1, center100, 1, 1)) { center100 = base.Center; center100.Y = Main.player[this.target].Center.Y; center101 = center100 - base.Center; if (center101.Length() > 8f && Collision.CanHit(base.Center, 1, 1, center100, 1, 1)) { this.ai[0] = 3f; this.ai[1] = center100.X; this.ai[2] = center100.Y; } } else { this.ai[0] = 3f; this.ai[1] = center100.X; this.ai[2] = center100.Y; Vector2 center102 = base.Center; center102.Y = Main.player[this.target].Center.Y; if (center101.Length() > 8f && Collision.CanHit(base.Center, 1, 1, center102, 1, 1) && Collision.CanHit(center102, 1, 1, Main.player[this.target].position, 1, 1)) { this.ai[0] = 3f; this.ai[1] = center102.X; this.ai[2] = center102.Y; } } if (this.ai[0] == 0f) { this.localAI[0] = 0f; center99.Normalize(); center99 = center99 * 0.5f; NPC nPC255 = this; nPC255.velocity = nPC255.velocity + center99; this.ai[0] = 4f; this.ai[1] = 0f; } } else { this.ai[0] = 2f; } } else { this.ai[0] = 1f; } } else if (this.ai[0] == 1f) { NPC nPC256 = this; nPC256.rotation = nPC256.rotation + (float)this.direction * 0.3f; Vector2 top = Main.player[this.target].Center - base.Center; if (this.type == 421) { top = Main.player[this.target].Top - base.Center; } float single534 = top.Length(); float single535 = 5.5f + single534 / 100f; int num828 = 50; top.Normalize(); top = top * single535; this.velocity = ((this.velocity * (float)(num828 - 1)) + top) / (float)num828; if (!Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[0] = 0f; this.ai[1] = 0f; } if (this.type == 421 && single534 < 40f && Main.player[this.target].active && !Main.player[this.target].dead) { bool flag154 = true; int num829 = 0; while (num829 < 200) { NPC nPC257 = Main.npc[num829]; if (!nPC257.active || nPC257.type != this.type || nPC257.ai[0] != 5f || nPC257.target != this.target) { num829++; } else { flag154 = false; break; } } if (flag154) { base.Center = Main.player[this.target].Top; this.velocity = Vector2.Zero; this.ai[0] = 5f; this.ai[1] = 0f; this.netUpdate = true; } } } else if (this.ai[0] == 2f) { this.rotation = this.velocity.X * 0.1f; this.noTileCollide = true; Vector2 center103 = Main.player[this.target].Center - base.Center; float single536 = center103.Length(); float single537 = 3f; int num830 = 3; center103.Normalize(); center103 = center103 * single537; this.velocity = ((this.velocity * (float)(num830 - 1)) + center103) / (float)num830; if (single536 < 600f && !Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[0] = 0f; } } else if (this.ai[0] == 3f) { this.rotation = this.velocity.X * 0.1f; Vector2 vector2303 = new Vector2(this.ai[1], this.ai[2]); Vector2 center104 = vector2303 - base.Center; float single538 = center104.Length(); float single539 = 2f; float single540 = 3f; center104.Normalize(); center104 = center104 * single539; this.velocity = ((this.velocity * (single540 - 1f)) + center104) / single540; if (this.collideX || this.collideY) { this.ai[0] = 4f; this.ai[1] = 0f; } if (single538 < single539 || single538 > 800f || Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[0] = 0f; } } else if (this.ai[0] == 4f) { this.rotation = this.velocity.X * 0.1f; if (this.collideX) { this.velocity.X = this.velocity.X * -0.8f; } if (this.collideY) { this.velocity.Y = this.velocity.Y * -0.8f; } if (this.velocity.X == 0f && this.velocity.Y == 0f) { center = Main.player[this.target].Center - base.Center; center.Y = center.Y - (float)(Main.player[this.target].height / 4); center.Normalize(); this.velocity = center * 0.1f; } float single541 = 2f; float single542 = 20f; center = this.velocity; center.Normalize(); center = center * single541; this.velocity = ((this.velocity * (single542 - 1f)) + center) / single542; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] > 180f) { this.ai[0] = 0f; this.ai[1] = 0f; } if (Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[0] = 0f; } this.localAI[0] = this.localAI[0] + 1f; if (this.localAI[0] >= 5f && !Collision.SolidCollision(this.position - new Vector2(10f, 10f), this.width + 20, this.height + 20)) { this.localAI[0] = 0f; Vector2 center105 = base.Center; center105.X = Main.player[this.target].Center.X; if (!Collision.CanHit(base.Center, 1, 1, center105, 1, 1) || !Collision.CanHit(base.Center, 1, 1, center105, 1, 1) || !Collision.CanHit(Main.player[this.target].Center, 1, 1, center105, 1, 1)) { center105 = base.Center; center105.Y = Main.player[this.target].Center.Y; if (Collision.CanHit(base.Center, 1, 1, center105, 1, 1) && Collision.CanHit(Main.player[this.target].Center, 1, 1, center105, 1, 1)) { this.ai[0] = 3f; this.ai[1] = center105.X; this.ai[2] = center105.Y; } } else { this.ai[0] = 3f; this.ai[1] = center105.X; this.ai[2] = center105.Y; } } } else if (this.ai[0] == 5f) { Player player9 = Main.player[this.target]; if (!player9.active || player9.dead) { this.ai[0] = 0f; this.ai[1] = 0f; this.netUpdate = true; } else { base.Center = (player9.gravDir == 1f ? player9.Top : player9.Bottom) + new Vector2((float)(player9.direction * 4), 0f); this.gfxOffY = player9.gfxOffY; this.velocity = Vector2.Zero; player9.AddBuff(163, 59, true); } } if (this.type == 405) { this.rotation = 0f; for (int g6 = 0; g6 < 200; g6++) { if (g6 != this.whoAmI && Main.npc[g6].active && Main.npc[g6].type == this.type && Math.Abs(this.position.X - Main.npc[g6].position.X) + Math.Abs(this.position.Y - Main.npc[g6].position.Y) < (float)this.width) { if (this.position.X >= Main.npc[g6].position.X) { this.velocity.X = this.velocity.X + 0.05f; } else { this.velocity.X = this.velocity.X - 0.05f; } if (this.position.Y >= Main.npc[g6].position.Y) { this.velocity.Y = this.velocity.Y + 0.05f; } else { this.velocity.Y = this.velocity.Y - 0.05f; } } } return; } if (this.type == 421) { this.hide = this.ai[0] == 5f; this.rotation = this.velocity.X * 0.1f; for (int h6 = 0; h6 < 200; h6++) { if (h6 != this.whoAmI && Main.npc[h6].active && Main.npc[h6].type == this.type && Math.Abs(this.position.X - Main.npc[h6].position.X) + Math.Abs(this.position.Y - Main.npc[h6].position.Y) < (float)this.width) { if (this.position.X >= Main.npc[h6].position.X) { this.velocity.X = this.velocity.X + 0.05f; } else { this.velocity.X = this.velocity.X - 0.05f; } if (this.position.Y >= Main.npc[h6].position.Y) { this.velocity.Y = this.velocity.Y + 0.05f; } else { this.velocity.Y = this.velocity.Y - 0.05f; } } } return; } } else if (this.aiStyle == 86) { if (this.alpha > 0) { NPC nPC258 = this; nPC258.alpha = nPC258.alpha - 30; if (this.alpha < 0) { this.alpha = 0; } } this.noGravity = true; this.noTileCollide = true; this.knockBackResist = 0f; for (int i7 = 0; i7 < 200; i7++) { if (i7 != this.whoAmI && Main.npc[i7].active && Main.npc[i7].type == this.type) { Vector2 center106 = Main.npc[i7].Center - base.Center; if (center106.Length() < 50f) { center106.Normalize(); if (center106.X == 0f && center106.Y == 0f) { if (i7 <= this.whoAmI) { center106.X = -1f; } else { center106.X = 1f; } } center106 = center106 * 0.4f; NPC nPC259 = this; nPC259.velocity = nPC259.velocity - center106; NPC nPC260 = Main.npc[i7]; nPC260.velocity = nPC260.velocity + center106; } } } if (this.type == 472) { float single543 = 120f; if (this.localAI[0] < single543) { if (this.localAI[0] == 0f) { this.TargetClosest(true); if (this.direction <= 0) { this.velocity.X = this.velocity.X - 2f; } else { this.velocity.X = this.velocity.X + 2f; } } this.localAI[0] = this.localAI[0] + 1f; } } if (this.type == 521 && this.localAI[0] < 120f) { if (this.localAI[0] == 0f) { this.TargetClosest(true); if (this.direction <= 0) { this.velocity.X = this.velocity.X - 2f; } else { this.velocity.X = this.velocity.X + 2f; } } this.localAI[0] = this.localAI[0] + 1f; int num835 = 10; } if (this.ai[0] == 0f) { this.TargetClosest(true); this.ai[0] = 1f; this.ai[1] = (float)this.direction; } else if (this.ai[0] == 1f) { this.TargetClosest(true); float single546 = 0.3f; float single547 = 7f; float single548 = 4f; float single549 = 660f; float single550 = 4f; if (this.type == 521) { single546 = 0.7f; single547 = 14f; single549 = 500f; single548 = 6f; single550 = 3f; } this.velocity.X = this.velocity.X + this.ai[1] * single546; if (this.velocity.X > single547) { this.velocity.X = single547; } if (this.velocity.X < -single547) { this.velocity.X = -single547; } float y211 = Main.player[this.target].Center.Y - base.Center.Y; if (Math.Abs(y211) > single548) { single550 = 15f; } if (y211 > single548) { y211 = single548; } else if (y211 < -single548) { y211 = -single548; } this.velocity.Y = (this.velocity.Y * (single550 - 1f) + y211) / single550; if (this.ai[1] > 0f && Main.player[this.target].Center.X - base.Center.X < -single549 || this.ai[1] < 0f && Main.player[this.target].Center.X - base.Center.X > single549) { this.ai[0] = 2f; this.ai[1] = 0f; if (base.Center.Y + 20f <= Main.player[this.target].Center.Y) { this.ai[1] = 1f; } else { this.ai[1] = -1f; } } } else if (this.ai[0] == 2f) { float single551 = 0.4f; float single552 = 0.95f; float single553 = 5f; if (this.type == 521) { single551 = 0.3f; single553 = 7f; single552 = 0.9f; } this.velocity.Y = this.velocity.Y + this.ai[1] * single551; if (this.velocity.Length() > single553) { NPC nPC261 = this; nPC261.velocity = nPC261.velocity * single552; } if (this.velocity.X > -1f && this.velocity.X < 1f) { this.TargetClosest(true); this.ai[0] = 3f; this.ai[1] = (float)this.direction; } } else if (this.ai[0] == 3f) { float single554 = 0.4f; float single555 = 0.2f; float single556 = 5f; float single557 = 0.95f; if (this.type == 521) { single554 = 0.6f; single555 = 0.3f; single556 = 7f; single557 = 0.9f; } this.velocity.X = this.velocity.X + this.ai[1] * single554; if (base.Center.Y <= Main.player[this.target].Center.Y) { this.velocity.Y = this.velocity.Y + single555; } else { this.velocity.Y = this.velocity.Y - single555; } if (this.velocity.Length() > single556) { NPC nPC262 = this; nPC262.velocity = nPC262.velocity * single557; } if (this.velocity.Y > -1f && this.velocity.Y < 1f) { this.TargetClosest(true); this.ai[0] = 0f; this.ai[1] = (float)this.direction; } } if (this.type == 521) { int num837 = 10; return; } } else if (this.aiStyle == 87) { this.knockBackResist = 0.2f * Main.knockBackMultiplier; this.dontTakeDamage = false; this.noTileCollide = false; this.noGravity = false; this.reflectingProjectiles = false; if (this.ai[0] != 7f && Main.player[this.target].dead) { this.TargetClosest(true); if (Main.player[this.target].dead) { this.ai[0] = 7f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; } } if (this.ai[0] == 0f) { this.TargetClosest(true); Vector2 center108 = Main.player[this.target].Center - base.Center; if (this.velocity.X != 0f || this.velocity.Y > 100f || this.justHit || center108.Length() < 80f) { this.ai[0] = 1f; this.ai[1] = 0f; return; } } else if (this.ai[0] == 1f) { this.ai[1] = this.ai[1] + 1f; if (this.ai[1] > 36f) { this.ai[0] = 2f; this.ai[1] = 0f; return; } } else if (this.ai[0] == 2f) { if ((Main.player[this.target].Center - base.Center).Length() > 600f) { this.ai[0] = 5f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; } if (this.velocity.Y != 0f) { this.knockBackResist = 0f; this.velocity.X = this.velocity.X * 0.99f; if (this.direction < 0 && this.velocity.X > -1f) { this.velocity.X = -1f; } if (this.direction > 0 && this.velocity.X < 1f) { this.velocity.X = 1f; } } else { this.TargetClosest(true); this.velocity.X = this.velocity.X * 0.85f; this.ai[1] = this.ai[1] + 1f; float single558 = 15f + 30f * ((float)this.life / (float)this.lifeMax); float single559 = 3f + 4f * (1f - (float)this.life / (float)this.lifeMax); float single560 = 4f; if (!Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { single560 = single560 + 2f; } if (this.ai[1] > single558) { this.ai[3] = this.ai[3] + 1f; if (this.ai[3] >= 3f) { this.ai[3] = 0f; single560 = single560 * 2f; single559 = single559 / 2f; } this.ai[1] = 0f; this.velocity.Y = this.velocity.Y - single560; this.velocity.X = single559 * (float)this.direction; } } this.ai[2] = this.ai[2] + 1f; if ((double)this.ai[2] > 210 && this.velocity.Y == 0f && Main.netMode != 1) { int num839 = Main.rand.Next(3); if (num839 == 0) { this.ai[0] = 3f; } else if (num839 == 1) { this.ai[0] = 4f; this.noTileCollide = true; this.velocity.Y = -8f; } else if (num839 != 2) { this.ai[0] = 2f; } else { this.ai[0] = 6f; } this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; return; } } else if (this.ai[0] == 3f) { this.velocity.X = this.velocity.X * 0.85f; this.dontTakeDamage = true; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= 180f) { this.ai[0] = 2f; this.ai[1] = 0f; } if (Main.expertMode) { this.ReflectProjectiles(base.Hitbox); this.reflectingProjectiles = true; return; } } else if (this.ai[0] == 4f) { this.noTileCollide = true; this.noGravity = true; this.knockBackResist = 0f; if (this.velocity.X >= 0f) { this.direction = 1; } else { this.direction = -1; } this.spriteDirection = this.direction; this.TargetClosest(true); Vector2 center109 = Main.player[this.target].Center; center109.Y = center109.Y - 350f; Vector2 center110 = center109 - base.Center; if (this.ai[2] != 1f) { if (Math.Abs(base.Center.X - Main.player[this.target].Center.X) < 40f && base.Center.Y < Main.player[this.target].Center.Y - 300f) { this.ai[1] = 0f; this.ai[2] = 1f; return; } center110.Normalize(); center110 = center110 * 12f; this.velocity = ((this.velocity * 5f) + center110) / 6f; return; } this.ai[1] = this.ai[1] + 1f; center110 = Main.player[this.target].Center - base.Center; center110.Normalize(); center110 = center110 * 8f; this.velocity = ((this.velocity * 4f) + center110) / 5f; if (this.ai[1] > 6f) { this.ai[1] = 0f; this.ai[0] = 4.1f; this.ai[2] = 0f; this.velocity = center110; return; } } else if (this.ai[0] != 4.1f) { if (this.ai[0] == 5f) { if (this.velocity.X <= 0f) { this.direction = -1; } else { this.direction = 1; } this.spriteDirection = this.direction; this.noTileCollide = true; this.noGravity = true; this.knockBackResist = 0f; Vector2 center111 = Main.player[this.target].Center - base.Center; center111.Y = center111.Y - 4f; if (center111.Length() < 200f && !Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[0] = 2f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; } if (center111.Length() > 10f) { center111.Normalize(); center111 = center111 * 10f; } this.velocity = ((this.velocity * 4f) + center111) / 5f; return; } if (this.ai[0] == 6f) { this.knockBackResist = 0f; if (this.velocity.Y != 0f) { this.velocity.X = this.velocity.X * 0.98f; if (this.direction < 0 && this.velocity.X > -8f) { this.velocity.X = -8f; } if (this.direction > 0 && this.velocity.X < 8f) { this.velocity.X = 8f; } } else { this.TargetClosest(true); this.velocity.X = this.velocity.X * 0.8f; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] > 5f) { this.ai[1] = 0f; this.velocity.Y = this.velocity.Y - 4f; if (Main.player[this.target].position.Y + (float)Main.player[this.target].height < base.Center.Y) { this.velocity.Y = this.velocity.Y - 1.25f; } if (Main.player[this.target].position.Y + (float)Main.player[this.target].height < base.Center.Y - 40f) { this.velocity.Y = this.velocity.Y - 1.5f; } if (Main.player[this.target].position.Y + (float)Main.player[this.target].height < base.Center.Y - 80f) { this.velocity.Y = this.velocity.Y - 1.75f; } if (Main.player[this.target].position.Y + (float)Main.player[this.target].height < base.Center.Y - 120f) { this.velocity.Y = this.velocity.Y - 2f; } if (Main.player[this.target].position.Y + (float)Main.player[this.target].height < base.Center.Y - 160f) { this.velocity.Y = this.velocity.Y - 2.25f; } if (Main.player[this.target].position.Y + (float)Main.player[this.target].height < base.Center.Y - 200f) { this.velocity.Y = this.velocity.Y - 2.5f; } if (!Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.velocity.Y = this.velocity.Y - 2f; } this.velocity.X = (float)(12 * this.direction); this.ai[2] = this.ai[2] + 1f; } } if (this.ai[2] >= 3f && this.velocity.Y == 0f) { this.ai[0] = 2f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; return; } } else if (this.ai[0] == 7f) { this.damage = 0; this.life = this.lifeMax; this.defense = 9999; this.noTileCollide = true; NPC nPC263 = this; nPC263.alpha = nPC263.alpha + 7; if (this.alpha > 255) { this.alpha = 255; } this.velocity.X = this.velocity.X * 0.98f; return; } } else { this.knockBackResist = 0f; if (this.ai[2] == 0f && Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1) && !Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[2] = 1f; } if (this.position.Y + (float)this.height >= Main.player[this.target].position.Y || this.velocity.Y <= 0f) { this.ai[1] = this.ai[1] + 1f; if (this.ai[1] > 10f) { this.ai[0] = 2f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; if (Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[0] = 5f; } } } else if (this.ai[2] == 0f) { this.noTileCollide = true; this.noGravity = true; this.knockBackResist = 0f; } this.velocity.Y = this.velocity.Y + 0.2f; if (this.velocity.Y > 16f) { this.velocity.Y = 16f; return; } } } else if (this.aiStyle == 88) { int num840 = 7; this.noTileCollide = false; this.noGravity = true; this.knockBackResist = 0.2f * Main.expertKnockBack; this.damage = this.defDamage; if (!Main.eclipse) { this.ai[0] = -1f; } else if (this.target < 0 || Main.player[this.target].dead || !Main.player[this.target].active) { this.TargetClosest(true); Vector2 center112 = Main.player[this.target].Center - base.Center; if (Main.player[this.target].dead || center112.Length() > 3000f) { this.ai[0] = -1f; } } else { Vector2 center113 = Main.player[this.target].Center - base.Center; if (this.ai[0] > 1f && center113.Length() > 1000f) { this.ai[0] = 1f; } } if (this.ai[0] == -1f) { Vector2 vector2308 = new Vector2(0f, -8f); this.velocity = ((this.velocity * 9f) + vector2308) / 10f; this.noTileCollide = true; this.dontTakeDamage = true; return; } if (this.ai[0] != 0f) { if (this.ai[0] == 1f) { this.collideX = false; this.collideY = false; this.noTileCollide = true; this.knockBackResist = 0f; if (this.target < 0 || !Main.player[this.target].active || Main.player[this.target].dead) { this.TargetClosest(true); } if (this.velocity.X < 0f) { this.direction = -1; } else if (this.velocity.X > 0f) { this.direction = 1; } this.spriteDirection = this.direction; this.rotation = (this.rotation * 9f + this.velocity.X * 0.08f) / 10f; Vector2 center114 = Main.player[this.target].Center - base.Center; if (center114.Length() < 300f && !Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; } float single561 = 7f + center114.Length() / 100f; float single562 = 25f; center114.Normalize(); center114 = center114 * single561; this.velocity = ((this.velocity * (single562 - 1f)) + center114) / single562; return; } if (this.ai[0] != 2f) { if (this.ai[0] == 3f) { this.knockBackResist = 0f; this.noTileCollide = true; if (this.velocity.X >= 0f) { this.direction = 1; } else { this.direction = -1; } this.spriteDirection = this.direction; this.rotation = (this.rotation * 4f + this.velocity.X * 0.07f) / 5f; Vector2 center115 = Main.player[this.target].Center - base.Center; center115.Y = center115.Y - 12f; if (base.Center.X <= Main.player[this.target].Center.X) { center115.X = center115.X - 400f; } else { center115.X = center115.X + 400f; } if (Math.Abs(base.Center.X - Main.player[this.target].Center.X) > 350f && Math.Abs(base.Center.Y - Main.player[this.target].Center.Y) < 20f) { this.ai[0] = 3.1f; this.ai[1] = 0f; } this.ai[1] = this.ai[1] + 0.0333333351f; float single563 = 8f + this.ai[1]; float single564 = 4f; center115.Normalize(); center115 = center115 * single563; this.velocity = ((this.velocity * (single564 - 1f)) + center115) / single564; return; } if (this.ai[0] != 3.1f) { if (this.ai[0] == 3.2f) { this.damage = (int)((double)this.defDamage * 1.3); this.collideX = false; this.collideY = false; this.knockBackResist = 0f; this.noTileCollide = true; this.ai[2] = this.ai[2] + 0.0333333351f; this.velocity.X = (16f + this.ai[2]) * this.ai[1]; if (this.ai[1] > 0f && base.Center.X > Main.player[this.target].Center.X + 260f || this.ai[1] < 0f && base.Center.X < Main.player[this.target].Center.X - 260f) { if (!Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; } else if (Math.Abs(base.Center.X - Main.player[this.target].Center.X) > 800f) { this.ai[0] = 1f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; } } this.rotation = (this.rotation * 4f + this.velocity.X * 0.07f) / 5f; return; } if (this.ai[0] == 4f) { this.ai[0] = 0f; this.TargetClosest(true); if (Main.netMode != 1) { this.ai[1] = -1f; this.ai[2] = -1f; for (int n7 = 0; n7 < 1000; n7++) { int x209 = (int)Main.player[this.target].Center.X / 16; int y212 = (int)Main.player[this.target].Center.Y / 16; int num841 = 30 + n7 / 50; int num842 = 20 + n7 / 75; x209 = x209 + Main.rand.Next(-num841, num841 + 1); y212 = y212 + Main.rand.Next(-num842, num842 + 1); if (!WorldGen.SolidTile(x209, y212)) { while (!WorldGen.SolidTile(x209, y212) && (double)y212 < Main.worldSurface) { y212++; } if ((new Vector2((float)(x209 * 16 + 8), (float)(y212 * 16 + 8)) - Main.player[this.target].Center).Length() < 600f) { this.ai[0] = 4.1f; this.ai[1] = (float)x209; this.ai[2] = (float)y212; break; } } } } this.netUpdate = true; return; } if (this.ai[0] == 4.1f) { if (this.velocity.X < -2f) { this.direction = -1; } else if (this.velocity.X > 2f) { this.direction = 1; } this.spriteDirection = this.direction; this.rotation = (this.rotation * 9f + this.velocity.X * 0.1f) / 10f; this.noTileCollide = true; int num843 = (int)this.ai[1]; int num844 = (int)this.ai[2]; float single565 = (float)(num843 * 16 + 8); float single566 = (float)(num844 * 16 - 20); Vector2 center116 = new Vector2(single565, single566); center116 = center116 - base.Center; float single567 = 6f + center116.Length() / 150f; if (single567 > 10f) { single567 = 10f; } float single568 = 10f; if (center116.Length() < 10f) { this.ai[0] = 4.2f; } center116.Normalize(); center116 = center116 * single567; this.velocity = ((this.velocity * (single568 - 1f)) + center116) / single568; return; } if (this.ai[0] == 4.2f) { this.rotation = (this.rotation * 9f + this.velocity.X * 0.1f) / 10f; this.knockBackResist = 0f; this.noTileCollide = true; int num845 = (int)this.ai[1]; int num846 = (int)this.ai[2]; float single569 = (float)(num845 * 16 + 8); float single570 = (float)(num846 * 16 - 20); Vector2 center117 = new Vector2(single569, single570); center117 = center117 - base.Center; float single571 = 4f; float single572 = 2f; if (Main.netMode != 1 && center117.Length() < 4f) { int num847 = 70; if (Main.expertMode) { num847 = (int)((double)num847 * 0.75); } this.ai[3] = this.ai[3] + 1f; if (this.ai[3] == (float)num847) { NPC.NewNPC(num845 * 16 + 8, num846 * 16, 478, this.whoAmI, 0f, 0f, 0f, 0f, 255); } else if (this.ai[3] == (float)(num847 * 2)) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; if (NPC.CountNPCS(478) + NPC.CountNPCS(479) < num840 && Main.rand.Next(3) != 0) { this.ai[0] = 4f; } else if (Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[0] = 1f; } } } if (center117.Length() > single571) { center117.Normalize(); center117 = center117 * single571; } this.velocity = ((this.velocity * (single572 - 1f)) + center117) / single572; return; } } else { this.knockBackResist = 0f; this.noTileCollide = true; this.rotation = (this.rotation * 4f + this.velocity.X * 0.07f) / 5f; Vector2 center118 = Main.player[this.target].Center - base.Center; center118.Y = center118.Y - 12f; float single573 = 16f; float single574 = 8f; center118.Normalize(); center118 = center118 * single573; this.velocity = ((this.velocity * (single574 - 1f)) + center118) / single574; if (this.velocity.X >= 0f) { this.direction = 1; } else { this.direction = -1; } this.spriteDirection = this.direction; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] > 10f) { this.velocity = center118; if (this.velocity.X >= 0f) { this.direction = 1; } else { this.direction = -1; } this.ai[0] = 3.2f; this.ai[1] = 0f; this.ai[1] = (float)this.direction; return; } } } else { this.damage = (int)((double)this.defDamage * 0.5); this.knockBackResist = 0f; if (this.target < 0 || !Main.player[this.target].active || Main.player[this.target].dead) { this.TargetClosest(true); this.ai[0] = 0f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; } if (Main.player[this.target].Center.X - 10f < base.Center.X) { this.direction = -1; } else if (Main.player[this.target].Center.X + 10f > base.Center.X) { this.direction = 1; } this.spriteDirection = this.direction; this.rotation = (this.rotation * 4f + this.velocity.X * 0.1f) / 5f; if (this.collideX) { this.velocity.X = this.velocity.X * (-this.oldVelocity.X * 0.5f); if (this.velocity.X > 4f) { this.velocity.X = 4f; } if (this.velocity.X < -4f) { this.velocity.X = -4f; } } if (this.collideY) { this.velocity.Y = this.velocity.Y * (-this.oldVelocity.Y * 0.5f); if (this.velocity.Y > 4f) { this.velocity.Y = 4f; } if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } } Vector2 center119 = Main.player[this.target].Center - base.Center; center119.Y = center119.Y - 20f; this.ai[2] = this.ai[2] + 0.0222222228f; if (Main.expertMode) { this.ai[2] = this.ai[2] + 0.0166666675f; } float single575 = 4f + this.ai[2] + center119.Length() / 120f; float single576 = 20f; center119.Normalize(); center119 = center119 * single575; this.velocity = ((this.velocity * (single576 - 1f)) + center119) / single576; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] > 240f || !Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; return; } } } else { this.TargetClosest(true); if (base.Center.X < Main.player[this.target].Center.X - 2f) { this.direction = 1; } if (base.Center.X > Main.player[this.target].Center.X + 2f) { this.direction = -1; } this.spriteDirection = this.direction; this.rotation = (this.rotation * 9f + this.velocity.X * 0.1f) / 10f; if (this.collideX) { this.velocity.X = this.velocity.X * (-this.oldVelocity.X * 0.5f); if (this.velocity.X > 4f) { this.velocity.X = 4f; } if (this.velocity.X < -4f) { this.velocity.X = -4f; } } if (this.collideY) { this.velocity.Y = this.velocity.Y * (-this.oldVelocity.Y * 0.5f); if (this.velocity.Y > 4f) { this.velocity.Y = 4f; } if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } } Vector2 center120 = Main.player[this.target].Center - base.Center; center120.Y = center120.Y - 200f; if (center120.Length() > 800f) { this.ai[0] = 1f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; } else if (center120.Length() > 80f) { float single577 = 6f; float single578 = 30f; center120.Normalize(); center120 = center120 * single577; this.velocity = ((this.velocity * (single578 - 1f)) + center120) / single578; } else if (this.velocity.Length() > 2f) { NPC nPC264 = this; nPC264.velocity = nPC264.velocity * 0.95f; } else if (this.velocity.Length() < 1f) { NPC nPC265 = this; nPC265.velocity = nPC265.velocity * 1.05f; } this.ai[1] = this.ai[1] + 1f; if (this.justHit) { this.ai[1] = this.ai[1] + (float)Main.rand.Next(10, 30); } if (this.ai[1] >= 180f && Main.netMode != 1) { this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; while (this.ai[0] == 0f) { int num848 = Main.rand.Next(3); if (num848 == 0 && Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[0] = 2f; } else if (num848 != 1) { if (num848 != 2 || NPC.CountNPCS(478) + NPC.CountNPCS(479) >= num840) { continue; } this.ai[0] = 4f; } else { this.ai[0] = 3f; } } return; } } } else if (this.aiStyle == 89) { if (this.velocity.Y != 0f) { this.velocity.X = this.velocity.X * 0.99f; NPC x211 = this; x211.rotation = x211.rotation + this.velocity.X * 0.04f; } else { this.velocity.X = this.velocity.X * 0.9f; NPC x212 = this; x212.rotation = x212.rotation + this.velocity.X * 0.02f; } int num849 = 900; if (Main.expertMode) { num849 = 600; } if (this.justHit) { this.ai[0] = this.ai[0] - (float)Main.rand.Next(10, 21); if (!Main.expertMode) { this.ai[0] = this.ai[0] - (float)Main.rand.Next(10, 21); } } this.ai[0] = this.ai[0] + 1f; if (this.ai[0] >= (float)num849) { this.Transform(479); } if (Main.netMode != 1 && this.velocity.Y == 0f && (double)Math.Abs(this.velocity.X) < 0.2 && (double)this.ai[0] >= (double)num849 * 0.75) { float single579 = this.ai[0] - (float)num849 * 0.75f; single579 = single579 / ((float)num849 * 0.25f); if ((float)Main.rand.Next(-10, 120) < single579 * 100f) { this.velocity.Y = this.velocity.Y - (float)Main.rand.Next(20, 40) * 0.025f; this.velocity.X = this.velocity.X + (float)Main.rand.Next(-20, 20) * 0.025f; NPC nPC266 = this; nPC266.velocity = nPC266.velocity * (1f + single579 * 2f); this.netUpdate = true; return; } } } else if (this.aiStyle == 90) { this.noTileCollide = false; this.knockBackResist = 0.4f * Main.knockBackMultiplier; this.noGravity = true; this.rotation = (this.rotation * 9f + this.velocity.X * 0.1f) / 10f; if (!Main.eclipse) { if (this.timeLeft > 5) { this.timeLeft = 5; } this.velocity.Y = this.velocity.Y - 0.2f; if (this.velocity.Y < -8f) { this.velocity.Y = -8f; } this.noTileCollide = true; return; } if (this.ai[0] == 0f || this.ai[0] == 1f) { for (int o7 = 0; o7 < 200; o7++) { if (o7 != this.whoAmI && Main.npc[o7].active && Main.npc[o7].type == this.type) { Vector2 center121 = Main.npc[o7].Center - base.Center; if (center121.Length() < (float)(this.width + this.height)) { center121.Normalize(); center121 = center121 * -0.1f; NPC nPC267 = this; nPC267.velocity = nPC267.velocity + center121; NPC nPC268 = Main.npc[o7]; nPC268.velocity = nPC268.velocity - center121; } } } } if (this.target < 0 || Main.player[this.target].dead || !Main.player[this.target].active) { this.TargetClosest(true); Vector2 center122 = Main.player[this.target].Center - base.Center; if (Main.player[this.target].dead || center122.Length() > 3000f) { this.ai[0] = -1f; } } else { Vector2 center123 = Main.player[this.target].Center - base.Center; if (this.ai[0] > 1f && center123.Length() > 1000f) { this.ai[0] = 1f; } } if (this.ai[0] == -1f) { Vector2 vector2309 = new Vector2(0f, -8f); this.velocity = ((this.velocity * 9f) + vector2309) / 10f; this.noTileCollide = true; this.dontTakeDamage = true; return; } if (this.ai[0] != 0f) { if (this.ai[0] == 1f) { this.collideX = false; this.collideY = false; this.noTileCollide = true; this.knockBackResist = 0f; if (this.target < 0 || !Main.player[this.target].active || Main.player[this.target].dead) { this.TargetClosest(true); } if (this.velocity.X < 0f) { this.direction = -1; } else if (this.velocity.X > 0f) { this.direction = 1; } this.spriteDirection = this.direction; this.rotation = (this.rotation * 9f + this.velocity.X * 0.08f) / 10f; Vector2 center124 = Main.player[this.target].Center - base.Center; if (center124.Length() < 300f && !Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; } this.ai[2] = this.ai[2] + 0.0166666675f; float single580 = 5.5f + this.ai[2] + center124.Length() / 150f; float single581 = 35f; center124.Normalize(); center124 = center124 * single580; this.velocity = ((this.velocity * (single581 - 1f)) + center124) / single581; return; } if (this.ai[0] == 2f) { if (this.velocity.X < 0f) { this.direction = -1; } else if (this.velocity.X > 0f) { this.direction = 1; } this.spriteDirection = this.direction; this.rotation = (this.rotation * 7f + this.velocity.X * 0.1f) / 8f; this.knockBackResist = 0f; this.noTileCollide = true; Vector2 center125 = Main.player[this.target].Center - base.Center; center125.Y = center125.Y - 8f; float single582 = 9f; float single583 = 8f; center125.Normalize(); center125 = center125 * single582; this.velocity = ((this.velocity * (single583 - 1f)) + center125) / single583; if (this.velocity.X >= 0f) { this.direction = 1; } else { this.direction = -1; } this.spriteDirection = this.direction; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] > 10f) { this.velocity = center125; if (this.velocity.X >= 0f) { this.direction = 1; } else { this.direction = -1; } this.ai[0] = 2.1f; this.ai[1] = 0f; return; } } else if (this.ai[0] == 2.1f) { if (this.velocity.X < 0f) { this.direction = -1; } else if (this.velocity.X > 0f) { this.direction = 1; } this.spriteDirection = this.direction; NPC nPC269 = this; nPC269.velocity = nPC269.velocity * 1.01f; this.knockBackResist = 0f; this.noTileCollide = true; this.ai[1] = this.ai[1] + 1f; int num850 = 45; if (this.ai[1] > (float)num850) { if (!Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[2] = 0f; return; } if (this.ai[1] > (float)(num850 * 2)) { this.ai[0] = 1f; this.ai[1] = 0f; this.ai[2] = 0f; return; } } } } else { this.TargetClosest(true); this.spriteDirection = this.direction; if (this.collideX) { this.velocity.X = this.velocity.X * (-this.oldVelocity.X * 0.5f); if (this.velocity.X > 4f) { this.velocity.X = 4f; } if (this.velocity.X < -4f) { this.velocity.X = -4f; } } if (this.collideY) { this.velocity.Y = this.velocity.Y * (-this.oldVelocity.Y * 0.5f); if (this.velocity.Y > 4f) { this.velocity.Y = 4f; } if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } } Vector2 center126 = Main.player[this.target].Center - base.Center; if (center126.Length() > 800f) { this.ai[0] = 1f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; } else if (center126.Length() > 200f) { float single584 = 5.5f + center126.Length() / 100f + this.ai[1] / 15f; float single585 = 40f; center126.Normalize(); center126 = center126 * single584; this.velocity = ((this.velocity * (single585 - 1f)) + center126) / single585; } else if (this.velocity.Length() > 2f) { NPC nPC270 = this; nPC270.velocity = nPC270.velocity * 0.95f; } else if (this.velocity.Length() < 1f) { NPC nPC271 = this; nPC271.velocity = nPC271.velocity * 1.05f; } this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= 90f) { this.ai[1] = 0f; this.ai[0] = 2f; return; } } } else if (this.aiStyle == 91) { this.noGravity = true; this.noTileCollide = false; this.dontTakeDamage = false; if (this.justHit && Main.netMode != 1 && Main.expertMode && Main.rand.Next(6) == 0) { this.netUpdate = true; this.ai[0] = -1f; this.ai[1] = 0f; } if (this.ai[0] == -1f) { this.dontTakeDamage = true; this.noGravity = false; this.velocity.X = this.velocity.X * 0.98f; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= 120f) { float single586 = 0f; single1 = single586; this.ai[3] = single586; float single587 = single1; single1 = single587; this.ai[2] = single587; float single588 = single1; single1 = single588; this.ai[1] = single588; this.ai[0] = single1; return; } } else if (this.ai[0] == 0f) { this.TargetClosest(true); if (Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[0] = 1f; return; } Vector2 center127 = Main.player[this.target].Center - base.Center; center127.Y = center127.Y - (float)(Main.player[this.target].height / 4); if (center127.Length() > 800f) { this.ai[0] = 2f; return; } Vector2 center128 = base.Center; center128.X = Main.player[this.target].Center.X; Vector2 center129 = center128 - base.Center; if (center129.Length() <= 8f || !Collision.CanHit(base.Center, 1, 1, center128, 1, 1)) { center128 = base.Center; center128.Y = Main.player[this.target].Center.Y; center129 = center128 - base.Center; if (center129.Length() > 8f && Collision.CanHit(base.Center, 1, 1, center128, 1, 1)) { this.ai[0] = 3f; this.ai[1] = center128.X; this.ai[2] = center128.Y; } } else { this.ai[0] = 3f; this.ai[1] = center128.X; this.ai[2] = center128.Y; Vector2 center130 = base.Center; center130.Y = Main.player[this.target].Center.Y; if (center129.Length() > 8f && Collision.CanHit(base.Center, 1, 1, center130, 1, 1) && Collision.CanHit(center130, 1, 1, Main.player[this.target].position, 1, 1)) { this.ai[0] = 3f; this.ai[1] = center130.X; this.ai[2] = center130.Y; } } if (this.ai[0] == 0f) { this.localAI[0] = 0f; center127.Normalize(); center127 = center127 * 0.5f; NPC nPC272 = this; nPC272.velocity = nPC272.velocity + center127; this.ai[0] = 4f; this.ai[1] = 0f; return; } } else if (this.ai[0] == 1f) { Vector2 center131 = Main.player[this.target].Center - base.Center; float single589 = 2f + center131.Length() / 200f; int num851 = 50; center131.Normalize(); center131 = center131 * single589; this.velocity = ((this.velocity * (float)(num851 - 1)) + center131) / (float)num851; if (!Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[0] = 0f; this.ai[1] = 0f; return; } } else if (this.ai[0] == 2f) { this.noTileCollide = true; Vector2 center132 = Main.player[this.target].Center - base.Center; float single590 = center132.Length(); float single591 = 2f; int num852 = 4; center132.Normalize(); center132 = center132 * single591; this.velocity = ((this.velocity * (float)(num852 - 1)) + center132) / (float)num852; if (single590 < 600f && !Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[0] = 0f; return; } } else if (this.ai[0] == 3f) { Vector2 vector2310 = new Vector2(this.ai[1], this.ai[2]); Vector2 center133 = vector2310 - base.Center; float single592 = center133.Length(); float single593 = 1f; float single594 = 3f; center133.Normalize(); center133 = center133 * single593; this.velocity = ((this.velocity * (single594 - 1f)) + center133) / single594; if (this.collideX || this.collideY) { this.ai[0] = 4f; this.ai[1] = 0f; } if (single592 < single593 || single592 > 800f || Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[0] = 0f; return; } } else if (this.ai[0] == 4f) { if (this.collideX) { this.velocity.X = this.velocity.X * -0.8f; } if (this.collideY) { this.velocity.Y = this.velocity.Y * -0.8f; } if (this.velocity.X == 0f && this.velocity.Y == 0f) { y = Main.player[this.target].Center - base.Center; y.Y = y.Y - (float)(Main.player[this.target].height / 4); y.Normalize(); this.velocity = y * 0.1f; } float single595 = 1.5f; float single596 = 20f; y = this.velocity; y.Normalize(); y = y * single595; this.velocity = ((this.velocity * (single596 - 1f)) + y) / single596; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] > 180f) { this.ai[0] = 0f; this.ai[1] = 0f; } if (Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[0] = 0f; } this.localAI[0] = this.localAI[0] + 1f; if (this.localAI[0] >= 5f && !Collision.SolidCollision(this.position - new Vector2(10f, 10f), this.width + 20, this.height + 20)) { this.localAI[0] = 0f; Vector2 center134 = base.Center; center134.X = Main.player[this.target].Center.X; if (Collision.CanHit(base.Center, 1, 1, center134, 1, 1) && Collision.CanHit(base.Center, 1, 1, center134, 1, 1) && Collision.CanHit(Main.player[this.target].Center, 1, 1, center134, 1, 1)) { this.ai[0] = 3f; this.ai[1] = center134.X; this.ai[2] = center134.Y; return; } center134 = base.Center; center134.Y = Main.player[this.target].Center.Y; if (Collision.CanHit(base.Center, 1, 1, center134, 1, 1) && Collision.CanHit(Main.player[this.target].Center, 1, 1, center134, 1, 1)) { this.ai[0] = 3f; this.ai[1] = center134.X; this.ai[2] = center134.Y; return; } } } } else if (this.aiStyle != 92) { if (this.aiStyle == 93) { if (this.localAI[0] == 0f) { this.localAI[0] = 1f; for (int p7 = 0; p7 < 4; p7++) { int num853 = NPC.NewNPC((int)base.Center.X + p7 * 40 - 150, (int)base.Center.Y, 492, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num853].netUpdate = true; Main.npc[num853].ai[0] = (float)this.whoAmI; Main.npc[num853].ai[1] = (float)p7; Main.npc[num853].ai[3] = (float)(60 * p7); Main.npc[num853].TargetClosest(false); Main.npc[num853].timeLeft = 600; this.ai[p7] = (float)num853; } } bool flag155 = true; for (int q7 = 0; q7 < 4; q7++) { if (this.ai[q7] >= 0f && (!Main.npc[(int)this.ai[q7]].active || Main.npc[(int)this.ai[q7]].type != 492)) { this.ai[q7] = -1f; this.netUpdate = true; } else if (this.ai[q7] >= 0f) { flag155 = false; } } if (flag155) { this.life = 0; this.HitEffect(9999, 10); this.checkDead(); return; } if (Main.netMode != 1 && Main.rand.Next(300) == 0) { Vector2 vector2311 = new Vector2((Main.rand.NextFloat() - 0.5f) * (float)(this.width - 70), (Main.rand.NextFloat() - 0.5f) * 20f - (float)(this.height / 2) - 20f); double num854 = (double)this.rotation; vector24 = new Vector2(); Vector2 center135 = vector2311.RotatedBy(num854, vector24); center135 = center135 + base.Center; int x213 = (int)center135.X; int y213 = (int)center135.Y; Random random4 = Main.rand; numArray = new int[] { 213, 215, 214, 212 }; int num855 = NPC.NewNPC(x213, y213, Utils.SelectRandom<int>(random4, numArray), 0, 0f, 0f, 0f, 0f, 255); Main.npc[num855].velocity = new Vector2((Main.rand.NextFloat() - 0.5f) * 5f, -8.01f) + this.velocity; Main.npc[num855].netUpdate = true; Main.npc[num855].timeLeft = 600; } float single597 = this.localAI[3] + 1f; single1 = single597; this.localAI[3] = single597; if (single1 >= 64f) { this.localAI[3] = 0f; } this.TargetClosest(true); int x214 = (int)base.Center.X / 16 + Math.Sign(this.velocity.X) * 10; int y214 = (int)(this.position.Y + (float)this.height) / 16; int num856 = 0; if ((!Main.tile[x214, y214].nactive() || !Main.tileSolid[Main.tile[x214, y214].type] ? true : Main.tileSolidTop[Main.tile[x214, y214].type])) { while (num856 < 150 && y214 + num856 < Main.maxTilesY) { int num857 = y214 + num856; if ((!Main.tile[x214, num857].nactive() || !Main.tileSolid[Main.tile[x214, num857].type] ? true : Main.tileSolidTop[Main.tile[x214, num857].type])) { num856++; } else { num856--; break; } } } else { num856 = 1; } float single598 = (float)(num856 * 16); if (single598 < 350f) { float single599 = single598 - 350f; if (single599 < -4f) { single599 = -4f; } this.velocity.Y = MathHelper.Lerp(this.velocity.Y, single599, 0.05f); } else if (single598 <= 450f) { this.velocity.Y = this.velocity.Y * 0.95f; } else { float single600 = single598 - 350f; if (single600 > 4f) { single600 = 4f; } this.velocity.Y = MathHelper.Lerp(this.velocity.Y, single600, 0.05f); } if (Math.Abs(Main.player[this.target].Center.X - base.Center.X) >= 300f && (Math.Abs(this.velocity.X) < 6f || Math.Sign(this.velocity.X) != this.direction)) { this.velocity.X = this.velocity.X + (float)this.direction * 0.06f; } this.rotation = this.velocity.X * 0.025f; this.spriteDirection = -Math.Sign(this.velocity.X); return; } if (this.aiStyle == 94) { if (this.ai[2] == 1f) { this.velocity = Vector2.UnitY * this.velocity.Length(); if (this.velocity.Y < 0.25f) { this.velocity.Y = this.velocity.Y + 0.02f; } if (this.velocity.Y > 0.25f) { this.velocity.Y = this.velocity.Y - 0.02f; } this.dontTakeDamage = true; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] > 120f) { this.Opacity = 1f - (this.ai[1] - 120f) / 60f; } int num859 = 6; num6 = this.type; if (num6 <= 493) { if (num6 == 422) { num859 = 229; } else if (num6 == 493) { num859 = 135; } } else if (num6 == 507) { num859 = 242; } else if (num6 == 517) { num859 = 127; } if (Main.rand.Next(5) == 0 && this.ai[1] < 150f) { } if (this.ai[1] >= 180f) { this.life = 0; this.HitEffect(0, 1337); this.checkDead(); } return; } if (this.ai[3] > 0f) { bool shieldStrengthTowerVortex = this.dontTakeDamage; num6 = this.type; if (num6 <= 493) { if (num6 == 422) { shieldStrengthTowerVortex = NPC.ShieldStrengthTowerVortex != 0; } else if (num6 == 493) { shieldStrengthTowerVortex = NPC.ShieldStrengthTowerStardust != 0; } } else if (num6 == 507) { shieldStrengthTowerVortex = NPC.ShieldStrengthTowerNebula != 0; } else if (num6 == 517) { shieldStrengthTowerVortex = NPC.ShieldStrengthTowerSolar != 0; } this.ai[3] = this.ai[3] + 1f; if (this.ai[3] > 120f) { this.ai[3] = 0f; } } num6 = this.type; if (num6 <= 493) { if (num6 == 422) { this.dontTakeDamage = NPC.ShieldStrengthTowerVortex != 0; } else if (num6 == 493) { this.dontTakeDamage = NPC.ShieldStrengthTowerStardust != 0; } } else if (num6 == 507) { this.dontTakeDamage = NPC.ShieldStrengthTowerNebula != 0; } else if (num6 == 517) { this.dontTakeDamage = NPC.ShieldStrengthTowerSolar != 0; } this.TargetClosest(false); if (Main.player[this.target].Distance(base.Center) > 2000f) { this.localAI[0] = this.localAI[0] + 1f; } if (this.localAI[0] < 60f || Main.netMode == 1) { this.localAI[0] = 0f; } else { this.localAI[0] = 0f; this.netUpdate = true; this.life = (int)MathHelper.Clamp((float)(this.life + 200), 0f, (float)this.lifeMax); } this.velocity = new Vector2(0f, (float)Math.Sin((double)(6.28318548f * this.ai[0] / 300f)) * 0.5f); this.ai[0] = this.ai[0] + 1f; if (this.ai[0] >= 300f) { this.ai[0] = 0f; } if (this.type == 493) { if (this.ai[1] > 0f) { this.ai[1] = this.ai[1] - 1f; } if (Main.netMode != 1 && this.ai[1] <= 0f && Main.player[this.target].active && !Main.player[this.target].dead && base.Distance(Main.player[this.target].Center) < 1080f && Main.player[this.target].position.Y - this.position.Y < 400f) { List<int> nums8 = new List<int>(); if (NPC.CountNPCS(405) + NPC.CountNPCS(406) < 2) { nums8.Add(405); } if (NPC.CountNPCS(402) < 2) { nums8.Add(402); } if (NPC.CountNPCS(407) < 1) { nums8.Add(407); } if (nums8.Count <= 0) { this.ai[1] = 30f; } else { int num868 = Utils.SelectRandom<int>(Main.rand, nums8.ToArray()); this.ai[1] = (float)(30 * Main.rand.Next(5, 16)); int num869 = Main.rand.Next(3, 6); int num870 = Main.rand.Next(0, 4); int num871 = 0; List<Tuple<Vector2, int, int>> tuples = new List<Tuple<Vector2, int, int>>(); List<Vector2> vector2s = new List<Vector2>(); tuples.Add(Tuple.Create<Vector2, int, int>(base.Top - (Vector2.UnitY * 120f), num869, 0)); int num872 = 0; int count4 = tuples.Count; while (tuples.Count > 0) { Vector2 item1 = tuples[0].Item1; int num873 = 1; int num874 = 1; if (num872 > 0 && num870 > 0 && (Main.rand.Next(3) != 0 || num872 == 1)) { num874 = Main.rand.Next(Math.Max(1, tuples[0].Item2)); num873++; num870--; } for (int x710 = 0; x710 < num873; x710++) { int item3 = tuples[0].Item3; if (num872 == 0) { Random random6 = Main.rand; numArray = new int[] { -1, 1 }; item3 = Utils.SelectRandom<int>(random6, numArray); } else if (x710 == 1) { item3 = item3 * -1; } float single602 = (num872 % 2 == 0 ? 0f : 3.14159274f) + (0.5f - Main.rand.NextFloat()) * 0.7853982f + (float)item3 * 0.7853982f * (float)(num872 % 2 == 0).ToDirectionInt(); float single603 = 100f + 50f * Main.rand.NextFloat(); int item2 = tuples[0].Item2; if (x710 != 0) { item2 = num874; } if (num872 == 0) { single602 = (0.5f - Main.rand.NextFloat()) * 0.7853982f; single603 = 100f + 100f * Main.rand.NextFloat(); } Vector2 unitY20 = -Vector2.UnitY; double num875 = (double)single602; vector24 = new Vector2(); Vector2 zero6 = unitY20.RotatedBy(num875, vector24) * single603; if (item2 - 1 < 0) { zero6 = Vector2.Zero; } num871 = Projectile.NewProjectile(item1.X, item1.Y, zero6.X, zero6.Y, 540, 0, 0f, Main.myPlayer, (float)(-num872) * 10f, 0.5f + Main.rand.NextFloat() * 0.5f); vector2s.Add(item1 + zero6); if (num872 < num869 && tuples[0].Item2 > 0) { tuples.Add(Tuple.Create<Vector2, int, int>(item1 + zero6, item2 - 1, item3)); } } tuples.Remove(tuples[0]); int num876 = count4 - 1; count4 = num876; if (num876 != 0) { continue; } count4 = tuples.Count; num872++; } Main.projectile[num871].localAI[0] = (float)num868; } } } if (this.type == 422) { if (this.ai[1] > 0f) { this.ai[1] = this.ai[1] - 1f; } if (Main.netMode != 1 && this.ai[1] <= 0f && Main.player[this.target].active && !Main.player[this.target].dead && base.Distance(Main.player[this.target].Center) < 1080f && Main.player[this.target].position.Y - this.position.Y < 400f && NPC.CountNPCS(427) + NPC.CountNPCS(426) * 3 + NPC.CountNPCS(428) < 20) { this.ai[1] = (float)(420 + Main.rand.Next(360)); Point point6 = base.Center.ToTileCoordinates(); Point tileCoordinates7 = Main.player[this.target].Center.ToTileCoordinates(); Vector2 center138 = Main.player[this.target].Center - base.Center; int num883 = 20; int num884 = 3; int num885 = 8; int num886 = 2; int num887 = 0; bool flag156 = false; if (center138.Length() > 2000f) { flag156 = true; } do { Label1: if (flag156 || num887 >= 100) { goto Label0; } num887++; num4 = Main.rand.Next(tileCoordinates7.X - num883, tileCoordinates7.X + num883 + 1); num5 = Main.rand.Next(tileCoordinates7.Y - num883, tileCoordinates7.Y + num883 + 1); if ((num5 < tileCoordinates7.Y - num885 || num5 > tileCoordinates7.Y + num885 || num4 < tileCoordinates7.X - num885 || num4 > tileCoordinates7.X + num885) && (num5 < point6.Y - num884 || num5 > point6.Y + num884 || num4 < point6.X - num884 || num4 > point6.X + num884) && !Main.tile[num4, num5].nactive()) { flag1 = true; if (flag1 && Main.tile[num4, num5].lava()) { flag1 = false; } if (flag1 && Collision.SolidTiles(num4 - num886, num4 + num886, num5 - num886, num5 + num886)) { flag1 = false; } if (!flag1 || Collision.CanHitLine(base.Center, 0, 0, Main.player[this.target].Center, 0, 0)) { continue; } flag1 = false; } else { goto Label1; } } while (!flag1); Projectile.NewProjectile((float)(num4 * 16 + 8), (float)(num5 * 16 + 8), 0f, 0f, 579, 0, 0f, Main.myPlayer, 0f, 0f); flag156 = true; } } Label0: if (this.type == 517) { if (this.ai[1] > 0f) { this.ai[1] = this.ai[1] - 1f; } if (Main.netMode != 1 && this.ai[1] <= 0f && Main.player[this.target].active && !Main.player[this.target].dead && base.Distance(Main.player[this.target].Center) < 1080f && Main.player[this.target].position.Y - this.position.Y < 700f) { Vector2 top6 = (base.Top + new Vector2((float)(-this.width) * 0.33f, -20f)) + (new Vector2((float)this.width * 0.66f, 20f) * Utils.RandomVector2(Main.rand, 0f, 1f)); Vector2 vector2314 = -Vector2.UnitY.RotatedByRandom(0.785398185253143) * (7f + Main.rand.NextFloat() * 5f); int num891 = NPC.NewNPC((int)top6.X, (int)top6.Y, 519, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num891].velocity = vector2314; Main.npc[num891].netUpdate = true; this.ai[1] = 60f; return; } } } else if (this.aiStyle == 95) { float single604 = 300f; if (this.velocity.Length() > 4f) { NPC nPC273 = this; nPC273.velocity = nPC273.velocity * 0.95f; } NPC nPC274 = this; nPC274.velocity = nPC274.velocity * 0.99f; this.ai[0] = this.ai[0] + 1f; this.scale = 1f + 0.3f * (this.ai[0] / single604); if (this.ai[0] >= single604) { if (Main.netMode != 1) { this.Transform(405); } return; } NPC x215 = this; x215.rotation = x215.rotation + this.velocity.X * 0.1f; if (this.ai[0] > 20f) { Vector2 center139 = base.Center; int num892 = (int)(this.ai[0] / (single604 / 2f)); return; } } else if (this.aiStyle == 96) { float single606 = 5f; float single607 = 0.15f; this.TargetClosest(true); Vector2 center140 = (Main.player[this.target].Center - base.Center) + new Vector2(0f, -250f); float single608 = center140.Length(); if (single608 < 20f) { center140 = this.velocity; } else if (single608 < 40f) { center140.Normalize(); center140 = center140 * (single606 * 0.35f); } else if (single608 >= 80f) { center140.Normalize(); center140 = center140 * single606; } else { center140.Normalize(); center140 = center140 * (single606 * 0.65f); } this.SimpleFlyMovement(center140, single607); this.rotation = this.velocity.X * 0.1f; float single609 = this.ai[0] + 1f; single1 = single609; this.ai[0] = single609; if (single1 >= 70f) { this.ai[0] = 0f; if (Main.netMode != 1) { Vector2 zero7 = Vector2.Zero; while (Math.Abs(zero7.X) < 1.5f) { zero7 = Vector2.UnitY.RotatedByRandom(1.57079637050629) * new Vector2(5f, 3f); } Projectile.NewProjectile(base.Center.X, base.Center.Y, zero7.X, zero7.Y, 539, 60, 0f, Main.myPlayer, 0f, (float)this.whoAmI); return; } } } else if (this.aiStyle == 97) { float single610 = 7f; int num895 = 480; if (this.localAI[2] < 180f) { this.localAI[2] = this.localAI[2] + 1f; if (Main.netMode != 1 && this.localAI[2] % 60f == 0f) { Vector2 zero8 = Vector2.Zero; while (Math.Abs(zero8.X) < 1.5f) { zero8 = Vector2.UnitY.RotatedByRandom(1.57079637050629) * new Vector2(4f, 2.5f); } Projectile.NewProjectile(base.Center.X, base.Center.Y, zero8.X, zero8.Y, 574, 0, 0f, Main.myPlayer, 0f, (float)this.whoAmI); } } if (this.localAI[1] == 1f) { this.localAI[1] = 0f; if (Main.rand.Next(4) == 0) { this.ai[0] = (float)num895; } } this.TargetClosest(true); this.rotation = Math.Abs(this.velocity.X) * (float)this.direction * 0.1f; this.spriteDirection = -this.direction; Vector2 center141 = base.Center + new Vector2((float)(this.direction * 20), 6f); Vector2 center142 = Main.player[this.target].Center - center141; bool flag157 = Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1); bool flag158 = false; if (center142.Length() > 400f || !flag157) { Vector2 vector2315 = center142; if (vector2315.Length() > single610) { vector2315.Normalize(); vector2315 = vector2315 * single610; } int num896 = 30; this.velocity = ((this.velocity * (float)(num896 - 1)) + vector2315) / (float)num896; } else { NPC nPC275 = this; nPC275.velocity = nPC275.velocity * 0.98f; flag158 = true; } if (this.ai[2] != 0f && this.ai[3] != 0f) { base.Center = new Vector2(this.ai[2] * 16f, this.ai[3] * 16f); this.velocity = Vector2.Zero; this.ai[2] = 0f; this.ai[3] = 0f; } this.ai[0] = this.ai[0] + 1f; if (this.ai[0] >= (float)num895 && Main.netMode != 1) { this.ai[0] = 0f; Point point7 = base.Center.ToTileCoordinates(); Point tileCoordinates8 = Main.player[this.target].Center.ToTileCoordinates(); int num903 = 20; int num904 = 3; int num905 = 10; int num906 = 1; int num907 = 0; bool flag159 = false; if (center142.Length() > 2000f) { flag159 = true; } while (!flag159 && num907 < 100) { num907++; int num908 = Main.rand.Next(tileCoordinates8.X - num903, tileCoordinates8.X + num903 + 1); int num909 = Main.rand.Next(tileCoordinates8.Y - num903, tileCoordinates8.Y + num903 + 1); if (num909 >= tileCoordinates8.Y - num905 && num909 <= tileCoordinates8.Y + num905 && num908 >= tileCoordinates8.X - num905 && num908 <= tileCoordinates8.X + num905 || num909 >= point7.Y - num904 && num909 <= point7.Y + num904 && num908 >= point7.X - num904 && num908 <= point7.X + num904 || Main.tile[num908, num909].nactive()) { continue; } bool flag160 = true; if (flag160 && Main.tile[num908, num909].lava()) { flag160 = false; } if (flag160 && Collision.SolidTiles(num908 - num906, num908 + num906, num909 - num906, num909 + num906)) { flag160 = false; } if (!flag160) { continue; } this.ai[1] = 20f; this.ai[2] = (float)num908; this.ai[3] = (float)num909; flag159 = true; break; } this.netUpdate = true; } if (flag158 && this.velocity.Length() < 2f && Main.netMode != 1) { this.localAI[0] = this.localAI[0] + 1f; if (this.localAI[0] >= 13f) { return; } } } else if (this.aiStyle == 98) { this.noTileCollide = false; if (this.ai[0] == 0f) { this.TargetClosest(true); this.ai[0] = 1f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; } bool flag161 = Collision.CanHit(base.Center, 1, 1, Main.player[this.target].position, 1, 1); bool flag162 = true; if (!flag161 || Main.player[this.target].dead) { flag162 = false; } else { int x217 = (int)(Main.player[this.target].Center.X / 16f); int y216 = (int)(Main.player[this.target].Center.Y / 16f); for (int f7 = x217 - 2; f7 <= x217 + 2; f7++) { for (int g7 = y216; g7 <= y216 + 25; g7++) { if (WorldGen.SolidTile2(f7, g7)) { flag162 = false; } } } } if (this.ai[0] < 0f) { Vector2 center143 = Main.player[this.target].Center - base.Center; float single611 = center143.Length(); if (this.ai[0] == -1f) { center143.Normalize(); if (center143.HasNaNs()) { center143 = new Vector2((float)this.direction, 0f); } float single612 = 8f + single611 / 100f; float single613 = 12f; if (Main.player[this.target].velocity.Length() > single613) { single613 = Main.player[this.target].velocity.Length(); } if (single612 > single613) { single612 = single613; } center143 = center143 * single612; float single614 = 10f; this.velocity = ((this.velocity * (single614 - 1f)) + center143) / single614; for (int h7 = 0; h7 < 200; h7++) { if (Main.npc[h7].active && Main.npc[h7].type == this.type && h7 != this.whoAmI) { Vector2 center144 = Main.npc[h7].Center - base.Center; if (center144.Length() < 40f) { center144.Normalize(); center144 = center144 * 1f; NPC nPC276 = this; nPC276.velocity = nPC276.velocity - center144; } } } NPC x218 = this; x218.rotation = x218.rotation + this.velocity.X * 0.03f; if ((double)this.rotation < -6.2831) { NPC nPC277 = this; nPC277.rotation = nPC277.rotation + 6.2831f; } if ((double)this.rotation > 6.2831) { NPC nPC278 = this; nPC278.rotation = nPC278.rotation - 6.2831f; } if (this.velocity.X > 0f) { this.direction = 1; } else if (this.velocity.X < 0f) { this.direction = -1; } this.spriteDirection = this.direction; } this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= 60f && !flag162) { this.ai[0] = 0f; } } else if (this.ai[0] == 2f) { NPC nPC279 = this; nPC279.rotation = nPC279.rotation * 0.92f; if ((double)Math.Abs(this.rotation) < 0.02) { this.rotation = 0f; } if (Math.Abs(base.Center.X - Main.player[this.target].Center.X) >= (float)300 || !Collision.CanHit(base.Center, 1, 1, Main.player[this.target].position, 1, 1)) { this.ai[0] = 0f; } else { this.velocity.X = this.velocity.X * 0.96f; this.velocity.Y = this.velocity.Y * 0.96f; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] == 20f) { if (Main.netMode != 1) { NPC.NewNPC((int)base.Center.X, (int)base.Center.Y + 26, 516, 0, 0f, 0f, 0f, 0f, this.target); } } else if (this.ai[1] >= 30f) { this.ai[1] = 0f; } for (int i8 = 0; i8 < 200; i8++) { if (Main.npc[i8].active && Main.npc[i8].type == this.type && i8 != this.whoAmI) { Vector2 center145 = Main.npc[i8].Center - base.Center; if (center145.Length() < 100f) { center145.Normalize(); center145 = center145 * 0.1f; NPC nPC280 = this; nPC280.velocity = nPC280.velocity - center145; } } } } if (Main.player[this.target].Center.X < base.Center.X) { this.direction = -1; } else if (Main.player[this.target].Center.X > base.Center.X) { this.direction = 1; } this.spriteDirection = this.direction; } if (this.ai[0] == 1f) { NPC nPC281 = this; nPC281.rotation = nPC281.rotation * 0.92f; if ((double)Math.Abs(this.rotation) < 0.02) { this.rotation = 0f; } if (flag162) { this.ai[0] = -1f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; } int num910 = 300; for (int j8 = 0; j8 < 200; j8++) { if (Main.npc[j8].active && Main.npc[j8].type == this.type && j8 != this.whoAmI) { Vector2 center146 = Main.npc[j8].Center - base.Center; if (center146.Length() < 50f) { center146.Normalize(); center146 = center146 * 0.1f; NPC nPC282 = this; nPC282.velocity = nPC282.velocity - center146; this.velocity.X = this.velocity.X - center146.X * 1f; } } } int num911 = 800; float single615 = Math.Abs(base.Center.X - Main.player[this.target].Center.X); if (single615 >= (float)num910 || !flag161) { if (this.collideX) { this.velocity.X = this.velocity.X * -0.5f; this.ai[1] = 60f; NPC nPC283 = this; nPC283.direction = nPC283.direction * -1; } if (this.ai[1] > 0f) { this.ai[1] = this.ai[1] - 1f; } else if (flag161) { if (base.Center.X <= Main.player[this.target].Center.X) { this.direction = 1; } else { this.direction = -1; } } else if (single615 > (float)num911) { if (base.Center.X <= Main.player[this.target].Center.X) { this.direction = 1; } else { this.direction = -1; } } float single616 = 2f; float single617 = 0.1f; if (this.velocity.X <= single616 && this.velocity.X >= -single616) { this.velocity.X = this.velocity.X + (float)this.direction * single617; } else if (Math.Abs(this.velocity.X) >= single616 + single617 * 2f) { this.velocity.X = this.velocity.X * 0.99f; } else if (this.velocity.X >= 0f) { this.velocity.X = single616; } else { this.velocity.X = -single616; } this.spriteDirection = this.direction; } else { this.ai[0] = 2f; this.ai[1] = 0f; } if (this.collideY) { this.ai[2] = 60f; NPC nPC284 = this; nPC284.directionY = nPC284.directionY * -1; this.velocity.Y = this.velocity.Y * -0.5f; } if (this.ai[2] <= 0f) { int y217 = (int)(base.Center.Y / 16f); int x219 = (int)((base.Center.X - 8f) / 16f); int num912 = 30; int num913 = 15; int num914 = 0; for (int k8 = y217; k8 < y217 + num912; k8++) { int num915 = x219; while (num915 <= x219 + 1) { if (WorldGen.SolidTile(num915, k8) || Main.tile[num915, k8].liquid > 0) { num914 = k8 - y217; break; } else { num915++; } } if (num914 != 0) { break; } } if (num914 == 0) { this.directionY = 1; } else if (num914 < num913) { this.directionY = -1; } } else { this.ai[2] = this.ai[2] - 1f; } float single618 = 2f; float single619 = 0.1f; if (this.velocity.Y <= single618 && this.velocity.Y >= -single618) { this.velocity.Y = this.velocity.Y + (float)this.directionY * single619; return; } if (Math.Abs(this.velocity.Y) >= single618 + single619 * 2f) { this.velocity.Y = this.velocity.Y * 0.99f; return; } if (this.velocity.Y >= 0f) { this.velocity.Y = single618; return; } this.velocity.Y = -single618; return; } } else if (this.aiStyle == 99) { if (this.velocity.Y == 0f && this.ai[0] == 0f) { this.ai[0] = 1f; this.ai[1] = 0f; this.netUpdate = true; return; } if (this.ai[0] == 1f) { this.velocity = Vector2.Zero; this.position = this.oldPosition; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= 5f) { this.HitEffect(0, 9999); this.active = false; } return; } this.velocity.Y = this.velocity.Y + 0.2f; if (this.velocity.Y > 12f) { this.velocity.Y = 12f; } this.rotation = this.velocity.ToRotation() - 1.57079637f; if (this.type == 519) { if (this.localAI[0] == 0f) { this.localAI[0] = 1f; } return; } } else if (this.aiStyle == 100) { if (this.velocity.Y == 0f && this.ai[0] >= 0f) { this.ai[0] = -1f; this.ai[1] = 0f; this.netUpdate = true; return; } if (this.ai[0] == -1f) { this.velocity = Vector2.Zero; this.position = this.oldPosition; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= 5f) { this.HitEffect(0, 9999); this.active = false; } return; } this.rotation = this.velocity.ToRotation() - 1.57079637f; if (this.type == 522) { if (this.localAI[0] == 0f) { this.localAI[0] = 1f; this.velocity.X = this.ai[2]; this.velocity.Y = this.ai[3]; } this.dontTakeDamage = (this.ai[0] < 0f ? false : this.ai[0] <= 20f); if (this.ai[0] >= 0f) { this.ai[0] = this.ai[0] + 1f; if (this.ai[0] > 60f) { Vector2 vector2322 = this.velocity; double num928 = (double)this.ai[1]; vector24 = new Vector2(); this.velocity = vector2322.RotatedBy(num928, vector24); } if (this.ai[0] > 120f) { NPC nPC285 = this; nPC285.velocity = nPC285.velocity * 0.98f; } if (this.velocity.Length() < 0.2f) { this.velocity = Vector2.Zero; return; } } } } else if (this.aiStyle == 101) { float single620 = 420f; float single621 = 120f; int num929 = 1; float single622 = 0f; float single623 = 1f; float single624 = 4f; bool flag163 = (this.ai[1] < 0f ? true : !Main.npc[(int)this.ai[0]].active); if (Main.npc[(int)this.ai[0]].type != 439) { flag163 = true; } else { if (Main.npc[(int)this.ai[0]].life < Main.npc[(int)this.ai[0]].lifeMax / 2) { num929 = 2; } if (Main.npc[(int)this.ai[0]].life < Main.npc[(int)this.ai[0]].lifeMax / 4) { num929 = 3; } } this.ai[1] = this.ai[1] + (float)num929; float single625 = this.ai[1] / single621; single625 = MathHelper.Clamp(single625, 0f, 1f); this.position = base.Center; this.scale = MathHelper.Lerp(single622, single623, single625); base.Center = this.position; this.alpha = (int)(255f - single625 * 255f); this.localAI[0] = this.localAI[0] + 0.05235988f; float[] singleArray15 = this.localAI; Vector2 unitY21 = Vector2.UnitY; double num930 = (double)(this.ai[1] * 6.28318548f / 60f); vector24 = new Vector2(); singleArray15[1] = 0.25f + unitY21.RotatedBy(num930, vector24).Y * 0.25f; if (this.ai[1] >= single620) { flag163 = true; if (Main.netMode != 1) { for (int p8 = 0; p8 < 4; p8++) { Vector2 vector2326 = new Vector2(0f, -single624); double num931 = (double)(1.57079637f * (float)p8); vector24 = new Vector2(); Vector2 vector2327 = vector2326.RotatedBy(num931, vector24); Projectile.NewProjectile(base.Center.X, base.Center.Y, vector2327.X, vector2327.Y, 593, this.damage, 0f, Main.myPlayer, 0f, 0f); } } } if (flag163) { this.HitEffect(0, 9999); this.active = false; } } } else { if (Main.rand.Next(20) == 0) { this.soundHit = Main.rand.Next(15, 18); } if (Main.netMode != 1) { bool flag164 = false; int num932 = (int)this.ai[0]; int num933 = (int)this.ai[1]; if (!flag164 && (!Main.tile[num932, num933].active() || Main.tile[num932, num933].type != 378)) { flag164 = true; } if (!flag164 && (this.target == 255 || Main.player[this.target].dead || Vector2.Distance(base.Center, Main.player[this.target].Center) > 160000f)) { this.TargetClosest(false); if (this.target == 255 || Main.player[this.target].dead || Vector2.Distance(base.Center, Main.player[this.target].Center) > 160000f) { flag164 = true; } } if (flag164) { this.life = 0; this.HitEffect(0, 10); this.active = false; int num934 = TETrainingDummy.Find((int)this.ai[0], (int)this.ai[1]); if (num934 != -1) { ((TETrainingDummy)TileEntity.ByID[num934]).Deactivate(); } return; } } } } else { if (this.type == 437) { if (this.localAI[3] == 0f && Main.netMode != 1) { this.localAI[3] = 1f; this.netUpdate = true; Point[] pointArray = null; if (!CultistRitual.CheckFloor(base.Center, out pointArray)) { this.life = 0; this.HitEffect(0, 10); this.active = false; return; } int num935 = 0; int num936 = 1; for (int q8 = 0; q8 < 4; q8++) { int num937 = 0; bool flag165 = (q8 == 1 ? true : q8 == 2); num937 = (!flag165 ? 379 : 438); int num938 = NPC.NewNPC(pointArray[q8].X * 16 + 8, pointArray[q8].Y * 16 - 48, num937, 0, 0f, 0f, 0f, 0f, 255); if (!flag165) { int num939 = num935; num935 = num939 + 1; this.ai[num939] = (float)(num938 + 1); Main.npc[num938].ai[3] = (float)(-(this.whoAmI + 1)); } else { int num940 = num936; num936 = num940 + 1; this.localAI[num940] = (float)(num938 + 1); Main.npc[num938].ai[3] = (float)(-(this.whoAmI + 1)); } Main.npc[num938].netUpdate = true; } } if (this.localAI[0] == 1f && Main.netMode != 1) { this.localAI[0] = 2f; for (int r8 = 0; r8 < 2; r8++) { Main.npc[(int)this.localAI[r8 + 1] - 1].ai[1] = 1f; Main.npc[(int)this.localAI[r8 + 1] - 1].netUpdate = true; Main.npc[(int)this.ai[r8] - 1].ai[3] = 0f; Main.npc[(int)this.ai[r8] - 1].TargetClosest(true); Main.npc[(int)this.ai[r8] - 1].netUpdate = true; } } if (this.ai[0] != -1f && Main.netMode != 1) { bool flag166 = true; for (int s8 = 0; s8 < 2; s8++) { if (Main.npc[(int)this.localAI[s8 + 1] - 1].active && Main.npc[(int)this.localAI[s8 + 1] - 1].type == 438) { flag166 = false; } if (Main.npc[(int)this.ai[s8] - 1].active && Main.npc[(int)this.ai[s8] - 1].type == 379) { flag166 = false; } } if (flag166) { this.ai[0] = -1f; this.ai[1] = 0f; this.ai[3] = 0f; int x220 = (int)base.Center.X / 16 + 11 * (Main.rand.Next(2) == 0).ToDirectionInt(); int num941 = 0; int num942 = -5; while (num942 < 12) { int num943 = x220; int y218 = (int)base.Center.Y / 16 + num942; if (!WorldGen.SolidTile(num943, y218) || Collision.SolidTiles(num943 - 1, num943 + 1, y218 - 3, y218 - 1)) { if (num942 == 11) { num941 = y218; } num942++; } else { num941 = y218; break; } } int num944 = NPC.NewNPC(x220 * 16 + 10, num941 * 16 - 2, 439, 0, 0f, 0f, 0f, 0f, 255); NPC nPC286 = Main.npc[num944]; NPC nPC287 = Main.npc[num944]; int num945 = Math.Sign(base.Center.X - (float)(x220 * 16) - 10f); num6 = num945; nPC287.spriteDirection = num945; nPC286.direction = num6; this.ai[2] = (float)num944; this.netUpdate = true; CultistRitual.TabletDestroyed(); } } if (this.ai[0] == -1f) { this.ai[3] = this.ai[3] + 1f; if (this.ai[3] > 300f) { this.life = 0; this.HitEffect(0, 9999); this.active = false; if (Main.netMode != 1) { for (int t8 = 0; t8 < 6; t8++) { float single626 = 3f + Main.rand.NextFloat() * 6f; Vector2 vector2328 = Vector2.UnitY.RotatedByRandom(6.28318548202515); Vector2 center150 = base.Center; center150 = center150 + (vector2328 * 30f); Projectile.NewProjectile(center150.X, center150.Y, vector2328.X * single626, vector2328.Y * single626, 526, 0, 0f, Main.myPlayer, Main.npc[(int)this.ai[2]].Center.X, Main.npc[(int)this.ai[2]].Center.Y); } for (int u8 = 0; u8 < 20; u8++) { if (Main.rand.Next(2) != 0) { float single627 = 3f + Main.rand.NextFloat() * 6f; Vector2 vector2329 = Vector2.UnitY.RotatedByRandom(6.28318548202515); Vector2 center151 = base.Center; center151 = center151 + (vector2329 * 30f); Vector2 center152 = (base.Center + (vector2329 * (Main.rand.NextFloat() * 45f + 45f))) + (Vector2.UnitY * 20f); Projectile.NewProjectile(center151.X, center151.Y, vector2329.X * single627, -20f, 526, 0, 0f, Main.myPlayer, center152.X, center152.Y); } } } } else if (this.ai[3] % 10f == 1f && this.ai[3] > 120f && Main.netMode != 1) { float single628 = 3f + Main.rand.NextFloat() * 6f; Vector2 vector2330 = Vector2.UnitY.RotatedByRandom(6.28318548202515); Vector2 center153 = base.Center; center153 = center153 + (vector2330 * 25f); Projectile.NewProjectile(center153.X, center153.Y, vector2330.X * single628, vector2330.Y * single628, 526, 0, 0f, Main.myPlayer, Main.npc[(int)this.ai[2]].Center.X, Main.npc[(int)this.ai[2]].Center.Y); } } } if (this.type == 438) { this.velocity.X = this.velocity.X * 0.93f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } int num946 = (int)(-this.ai[3] - 1f); if (num946 == -1) { this.life = 0; this.HitEffect(0, 10); this.active = false; return; } int num947 = Math.Sign(Main.npc[num946].Center.X - base.Center.X); if (num947 != this.direction) { this.velocity.X = 0f; int num948 = num947; num6 = num948; this.spriteDirection = num948; this.direction = num6; this.netUpdate = true; } if (this.justHit && Main.netMode != 1 && Main.npc[num946].localAI[0] == 0f) { Main.npc[num946].localAI[0] = 1f; } } if (this.type == 437) { return; } } } else { Vector2 vector2331 = new Vector2(30f); if (!Main.npc[(int)this.ai[3]].active || Main.npc[(int)this.ai[3]].type != 398) { this.life = 0; this.HitEffect(0, 10); this.active = false; } float single629 = 0f; float moonLordAttacksArray2 = 0f; float single630 = this.ai[0]; this.ai[1] = this.ai[1] + 1f; int num949 = 0; int num950 = 0; while (num949 < 10) { moonLordAttacksArray2 = (float)NPC.MoonLordAttacksArray2[1, num949]; if (moonLordAttacksArray2 + (float)num950 > this.ai[1]) { break; } num950 = num950 + (int)moonLordAttacksArray2; num949++; } if (num949 == 10) { num949 = 0; this.ai[1] = 0f; moonLordAttacksArray2 = (float)NPC.MoonLordAttacksArray2[1, num949]; num950 = 0; } this.ai[0] = (float)NPC.MoonLordAttacksArray2[0, num949]; single629 = (float)((int)this.ai[1] - num950); if (this.ai[0] != single630) { this.netUpdate = true; } if (this.ai[0] == -1f) { this.ai[1] = this.ai[1] + 1f; if (this.ai[1] > 180f) { this.ai[1] = 0f; } float single631 = 1f; if (this.ai[1] < 60f) { single631 = 0.75f; this.localAI[0] = 0f; this.localAI[1] = (float)Math.Sin((double)(this.ai[1] * 6.28318548f / 15f)) * 0.35f; if (this.localAI[1] < 0f) { this.localAI[0] = 3.14159274f; } } else if (this.ai[1] >= 120f) { single631 = 1.15f; this.localAI[1] = this.localAI[1] - 0.05f; if (this.localAI[1] < 0f) { this.localAI[1] = 0f; } } else { single631 = 1f; if (this.localAI[1] < 0.5f) { this.localAI[1] = this.localAI[1] + 0.025f; } this.localAI[0] = this.localAI[0] + 0.209439516f; } this.localAI[2] = MathHelper.Lerp(this.localAI[2], single631, 0.3f); } if (this.ai[0] == 0f) { this.TargetClosest(false); Vector2 center154 = (Main.player[this.target].Center + (Main.player[this.target].velocity * 20f)) - base.Center; this.localAI[0] = this.localAI[0].AngleLerp(center154.ToRotation(), 0.5f); this.localAI[1] = this.localAI[1] + 0.05f; if (this.localAI[1] > 0.7f) { this.localAI[1] = 0.7f; } this.localAI[2] = MathHelper.Lerp(this.localAI[2], 1f, 0.2f); float single632 = 24f; Vector2 center155 = base.Center; Vector2 center156 = Main.player[this.target].Center; Vector2 vector2332 = center156 - center155; Vector2 unitY22 = vector2332 - (Vector2.UnitY * 200f); unitY22 = Vector2.Normalize(unitY22) * single632; int num951 = 30; this.velocity.X = (this.velocity.X * (float)(num951 - 1) + unitY22.X) / (float)num951; this.velocity.Y = (this.velocity.Y * (float)(num951 - 1) + unitY22.Y) / (float)num951; float single633 = 0.25f; for (int v8 = 0; v8 < 200; v8++) { if (v8 != this.whoAmI && Main.npc[v8].active && Main.npc[v8].type == 400 && Vector2.Distance(base.Center, Main.npc[v8].Center) < 150f) { if (this.position.X >= Main.npc[v8].position.X) { this.velocity.X = this.velocity.X + single633; } else { this.velocity.X = this.velocity.X - single633; } if (this.position.Y >= Main.npc[v8].position.Y) { this.velocity.Y = this.velocity.Y + single633; } else { this.velocity.Y = this.velocity.Y - single633; } } } return; } if (this.ai[0] == 1f) { if (single629 == 0f) { this.TargetClosest(false); this.netUpdate = true; } NPC nPC288 = this; nPC288.velocity = nPC288.velocity * 0.95f; if (this.velocity.Length() < 1f) { this.velocity = Vector2.Zero; } Vector2 center157 = (Main.player[this.target].Center + (Main.player[this.target].velocity * 20f)) - base.Center; this.localAI[0] = this.localAI[0].AngleLerp(center157.ToRotation(), 0.5f); this.localAI[1] = this.localAI[1] + 0.05f; if (this.localAI[1] > 1f) { this.localAI[1] = 1f; } if (single629 >= 20f) { this.localAI[2] = MathHelper.Lerp(this.localAI[2], 0.4f, 0.2f); } else { this.localAI[2] = MathHelper.Lerp(this.localAI[2], 1.1f, 0.2f); } if ((single629 == moonLordAttacksArray2 - 14f || single629 == moonLordAttacksArray2 - 7f || single629 == moonLordAttacksArray2) && Main.netMode != 1) { Vector2 vector2333 = Utils.Vector2FromElipse(this.localAI[0].ToRotationVector2(), vector2331 * this.localAI[1]); Vector2 vector2334 = Vector2.Normalize(center157) * 8f; Projectile.NewProjectile(base.Center.X + vector2333.X, base.Center.Y + vector2333.Y, vector2334.X, vector2334.Y, 462, 35, 0f, Main.myPlayer, 0f, 0f); return; } } else if (this.ai[0] == 2f) { if (single629 >= 15f) { if (single629 >= 75f) { if (single629 >= 105f) { if (single629 >= 120f) { NPC nPC289 = this; nPC289.velocity = nPC289.velocity * 0.92f; this.rotation = this.rotation.AngleLerp(0f, 0.2f); return; } if (single629 == 105f) { this.netUpdate = true; } Vector2 rotationVector27 = (this.ai[2] - 1.57079637f).ToRotationVector2() * 12f; this.velocity = rotationVector27 * 2f; for (int w8 = 0; w8 < 1000; w8++) { Projectile projectile4 = Main.projectile[w8]; if (projectile4.active && projectile4.type == 454 && projectile4.ai[1] == (float)this.whoAmI && projectile4.ai[0] != -1f) { projectile4.ai[0] = -1f; projectile4.velocity = rotationVector27; projectile4.netUpdate = true; } } return; } this.localAI[0] = this.localAI[0].AngleLerp(this.ai[2] - 1.57079637f, 0.2f); this.localAI[2] = MathHelper.Lerp(this.localAI[2], 0.75f, 0.2f); if (single629 == 75f) { this.TargetClosest(false); this.netUpdate = true; this.velocity = Vector2.UnitY * -7f; for (int x810 = 0; x810 < 1000; x810++) { Projectile projectile5 = Main.projectile[x810]; if (projectile5.active && projectile5.type == 454 && projectile5.ai[1] == (float)this.whoAmI && projectile5.ai[0] != -1f) { Projectile projectile6 = projectile5; projectile6.velocity = projectile6.velocity + this.velocity; projectile5.netUpdate = true; } } } this.velocity.Y = this.velocity.Y * 0.96f; this.ai[2] = (Main.player[this.target].Center - base.Center).ToRotation() + 1.57079637f; this.rotation = this.rotation.AngleTowards(this.ai[2], 0.104719758f); return; } float single634 = (single629 - 15f) / 10f; int num952 = 0; int num953 = 0; num6 = (int)single634; switch (num6) { case 0: { num952 = 0; num953 = 2; break; } case 1: { num952 = 2; num953 = 5; break; } case 2: { num952 = 5; num953 = 3; break; } case 3: { num952 = 3; num953 = 1; break; } case 4: { num952 = 1; num953 = 4; break; } case 5: { num952 = 4; num953 = 0; break; } } Vector2 unitY23 = Vector2.UnitY * -30f; double num954 = (double)((float)num952 * 6.28318548f / 6f); vector24 = new Vector2(); Vector2 vector2335 = unitY23.RotatedBy(num954, vector24); double num955 = (double)((float)num953 * 6.28318548f / 6f); vector24 = new Vector2(); Vector2 vector2336 = unitY23.RotatedBy(num955, vector24); Vector2 vector2337 = Vector2.Lerp(vector2335, vector2336, single634 - (float)((int)single634)); float single635 = vector2337.Length() / 30f; this.localAI[0] = vector2337.ToRotation(); this.localAI[1] = MathHelper.Lerp(this.localAI[1], single635, 0.5f); if ((single629 - 15f) % 10f == 0f && Main.netMode != 1) { Vector2 unitY24 = Vector2.Normalize(vector2337); if (unitY24.HasNaNs()) { unitY24 = Vector2.UnitY * -1f; } unitY24 = unitY24 * 4f; Projectile.NewProjectile(base.Center.X + vector2337.X, base.Center.Y + vector2337.Y, unitY24.X, unitY24.Y, 454, 55, 0f, Main.myPlayer, 30f, (float)this.whoAmI); return; } } else { this.localAI[1] = this.localAI[1] - 0.07f; if (this.localAI[1] < 0f) { this.localAI[1] = 0f; } this.localAI[2] = MathHelper.Lerp(this.localAI[2], 0.4f, 0.2f); NPC nPC290 = this; nPC290.velocity = nPC290.velocity * 0.8f; if (this.velocity.Length() < 1f) { this.velocity = Vector2.Zero; return; } } } else if (this.ai[0] != 3f) { if (this.ai[0] == 4f) { if (single629 == 0f) { this.TargetClosest(false); this.netUpdate = true; } if (single629 >= 180f) { if (single629 < moonLordAttacksArray2 - 15f) { if (single629 == 180f && Main.netMode != 1) { this.TargetClosest(false); Vector2 center159 = Main.player[this.target].Center - base.Center; center159.Normalize(); float single636 = -1f; if (center159.X < 0f) { single636 = 1f; } double num957 = (double)(-single636 * 6.28318548f / 6f); vector24 = new Vector2(); center159 = center159.RotatedBy(num957, vector24); Projectile.NewProjectile(base.Center.X, base.Center.Y, center159.X, center159.Y, 455, 50, 0f, Main.myPlayer, single636 * 6.28318548f / 540f, (float)this.whoAmI); this.ai[2] = (center159.ToRotation() + 9.424778f) * single636; this.netUpdate = true; } this.localAI[1] = this.localAI[1] + 0.05f; if (this.localAI[1] > 1f) { this.localAI[1] = 1f; } float directionInt6 = (float)(this.ai[2] >= 0f).ToDirectionInt(); float single637 = this.ai[2]; if (single637 < 0f) { single637 = single637 * -1f; } single637 = single637 + -9.424778f; single637 = single637 + directionInt6 * 6.28318548f / 540f; this.localAI[0] = single637; this.ai[2] = (single637 + 9.424778f) * directionInt6; return; } this.localAI[1] = this.localAI[1] - 0.07f; if (this.localAI[1] < 0f) { this.localAI[1] = 0f; return; } } else { this.localAI[2] = MathHelper.Lerp(this.localAI[2], 1f, 0.2f); this.localAI[1] = this.localAI[1] - 0.05f; if (this.localAI[1] < 0f) { this.localAI[1] = 0f; } NPC nPC291 = this; nPC291.velocity = nPC291.velocity * 0.95f; if (this.velocity.Length() < 1f) { this.velocity = Vector2.Zero; } if (single629 >= 60f) { Vector2 center160 = base.Center; int num958 = 0; if (single629 >= 120f) { num958 = 1; } return; } } } } else if (single629 < 15f) { this.localAI[1] = this.localAI[1] - 0.07f; if (this.localAI[1] < 0f) { this.localAI[1] = 0f; } this.localAI[2] = MathHelper.Lerp(this.localAI[2], 0.4f, 0.2f); NPC nPC292 = this; nPC292.velocity = nPC292.velocity * 0.9f; if (this.velocity.Length() < 1f) { this.velocity = Vector2.Zero; return; } } else if (single629 >= 45f) { if (single629 >= 185f) { NPC nPC293 = this; nPC293.velocity = nPC293.velocity * 0.88f; this.rotation = this.rotation.AngleLerp(0f, 0.2f); this.localAI[1] = this.localAI[1] - 0.07f; if (this.localAI[1] < 0f) { this.localAI[1] = 0f; } this.localAI[2] = MathHelper.Lerp(this.localAI[2], 1f, 0.2f); return; } if (single629 == 45f) { this.ai[2] = (float)(Main.rand.Next(2) == 0).ToDirectionInt() * 6.28318548f / 40f; this.netUpdate = true; } if ((single629 - 15f - 30f) % 40f == 0f) { this.ai[2] = this.ai[2] * 0.95f; } this.localAI[0] = this.localAI[0] + this.ai[2]; this.localAI[1] = this.localAI[1] + 0.05f; if (this.localAI[1] > 1f) { this.localAI[1] = 1f; } Vector2 rotationVector29 = (this.localAI[0].ToRotationVector2() * vector2331) * this.localAI[1]; float single639 = MathHelper.Lerp(8f, 20f, (single629 - 15f - 30f) / 140f); this.velocity = Vector2.Normalize(rotationVector29) * single639; this.rotation = this.rotation.AngleLerp(this.velocity.ToRotation() + 1.57079637f, 0.2f); if ((single629 - 15f - 30f) % 10f == 0f && Main.netMode != 1) { Vector2 center161 = base.Center + ((Vector2.Normalize(rotationVector29) * vector2331.Length()) * 0.4f); Vector2 vector2338 = Vector2.Normalize(rotationVector29) * 8f; float single640 = (6.28318548f * (float)Main.rand.NextDouble() - 3.14159274f) / 30f + 0.0174532924f * this.ai[2]; Projectile.NewProjectile(center161.X, center161.Y, vector2338.X, vector2338.Y, 452, 35, 0f, Main.myPlayer, 0f, single640); return; } } else { this.localAI[0] = 0f; this.localAI[1] = (float)Math.Sin((double)((single629 - 15f) * 6.28318548f / 15f)) * 0.5f; if (this.localAI[1] < 0f) { this.localAI[0] = 3.14159274f; return; } } } } else { if (!Main.npc[(int)this.ai[3]].active || Main.npc[(int)this.ai[3]].type != 398) { this.life = 0; this.HitEffect(0, 10); this.active = false; } this.dontTakeDamage = this.localAI[3] >= 15f; this.velocity = Vector2.Zero; base.Center = Main.npc[(int)this.ai[3]].Center + new Vector2(0f, -400f); Vector2 vector2339 = new Vector2(27f, 59f); float single641 = 0f; float moonLordAttacksArray1 = 0f; int num961 = 0; int num962 = 0; if (this.ai[0] >= 0f) { float single642 = this.ai[0]; this.ai[1] = this.ai[1] + 1f; int num963 = (int)Main.npc[(int)this.ai[3]].ai[2]; int num964 = 2; int num965 = 0; int num966 = 0; while (num965 < 5) { moonLordAttacksArray1 = (float)NPC.MoonLordAttacksArray[num963, num964, 1, num965]; if (moonLordAttacksArray1 + (float)num966 > this.ai[1]) { break; } num966 = num966 + (int)moonLordAttacksArray1; num965++; } if (num965 == 5) { num965 = 0; this.ai[1] = 0f; moonLordAttacksArray1 = (float)NPC.MoonLordAttacksArray[num963, num964, 1, num965]; num966 = 0; } this.ai[0] = (float)NPC.MoonLordAttacksArray[num963, num964, 0, num965]; single641 = (float)((int)this.ai[1] - num966); if (this.ai[0] != single642) { this.netUpdate = true; } } if (this.ai[0] == -3f) { this.damage = 0; this.dontTakeDamage = true; this.rotation = MathHelper.Lerp(this.rotation, 0.2617994f, 0.07f); this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= 32f) { this.ai[1] = 0f; } if (this.ai[1] < 0f) { this.ai[1] = 0f; } if (this.localAI[2] < 14f) { this.localAI[2] = this.localAI[2] + 1f; } } else if (this.ai[0] == -2f) { if (Main.npc[(int)this.ai[3]].ai[0] == 2f) { this.ai[0] = -3f; return; } this.damage = 80; this.dontTakeDamage = true; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= 32f) { this.ai[1] = 0f; } if (this.ai[1] < 0f) { this.ai[1] = 0f; } this.ai[2] = this.ai[2] + 1f; if (this.ai[2] >= 555f) { this.ai[2] = 0f; } if (this.ai[2] >= 120f) { single641 = this.ai[2] - 120f; moonLordAttacksArray1 = 555f; num961 = 2; Vector2 vector2340 = new Vector2(0f, 216f); if (single641 == 0f && Main.netMode != 1) { Vector2 center162 = base.Center + vector2340; for (int b8 = 0; b8 < 255; b8++) { Player player10 = Main.player[b8]; if (player10.active && !player10.dead && Vector2.Distance(player10.Center, center162) <= 3000f) { Vector2 center163 = Main.player[this.target].Center - center162; if (center163 != Vector2.Zero) { center163.Normalize(); } Projectile.NewProjectile(center162.X, center162.Y, center163.X, center163.Y, 456, 0, 0f, Main.myPlayer, (float)(this.whoAmI + 1), (float)b8); } } } if ((single641 == 120f || single641 == 180f || single641 == 240f) && Main.netMode != 1) { for (int c8 = 0; c8 < 1000; c8++) { Projectile projectile7 = Main.projectile[c8]; if (projectile7.active && projectile7.type == 456 && Main.player[(int)projectile7.ai[1]].HasBuff(145) != -1) { Vector2 center164 = Main.player[this.target].Center; int num967 = NPC.NewNPC((int)center164.X, (int)center164.Y, 401, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num967].netUpdate = true; Main.npc[num967].ai[0] = (float)(this.whoAmI + 1); Main.npc[num967].ai[1] = (float)c8; } } } } } else if (this.ai[0] == 0f) { num962 = 3; this.TargetClosest(false); Vector2 center165 = (Main.player[this.target].Center - base.Center) - new Vector2(0f, -22f); float single643 = center165.Length() / 500f; if (single643 > 1f) { single643 = 1f; } single643 = 1f - single643; single643 = single643 * 2f; if (single643 > 1f) { single643 = 1f; } this.localAI[0] = center165.ToRotation(); this.localAI[1] = single643; this.localAI[2] = MathHelper.Lerp(this.localAI[2], 1f, 0.2f); } if (this.ai[0] == 1f) { if (single641 < 180f) { this.localAI[1] = this.localAI[1] - 0.05f; if (this.localAI[1] < 0f) { this.localAI[1] = 0f; } if (single641 >= 60f) { Vector2 center166 = base.Center; int num968 = 0; if (single641 >= 120f) { num968 = 1; } for (int d8 = 0; d8 < 1 + num968; d8++) { int num969 = 229; float single644 = 0.8f; if (d8 % 2 == 1) { num969 = 229; single644 = 1.65f; } } } } else if (single641 >= moonLordAttacksArray1 - 15f) { this.localAI[1] = this.localAI[1] - 0.07f; if (this.localAI[1] < 0f) { this.localAI[1] = 0f; } num962 = 3; } else { if (single641 == 180f && Main.netMode != 1) { this.TargetClosest(false); Vector2 center167 = Main.player[this.target].Center - base.Center; center167.Normalize(); float single645 = -1f; if (center167.X < 0f) { single645 = 1f; } double num971 = (double)(-single645 * 6.28318548f / 6f); vector24 = new Vector2(); center167 = center167.RotatedBy(num971, vector24); Projectile.NewProjectile(base.Center.X, base.Center.Y, center167.X, center167.Y, 455, 75, 0f, Main.myPlayer, single645 * 6.28318548f / 540f, (float)this.whoAmI); this.ai[2] = (center167.ToRotation() + 9.424778f) * single645; this.netUpdate = true; } this.localAI[1] = this.localAI[1] + 0.05f; if (this.localAI[1] > 1f) { this.localAI[1] = 1f; } float directionInt7 = (float)(this.ai[2] >= 0f).ToDirectionInt(); float single646 = this.ai[2]; if (single646 < 0f) { single646 = single646 * -1f; } single646 = single646 + -9.424778f; single646 = single646 + directionInt7 * 6.28318548f / 540f; this.localAI[0] = single646; this.ai[2] = (single646 + 9.424778f) * directionInt7; } } else if (this.ai[0] == 2f) { num961 = 2; num962 = 3; Vector2 vector2341 = new Vector2(0f, 216f); if (single641 == 0f && Main.netMode != 1) { Vector2 center168 = base.Center + vector2341; for (int e8 = 0; e8 < 255; e8++) { Player player11 = Main.player[e8]; if (player11.active && !player11.dead && Vector2.Distance(player11.Center, center168) <= 3000f) { Vector2 center169 = Main.player[this.target].Center - center168; if (center169 != Vector2.Zero) { center169.Normalize(); } Projectile.NewProjectile(center168.X, center168.Y, center169.X, center169.Y, 456, 0, 0f, Main.myPlayer, (float)(this.whoAmI + 1), (float)e8); } } } if ((single641 == 120f || single641 == 180f || single641 == 240f) && Main.netMode != 1) { for (int f8 = 0; f8 < 1000; f8++) { Projectile projectile8 = Main.projectile[f8]; if (projectile8.active && projectile8.type == 456 && Main.player[(int)projectile8.ai[1]].HasBuff(145) != -1) { Vector2 center170 = Main.player[this.target].Center; int num972 = NPC.NewNPC((int)center170.X, (int)center170.Y, 401, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num972].netUpdate = true; Main.npc[num972].ai[0] = (float)(this.whoAmI + 1); Main.npc[num972].ai[1] = (float)f8; } } } } else if (this.ai[0] == 3f) { if (single641 == 0f) { this.TargetClosest(false); this.netUpdate = true; } Vector2 center171 = (Main.player[this.target].Center + (Main.player[this.target].velocity * 20f)) - base.Center; this.localAI[0] = this.localAI[0].AngleLerp(center171.ToRotation(), 0.5f); this.localAI[1] = this.localAI[1] + 0.05f; if (this.localAI[1] > 1f) { this.localAI[1] = 1f; } if ((single641 == moonLordAttacksArray1 - 14f || single641 == moonLordAttacksArray1 - 7f || single641 == moonLordAttacksArray1) && Main.netMode != 1) { Vector2 vector2342 = Utils.Vector2FromElipse(this.localAI[0].ToRotationVector2(), vector2339 * this.localAI[1]); Vector2 vector2343 = Vector2.Normalize(center171) * 8f; Projectile.NewProjectile(base.Center.X + vector2342.X, base.Center.Y + vector2342.Y, vector2343.X, vector2343.Y, 462, 30, 0f, Main.myPlayer, 0f, 0f); } } int num973 = num961 * 7; if ((float)num973 > this.localAI[2]) { this.localAI[2] = this.localAI[2] + 1f; } if ((float)num973 < this.localAI[2]) { this.localAI[2] = this.localAI[2] - 1f; } if (this.localAI[2] < 0f) { this.localAI[2] = 0f; } if (this.localAI[2] > 14f) { this.localAI[2] = 14f; } int num974 = num962 * 5; if ((float)num974 > this.localAI[3]) { this.localAI[3] = this.localAI[3] + 1f; } if ((float)num974 < this.localAI[3]) { this.localAI[3] = this.localAI[3] - 1f; } if (this.localAI[3] < 0f) { this.localAI[2] = 0f; } if (this.localAI[3] > 15f) { this.localAI[2] = 15f; } int num975 = 0; if (num975 == 1) { Vector2 vector2344 = new Vector2(27f, 59f); this.TargetClosest(false); Vector2 vector2345 = (Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY)) - base.Center; float single647 = vector2345.Length() / 200f; if (single647 > 1f) { single647 = 1f; } single647 = 1f - single647; single647 = single647 * 2f; if (single647 > 1f) { single647 = 1f; } this.localAI[0] = vector2345.ToRotation(); this.localAI[1] = single647; this.localAI[1] = 1f; } if (num975 == 2) { Vector2 vector2346 = new Vector2(27f, 59f); float single648 = 6.28318548f * ((float)Main.time % 600f) / 600f; this.localAI[0] = (new Vector2((float)Math.Cos((double)single648) * vector2346.X, (float)Math.Sin((double)single648) * vector2346.Y)).ToRotation(); this.localAI[1] = 0.75f; if (this.ai[1] == 0f) { Vector2 one3 = single648.ToRotationVector2(); one3 = Vector2.One; Projectile.NewProjectile(base.Center.X, base.Center.Y, one3.X, one3.Y, 455, 1, 0f, Main.myPlayer, 0.0104719754f, (float)this.whoAmI); } this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= 600f) { this.ai[1] = 0f; } } if (num975 == 3) { Vector2 vector2347 = new Vector2(0f, 216f); if (this.ai[1] == 0f) { this.TargetClosest(false); Vector2 center172 = Main.player[this.target].Center - base.Center; center172.Normalize(); Projectile.NewProjectile(base.Center.X + vector2347.X, base.Center.Y + vector2347.Y, center172.X, center172.Y, 456, 0, 0f, Main.myPlayer, (float)(this.whoAmI + 1), (float)this.target); } this.ai[1] = this.ai[1] + 1f; if (this.ai[1] >= 600f) { this.ai[1] = 0f; } } if (num975 == 4) { Vector2 vector2348 = new Vector2(27f, 59f); this.TargetClosest(false); Vector2 center173 = (Main.player[this.target].Center + (Main.player[this.target].velocity * 20f)) - base.Center; this.localAI[0] = this.localAI[0].AngleLerp(center173.ToRotation(), 0.5f); this.localAI[1] = 1f; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] == 76f || this.ai[1] == 83f || this.ai[1] == 90f) { vector2339 = new Vector2(27f, 59f); Vector2 vector2349 = Utils.Vector2FromElipse(this.localAI[0].ToRotationVector2(), vector2339 * this.localAI[1]); Vector2 vector2350 = Vector2.Normalize(center173) * 8f; Projectile.NewProjectile(base.Center.X + vector2349.X, base.Center.Y + vector2349.Y, vector2350.X, vector2350.Y, 462, 5, 0f, Main.myPlayer, 0f, 0f); } if (this.ai[1] >= 90f) { this.ai[1] = 0f; return; } } } } else { this.TargetClosest(true); this.rotation = Math.Abs(this.velocity.X) * (float)this.direction * 0.1f; this.spriteDirection = this.direction; float single649 = 7f; Vector2 vector2351 = new Vector2(base.Center.X + (float)(this.direction * 20), base.Center.Y + 6f); float x223 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector2351.X; float y221 = Main.player[this.target].position.Y - vector2351.Y; float single650 = (float)Math.Sqrt((double)(x223 * x223 + y221 * y221)); float single651 = single649 / single650; x223 = x223 * single651; y221 = y221 * single651; bool flag167 = Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1); if (!Main.dayTime) { if (single650 > 600f || !flag167) { int num976 = 60; this.velocity.X = (this.velocity.X * (float)(num976 - 1) + x223) / (float)num976; this.velocity.Y = (this.velocity.Y * (float)(num976 - 1) + y221) / (float)num976; return; } NPC nPC294 = this; nPC294.velocity = nPC294.velocity * 0.98f; if (Math.Abs(this.velocity.X) < 1f && Math.Abs(this.velocity.Y) < 1f && Main.netMode != 1) { this.localAI[0] = this.localAI[0] + 1f; if (this.localAI[0] >= 15f) { this.localAI[0] = 0f; x223 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector2351.X; y221 = Main.player[this.target].Center.Y - vector2351.Y; x223 = x223 + (float)Main.rand.Next(-35, 36); y221 = y221 + (float)Main.rand.Next(-35, 36); x223 = x223 * (1f + (float)Main.rand.Next(-20, 21) * 0.015f); y221 = y221 * (1f + (float)Main.rand.Next(-20, 21) * 0.015f); single650 = (float)Math.Sqrt((double)(x223 * x223 + y221 * y221)); single651 = 10f / single650; x223 = x223 * single651; y221 = y221 * single651; x223 = x223 * (1f + (float)Main.rand.Next(-20, 21) * 0.0125f); y221 = y221 * (1f + (float)Main.rand.Next(-20, 21) * 0.0125f); Projectile.NewProjectile(vector2351.X, vector2351.Y, x223, y221, 180, 32, 0f, Main.myPlayer, 0f, 0f); return; } } } else { int num977 = 60; this.velocity.X = (this.velocity.X * (float)(num977 - 1) - x223) / (float)num977; this.velocity.Y = (this.velocity.Y * (float)(num977 - 1) - y221) / (float)num977; if (this.timeLeft > 10) { this.timeLeft = 10; return; } } } } else { float single652 = 2f; this.noGravity = true; this.noTileCollide = true; if (!Main.dayTime) { this.TargetClosest(true); } bool flag168 = false; if ((double)this.life < (double)this.lifeMax * 0.75) { single652 = 3f; } if ((double)this.life < (double)this.lifeMax * 0.5) { single652 = 4f; } if (Main.dayTime) { if (this.timeLeft > 10) { this.timeLeft = 10; } single652 = 8f; } else if (this.ai[0] == 0f) { this.ai[1] = this.ai[1] + 1f; if ((double)this.life < (double)this.lifeMax * 0.5) { this.ai[1] = this.ai[1] + 1f; } if ((double)this.life < (double)this.lifeMax * 0.25) { this.ai[1] = this.ai[1] + 1f; } if (this.ai[1] >= 300f && Main.netMode != 1) { this.ai[1] = 0f; if ((double)this.life >= (double)this.lifeMax * 0.25 || this.type == 344) { this.ai[0] = (float)Main.rand.Next(1, 3); } else { this.ai[0] = (float)Main.rand.Next(3, 5); } this.netUpdate = true; } } else if (this.ai[0] == 1f) { if (this.type != 344) { flag168 = true; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] % 15f == 0f) { Vector2 vector2352 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f + 30f); float x224 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector2352.X; float y222 = Main.player[this.target].position.Y - vector2352.Y; float single653 = (float)Math.Sqrt((double)(x224 * x224 + y222 * y222)); single653 = 10f / single653; x224 = x224 * single653; y222 = y222 * single653; x224 = x224 * (1f + (float)Main.rand.Next(-20, 21) * 0.01f); y222 = y222 * (1f + (float)Main.rand.Next(-20, 21) * 0.01f); Projectile.NewProjectile(vector2352.X, vector2352.Y, x224, y222, 325, 50, 0f, Main.myPlayer, 0f, 0f); } if (this.ai[1] >= 120f) { this.ai[1] = 0f; this.ai[0] = 0f; } } else { flag168 = true; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] % 5f == 0f) { Vector2 vector2353 = new Vector2(this.position.X + 20f + (float)Main.rand.Next(this.width - 40), this.position.Y + 20f + (float)Main.rand.Next(this.height - 40)); float x225 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector2353.X; float y223 = Main.player[this.target].position.Y - vector2353.Y; x225 = x225 + (float)Main.rand.Next(-50, 51); y223 = y223 + (float)Main.rand.Next(-50, 51); y223 = y223 - Math.Abs(x225) * ((float)Main.rand.Next(0, 21) * 0.01f); float single654 = (float)Math.Sqrt((double)(x225 * x225 + y223 * y223)); single654 = 12.5f / single654; x225 = x225 * single654; y223 = y223 * single654; x225 = x225 * (1f + (float)Main.rand.Next(-20, 21) * 0.02f); y223 = y223 * (1f + (float)Main.rand.Next(-20, 21) * 0.02f); Projectile.NewProjectile(vector2353.X, vector2353.Y, x225, y223, 345, 43, 0f, Main.myPlayer, (float)Main.rand.Next(0, 31), 0f); } if (this.ai[1] >= 180f) { this.ai[1] = 0f; this.ai[0] = 0f; } } } else if (this.ai[0] == 2f) { if (this.type != 344) { flag168 = true; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] > 60f && this.ai[1] < 240f && this.ai[1] % 8f == 0f) { float single655 = 10f; Vector2 vector2354 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f + 30f); float x226 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector2354.X; float y224 = Main.player[this.target].position.Y - vector2354.Y; y224 = y224 - Math.Abs(x226) * 0.3f; single655 = single655 + Math.Abs(x226) * 0.004f; if (single655 > 14f) { single655 = 14f; } x226 = x226 + (float)Main.rand.Next(-50, 51); y224 = y224 - (float)Main.rand.Next(50, 201); float single656 = (float)Math.Sqrt((double)(x226 * x226 + y224 * y224)); single656 = single655 / single656; x226 = x226 * single656; y224 = y224 * single656; x226 = x226 * (1f + (float)Main.rand.Next(-30, 31) * 0.01f); y224 = y224 * (1f + (float)Main.rand.Next(-30, 31) * 0.01f); Projectile.NewProjectile(vector2354.X, vector2354.Y, x226, y224, Main.rand.Next(326, 329), 40, 0f, Main.myPlayer, 0f, 0f); } if (this.ai[1] >= 300f) { this.ai[1] = 0f; this.ai[0] = 0f; } } else { flag168 = true; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] > 60f && this.ai[1] < 240f && this.ai[1] % 15f == 0f) { float single657 = 4.5f; Vector2 vector2355 = new Vector2(this.position.X + 20f + (float)Main.rand.Next(this.width - 40), this.position.Y + 60f + (float)Main.rand.Next(this.height - 80)); float x227 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector2355.X; float y225 = Main.player[this.target].position.Y - vector2355.Y; y225 = y225 - Math.Abs(x227) * 0.3f; single657 = single657 + Math.Abs(x227) * 0.004f; x227 = x227 + (float)Main.rand.Next(-50, 51); y225 = y225 - (float)Main.rand.Next(50, 201); float single658 = (float)Math.Sqrt((double)(x227 * x227 + y225 * y225)); single658 = single657 / single658; x227 = x227 * single658; y225 = y225 * single658; x227 = x227 * (1f + (float)Main.rand.Next(-30, 31) * 0.01f); y225 = y225 * (1f + (float)Main.rand.Next(-30, 31) * 0.01f); Projectile.NewProjectile(vector2355.X, vector2355.Y, x227, y225, 346, 57, 0f, Main.myPlayer, 0f, (float)Main.rand.Next(2)); } if (this.ai[1] >= 300f) { this.ai[1] = 0f; this.ai[0] = 0f; } } } else if (this.ai[0] == 3f) { single652 = 4f; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] % 30f == 0f) { Vector2 vector2356 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f + 30f); float x228 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector2356.X; float y226 = Main.player[this.target].position.Y - vector2356.Y; float single659 = (float)Math.Sqrt((double)(x228 * x228 + y226 * y226)); single659 = 16f / single659; x228 = x228 * single659; y226 = y226 * single659; x228 = x228 * (1f + (float)Main.rand.Next(-20, 21) * 0.001f); y226 = y226 * (1f + (float)Main.rand.Next(-20, 21) * 0.001f); Projectile.NewProjectile(vector2356.X, vector2356.Y, x228, y226, 325, 75, 0f, Main.myPlayer, 0f, 0f); } if (this.ai[1] >= 120f) { this.ai[1] = 0f; this.ai[0] = 0f; } } else if (this.ai[0] == 4f) { single652 = 4f; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] % 10f == 0f) { float single660 = 12f; Vector2 vector2357 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f + 30f); float x229 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector2357.X; float y227 = Main.player[this.target].position.Y - vector2357.Y; y227 = y227 - Math.Abs(x229) * 0.2f; single660 = single660 + Math.Abs(x229) * 0.002f; if (single660 > 16f) { single660 = 16f; } x229 = x229 + (float)Main.rand.Next(-50, 51); y227 = y227 - (float)Main.rand.Next(50, 201); float single661 = (float)Math.Sqrt((double)(x229 * x229 + y227 * y227)); single661 = single660 / single661; x229 = x229 * single661; y227 = y227 * single661; x229 = x229 * (1f + (float)Main.rand.Next(-30, 31) * 0.005f); y227 = y227 * (1f + (float)Main.rand.Next(-30, 31) * 0.005f); Projectile.NewProjectile(vector2357.X, vector2357.Y, x229, y227, Main.rand.Next(326, 329), 50, 0f, Main.myPlayer, 0f, 0f); } if (this.ai[1] >= 240f) { this.ai[1] = 0f; this.ai[0] = 0f; } } if (Math.Abs(base.Center.X - Main.player[this.target].Center.X) < 50f) { flag168 = true; } if (!flag168) { if (this.direction > 0) { this.velocity.X = (this.velocity.X * 20f + single652) / 21f; } if (this.direction < 0) { this.velocity.X = (this.velocity.X * 20f - single652) / 21f; } } else { this.velocity.X = this.velocity.X * 0.9f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } } int num978 = 80; int num979 = 20; Vector2 vector2358 = new Vector2(base.Center.X - (float)(num978 / 2), this.position.Y + (float)this.height - (float)num979); bool flag169 = false; if (this.position.X < Main.player[this.target].position.X && this.position.X + (float)this.width > Main.player[this.target].position.X + (float)Main.player[this.target].width && this.position.Y + (float)this.height < Main.player[this.target].position.Y + (float)Main.player[this.target].height - 16f) { flag169 = true; } if (flag169) { this.velocity.Y = this.velocity.Y + 0.5f; } else if (!Collision.SolidCollision(vector2358, num978, num979)) { if (this.velocity.Y < 0f) { this.velocity.Y = 0f; } if ((double)this.velocity.Y >= 0.1) { this.velocity.Y = this.velocity.Y + 0.5f; } else { this.velocity.Y = this.velocity.Y + 0.025f; } } else { if (this.velocity.Y > 0f) { this.velocity.Y = 0f; } if ((double)this.velocity.Y <= -0.2) { this.velocity.Y = this.velocity.Y - 0.2f; } else { this.velocity.Y = this.velocity.Y - 0.025f; } if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } } if (this.velocity.Y > 10f) { this.velocity.Y = 10f; return; } } } else { if (NPC.crimsonBoss < 0) { this.active = false; this.netUpdate = true; return; } if (this.ai[0] != 0f) { if (Main.expertMode) { Vector2 center174 = Main.player[this.target].Center - base.Center; center174.Normalize(); center174 = center174 * 9f; this.velocity = ((this.velocity * 99f) + center174) / 100f; } Vector2 vector2359 = new Vector2(base.Center.X, base.Center.Y); float x230 = Main.npc[NPC.crimsonBoss].Center.X - vector2359.X; float y228 = Main.npc[NPC.crimsonBoss].Center.Y - vector2359.Y; if ((float)Math.Sqrt((double)(x230 * x230 + y228 * y228)) > 700f || this.justHit) { this.ai[0] = 0f; return; } } else { Vector2 vector2360 = new Vector2(base.Center.X, base.Center.Y); float x231 = Main.npc[NPC.crimsonBoss].Center.X - vector2360.X; float y229 = Main.npc[NPC.crimsonBoss].Center.Y - vector2360.Y; float single662 = (float)Math.Sqrt((double)(x231 * x231 + y229 * y229)); if (single662 > 90f) { single662 = 8f / single662; x231 = x231 * single662; y229 = y229 * single662; this.velocity.X = (this.velocity.X * 15f + x231) / 16f; this.velocity.Y = (this.velocity.Y * 15f + y229) / 16f; return; } if (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) < 8f) { this.velocity.Y = this.velocity.Y * 1.05f; this.velocity.X = this.velocity.X * 1.05f; } if (Main.netMode != 1 && (Main.expertMode && Main.rand.Next(100) == 0 || Main.rand.Next(200) == 0)) { this.TargetClosest(true); vector2360 = new Vector2(base.Center.X, base.Center.Y); x231 = Main.player[this.target].Center.X - vector2360.X; y229 = Main.player[this.target].Center.Y - vector2360.Y; single662 = (float)Math.Sqrt((double)(x231 * x231 + y229 * y229)); single662 = 8f / single662; this.velocity.X = x231 * single662; this.velocity.Y = y229 * single662; this.ai[0] = 1f; this.netUpdate = true; return; } } } } else { this.noGravity = true; this.TargetClosest(true); float single663 = 4f; float single664 = 0.25f; Vector2 vector2361 = new Vector2(base.Center.X, base.Center.Y); float x232 = Main.player[this.target].Center.X - vector2361.X; float y230 = Main.player[this.target].Center.Y - vector2361.Y - 200f; float single665 = (float)Math.Sqrt((double)(x232 * x232 + y230 * y230)); if (single665 >= 20f) { single665 = single663 / single665; x232 = x232 * single665; y230 = y230 * single665; } else { x232 = this.velocity.X; y230 = this.velocity.Y; } if (this.velocity.X < x232) { this.velocity.X = this.velocity.X + single664; if (this.velocity.X < 0f && x232 > 0f) { this.velocity.X = this.velocity.X + single664 * 2f; } } else if (this.velocity.X > x232) { this.velocity.X = this.velocity.X - single664; if (this.velocity.X > 0f && x232 < 0f) { this.velocity.X = this.velocity.X - single664 * 2f; } } if (this.velocity.Y < y230) { this.velocity.Y = this.velocity.Y + single664; if (this.velocity.Y < 0f && y230 > 0f) { this.velocity.Y = this.velocity.Y + single664 * 2f; } } else if (this.velocity.Y > y230) { this.velocity.Y = this.velocity.Y - single664; if (this.velocity.Y > 0f && y230 < 0f) { this.velocity.Y = this.velocity.Y - single664 * 2f; } } if (this.position.X + (float)this.width > Main.player[this.target].position.X && this.position.X < Main.player[this.target].position.X + (float)Main.player[this.target].width && this.position.Y + (float)this.height < Main.player[this.target].position.Y && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height) && Main.netMode != 1) { this.ai[0] = this.ai[0] + 1f; if (this.ai[0] > 8f) { this.ai[0] = 0f; int x233 = (int)(this.position.X + 10f + (float)Main.rand.Next(this.width - 20)); int y231 = (int)(this.position.Y + (float)this.height + 4f); Projectile.NewProjectile((float)x233, (float)y231, 0f, 5f, 264, 20, 0f, Main.myPlayer, 0f, 0f); return; } } } } else { NPC.golemBoss = this.whoAmI; if (this.localAI[0] == 0f && Main.netMode != 1) { this.localAI[0] = 1f; NPC.NewNPC((int)base.Center.X - 84, (int)base.Center.Y - 9, 247, 0, 0f, 0f, 0f, 0f, 255); NPC.NewNPC((int)base.Center.X + 78, (int)base.Center.Y - 9, 248, 0, 0f, 0f, 0f, 0f, 255); NPC.NewNPC((int)base.Center.X - 3, (int)base.Center.Y - 57, 246, 0, 0f, 0f, 0f, 0f, 255); } if (this.target >= 0 && Main.player[this.target].dead) { this.TargetClosest(true); if (Main.player[this.target].dead) { this.noTileCollide = true; } } if (this.alpha > 0) { NPC nPC295 = this; nPC295.alpha = nPC295.alpha - 10; if (this.alpha < 0) { this.alpha = 0; } this.ai[1] = 0f; } bool flag170 = false; bool flag171 = false; bool flag172 = false; this.dontTakeDamage = false; for (int g8 = 0; g8 < 200; g8++) { if (Main.npc[g8].active && Main.npc[g8].type == 246) { flag170 = true; } if (Main.npc[g8].active && Main.npc[g8].type == 247) { flag171 = true; } if (Main.npc[g8].active && Main.npc[g8].type == 248) { flag172 = true; } } this.dontTakeDamage = flag170; if (this.ai[0] == 0f) { this.noTileCollide = false; if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.8f; this.ai[1] = this.ai[1] + 1f; if (this.ai[1] > 0f) { if (!flag171) { this.ai[1] = this.ai[1] + 2f; } if (!flag172) { this.ai[1] = this.ai[1] + 2f; } if (!flag170) { this.ai[1] = this.ai[1] + 2f; } if (this.life < this.lifeMax) { this.ai[1] = this.ai[1] + 1f; } if (this.life < this.lifeMax / 2) { this.ai[1] = this.ai[1] + 4f; } if (this.life < this.lifeMax / 3) { this.ai[1] = this.ai[1] + 8f; } } if (this.ai[1] >= 300f) { this.ai[1] = -20f; this.frameCounter = 0; } else if (this.ai[1] == -1f) { this.TargetClosest(true); this.velocity.X = (float)(4 * this.direction); this.velocity.Y = -12.1f; this.ai[0] = 1f; this.ai[1] = 0f; } } } else if (this.ai[0] == 1f) { if (this.velocity.Y != 0f) { this.TargetClosest(true); if (this.position.X >= Main.player[this.target].position.X || this.position.X + (float)this.width <= Main.player[this.target].position.X + (float)Main.player[this.target].width) { if (this.direction < 0) { this.velocity.X = this.velocity.X - 0.2f; } else if (this.direction > 0) { this.velocity.X = this.velocity.X + 0.2f; } float single666 = 3f; if (this.life < this.lifeMax) { single666 = single666 + 1f; } if (this.life < this.lifeMax / 2) { single666 = single666 + 1f; } if (this.life < this.lifeMax / 4) { single666 = single666 + 1f; } if (this.velocity.X < -single666) { this.velocity.X = -single666; } if (this.velocity.X > single666) { this.velocity.X = single666; } } else { this.velocity.X = this.velocity.X * 0.9f; this.velocity.Y = this.velocity.Y + 0.2f; } } else { this.ai[0] = 0f; } } if (this.target <= 0 || this.target == 255 || Main.player[this.target].dead) { this.TargetClosest(true); } int num984 = 3000; if (Math.Abs(base.Center.X - Main.player[this.target].Center.X) + Math.Abs(base.Center.Y - Main.player[this.target].Center.Y) > (float)num984) { this.TargetClosest(true); if (Math.Abs(base.Center.X - Main.player[this.target].Center.X) + Math.Abs(base.Center.Y - Main.player[this.target].Center.Y) > (float)num984) { this.active = false; return; } } } } else { if (Main.wof < 0) { this.active = false; return; } this.realLife = Main.wof; if (Main.npc[Main.wof].life > 0) { this.life = Main.npc[Main.wof].life; } this.TargetClosest(true); this.position.X = Main.npc[Main.wof].position.X; this.direction = Main.npc[Main.wof].direction; this.spriteDirection = this.direction; float single667 = (float)((Main.wofB + Main.wofT) / 2); single667 = (this.ai[0] <= 0f ? (single667 + (float)Main.wofB) / 2f : (single667 + (float)Main.wofT) / 2f); single667 = single667 - (float)(this.height / 2); if (this.position.Y > single667 + 1f) { this.velocity.Y = -1f; } else if (this.position.Y >= single667 - 1f) { this.velocity.Y = 0f; this.position.Y = single667; } else { this.velocity.Y = 1f; } if (this.velocity.Y > 5f) { this.velocity.Y = 5f; } if (this.velocity.Y < -5f) { this.velocity.Y = -5f; } Vector2 y232 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x234 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - y232.X; float y233 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - y232.Y; float single668 = (float)Math.Sqrt((double)(x234 * x234 + y233 * y233)); x234 = x234 * single668; y233 = y233 * single668; bool flag173 = true; if (this.direction > 0) { if (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) <= this.position.X + (float)(this.width / 2)) { this.rotation = 0f; flag173 = false; } else { this.rotation = (float)Math.Atan2((double)(-y233), (double)(-x234)) + 3.14f; } } else if (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) >= this.position.X + (float)(this.width / 2)) { this.rotation = 0f; flag173 = false; } else { this.rotation = (float)Math.Atan2((double)y233, (double)x234) + 3.14f; } if (Main.netMode != 1) { int num985 = 4; this.localAI[1] = this.localAI[1] + 1f; if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.75) { this.localAI[1] = this.localAI[1] + 1f; num985++; } if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.5) { this.localAI[1] = this.localAI[1] + 1f; num985++; } if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.25) { this.localAI[1] = this.localAI[1] + 1f; num985 = num985 + 2; } if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.1) { this.localAI[1] = this.localAI[1] + 2f; num985 = num985 + 3; } if (Main.expertMode) { this.localAI[1] = this.localAI[1] + 0.5f; num985++; if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.1) { this.localAI[1] = this.localAI[1] + 2f; num985 = num985 + 3; } } if (this.localAI[2] == 0f) { if (this.localAI[1] > 600f) { this.localAI[2] = 1f; this.localAI[1] = 0f; return; } } else if (this.localAI[1] > 45f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.localAI[1] = 0f; this.localAI[2] = this.localAI[2] + 1f; if (this.localAI[2] >= (float)num985) { this.localAI[2] = 0f; } if (flag173) { float single669 = 9f; int num986 = 11; int num987 = 83; if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.5) { num986++; single669 = single669 + 1f; } if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.25) { num986++; single669 = single669 + 1f; } if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.1) { num986 = num986 + 2; single669 = single669 + 2f; } y232 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); x234 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - y232.X; y233 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - y232.Y; single668 = (float)Math.Sqrt((double)(x234 * x234 + y233 * y233)); single668 = single669 / single668; x234 = x234 * single668; y233 = y233 * single668; y232.X = y232.X + x234; y232.Y = y232.Y + y233; Projectile.NewProjectile(y232.X, y232.Y, x234, y233, num987, num986, 0f, Main.myPlayer, 0f, 0f); return; } } } } } else { this.TargetClosest(true); float single670 = 12f; Vector2 vector2368 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x235 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector2368.X; float y234 = Main.player[this.target].position.Y - vector2368.Y; float single671 = (float)Math.Sqrt((double)(x235 * x235 + y234 * y234)); single671 = single670 / single671; x235 = x235 * single671; y234 = y234 * single671; bool flag174 = false; if (this.directionY < 0) { this.rotation = (float)(Math.Atan2((double)y234, (double)x235) + 1.57); flag174 = ((double)this.rotation < -1.2 || (double)this.rotation > 1.2 ? false : true); if ((double)this.rotation < -0.8) { this.rotation = -0.8f; } else if ((double)this.rotation > 0.8) { this.rotation = 0.8f; } if (this.velocity.X != 0f) { this.velocity.X = this.velocity.X * 0.9f; if ((double)this.velocity.X > -0.1 || (double)this.velocity.X < 0.1) { this.netUpdate = true; this.velocity.X = 0f; } } } if (this.ai[0] > 0f) { this.ai[0] = this.ai[0] - 1f; } if (Main.netMode != 1 && flag174 && this.ai[0] == 0f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.ai[0] = 200f; int num988 = 10; int num989 = 31; int num990 = Projectile.NewProjectile(vector2368.X, vector2368.Y, x235, y234, num989, num988, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num990].ai[0] = 2f; Main.projectile[num990].timeLeft = 300; Main.projectile[num990].friendly = false; NetMessage.SendData(27, -1, -1, "", num990, 0f, 0f, 0f, 0, 0, 0); this.netUpdate = true; } try { int x236 = (int)this.position.X / 16; int x237 = (int)(this.position.X + (float)(this.width / 2)) / 16; int x238 = (int)(this.position.X + (float)this.width) / 16; int y235 = (int)(this.position.Y + (float)this.height) / 16; bool flag175 = false; if (Main.tile[x236, y235] == null) { Main.tile[x236, y235] = new Tile(); } if (Main.tile[x237, y235] == null) { Main.tile[x236, y235] = new Tile(); } if (Main.tile[x238, y235] == null) { Main.tile[x236, y235] = new Tile(); } if (Main.tile[x236, y235].nactive() && Main.tileSolid[Main.tile[x236, y235].type] || Main.tile[x237, y235].nactive() && Main.tileSolid[Main.tile[x237, y235].type] || Main.tile[x238, y235].nactive() && Main.tileSolid[Main.tile[x238, y235].type]) { flag175 = true; } if (!flag175) { this.noGravity = false; this.noTileCollide = false; } else { this.noGravity = true; this.noTileCollide = true; this.velocity.Y = -0.2f; } } catch (Exception ex) { #if DEBUG Console.WriteLine(ex); System.Diagnostics.Debugger.Break(); #endif } } }
public void ItemCheck(int i) { TileObject tileObject; Vector2 vector2 = new Vector2(); Vector2 x = new Vector2(); Vector2 y = new Vector2(); int num; Vector2 vector21; if (this.webbed || this.frozen || this.stoned) { return; } bool flag = false; float playerOffsetHitbox = (float)this.mount.PlayerOffsetHitbox; Item item = this.inventory[this.selectedItem]; if (this.mount.Active) { if (this.mount.Type == 8) { this.noItems = true; if (this.controlUseItem) { this.channel = true; if (this.releaseUseItem) { this.mount.UseAbility(this, Vector2.Zero, true); } this.releaseUseItem = false; } } if (this.whoAmI == Main.myPlayer && this.gravDir == -1f) { this.mount.Dismount(this); } } int weaponDamage = this.GetWeaponDamage(item); if (item.autoReuse && !this.noItems) { this.releaseUseItem = true; if (this.itemAnimation == 1 && item.stack > 0) { if (item.shoot <= 0 || this.whoAmI == Main.myPlayer || !this.controlUseItem || item.useStyle != 5) { this.itemAnimation = 0; } else { this.ApplyAnimation(item); } } } if (item.fishingPole > 0) { item.holdStyle = 0; if (this.itemTime == 0 && this.itemAnimation == 0) { for (int i1 = 0; i1 < 1000; i1++) { if (Main.projectile[i1].active && Main.projectile[i1].owner == this.whoAmI && Main.projectile[i1].bobber) { item.holdStyle = 1; } } } } if (this.itemAnimation == 0 && this.altFunctionUse == 2) { this.altFunctionUse = 0; } if (this.itemAnimation == 0 && this.reuseDelay > 0) { this.itemAnimation = this.reuseDelay; this.itemTime = this.reuseDelay; this.reuseDelay = 0; } if (this.controlUseItem && this.releaseUseItem && (item.headSlot > 0 || item.bodySlot > 0 || item.legSlot > 0)) { if (item.useStyle == 0) { this.releaseUseItem = false; } if (this.position.X / 16f - (float)Player.tileRangeX - (float)item.tileBoost <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)item.tileBoost - 1f >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)item.tileBoost <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)item.tileBoost - 2f >= (float)Player.tileTargetY) { int num2 = Player.tileTargetX; int num3 = Player.tileTargetY; if (Main.tile[num2, num3].active() && (Main.tile[num2, num3].type == TileID.Mannequin || Main.tile[num2, num3].type == TileID.Womannequin)) { int j = Main.tile[num2, num3].frameY; int num4 = 0; if (item.bodySlot >= 0) { num4 = 1; } if (item.legSlot >= 0) { num4 = 2; } for (j = j / 18; num4 > j; j = j / 18) { num3++; j = Main.tile[num2, num3].frameY; } while (num4 < j) { num3--; j = Main.tile[num2, num3].frameY; j = j / 18; } int num5 = Main.tile[num2, num3].frameX; while (num5 >= 100) { num5 = num5 - 100; } if (num5 >= 36) { num5 = num5 - 36; } num2 = num2 - num5 / 18; int num6 = Main.tile[num2, num3].frameX; WorldGen.KillTile(num2, num3, true, false, false); if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 0, (float)num2, (float)num3, 1f, 0, 0, 0); } while (num6 >= 100) { num6 = num6 - 100; } if (j == 0 && item.headSlot >= 0) { Main.blockMouse = true; Main.tile[num2, num3].frameX = (short)(num6 + item.headSlot * 100); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num2, num3, 1); } Item item1 = item; item1.stack = item1.stack - 1; if (item.stack <= 0) { item.SetDefaults(0, false); Main.mouseItem.SetDefaults(0, false); } if (this.selectedItem == 58) { Main.mouseItem = item.Clone(); } this.releaseUseItem = false; this.mouseInterface = true; } else if (j == 1 && item.bodySlot >= 0) { Main.blockMouse = true; Main.tile[num2, num3].frameX = (short)(num6 + item.bodySlot * 100); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num2, num3, 1); } Item item2 = item; item2.stack = item2.stack - 1; if (item.stack <= 0) { item.SetDefaults(0, false); Main.mouseItem.SetDefaults(0, false); } if (this.selectedItem == 58) { Main.mouseItem = item.Clone(); } this.releaseUseItem = false; this.mouseInterface = true; } else if (j == 2 && item.legSlot >= 0) { Main.blockMouse = true; Main.tile[num2, num3].frameX = (short)(num6 + item.legSlot * 100); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num2, num3, 1); } Item item3 = item; item3.stack = item3.stack - 1; if (item.stack <= 0) { item.SetDefaults(0, false); Main.mouseItem.SetDefaults(0, false); } if (this.selectedItem == 58) { Main.mouseItem = item.Clone(); } this.releaseUseItem = false; this.mouseInterface = true; } } } } if (Main.myPlayer == i && this.itemAnimation == 0 && TileObjectData.CustomPlace(item.createTile, item.placeStyle)) { TileObject.CanPlace(Player.tileTargetX, Player.tileTargetY, item.createTile, item.placeStyle, this.direction, out tileObject, true); } if (this.controlUseItem && this.itemAnimation == 0 && this.releaseUseItem && item.useStyle > 0) { if (this.altFunctionUse == 1) { this.altFunctionUse = 2; } bool flag1 = true; if (item.shoot == 0) { this.itemRotation = 0f; } if (item.type == ItemID.DemonHeart && (this.extraAccessory || !Main.expertMode)) { flag1 = false; } if (this.pulley && item.fishingPole > 0) { flag1 = false; } if (this.wet && (item.shoot == 85 || item.shoot == 15 || item.shoot == 34)) { flag1 = false; } if (item.makeNPC > 0 && !NPC.CanReleaseNPCs(this.whoAmI)) { flag1 = false; } if (this.whoAmI == Main.myPlayer && item.type == ItemID.Carrot && !Main.cEd) { flag1 = false; } if (item.type == ItemID.Paintbrush || item.type == ItemID.PaintRoller) { bool flag2 = false; int num7 = 0; while (num7 < 58) { if (this.inventory[num7].paint <= 0) { num7++; } else { flag2 = true; break; } } if (!flag2) { flag1 = false; } } if (this.noItems) { flag1 = false; } if (item.tileWand > 0) { int num8 = item.tileWand; flag1 = false; int num9 = 0; while (num9 < 58) { if (num8 != this.inventory[num9].type || this.inventory[num9].stack <= 0) { num9++; } else { flag1 = true; break; } } } if (item.fishingPole > 0) { for (int k = 0; k < 1000; k++) { if (Main.projectile[k].active && Main.projectile[k].owner == this.whoAmI && Main.projectile[k].bobber) { flag1 = false; if (this.whoAmI == Main.myPlayer && Main.projectile[k].ai[0] == 0f) { Main.projectile[k].ai[0] = 1f; float single1 = -10f; if (Main.projectile[k].wet && Main.projectile[k].velocity.Y > single1) { Main.projectile[k].velocity.Y = single1; } Main.projectile[k].netUpdate2 = true; if (Main.projectile[k].ai[1] < 0f && Main.projectile[k].localAI[1] != 0f) { bool flag3 = false; int num10 = 0; int num11 = 0; while (num11 < 58) { if (this.inventory[num11].stack <= 0 || this.inventory[num11].bait <= 0) { num11++; } else { bool flag4 = false; int num12 = 1 + this.inventory[num11].bait / 5; if (num12 < 1) { num12 = 1; } if (this.accTackleBox) { num12++; } if (Main.rand.Next(num12) == 0) { flag4 = true; } if (Main.projectile[k].localAI[1] < 0f) { flag4 = true; } if (Main.projectile[k].localAI[1] > 0f) { Item item4 = new Item(); item4.SetDefaults((int)Main.projectile[k].localAI[1], false); if (item4.rare < 0) { flag4 = false; } } if (flag4) { num10 = this.inventory[num11].type; Item item5 = this.inventory[num11]; item5.stack = item5.stack - 1; if (this.inventory[num11].stack <= 0) { this.inventory[num11].SetDefaults(0, false); } } flag3 = true; break; } } if (flag3) { if (num10 == 2673) { if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.SpawnBossorInvasion, -1, -1, "", this.whoAmI, 370f, 0f, 0f, 0, 0, 0); } else { NPC.SpawnOnPlayer(this.whoAmI, 370); } Main.projectile[k].ai[0] = 2f; } else if (Main.rand.Next(7) != 0 || this.accFishingLine) { Main.projectile[k].ai[1] = Main.projectile[k].localAI[1]; } else { Main.projectile[k].ai[0] = 2f; } Main.projectile[k].netUpdate = true; } } } } } } if (item.shoot == 6 || item.shoot == 19 || item.shoot == 33 || item.shoot == 52 || item.shoot == 113 || item.shoot == 320 || item.shoot == 333 || item.shoot == 383 || item.shoot == 491) { for (int l = 0; l < 1000; l++) { if (Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == item.shoot) { flag1 = false; } } } if (item.shoot == 106) { int num13 = 0; for (int m = 0; m < 1000; m++) { if (Main.projectile[m].active && Main.projectile[m].owner == Main.myPlayer && Main.projectile[m].type == item.shoot) { num13++; } } if (num13 >= item.stack) { flag1 = false; } } if (item.shoot == 272) { int num14 = 0; for (int n = 0; n < 1000; n++) { if (Main.projectile[n].active && Main.projectile[n].owner == Main.myPlayer && Main.projectile[n].type == item.shoot) { num14++; } } if (num14 >= item.stack) { flag1 = false; } } if (item.shoot == 13 || item.shoot == 32 || item.shoot >= 230 && item.shoot <= 235 || item.shoot == 315 || item.shoot == 331 || item.shoot == 372) { for (int o = 0; o < 1000; o++) { if (Main.projectile[o].active && Main.projectile[o].owner == Main.myPlayer && Main.projectile[o].type == item.shoot && Main.projectile[o].ai[0] != 2f) { flag1 = false; } } } if (item.shoot == 332) { int num15 = 0; for (int p = 0; p < 1000; p++) { if (Main.projectile[p].active && Main.projectile[p].owner == Main.myPlayer && Main.projectile[p].type == item.shoot && Main.projectile[p].ai[0] != 2f) { num15++; } } if (num15 >= 3) { flag1 = false; } } if (item.potion && flag1) { if (this.potionDelay > 0) { flag1 = false; } else if (item.type != ItemID.RestorationPotion) { this.potionDelay = this.potionDelayTime; this.AddBuff(BuffID.PotionSickness, this.potionDelay, true); } else { this.potionDelay = this.restorationDelayTime; this.AddBuff(BuffID.PotionSickness, this.potionDelay, true); } } if (item.mana > 0 && this.silence) { flag1 = false; } if (item.mana > 0 && flag1) { bool flag5 = false; if (item.type == ItemID.LaserMachinegun) { flag5 = true; } if (item.type != ItemID.SpaceGun || !this.spaceGun) { if (this.statMana >= (int)((float)item.mana * this.manaCost)) { if (!flag5) { Player player = this; player.statMana = player.statMana - (int)((float)item.mana * this.manaCost); } } else if (!this.manaFlower) { flag1 = false; } else { this.QuickMana(); if (this.statMana < (int)((float)item.mana * this.manaCost)) { flag1 = false; } else if (!flag5) { Player player1 = this; player1.statMana = player1.statMana - (int)((float)item.mana * this.manaCost); } } } if (this.whoAmI == Main.myPlayer && item.buffType != 0 && flag1) { this.AddBuff(item.buffType, item.buffTime, true); } } if (this.whoAmI == Main.myPlayer && item.type == ItemID.Carrot && Main.cEd) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.Fish) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.ShadowOrb) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.BoneRattle) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.CrimsonHeart) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.SuspiciousLookingTentacle) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.FairyBell) { int num16 = Main.rand.Next(3); if (num16 == 0) { num16 = 27; } if (num16 == 1) { num16 = 101; } if (num16 == 2) { num16 = 102; } for (int q = 0; q < 22; q++) { if (this.buffType[q] == BuffID.FairyBlue || this.buffType[q] == BuffID.FairyRed || this.buffType[q] == BuffID.FairyGreen) { this.DelBuff(q); q--; } } this.AddBuff(num16, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.Seaweed) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.EatersBone) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.BoneKey) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.Nectar) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.TikiTotem) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.LizardEgg) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.ParrotCracker) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.StrangeGlowingMushroom) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.Seedling) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.WispinaBottle) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.AmberMosquito) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.PygmyStaff) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.SlimeStaff) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.EyeSpring) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.CursedSapling) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.ToySled) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.SpiderEgg) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.MagicalPumpkinSeed) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.RavenStaff) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.UnluckyYarn) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.DogWhistle) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.BabyGrinchMischiefWhistle) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.HornetStaff) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.ImpStaff) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.MagicLantern) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.ZephyrFish) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.OpticStaff) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.SpiderStaff) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.PirateStaff) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.TartarSauce) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.TempestStaff) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.XenoStaff) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.DeadlySphereStaff) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.StardustCellStaff) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && item.type == ItemID.StardustDragonStaff) { this.AddBuff(item.buffType, 3600, true); } if (this.whoAmI == Main.myPlayer && this.gravDir == 1f && item.mountType != -1 && this.mount.CanMount(item.mountType, this)) { this.mount.SetMount(item.mountType, this, false); } if (item.type == ItemID.SuspiciousLookingEye && Main.dayTime) { flag1 = false; } if (item.type == ItemID.MechanicalEye && Main.dayTime) { flag1 = false; } if (item.type == ItemID.MechanicalWorm && Main.dayTime) { flag1 = false; } if (item.type == ItemID.MechanicalSkull && Main.dayTime) { flag1 = false; } if (item.type == ItemID.WormFood && !this.ZoneCorrupt) { flag1 = false; } if (item.type == ItemID.Abeemination && !this.ZoneJungle) { flag1 = false; } if (item.type == ItemID.PumpkinMoonMedallion && (Main.dayTime || Main.pumpkinMoon || Main.snowMoon)) { flag1 = false; } if (item.type == ItemID.NaughtyPresent && (Main.dayTime || Main.pumpkinMoon || Main.snowMoon)) { flag1 = false; } if (item.type == ItemID.LunarTablet && (!Main.dayTime || Main.eclipse || !Main.hardMode)) { flag1 = false; } if (item.type == ItemID.CelestialSigil && (!NPC.downedGolemBoss || !Main.hardMode || NPC.AnyDanger() || NPC.AnyoneNearCultists())) { flag1 = false; } if (!this.SummonItemCheck()) { flag1 = false; } if (item.shoot == 17 && flag1 && i == Main.myPlayer) { int x1 = (int)((float)Main.mouseX + Main.screenPosition.X) / 16; int y1 = (int)((float)Main.mouseY + Main.screenPosition.Y) / 16; if (this.gravDir == -1f) { y1 = (int)(Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY) / 16; } Tile tile = Main.tile[x1, y1]; if (!tile.active() || tile.type != TileID.Dirt && tile.type != TileID.Grass && tile.type != TileID.CorruptGrass && tile.type != TileID.HallowedGrass && tile.type != TileID.FleshGrass) { flag1 = false; } else { WorldGen.KillTile(x1, y1, false, false, true); if (Main.tile[x1, y1].active()) { flag1 = false; } else if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 4, (float)x1, (float)y1, 0f, 0, 0, 0); } } } if (flag1) { flag1 = this.HasAmmo(item, flag1); } if (flag1) { if (item.pick > 0 || item.axe > 0 || item.hammer > 0) { this.toolTime = 1; } if (this.grappling[0] > -1) { this.pulley = false; this.pulleyDir = 1; if (this.controlRight) { this.direction = 1; } else if (this.controlLeft) { this.direction = -1; } } this.channel = item.channel; this.attackCD = 0; this.ApplyAnimation(item); } if (flag1 && this.whoAmI == Main.myPlayer && item.shoot >= 0 && item.shoot < 651 && (ProjectileID.Sets.LightPet[item.shoot] || Main.projPet[item.shoot])) { if (!ProjectileID.Sets.MinionSacrificable[item.shoot]) { for (int r = 0; r < 1000; r++) { if (Main.projectile[r].active && Main.projectile[r].owner == i && Main.projectile[r].type == item.shoot) { Main.projectile[r].Kill(); } if (item.shoot == 72) { if (Main.projectile[r].active && Main.projectile[r].owner == i && Main.projectile[r].type == ProjectileID.PinkFairy) { Main.projectile[r].Kill(); } if (Main.projectile[r].active && Main.projectile[r].owner == i && Main.projectile[r].type == ProjectileID.GreenFairy) { Main.projectile[r].Kill(); } } } } else { List<int> nums = new List<int>(); float single2 = 0f; for (int s = 0; s < 1000; s++) { if (Main.projectile[s].active && Main.projectile[s].owner == i && Main.projectile[s].minion) { int num17 = 0; while (num17 < nums.Count) { if (Main.projectile[nums[num17]].minionSlots <= Main.projectile[s].minionSlots) { num17++; } else { nums.Insert(num17, s); break; } } if (num17 == nums.Count) { nums.Add(s); } single2 = single2 + Main.projectile[s].minionSlots; } } float staffMinionSlotsRequired = (float)ItemID.Sets.StaffMinionSlotsRequired[item.type]; float single3 = 0f; int num18 = 388; int item6 = -1; for (int t = 0; t < nums.Count; t++) { int num19 = Main.projectile[nums[t]].type; if (num19 == 626) { nums.RemoveAt(t); t--; } if (num19 == 627) { if (Main.projectile[(int)Main.projectile[nums[t]].localAI[1]].type == 628) { item6 = nums[t]; } nums.RemoveAt(t); t--; } } if (item6 != -1) { nums.Add(item6); nums.Add((int)Main.projectile[item6].ai[0]); } for (int u = 0; u < nums.Count && single2 - single3 > (float)this.maxMinions - staffMinionSlotsRequired; u++) { int num20 = Main.projectile[nums[u]].type; if (num20 != num18 && num20 != 625 && num20 != 628) { if (num20 == 388 && num18 == 387) { num18 = 388; } if (num20 == 387 && num18 == 388) { num18 = 387; } single3 = single3 + Main.projectile[nums[u]].minionSlots; if (num20 == 626 || num20 == 627) { int byUUID = Projectile.GetByUUID(Main.projectile[nums[u]].owner, Main.projectile[nums[u]].ai[0]); if (byUUID >= 0) { Projectile projectile = Main.projectile[byUUID]; if (projectile.type != ProjectileID.StardustDragon1) { projectile.localAI[1] = Main.projectile[nums[u]].localAI[1]; } projectile = Main.projectile[(int)Main.projectile[nums[u]].localAI[1]]; projectile.ai[0] = Main.projectile[nums[u]].ai[0]; projectile.ai[1] = 1f; projectile.netUpdate = true; } } Main.projectile[nums[u]].Kill(); } } nums.Clear(); if (single2 + staffMinionSlotsRequired >= 9f) { AchievementsHelper.HandleSpecialEvent(this, 6); } } } } if (!this.controlUseItem) { bool flag6 = this.channel; this.channel = false; } if (this.itemAnimation > 0) { if (!item.melee) { this.itemAnimationMax = item.useAnimation; } else { this.itemAnimationMax = (int)((float)item.useAnimation * this.meleeSpeed); } if (item.mana > 0 && !flag && (item.type != ItemID.SpaceGun || !this.spaceGun)) { this.manaRegenDelay = (int)this.maxRegenDelay; } this.itemHeight = item.height; this.itemWidth = item.width; Player player2 = this; player2.itemAnimation = player2.itemAnimation - 1; } else if (item.holdStyle == 1 && !this.pulley) { if (Main.dedServ) { this.itemLocation.X = this.position.X + (float)this.width * 0.5f + 20f * (float)this.direction; } this.itemLocation.Y = this.position.Y + 24f + playerOffsetHitbox; if (item.type == ItemID.UnicornonaStick) { this.itemLocation.Y = this.position.Y + 34f + playerOffsetHitbox; } if (item.type == ItemID.FlareGun) { this.itemLocation.Y = this.position.Y + 9f + playerOffsetHitbox; } if (item.fishingPole > 0) { this.itemLocation.Y = this.itemLocation.Y + 4f; } else if (item.type == ItemID.NebulaArcanum) { this.itemLocation.X = base.Center.X + (float)(14 * this.direction); this.itemLocation.Y = this.MountedCenter.Y; } this.itemRotation = 0f; if (this.gravDir == -1f) { this.itemRotation = -this.itemRotation; this.itemLocation.Y = this.position.Y + (float)this.height + (this.position.Y - this.itemLocation.Y) + playerOffsetHitbox; if (item.type == ItemID.FlareGun) { this.itemLocation.Y = this.itemLocation.Y - 24f; } } } else if (item.holdStyle == 2 && !this.pulley) { if (item.type != ItemID.Umbrella) { this.itemLocation.X = this.position.X + (float)this.width * 0.5f + (float)(6 * this.direction); this.itemLocation.Y = this.position.Y + 16f + playerOffsetHitbox; this.itemRotation = 0.79f * (float)(-this.direction); if (this.gravDir == -1f) { this.itemRotation = -this.itemRotation; this.itemLocation.Y = this.position.Y + (float)this.height + (this.position.Y - this.itemLocation.Y); } } else { this.itemRotation = 0f; this.itemLocation.X = this.position.X + (float)this.width * 0.5f - (float)(16 * this.direction); this.itemLocation.Y = this.position.Y + 22f + playerOffsetHitbox; this.fallStart = (int)(this.position.Y / 16f); if (this.gravDir == -1f) { this.itemRotation = -this.itemRotation; this.itemLocation.Y = this.position.Y + (float)this.height + (this.position.Y - this.itemLocation.Y); if (this.velocity.Y < -2f) { this.velocity.Y = -2f; } } else if (this.velocity.Y > 2f) { this.velocity.Y = 2f; } } } if (((item.type == ItemID.IceTorch || item.type == ItemID.Torch || item.type == ItemID.OrangeTorch || item.type == ItemID.UltrabrightTorch || item.type == ItemID.BoneTorch || item.type == ItemID.RainbowTorch || item.type == ItemID.PinkTorch || item.type >= ItemID.BlueTorch && item.type <= ItemID.DemonTorch) && !this.wet || item.type == ItemID.CursedTorch || item.type == ItemID.IchorTorch) && !this.pulley) { float discoR = 1f; float discoG = 0.95f; float discoB = 0.8f; int num25 = 0; if (item.type == ItemID.CursedTorch) { num25 = 8; } else if (item.type == ItemID.IceTorch) { num25 = 9; } else if (item.type == ItemID.OrangeTorch) { num25 = 10; } else if (item.type == ItemID.IchorTorch) { num25 = 11; } else if (item.type == ItemID.UltrabrightTorch) { num25 = 12; } else if (item.type == ItemID.BoneTorch) { num25 = 13; } else if (item.type == ItemID.RainbowTorch) { num25 = 14; } else if (item.type == ItemID.PinkTorch) { num25 = 15; } else if (item.type >= ItemID.BlueTorch) { num25 = item.type - 426; } if (num25 == 1) { discoR = 0f; discoG = 0.1f; discoB = 1.3f; } else if (num25 == 2) { discoR = 1f; discoG = 0.1f; discoB = 0.1f; } else if (num25 == 3) { discoR = 0f; discoG = 1f; discoB = 0.1f; } else if (num25 == 4) { discoR = 0.9f; discoG = 0f; discoB = 0.9f; } else if (num25 == 5) { discoR = 1.3f; discoG = 1.3f; discoB = 1.3f; } else if (num25 == 6) { discoR = 0.9f; discoG = 0.9f; discoB = 0f; } else if (num25 == 7) { discoR = 0.5f * Main.demonTorch + 1f * (1f - Main.demonTorch); discoG = 0.3f; discoB = 1f * Main.demonTorch + 0.5f * (1f - Main.demonTorch); } else if (num25 == 8) { discoB = 0.7f; discoR = 0.85f; discoG = 1f; } else if (num25 == 9) { discoB = 1f; discoR = 0.7f; discoG = 0.85f; } else if (num25 == 10) { discoB = 0f; discoR = 1f; discoG = 0.5f; } else if (num25 == 11) { discoB = 0.8f; discoR = 1.25f; discoG = 1.25f; } else if (num25 == 12) { discoR = discoR * 0.75f; discoG = discoG * 1.3499999f; discoB = discoB * 1.5f; } else if (num25 == 13) { discoR = 0.95f; discoG = 0.65f; discoB = 1.3f; } else if (num25 == 14) { discoR = (float)Main.DiscoR / 255f; discoG = (float)Main.DiscoG / 255f; discoB = (float)Main.DiscoB / 255f; } else if (num25 == 15) { discoR = 1f; discoG = 0f; discoB = 1f; } int num26 = num25; if (num26 == 0) { num26 = 6; } else if (num26 == 8) { num26 = 75; } else if (num26 == 9) { num26 = 135; } else if (num26 == 10) { num26 = 158; } else if (num26 == 11) { num26 = 169; } else if (num26 == 12) { num26 = 156; } else if (num26 == 13) { num26 = 234; } else if (num26 != 14) { num26 = (num26 != 15 ? 58 + num26 : 242); } else { num26 = 66; } } else if (item.type == ItemID.PeaceCandle && !this.wet) { this.itemLocation.X = this.itemLocation.X - (float)(this.direction * 4); } if (item.type == ItemID.SpelunkerGlowstick && !this.pulley) { Player player5 = this; player5.spelunkerTimer = (byte)(player5.spelunkerTimer + 1); if (this.spelunkerTimer >= 10) { this.spelunkerTimer = 0; } } if (!this.controlUseItem) { this.releaseUseItem = true; } else { this.releaseUseItem = false; } if (this.itemTime > 0) { Player player6 = this; player6.itemTime = player6.itemTime - 1; } if (i == Main.myPlayer) { bool flag8 = true; int num45 = item.type; if ((num45 == 65 || num45 == 676 || num45 == 723 || num45 == 724 || num45 == 757 || num45 == 674 || num45 == 675 || num45 == 989 || num45 == 1226 || num45 == 1227) && this.itemAnimation != this.itemAnimationMax - 1) { flag8 = false; } if (item.shoot > 0 && this.itemAnimation > 0 && this.itemTime == 0 && flag8) { int num46 = item.shoot; float single14 = item.shootSpeed; if (this.inventory[this.selectedItem].thrown && single14 < 16f) { single14 = single14 * this.thrownVelocity; if (single14 > 16f) { single14 = 16f; } } if (item.melee && num46 != 25 && num46 != 26 && num46 != 35) { single14 = single14 / this.meleeSpeed; } bool flag9 = false; int num47 = weaponDamage; float single15 = item.knockBack; if (num46 == 13 || num46 == 32 || num46 == 315 || num46 >= 230 && num46 <= 235 || num46 == 331) { this.grappling[0] = -1; this.grapCount = 0; for (int a = 0; a < 1000; a++) { if (Main.projectile[a].active && Main.projectile[a].owner == i) { if (Main.projectile[a].type == ProjectileID.Hook) { Main.projectile[a].Kill(); } if (Main.projectile[a].type == ProjectileID.CandyCaneHook) { Main.projectile[a].Kill(); } if (Main.projectile[a].type == ProjectileID.BatHook) { Main.projectile[a].Kill(); } if (Main.projectile[a].type >= ProjectileID.GemHookAmethyst && Main.projectile[a].type <= ProjectileID.GemHookDiamond) { Main.projectile[a].Kill(); } } } } if (item.useAmmo <= 0) { flag9 = true; } else { this.PickAmmo(item, ref num46, ref single14, ref flag9, ref num47, ref single15, ItemID.Sets.gunProj[item.type]); } if (item.type == ItemID.VortexBeater || item.type == ItemID.Phantasm) { single15 = item.knockBack; num47 = weaponDamage; single14 = item.shootSpeed; } if (item.type == ItemID.CopperCoin) { flag9 = false; } if (item.type == ItemID.SilverCoin) { flag9 = false; } if (item.type == ItemID.GoldCoin) { flag9 = false; } if (item.type == ItemID.PlatinumCoin) { flag9 = false; } if (item.type == ItemID.SniperRifle && num46 == 14) { num46 = 242; } if (item.type == ItemID.VenusMagnum && num46 == 14) { num46 = 242; } if (item.type == ItemID.Uzi && num46 == 14) { num46 = 242; } if (item.type == ItemID.NebulaBlaze) { if (Main.rand.Next(100) >= 20) { single14 = single14 - 1f; } else { num46++; num47 = num47 * 3; } } if (num46 == 73) { for (int b = 0; b < 1000; b++) { if (Main.projectile[b].active && Main.projectile[b].owner == i) { if (Main.projectile[b].type == ProjectileID.DualHookBlue) { num46 = 74; } if (num46 == 74 && Main.projectile[b].type == ProjectileID.DualHookRed) { flag9 = false; } } } } if (flag9) { single15 = this.GetWeaponKnockback(item, single15); if (num46 == 228) { single15 = 0f; } if (num46 == 1 && item.type == ItemID.MoltenFury) { num46 = 2; } if (item.type == ItemID.Marrow) { num46 = 117; } if (item.type == ItemID.IceBow) { num46 = 120; } if (item.type == ItemID.ElectrosphereLauncher) { num46 = 442; } if (item.type == ItemID.PulseBow) { num46 = 357; } this.itemTime = item.useTime; Vector2 center = this.RotatedRelativePoint(this.MountedCenter, true); Vector2 unitX = Vector2.UnitX; double num48 = (double)this.fullRotation; vector21 = new Vector2(); Vector2 vector230 = unitX.RotatedBy(num48, vector21); Vector2 mouseWorld = Main.MouseWorld - center; if (mouseWorld != Vector2.Zero) { mouseWorld.Normalize(); } if (Vector2.Dot(vector230, mouseWorld) <= 0f) { this.ChangeDir(-1); } else { this.ChangeDir(1); } if (item.type == ItemID.Javelin || item.type == ItemID.BoneJavelin || item.type == ItemID.DayBreak) { center.Y = this.position.Y + (float)(this.height / 3); } if (num46 == 9) { center = new Vector2(this.position.X + (float)this.width * 0.5f + (float)(Main.rand.Next(201) * -this.direction) + ((float)Main.mouseX + Main.screenPosition.X - this.position.X), this.MountedCenter.Y - 600f); single15 = 0f; num47 = num47 * 2; } if (item.type == ItemID.Blowgun || item.type == ItemID.Blowpipe) { center.X = center.X + (float)(6 * this.direction); center.Y = center.Y - 6f * this.gravDir; } if (item.type == ItemID.DartPistol) { center.X = center.X - (float)(4 * this.direction); center.Y = center.Y - 1f * this.gravDir; } float x6 = (float)Main.mouseX + Main.screenPosition.X - center.X; float y6 = (float)Main.mouseY + Main.screenPosition.Y - center.Y; if (this.gravDir == -1f) { y6 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - center.Y; } float single16 = (float)Math.Sqrt((double)(x6 * x6 + y6 * y6)); float single17 = single16; if ((!float.IsNaN(x6) || !float.IsNaN(y6)) && (x6 != 0f || y6 != 0f)) { single16 = single14 / single16; } else { x6 = (float)this.direction; y6 = 0f; single16 = single14; } if (item.type == ItemID.ChainGun || item.type == ItemID.Gatligator) { x6 = x6 + (float)Main.rand.Next(-50, 51) * 0.03f / single16; y6 = y6 + (float)Main.rand.Next(-50, 51) * 0.03f / single16; } x6 = x6 * single16; y6 = y6 * single16; if (item.type == ItemID.TerraBlade) { num47 = (int)((float)num47 * 1.25f); } if (num46 == 250) { for (int c = 0; c < 1000; c++) { if (Main.projectile[c].active && Main.projectile[c].owner == this.whoAmI && (Main.projectile[c].type == ProjectileID.RainbowFront || Main.projectile[c].type == ProjectileID.RainbowBack)) { Main.projectile[c].Kill(); } } } if (num46 == 12) { center.X = center.X + x6 * 3f; center.Y = center.Y + y6 * 3f; } if (item.useStyle == 5) { if (item.type != ItemID.DaedalusStormbow) { this.itemRotation = (float)Math.Atan2((double)(y6 * (float)this.direction), (double)(x6 * (float)this.direction)) - this.fullRotation; NetMessage.SendData((int)PacketTypes.PlayerUpdate, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); NetMessage.SendData((int)PacketTypes.PlayerAnimation, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); } else { Vector2 vector231 = new Vector2(x6, y6) { X = (float)Main.mouseX + Main.screenPosition.X - center.X, Y = (float)Main.mouseY + Main.screenPosition.Y - center.Y - 1000f }; this.itemRotation = (float)Math.Atan2((double)(vector231.Y * (float)this.direction), (double)(vector231.X * (float)this.direction)); NetMessage.SendData((int)PacketTypes.PlayerUpdate, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); NetMessage.SendData((int)PacketTypes.PlayerAnimation, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } if (num46 == 17) { center.X = (float)Main.mouseX + Main.screenPosition.X; center.Y = (float)Main.mouseY + Main.screenPosition.Y; if (this.gravDir == -1f) { center.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY; } } if (num46 == 76) { num46 = num46 + Main.rand.Next(3); single17 = single17 / (float)(Main.screenHeight / 2); if (single17 > 1f) { single17 = 1f; } float single18 = x6 + (float)Main.rand.Next(-40, 41) * 0.01f; float single19 = y6 + (float)Main.rand.Next(-40, 41) * 0.01f; single18 = single18 * (single17 + 0.25f); single19 = single19 * (single17 + 0.25f); int num49 = Projectile.NewProjectile(center.X, center.Y, single18, single19, num46, num47, single15, i, 0f, 0f); Main.projectile[num49].ai[1] = 1f; single17 = single17 * 2f - 1f; if (single17 < -1f) { single17 = -1f; } if (single17 > 1f) { single17 = 1f; } Main.projectile[num49].ai[0] = single17; NetMessage.SendData((int)PacketTypes.ProjectileNew, -1, -1, "", num49, 0f, 0f, 0f, 0, 0, 0); } else if (item.type == ItemID.DaedalusStormbow) { int num50 = 3; if (Main.rand.Next(3) == 0) { num50++; } for (int d = 0; d < num50; d++) { center = new Vector2(this.position.X + (float)this.width * 0.5f + (float)(Main.rand.Next(201) * -this.direction) + ((float)Main.mouseX + Main.screenPosition.X - this.position.X), this.MountedCenter.Y - 600f) { X = (center.X * 10f + base.Center.X) / 11f + (float)Main.rand.Next(-100, 101), Y = center.Y - (float)(150 * d) }; x6 = (float)Main.mouseX + Main.screenPosition.X - center.X; y6 = (float)Main.mouseY + Main.screenPosition.Y - center.Y; if (y6 < 0f) { y6 = y6 * -1f; } if (y6 < 20f) { y6 = 20f; } single16 = (float)Math.Sqrt((double)(x6 * x6 + y6 * y6)); single16 = single14 / single16; x6 = x6 * single16; y6 = y6 * single16; float single20 = x6 + (float)Main.rand.Next(-40, 41) * 0.03f; float single21 = y6 + (float)Main.rand.Next(-40, 41) * 0.03f; single20 = single20 * ((float)Main.rand.Next(75, 150) * 0.01f); center.X = center.X + (float)Main.rand.Next(-50, 51); int num51 = Projectile.NewProjectile(center.X, center.Y, single20, single21, num46, num47, single15, i, 0f, 0f); Main.projectile[num51].noDropItem = true; } } else if (item.type == ItemID.Minishark || item.type == ItemID.Megashark) { float single22 = x6 + (float)Main.rand.Next(-40, 41) * 0.01f; float single23 = y6 + (float)Main.rand.Next(-40, 41) * 0.01f; Projectile.NewProjectile(center.X, center.Y, single22, single23, num46, num47, single15, i, 0f, 0f); } else if (item.type == ItemID.SnowballCannon) { float single24 = x6 + (float)Main.rand.Next(-40, 41) * 0.02f; float single25 = y6 + (float)Main.rand.Next(-40, 41) * 0.02f; int num52 = Projectile.NewProjectile(center.X, center.Y, single24, single25, num46, num47, single15, i, 0f, 0f); Main.projectile[num52].ranged = true; Main.projectile[num52].thrown = false; } else if (item.type == ItemID.NailGun) { float single26 = x6 + (float)Main.rand.Next(-40, 41) * 0.02f; float single27 = y6 + (float)Main.rand.Next(-40, 41) * 0.02f; Projectile.NewProjectile(center.X, center.Y, single26, single27, num46, num47, single15, i, 0f, 0f); } else if (item.type == ItemID.ShadowFlameHexDoll) { Vector2 vector232 = new Vector2(x6, y6); vector232.Normalize(); Vector2 vector233 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); vector233.Normalize(); vector232 = (vector232 * 4f) + vector233; vector232.Normalize(); vector232 = vector232 * item.shootSpeed; float single28 = (float)Main.rand.Next(10, 80) * 0.001f; if (Main.rand.Next(2) == 0) { single28 = single28 * -1f; } float single29 = (float)Main.rand.Next(10, 80) * 0.001f; if (Main.rand.Next(2) == 0) { single29 = single29 * -1f; } Projectile.NewProjectile(center.X, center.Y, vector232.X, vector232.Y, num46, num47, single15, i, single29, single28); } else if (item.type == ItemID.HellwingBow) { Vector2 x7 = new Vector2(x6, y6); float single30 = x7.Length(); x7.X = x7.X + (float)Main.rand.Next(-100, 101) * 0.01f * single30 * 0.15f; x7.Y = x7.Y + (float)Main.rand.Next(-100, 101) * 0.01f * single30 * 0.15f; float x8 = x6 + (float)Main.rand.Next(-40, 41) * 0.03f; float y7 = y6 + (float)Main.rand.Next(-40, 41) * 0.03f; x7.Normalize(); x7 = x7 * single30; x8 = x8 * ((float)Main.rand.Next(50, 150) * 0.01f); y7 = y7 * ((float)Main.rand.Next(50, 150) * 0.01f); Vector2 vector234 = new Vector2(x8, y7); vector234.Normalize(); vector234 = vector234 * single30; x8 = vector234.X; y7 = vector234.Y; Projectile.NewProjectile(center.X, center.Y, x8, y7, num46, num47, single15, i, x7.X, x7.Y); } else if (item.type == ItemID.Xenopopper) { Vector2 vector235 = (Vector2.Normalize(new Vector2(x6, y6)) * 40f) * item.scale; if (Collision.CanHit(center, 0, 0, center + vector235, 0, 0)) { center = center + vector235; } float rotation = (new Vector2(x6, y6)).ToRotation(); float single31 = 2.09439516f; int num53 = Main.rand.Next(4, 5); if (Main.rand.Next(4) == 0) { num53++; } for (int e = 0; e < num53; e++) { float single32 = (float)Main.rand.NextDouble() * 0.2f + 0.05f; Vector2 vector236 = new Vector2(x6, y6); double num54 = (double)(single31 * (float)Main.rand.NextDouble() - single31 / 2f); vector21 = new Vector2(); Vector2 vector237 = vector236.RotatedBy(num54, vector21) * single32; int num55 = Projectile.NewProjectile(center.X, center.Y, vector237.X, vector237.Y, 444, num47, single15, i, rotation, 0f); Main.projectile[num55].localAI[0] = (float)num46; Main.projectile[num55].localAI[1] = single14; } } else if (item.type == ItemID.Gatligator) { float single33 = x6 + (float)Main.rand.Next(-40, 41) * 0.05f; float single34 = y6 + (float)Main.rand.Next(-40, 41) * 0.05f; if (Main.rand.Next(3) == 0) { single33 = single33 * (1f + (float)Main.rand.Next(-30, 31) * 0.02f); single34 = single34 * (1f + (float)Main.rand.Next(-30, 31) * 0.02f); } Projectile.NewProjectile(center.X, center.Y, single33, single34, num46, num47, single15, i, 0f, 0f); } else if (item.type == ItemID.Razorpine) { int num56 = 2 + Main.rand.Next(3); for (int f = 0; f < num56; f++) { float single35 = x6; float single36 = y6; float single37 = 0.025f * (float)f; single35 = single35 + (float)Main.rand.Next(-35, 36) * single37; single36 = single36 + (float)Main.rand.Next(-35, 36) * single37; single16 = (float)Math.Sqrt((double)(single35 * single35 + single36 * single36)); single16 = single14 / single16; single35 = single35 * single16; single36 = single36 * single16; float x9 = center.X + x6 * (float)(num56 - f) * 1.75f; float y8 = center.Y + y6 * (float)(num56 - f) * 1.75f; Projectile.NewProjectile(x9, y8, single35, single36, num46, num47, single15, i, (float)Main.rand.Next(0, 10 * (f + 1)), 0f); } } else if (item.type == ItemID.BlizzardStaff) { int num57 = 2; for (int g = 0; g < num57; g++) { center = new Vector2(this.position.X + (float)this.width * 0.5f + (float)(Main.rand.Next(201) * -this.direction) + ((float)Main.mouseX + Main.screenPosition.X - this.position.X), this.MountedCenter.Y - 600f) { X = (center.X + base.Center.X) / 2f + (float)Main.rand.Next(-200, 201), Y = center.Y - (float)(100 * g) }; x6 = (float)Main.mouseX + Main.screenPosition.X - center.X; y6 = (float)Main.mouseY + Main.screenPosition.Y - center.Y; if (y6 < 0f) { y6 = y6 * -1f; } if (y6 < 20f) { y6 = 20f; } single16 = (float)Math.Sqrt((double)(x6 * x6 + y6 * y6)); single16 = single14 / single16; x6 = x6 * single16; y6 = y6 * single16; float single38 = x6 + (float)Main.rand.Next(-40, 41) * 0.02f; float single39 = y6 + (float)Main.rand.Next(-40, 41) * 0.02f; Projectile.NewProjectile(center.X, center.Y, single38, single39, num46, num47, single15, i, 0f, (float)Main.rand.Next(5)); } } else if (item.type == ItemID.MeteorStaff) { int num58 = 1; for (int h = 0; h < num58; h++) { center = new Vector2(this.position.X + (float)this.width * 0.5f + (float)(Main.rand.Next(201) * -this.direction) + ((float)Main.mouseX + Main.screenPosition.X - this.position.X), this.MountedCenter.Y - 600f) { X = (center.X + base.Center.X) / 2f + (float)Main.rand.Next(-200, 201), Y = center.Y - (float)(100 * h) }; x6 = (float)Main.mouseX + Main.screenPosition.X - center.X + (float)Main.rand.Next(-40, 41) * 0.03f; y6 = (float)Main.mouseY + Main.screenPosition.Y - center.Y; if (y6 < 0f) { y6 = y6 * -1f; } if (y6 < 20f) { y6 = 20f; } single16 = (float)Math.Sqrt((double)(x6 * x6 + y6 * y6)); single16 = single14 / single16; x6 = x6 * single16; y6 = y6 * single16; float single40 = x6; float single41 = y6 + (float)Main.rand.Next(-40, 41) * 0.02f; Projectile.NewProjectile(center.X, center.Y, single40 * 0.75f, single41 * 0.75f, num46 + Main.rand.Next(3), num47, single15, i, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); } } else if (item.type == ItemID.LunarFlareBook) { int num59 = 3; for (int i11 = 0; i11 < num59; i11++) { center = new Vector2(this.position.X + (float)this.width * 0.5f + (float)(Main.rand.Next(201) * -this.direction) + ((float)Main.mouseX + Main.screenPosition.X - this.position.X), this.MountedCenter.Y - 600f) { X = (center.X + base.Center.X) / 2f + (float)Main.rand.Next(-200, 201), Y = center.Y - (float)(100 * i11) }; x6 = (float)Main.mouseX + Main.screenPosition.X - center.X; y6 = (float)Main.mouseY + Main.screenPosition.Y - center.Y; float y9 = y6 + center.Y; if (y6 < 0f) { y6 = y6 * -1f; } if (y6 < 20f) { y6 = 20f; } single16 = (float)Math.Sqrt((double)(x6 * x6 + y6 * y6)); single16 = single14 / single16; x6 = x6 * single16; y6 = y6 * single16; Vector2 vector238 = new Vector2(x6, y6) / 2f; Projectile.NewProjectile(center.X, center.Y, vector238.X, vector238.Y, num46, num47, single15, i, 0f, y9); } } else if (item.type == ItemID.StarWrath) { Vector2 vector239 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY); float y10 = vector239.Y; if (y10 > base.Center.Y - 200f) { y10 = base.Center.Y - 200f; } for (int j1 = 0; j1 < 3; j1++) { center = base.Center + new Vector2((float)(-Main.rand.Next(0, 401) * this.direction), -600f); center.Y = center.Y - (float)(100 * j1); Vector2 y11 = vector239 - center; if (y11.Y < 0f) { y11.Y = y11.Y * -1f; } if (y11.Y < 20f) { y11.Y = 20f; } y11.Normalize(); y11 = y11 * single14; x6 = y11.X; y6 = y11.Y; float single42 = x6; float single43 = y6 + (float)Main.rand.Next(-40, 41) * 0.02f; Projectile.NewProjectile(center.X, center.Y, single42, single43, num46, num47 * 2, single15, i, 0f, y10); } } else if (item.type == ItemID.Tsunami) { float single44 = 0.314159274f; int num60 = 5; Vector2 vector240 = new Vector2(x6, y6); vector240.Normalize(); vector240 = vector240 * 40f; bool flag10 = Collision.CanHit(center, 0, 0, center + vector240, 0, 0); for (int k1 = 0; k1 < num60; k1++) { float single45 = (float)k1 - ((float)num60 - 1f) / 2f; double num61 = (double)(single44 * single45); vector21 = new Vector2(); Vector2 vector241 = vector240.RotatedBy(num61, vector21); if (!flag10) { vector241 = vector241 - vector240; } int num62 = Projectile.NewProjectile(center.X + vector241.X, center.Y + vector241.Y, x6, y6, num46, num47, single15, i, 0f, 0f); Main.projectile[num62].noDropItem = true; } } else if (item.type == ItemID.ChainGun) { float single46 = x6 + (float)Main.rand.Next(-40, 41) * 0.03f; float single47 = y6 + (float)Main.rand.Next(-40, 41) * 0.03f; Projectile.NewProjectile(center.X, center.Y, single46, single47, num46, num47, single15, i, 0f, 0f); } else if (item.type == ItemID.SDMG) { float single48 = x6 + (float)Main.rand.Next(-40, 41) * 0.005f; float single49 = y6 + (float)Main.rand.Next(-40, 41) * 0.005f; Projectile.NewProjectile(center.X, center.Y, single48, single49, num46, num47, single15, i, 0f, 0f); } else if (item.type == ItemID.CrystalStorm) { float single50 = x6; float single51 = y6; single50 = single50 + (float)Main.rand.Next(-40, 41) * 0.04f; single51 = single51 + (float)Main.rand.Next(-40, 41) * 0.04f; Projectile.NewProjectile(center.X, center.Y, single50, single51, num46, num47, single15, i, 0f, 0f); } else if (item.type == ItemID.Uzi) { float single52 = x6; float single53 = y6; single52 = single52 + (float)Main.rand.Next(-30, 31) * 0.03f; single53 = single53 + (float)Main.rand.Next(-30, 31) * 0.03f; Projectile.NewProjectile(center.X, center.Y, single52, single53, num46, num47, single15, i, 0f, 0f); } else if (item.type == ItemID.Shotgun) { int num63 = Main.rand.Next(4, 6); for (int l1 = 0; l1 < num63; l1++) { float single54 = x6; float single55 = y6; single54 = single54 + (float)Main.rand.Next(-40, 41) * 0.05f; single55 = single55 + (float)Main.rand.Next(-40, 41) * 0.05f; Projectile.NewProjectile(center.X, center.Y, single54, single55, num46, num47, single15, i, 0f, 0f); } } else if (item.type == ItemID.VenomStaff) { int num64 = 4; if (Main.rand.Next(3) == 0) { num64++; } if (Main.rand.Next(4) == 0) { num64++; } if (Main.rand.Next(5) == 0) { num64++; } for (int m1 = 0; m1 < num64; m1++) { float single56 = x6; float single57 = y6; float single58 = 0.05f * (float)m1; single56 = single56 + (float)Main.rand.Next(-35, 36) * single58; single57 = single57 + (float)Main.rand.Next(-35, 36) * single58; single16 = (float)Math.Sqrt((double)(single56 * single56 + single57 * single57)); single16 = single14 / single16; single56 = single56 * single16; single57 = single57 * single16; float x10 = center.X; float y12 = center.Y; Projectile.NewProjectile(x10, y12, single56, single57, num46, num47, single15, i, 0f, 0f); } } else if (item.type == ItemID.PoisonStaff) { int num65 = 3; if (Main.rand.Next(3) == 0) { num65++; } for (int n1 = 0; n1 < num65; n1++) { float single59 = x6; float single60 = y6; float single61 = 0.05f * (float)n1; single59 = single59 + (float)Main.rand.Next(-35, 36) * single61; single60 = single60 + (float)Main.rand.Next(-35, 36) * single61; single16 = (float)Math.Sqrt((double)(single59 * single59 + single60 * single60)); single16 = single14 / single16; single59 = single59 * single16; single60 = single60 * single16; float x11 = center.X; float y13 = center.Y; Projectile.NewProjectile(x11, y13, single59, single60, num46, num47, single15, i, 0f, 0f); } } else if (item.type == ItemID.Stynger) { float single62 = x6; float single63 = y6; single62 = single62 + (float)Main.rand.Next(-40, 41) * 0.01f; single63 = single63 + (float)Main.rand.Next(-40, 41) * 0.01f; center.X = center.X + (float)Main.rand.Next(-40, 41) * 0.05f; center.Y = center.Y + (float)Main.rand.Next(-45, 36) * 0.05f; Projectile.NewProjectile(center.X, center.Y, single62, single63, num46, num47, single15, i, 0f, 0f); } else if (item.type == ItemID.Boomstick) { int num66 = Main.rand.Next(3, 5); for (int o1 = 0; o1 < num66; o1++) { float single64 = x6; float single65 = y6; single64 = single64 + (float)Main.rand.Next(-35, 36) * 0.04f; single65 = single65 + (float)Main.rand.Next(-35, 36) * 0.04f; Projectile.NewProjectile(center.X, center.Y, single64, single65, num46, num47, single15, i, 0f, 0f); } } else if (item.type == ItemID.VampireKnives) { int num67 = 4; if (Main.rand.Next(2) == 0) { num67++; } if (Main.rand.Next(4) == 0) { num67++; } if (Main.rand.Next(8) == 0) { num67++; } if (Main.rand.Next(16) == 0) { num67++; } for (int p1 = 0; p1 < num67; p1++) { float single66 = x6; float single67 = y6; float single68 = 0.05f * (float)p1; single66 = single66 + (float)Main.rand.Next(-35, 36) * single68; single67 = single67 + (float)Main.rand.Next(-35, 36) * single68; single16 = (float)Math.Sqrt((double)(single66 * single66 + single67 * single67)); single16 = single14 / single16; single66 = single66 * single16; single67 = single67 * single16; float x12 = center.X; float y14 = center.Y; Projectile.NewProjectile(x12, y14, single66, single67, num46, num47, single15, i, 0f, 0f); } } else if (item.type == ItemID.StaffoftheFrostHydra || item.type == ItemID.QueenSpiderStaff || item.type == ItemID.RainbowCrystalStaff || item.type == ItemID.MoonlordTurretStaff) { int num68 = item.shoot; for (int q1 = 0; q1 < 1000; q1++) { if (Main.projectile[q1].owner == this.whoAmI && Main.projectile[q1].type == num68) { Main.projectile[q1].Kill(); } } bool flag11 = (item.type == ItemID.RainbowCrystalStaff ? true : item.type == ItemID.MoonlordTurretStaff); int x13 = (int)((float)Main.mouseX + Main.screenPosition.X) / 16; int y15 = (int)((float)Main.mouseY + Main.screenPosition.Y) / 16; if (this.gravDir == -1f) { y15 = (int)(Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY) / 16; } if (!flag11) { while (y15 < Main.maxTilesY - 10 && Main.tile[x13, y15] != null && !WorldGen.SolidTile2(x13, y15) && Main.tile[x13 - 1, y15] != null && !WorldGen.SolidTile2(x13 - 1, y15) && Main.tile[x13 + 1, y15] != null && !WorldGen.SolidTile2(x13 + 1, y15)) { y15++; } y15--; } Projectile.NewProjectile((float)Main.mouseX + Main.screenPosition.X, (float)(y15 * 16 - 24), 0f, 15f, num46, num47, single15, i, 0f, 0f); } else if (item.type == ItemID.NimbusRod || item.type == ItemID.CrimsonRod) { int num69 = Projectile.NewProjectile(center.X, center.Y, x6, y6, num46, num47, single15, i, 0f, 0f); Main.projectile[num69].ai[0] = (float)Main.mouseX + Main.screenPosition.X; Main.projectile[num69].ai[1] = (float)Main.mouseY + Main.screenPosition.Y; } else if (item.type == ItemID.ChlorophyteShotbow) { int num70 = Main.rand.Next(2, 4); if (Main.rand.Next(5) == 0) { num70++; } for (int r1 = 0; r1 < num70; r1++) { float single69 = x6; float single70 = y6; if (r1 > 0) { single69 = single69 + (float)Main.rand.Next(-35, 36) * 0.04f; single70 = single70 + (float)Main.rand.Next(-35, 36) * 0.04f; } if (r1 > 1) { single69 = single69 + (float)Main.rand.Next(-35, 36) * 0.04f; single70 = single70 + (float)Main.rand.Next(-35, 36) * 0.04f; } if (r1 > 2) { single69 = single69 + (float)Main.rand.Next(-35, 36) * 0.04f; single70 = single70 + (float)Main.rand.Next(-35, 36) * 0.04f; } int num71 = Projectile.NewProjectile(center.X, center.Y, single69, single70, num46, num47, single15, i, 0f, 0f); Main.projectile[num71].noDropItem = true; } } else if (item.type == ItemID.BeeGun) { int num72 = Main.rand.Next(1, 4); if (Main.rand.Next(6) == 0) { num72++; } if (Main.rand.Next(6) == 0) { num72++; } if (this.strongBees && Main.rand.Next(3) == 0) { num72++; } for (int s1 = 0; s1 < num72; s1++) { float single71 = x6; float single72 = y6; single71 = single71 + (float)Main.rand.Next(-35, 36) * 0.02f; single72 = single72 + (float)Main.rand.Next(-35, 36) * 0.02f; Projectile.NewProjectile(center.X, center.Y, single71, single72, this.beeType(), this.beeDamage(num47), this.beeKB(single15), i, 0f, 0f); } } else if (item.type == ItemID.WaspGun) { int num73 = Main.rand.Next(2, 5); if (Main.rand.Next(5) == 0) { num73++; } if (Main.rand.Next(5) == 0) { num73++; } for (int t1 = 0; t1 < num73; t1++) { float single73 = x6; float single74 = y6; single73 = single73 + (float)Main.rand.Next(-35, 36) * 0.02f; single74 = single74 + (float)Main.rand.Next(-35, 36) * 0.02f; Projectile.NewProjectile(center.X, center.Y, single73, single74, num46, num47, single15, i, 0f, 0f); } } else if (item.type == ItemID.BatScepter) { int num74 = Main.rand.Next(1, 4); for (int u1 = 0; u1 < num74; u1++) { float single75 = x6; float single76 = y6; single75 = single75 + (float)Main.rand.Next(-35, 36) * 0.05f; single76 = single76 + (float)Main.rand.Next(-35, 36) * 0.05f; Projectile.NewProjectile(center.X, center.Y, single75, single76, num46, num47, single15, i, 0f, 0f); } } else if (item.type == ItemID.TacticalShotgun) { for (int v1 = 0; v1 < 6; v1++) { float single77 = x6; float single78 = y6; single77 = single77 + (float)Main.rand.Next(-40, 41) * 0.05f; single78 = single78 + (float)Main.rand.Next(-40, 41) * 0.05f; Projectile.NewProjectile(center.X, center.Y, single77, single78, num46, num47, single15, i, 0f, 0f); } } else if (item.type == ItemID.BubbleGun) { for (int w1 = 0; w1 < 3; w1++) { float single79 = x6; float single80 = y6; single79 = single79 + (float)Main.rand.Next(-40, 41) * 0.1f; single80 = single80 + (float)Main.rand.Next(-40, 41) * 0.1f; Projectile.NewProjectile(center.X, center.Y, single79, single80, num46, num47, single15, i, 0f, 0f); } } else if (item.type == ItemID.Toxikarp) { Vector2 x14 = new Vector2(x6, y6); x14.Normalize(); x14 = x14 * ((float)Main.rand.Next(70, 91) * 0.1f); x14.X = x14.X + (float)Main.rand.Next(-30, 31) * 0.04f; x14.Y = x14.Y + (float)Main.rand.Next(-30, 31) * 0.03f; Projectile.NewProjectile(center.X, center.Y, x14.X, x14.Y, num46, num47, single15, i, (float)Main.rand.Next(20), 0f); } else if (item.type == ItemID.ClockworkAssaultRifle) { float single81 = x6; float single82 = y6; if (this.itemAnimation < 5) { single81 = single81 + (float)Main.rand.Next(-40, 41) * 0.01f; single82 = single82 + (float)Main.rand.Next(-40, 41) * 0.01f; single81 = single81 * 1.1f; single82 = single82 * 1.1f; } else if (this.itemAnimation < 10) { single81 = single81 + (float)Main.rand.Next(-20, 21) * 0.01f; single82 = single82 + (float)Main.rand.Next(-20, 21) * 0.01f; single81 = single81 * 1.05f; single82 = single82 * 1.05f; } Projectile.NewProjectile(center.X, center.Y, single81, single82, num46, num47, single15, i, 0f, 0f); } else if (item.type == ItemID.PygmyStaff) { num46 = Main.rand.Next(191, 195); x6 = 0f; y6 = 0f; center.X = (float)Main.mouseX + Main.screenPosition.X; center.Y = (float)Main.mouseY + Main.screenPosition.Y; int num75 = Projectile.NewProjectile(center.X, center.Y, x6, y6, num46, num47, single15, i, 0f, 0f); Main.projectile[num75].localAI[0] = 30f; } else if (item.type == ItemID.RavenStaff) { x6 = 0f; y6 = 0f; center.X = (float)Main.mouseX + Main.screenPosition.X; center.Y = (float)Main.mouseY + Main.screenPosition.Y; Projectile.NewProjectile(center.X, center.Y, x6, y6, num46, num47, single15, i, 0f, 0f); } else if (item.type == ItemID.HornetStaff || item.type == ItemID.ImpStaff) { x6 = 0f; y6 = 0f; center.X = (float)Main.mouseX + Main.screenPosition.X; center.Y = (float)Main.mouseY + Main.screenPosition.Y; Projectile.NewProjectile(center.X, center.Y, x6, y6, num46, num47, single15, i, 0f, 0f); } else if (item.type == ItemID.OpticStaff) { x6 = 0f; y6 = 0f; center.X = (float)Main.mouseX + Main.screenPosition.X; center.Y = (float)Main.mouseY + Main.screenPosition.Y; Vector2 vector242 = new Vector2(x6, y6); vector21 = new Vector2(); vector242 = vector242.RotatedBy(1.57079637050629, vector21); Projectile.NewProjectile(center.X + vector242.X, center.Y + vector242.Y, vector242.X, vector242.Y, num46, num47, single15, i, 0f, 0f); vector21 = new Vector2(); vector242 = vector242.RotatedBy(-3.14159274101257, vector21); Projectile.NewProjectile(center.X + vector242.X, center.Y + vector242.Y, vector242.X, vector242.Y, num46 + 1, num47, single15, i, 0f, 0f); } else if (item.type == ItemID.SpiderStaff) { x6 = 0f; y6 = 0f; center.X = (float)Main.mouseX + Main.screenPosition.X; center.Y = (float)Main.mouseY + Main.screenPosition.Y; Projectile.NewProjectile(center.X, center.Y, x6, y6, num46 + Main.rand.Next(3), num47, single15, i, 0f, 0f); } else if (item.type == ItemID.PirateStaff) { x6 = 0f; y6 = 0f; center.X = (float)Main.mouseX + Main.screenPosition.X; center.Y = (float)Main.mouseY + Main.screenPosition.Y; Projectile.NewProjectile(center.X, center.Y, x6, y6, num46 + Main.rand.Next(3), num47, single15, i, 0f, 0f); } else if (item.type == ItemID.TempestStaff) { x6 = 0f; y6 = 0f; center.X = (float)Main.mouseX + Main.screenPosition.X; center.Y = (float)Main.mouseY + Main.screenPosition.Y; Projectile.NewProjectile(center.X, center.Y, x6, y6, num46, num47, single15, i, 0f, 0f); } else if (item.type == ItemID.XenoStaff || item.type == ItemID.DeadlySphereStaff || item.type == ItemID.StardustCellStaff) { x6 = 0f; y6 = 0f; center.X = (float)Main.mouseX + Main.screenPosition.X; center.Y = (float)Main.mouseY + Main.screenPosition.Y; Projectile.NewProjectile(center.X, center.Y, x6, y6, num46, num47, single15, i, 0f, 0f); } else if (item.type == ItemID.StardustDragonStaff) { int num76 = -1; int num77 = -1; for (int x15 = 0; x15 < 1000; x15++) { if (Main.projectile[x15].active && Main.projectile[x15].owner == Main.myPlayer) { if (num76 == -1 && Main.projectile[x15].type == ProjectileID.StardustDragon1) { num76 = x15; } if (num77 == -1 && Main.projectile[x15].type == ProjectileID.StardustDragon4) { num77 = x15; } if (num76 != -1 && num77 != -1) { break; } } } if (num76 == -1 && num77 == -1) { x6 = 0f; y6 = 0f; center.X = (float)Main.mouseX + Main.screenPosition.X; center.Y = (float)Main.mouseY + Main.screenPosition.Y; int num78 = Projectile.NewProjectile(center.X, center.Y, x6, y6, num46, num47, single15, i, 0f, 0f); num78 = Projectile.NewProjectile(center.X, center.Y, x6, y6, num46 + 1, num47, single15, i, (float)num78, 0f); int num79 = num78; num78 = Projectile.NewProjectile(center.X, center.Y, x6, y6, num46 + 2, num47, single15, i, (float)num78, 0f); Main.projectile[num79].localAI[1] = (float)num78; num79 = num78; num78 = Projectile.NewProjectile(center.X, center.Y, x6, y6, num46 + 3, num47, single15, i, (float)num78, 0f); Main.projectile[num79].localAI[1] = (float)num78; } else if (num76 != -1 && num77 != -1) { int num80 = Projectile.NewProjectile(center.X, center.Y, x6, y6, num46 + 1, num47, single15, i, Main.projectile[num77].ai[0], 0f); int num81 = num80; num80 = Projectile.NewProjectile(center.X, center.Y, x6, y6, num46 + 2, num47, single15, i, (float)num80, 0f); Main.projectile[num81].localAI[1] = (float)num80; Main.projectile[num81].netUpdate = true; Main.projectile[num81].ai[1] = 1f; Main.projectile[num80].localAI[1] = (float)num77; Main.projectile[num80].netUpdate = true; Main.projectile[num80].ai[1] = 1f; Main.projectile[num77].ai[0] = (float)Main.projectile[num80].projUUID; Main.projectile[num77].netUpdate = true; Main.projectile[num77].ai[1] = 1f; } } else if (item.type == ItemID.SlimeStaff) { x6 = 0f; y6 = 0f; center.X = (float)Main.mouseX + Main.screenPosition.X; center.Y = (float)Main.mouseY + Main.screenPosition.Y; Projectile.NewProjectile(center.X, center.Y, x6, y6, num46, num47, single15, i, 0f, 0f); } else if (item.shoot > 0 && (Main.projPet[item.shoot] || item.shoot == 72 || item.shoot == 18 || item.shoot == 500 || item.shoot == 650) && !item.summon) { for (int y16 = 0; y16 < 1000; y16++) { if (Main.projectile[y16].active && Main.projectile[y16].owner == this.whoAmI) { if (item.shoot == 72) { if (Main.projectile[y16].type == ProjectileID.BlueFairy || Main.projectile[y16].type == ProjectileID.PinkFairy || Main.projectile[y16].type == ProjectileID.GreenFairy) { Main.projectile[y16].Kill(); } } else if (item.shoot == Main.projectile[y16].type) { Main.projectile[y16].Kill(); } } } Projectile.NewProjectile(center.X, center.Y, x6, y6, num46, num47, single15, i, 0f, 0f); } else if (item.type == ItemID.SoulDrain) { vector2.X = (float)Main.mouseX + Main.screenPosition.X; vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; while (Collision.CanHitLine(this.position, this.width, this.height, center, 1, 1)) { center.X = center.X + x6; center.Y = center.Y + y6; if ((center - vector2).Length() >= 20f + Math.Abs(x6) + Math.Abs(y6)) { continue; } center = vector2; break; } Projectile.NewProjectile(center.X, center.Y, 0f, 0f, num46, num47, single15, i, 0f, 0f); } else if (item.type == ItemID.ClingerStaff) { x.X = (float)Main.mouseX + Main.screenPosition.X; x.Y = (float)Main.mouseY + Main.screenPosition.Y; while (Collision.CanHitLine(this.position, this.width, this.height, center, 1, 1)) { center.X = center.X + x6; center.Y = center.Y + y6; if ((center - x).Length() >= 20f + Math.Abs(x6) + Math.Abs(y6)) { continue; } center = x; break; } bool flag12 = false; int y17 = (int)center.Y / 16; int x16 = (int)center.X / 16; int num82 = y17; while (y17 < Main.maxTilesY - 10 && y17 - num82 < 30 && !WorldGen.SolidTile(x16, y17)) { y17++; } if (!WorldGen.SolidTile(x16, y17)) { flag12 = true; } float single83 = (float)(y17 * 16); y17 = num82; while (y17 > 10 && num82 - y17 < 30 && !WorldGen.SolidTile(x16, y17)) { y17--; } float single84 = (float)(y17 * 16 + 16); float single85 = single83 - single84; int num83 = 10; if (single85 > (float)(16 * num83)) { single85 = (float)(16 * num83); } single84 = single83 - single85; center.X = (float)((int)(center.X / 16f) * 16); if (!flag12) { Projectile.NewProjectile(center.X, center.Y, 0f, 0f, num46, num47, single15, i, single84, single85); } } else if (item.type == ItemID.PortalGun) { int num84 = (this.altFunctionUse == 2 ? 1 : 0); Projectile.NewProjectile(center.X, center.Y, x6, y6, num46, num47, single15, i, 0f, (float)num84); } else if (item.type == ItemID.SolarEruption) { float single86 = (Main.rand.NextFloat() - 0.5f) * 0.7853982f; Vector2 vector243 = new Vector2(x6, y6); Projectile.NewProjectile(center.X, center.Y, vector243.X, vector243.Y, num46, num47, single15, i, 0f, single86); } else if (item.type == ItemID.NebulaBlaze) { float single87 = (Main.rand.NextFloat() - 0.5f) * 0.7853982f; for (int a1 = 0; a1 < 10; a1++) { Vector2 vector244 = new Vector2(x6, y6); double num85 = (double)single87; vector21 = new Vector2(); if (Collision.CanHit(center, 0, 0, center + (vector244.RotatedBy(num85, vector21) * 100f), 0, 0)) { break; } single87 = (Main.rand.NextFloat() - 0.5f) * 0.7853982f; } Vector2 vector245 = new Vector2(x6, y6); double num86 = (double)single87; vector21 = new Vector2(); Vector2 vector246 = vector245.RotatedBy(num86, vector21) * (0.85f + Main.rand.NextFloat() * 0.3f); Projectile.NewProjectile(center.X, center.Y, vector246.X, vector246.Y, num46, num47, single15, i, 0f, 0f); } else if (item.type == ItemID.VortexBeater) { Projectile.NewProjectile(center.X, center.Y, x6, y6, 615, num47, single15, i, (float)(5 * Main.rand.Next(0, 20)), 0f); } else if (item.type == ItemID.Phantasm) { Projectile.NewProjectile(center.X, center.Y, x6, y6, 630, num47, single15, i, 0f, 0f); } else if (item.type == ItemID.FireworksLauncher) { for (int b1 = 0; b1 < 2; b1++) { float single88 = x6; float single89 = y6; single88 = single88 + (float)Main.rand.Next(-40, 41) * 0.05f; single89 = single89 + (float)Main.rand.Next(-40, 41) * 0.05f; Vector2 vector247 = new Vector2(single88, single89); double num87 = (double)(-1.57079637f * (float)this.direction); vector21 = new Vector2(); Vector2 vector248 = center + (Vector2.Normalize(vector247.RotatedBy(num87, vector21)) * 6f); Projectile.NewProjectile(vector248.X, vector248.Y, single88, single89, 167 + Main.rand.Next(4), num47, single15, i, 0f, 1f); } } else if (item.type != ItemID.PainterPaintballGun) { int num88 = Projectile.NewProjectile(center.X, center.Y, x6, y6, num46, num47, single15, i, 0f, 0f); if (item.type == ItemID.FrostStaff) { Main.projectile[num88].magic = true; } if (item.type == ItemID.IceBlade || item.type == ItemID.Frostbrand) { Main.projectile[num88].melee = true; } if (num46 == 80) { Main.projectile[num88].ai[0] = (float)Player.tileTargetX; Main.projectile[num88].ai[1] = (float)Player.tileTargetY; } if (num46 == 442) { Main.projectile[num88].ai[0] = (float)Player.tileTargetX; Main.projectile[num88].ai[1] = (float)Player.tileTargetY; } if ((this.thrownCost50 || this.thrownCost33) && this.inventory[this.selectedItem].thrown) { Main.projectile[num88].noDropItem = true; } if (Main.projectile[num88].aiStyle == 99) { AchievementsHelper.HandleSpecialEvent(this, 7); } } else { float single90 = x6; float single91 = y6; single90 = single90 + (float)Main.rand.Next(-1, 2) * 0.5f; single91 = single91 + (float)Main.rand.Next(-1, 2) * 0.5f; if (Collision.CanHitLine(base.Center, 0, 0, center + (new Vector2(single90, single91) * 2f), 0, 0)) { center = center + new Vector2(single90, single91); } Projectile.NewProjectile(center.X, center.Y - this.gravDir * 4f, single90, single91, num46, num47, single15, i, 0f, (float)Main.rand.Next(12) / 6f); } } else if (item.useStyle == 5) { this.itemRotation = 0f; NetMessage.SendData((int)PacketTypes.PlayerAnimation, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } if (this.whoAmI == Main.myPlayer && (item.type == ItemID.Wrench || item.type == ItemID.WireCutter || item.type == ItemID.Actuator || item.type == ItemID.BlueWrench || item.type == ItemID.GreenWrench) && this.position.X / 16f - (float)Player.tileRangeX - (float)item.tileBoost - (float)this.blockRange <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)item.tileBoost - 1f + (float)this.blockRange >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)item.tileBoost - (float)this.blockRange <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)item.tileBoost - 2f + (float)this.blockRange >= (float)Player.tileTargetY) { this.showItemIcon = true; if (this.itemAnimation > 0 && this.itemTime == 0 && this.controlUseItem) { int num89 = Player.tileTargetX; int num90 = Player.tileTargetY; if (item.type == ItemID.Wrench) { int num91 = -1; int num92 = 0; while (num92 < 58) { if (this.inventory[num92].stack <= 0 || this.inventory[num92].type != 530) { num92++; } else { num91 = num92; break; } } if (num91 >= 0 && WorldGen.PlaceWire(num89, num90)) { Item item8 = this.inventory[num91]; item8.stack = item8.stack - 1; if (this.inventory[num91].stack <= 0) { this.inventory[num91].SetDefaults(0, false); } this.itemTime = item.useTime; NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 5, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0); } } else if (item.type == ItemID.BlueWrench) { int num93 = -1; int num94 = 0; while (num94 < 58) { if (this.inventory[num94].stack <= 0 || this.inventory[num94].type != 530) { num94++; } else { num93 = num94; break; } } if (num93 >= 0 && WorldGen.PlaceWire2(num89, num90)) { Item item9 = this.inventory[num93]; item9.stack = item9.stack - 1; if (this.inventory[num93].stack <= 0) { this.inventory[num93].SetDefaults(0, false); } this.itemTime = item.useTime; NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 10, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0); } } if (item.type == ItemID.GreenWrench) { int num95 = -1; int num96 = 0; while (num96 < 58) { if (this.inventory[num96].stack <= 0 || this.inventory[num96].type != 530) { num96++; } else { num95 = num96; break; } } if (num95 >= 0 && WorldGen.PlaceWire3(num89, num90)) { Item item10 = this.inventory[num95]; item10.stack = item10.stack - 1; if (this.inventory[num95].stack <= 0) { this.inventory[num95].SetDefaults(0, false); } this.itemTime = item.useTime; NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 12, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0); } } else if (item.type != ItemID.WireCutter) { if (item.type == ItemID.Actuator && item.stack > 0 && WorldGen.PlaceActuator(num89, num90)) { this.itemTime = item.useTime; NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 8, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0); Item item11 = item; item11.stack = item11.stack - 1; if (item.stack <= 0) { item.SetDefaults(0, false); } } } else if (WorldGen.KillActuator(num89, num90)) { this.itemTime = item.useTime; NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 9, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0); } else if (WorldGen.KillWire3(num89, num90)) { this.itemTime = item.useTime; NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 13, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0); } else if (WorldGen.KillWire2(num89, num90)) { this.itemTime = item.useTime; NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 11, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0); } else if (WorldGen.KillWire(num89, num90)) { this.itemTime = item.useTime; NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 6, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0); } } } if (this.itemAnimation > 0 && this.itemTime == 0 && (item.type == ItemID.Bell || item.type == ItemID.Harp)) { this.itemTime = item.useTime; Vector2 vector249 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float x17 = (float)Main.mouseX + Main.screenPosition.X - vector249.X; float y18 = (float)Main.mouseY + Main.screenPosition.Y - vector249.Y; float single92 = (float)Math.Sqrt((double)(x17 * x17 + y18 * y18)); single92 = single92 / (float)(Main.screenHeight / 2); if (single92 > 1f) { single92 = 1f; } single92 = single92 * 2f - 1f; if (single92 < -1f) { single92 = -1f; } if (single92 > 1f) { single92 = 1f; } Main.harpNote = single92; NetMessage.SendData((int)PacketTypes.PlayHarp, -1, -1, "", this.whoAmI, single92, 0f, 0f, 0, 0, 0); } if ((item.type >= ItemID.EmptyBucket && item.type <= ItemID.LavaBucket || item.type == ItemID.HoneyBucket || item.type == ItemID.BottomlessBucket || item.type == ItemID.SuperAbsorbantSponge) && this.position.X / 16f - (float)Player.tileRangeX - (float)item.tileBoost <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)item.tileBoost - 1f >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)item.tileBoost <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)item.tileBoost - 2f >= (float)Player.tileTargetY) { this.showItemIcon = true; if (this.itemTime == 0 && this.itemAnimation > 0 && this.controlUseItem) { if (item.type == ItemID.EmptyBucket || item.type == ItemID.SuperAbsorbantSponge && Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType() == 0) { int num98 = Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType(); int num99 = 0; for (int c1 = Player.tileTargetX - 1; c1 <= Player.tileTargetX + 1; c1++) { for (int d1 = Player.tileTargetY - 1; d1 <= Player.tileTargetY + 1; d1++) { if (Main.tile[c1, d1].liquidType() == num98) { num99 = num99 + Main.tile[c1, d1].liquid; } } } if (Main.tile[Player.tileTargetX, Player.tileTargetY].liquid > 0 && (num99 > 100 || item.type == ItemID.SuperAbsorbantSponge)) { int num100 = Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType(); if (item.type != ItemID.SuperAbsorbantSponge) { if (Main.tile[Player.tileTargetX, Player.tileTargetY].lava()) { Item item12 = item; item12.stack = item12.stack - 1; this.PutItemInInventory(207, this.selectedItem); } else if (!Main.tile[Player.tileTargetX, Player.tileTargetY].honey()) { Item item13 = item; item13.stack = item13.stack - 1; this.PutItemInInventory(206, this.selectedItem); } else { Item item14 = item; item14.stack = item14.stack - 1; this.PutItemInInventory(1128, this.selectedItem); } } this.itemTime = item.useTime; int num101 = Main.tile[Player.tileTargetX, Player.tileTargetY].liquid; Main.tile[Player.tileTargetX, Player.tileTargetY].liquid = 0; Main.tile[Player.tileTargetX, Player.tileTargetY].lava(false); Main.tile[Player.tileTargetX, Player.tileTargetY].honey(false); WorldGen.SquareTileFrame(Player.tileTargetX, Player.tileTargetY, false); if (Main.netMode != 1) { Liquid.AddWater(Player.tileTargetX, Player.tileTargetY); } else { NetMessage.sendWater(Player.tileTargetX, Player.tileTargetY); } for (int e1 = Player.tileTargetX - 1; e1 <= Player.tileTargetX + 1; e1++) { for (int f1 = Player.tileTargetY - 1; f1 <= Player.tileTargetY + 1; f1++) { if (num101 < 256 && Main.tile[e1, f1].liquidType() == num98) { int num102 = Main.tile[e1, f1].liquid; if (num102 + num101 > 255) { num102 = 255 - num101; } num101 = num101 + num102; Tile tile1 = Main.tile[e1, f1]; tile1.liquid = (byte)(tile1.liquid - (byte)num102); Main.tile[e1, f1].liquidType(num100); if (Main.tile[e1, f1].liquid == 0) { Main.tile[e1, f1].lava(false); Main.tile[e1, f1].honey(false); } WorldGen.SquareTileFrame(e1, f1, false); if (Main.netMode != 1) { Liquid.AddWater(e1, f1); } else { NetMessage.sendWater(e1, f1); } } } } } } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].liquid < 200 && (!Main.tile[Player.tileTargetX, Player.tileTargetY].nactive() || !Main.tileSolid[Main.tile[Player.tileTargetX, Player.tileTargetY].type] || Main.tileSolidTop[Main.tile[Player.tileTargetX, Player.tileTargetY].type])) { if (item.type == ItemID.LavaBucket) { if (Main.tile[Player.tileTargetX, Player.tileTargetY].liquid == 0 || Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType() == 1) { Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType(1); Main.tile[Player.tileTargetX, Player.tileTargetY].liquid = 255; WorldGen.SquareTileFrame(Player.tileTargetX, Player.tileTargetY, true); Item item15 = item; item15.stack = item15.stack - 1; this.PutItemInInventory(205, this.selectedItem); this.itemTime = item.useTime; if (Main.netMode == 1) { NetMessage.sendWater(Player.tileTargetX, Player.tileTargetY); } } } else if (item.type != ItemID.WaterBucket && item.type != ItemID.BottomlessBucket) { if (item.type == ItemID.HoneyBucket && (Main.tile[Player.tileTargetX, Player.tileTargetY].liquid == 0 || Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType() == 2)) { Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType(2); Main.tile[Player.tileTargetX, Player.tileTargetY].liquid = 255; WorldGen.SquareTileFrame(Player.tileTargetX, Player.tileTargetY, true); Item item16 = item; item16.stack = item16.stack - 1; this.PutItemInInventory(205, this.selectedItem); this.itemTime = item.useTime; if (Main.netMode == 1) { NetMessage.sendWater(Player.tileTargetX, Player.tileTargetY); } } } else if (Main.tile[Player.tileTargetX, Player.tileTargetY].liquid == 0 || Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType() == 0) { Main.tile[Player.tileTargetX, Player.tileTargetY].liquidType(0); Main.tile[Player.tileTargetX, Player.tileTargetY].liquid = 255; WorldGen.SquareTileFrame(Player.tileTargetX, Player.tileTargetY, true); if (item.type != ItemID.BottomlessBucket) { Item item17 = item; item17.stack = item17.stack - 1; this.PutItemInInventory(205, this.selectedItem); } this.itemTime = item.useTime; if (Main.netMode == 1) { NetMessage.sendWater(Player.tileTargetX, Player.tileTargetY); } } } } } if (this.channel) { Player player7 = this; player7.toolTime = player7.toolTime - 1; if (this.toolTime < 0) { if (item.pick <= 0) { this.toolTime = (int)((float)item.useTime * this.pickSpeed); } else { this.toolTime = item.useTime; } } } else { this.toolTime = this.itemTime; } if ((item.pick > 0 || item.axe > 0 || item.hammer > 0) && this.position.X / 16f - (float)Player.tileRangeX - (float)item.tileBoost <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)item.tileBoost - 1f >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)item.tileBoost <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)item.tileBoost - 2f >= (float)Player.tileTargetY) { int num103 = -1; int num104 = 0; bool flag13 = true; this.showItemIcon = true; if (this.toolTime == 0 && this.itemAnimation > 0 && this.controlUseItem && (!Main.tile[Player.tileTargetX, Player.tileTargetY].active() || !Main.tileHammer[Main.tile[Player.tileTargetX, Player.tileTargetY].type] && !Main.tileSolid[Main.tile[Player.tileTargetX, Player.tileTargetY].type] && Main.tile[Player.tileTargetX, Player.tileTargetY].type != 314 && Main.tile[Player.tileTargetX, Player.tileTargetY].type != 351)) { this.poundRelease = false; } if (Main.tile[Player.tileTargetX, Player.tileTargetY].active()) { if (item.pick > 0 && !Main.tileAxe[Main.tile[Player.tileTargetX, Player.tileTargetY].type] && !Main.tileHammer[Main.tile[Player.tileTargetX, Player.tileTargetY].type] || item.axe > 0 && Main.tileAxe[Main.tile[Player.tileTargetX, Player.tileTargetY].type] || item.hammer > 0 && Main.tileHammer[Main.tile[Player.tileTargetX, Player.tileTargetY].type]) { flag13 = false; } if (this.toolTime == 0 && this.itemAnimation > 0 && this.controlUseItem) { num103 = this.hitTile.HitObject(Player.tileTargetX, Player.tileTargetY, 1); if (Main.tileNoFail[Main.tile[Player.tileTargetX, Player.tileTargetY].type]) { num104 = 100; } if (Main.tileHammer[Main.tile[Player.tileTargetX, Player.tileTargetY].type]) { flag13 = false; if (item.hammer > 0) { num104 = num104 + item.hammer; if (!WorldGen.CanKillTile(Player.tileTargetX, Player.tileTargetY)) { num104 = 0; } if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 26 && (item.hammer < 80 || !Main.hardMode)) { num104 = 0; this.Hurt(this.statLife / 2, -this.direction, false, false, Lang.deathMsg(-1, -1, -1, 4), false); } AchievementsHelper.CurrentlyMining = true; if (this.hitTile.AddDamage(num103, num104, true) < 100) { WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY, true, false, false); if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 0, (float)Player.tileTargetX, (float)Player.tileTargetY, 1f, 0, 0, 0); } } else { this.hitTile.Clear(num103); WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY, false, false, false); if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 0, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0); } } if (num104 != 0) { this.hitTile.Prune(); } this.itemTime = item.useTime; AchievementsHelper.CurrentlyMining = false; } } else if (Main.tileAxe[Main.tile[Player.tileTargetX, Player.tileTargetY].type]) { num104 = (Main.tile[Player.tileTargetX, Player.tileTargetY].type != 80 ? num104 + item.axe : num104 + item.axe * 3); if (item.axe > 0) { AchievementsHelper.CurrentlyMining = true; if (!WorldGen.CanKillTile(Player.tileTargetX, Player.tileTargetY)) { num104 = 0; } if (this.hitTile.AddDamage(num103, num104, true) < 100) { WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY, true, false, false); if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 0, (float)Player.tileTargetX, (float)Player.tileTargetY, 1f, 0, 0, 0); } } else { this.hitTile.Clear(num103); WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY, false, false, false); if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 0, (float)Player.tileTargetX, (float)Player.tileTargetY, 0f, 0, 0, 0); } } if (num104 != 0) { this.hitTile.Prune(); } this.itemTime = item.useTime; AchievementsHelper.CurrentlyMining = false; } } else if (item.pick > 0) { this.PickTile(Player.tileTargetX, Player.tileTargetY, item.pick); this.itemTime = (int)((float)item.useTime * this.pickSpeed); } if (item.pick > 0) { this.itemTime = (int)((float)item.useTime * this.pickSpeed); } if (item.hammer <= 0 || !Main.tile[Player.tileTargetX, Player.tileTargetY].active() || (!Main.tileSolid[Main.tile[Player.tileTargetX, Player.tileTargetY].type] || Main.tile[Player.tileTargetX, Player.tileTargetY].type == 10) && Main.tile[Player.tileTargetX, Player.tileTargetY].type != 314 && Main.tile[Player.tileTargetX, Player.tileTargetY].type != 351 || !this.poundRelease) { this.poundRelease = false; } else { flag13 = false; this.itemTime = item.useTime; num104 = num104 + (int)((double)item.hammer * 1.25); num104 = 100; if (Main.tile[Player.tileTargetX, Player.tileTargetY - 1].active() && Main.tile[Player.tileTargetX, Player.tileTargetY - 1].type == 10) { num104 = 0; } if (Main.tile[Player.tileTargetX, Player.tileTargetY + 1].active() && Main.tile[Player.tileTargetX, Player.tileTargetY + 1].type == 10) { num104 = 0; } if (this.hitTile.AddDamage(num103, num104, true) < 100) { WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY, true, true, false); } else { this.hitTile.Clear(num103); if (this.poundRelease) { int num105 = Player.tileTargetX; int num106 = Player.tileTargetY; if (Main.tile[num105, num106].type == TileID.Platforms) { if (!Main.tile[num105, num106].halfBrick()) { int num107 = 1; int num108 = 2; if (Main.tile[num105 + 1, num106 - 1].type == 19 || Main.tile[num105 - 1, num106 + 1].type == 19 || WorldGen.SolidTile(num105 + 1, num106) && !WorldGen.SolidTile(num105 - 1, num106)) { num107 = 2; num108 = 1; } if (Main.tile[num105, num106].slope() == 0) { WorldGen.SlopeTile(num105, num106, num107); int num109 = Main.tile[num105, num106].slope(); if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 14, (float)Player.tileTargetX, (float)Player.tileTargetY, (float)num109, 0, 0, 0); } } else if (Main.tile[num105, num106].slope() != num107) { WorldGen.SlopeTile(num105, num106, 0); int num110 = Main.tile[num105, num106].slope(); if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 14, (float)Player.tileTargetX, (float)Player.tileTargetY, (float)num110, 0, 0, 0); } WorldGen.PoundTile(num105, num106); if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 7, (float)Player.tileTargetX, (float)Player.tileTargetY, 1f, 0, 0, 0); } } else { WorldGen.SlopeTile(num105, num106, num108); int num111 = Main.tile[num105, num106].slope(); if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 14, (float)Player.tileTargetX, (float)Player.tileTargetY, (float)num111, 0, 0, 0); } } } else { WorldGen.PoundTile(num105, num106); if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 7, (float)Player.tileTargetX, (float)Player.tileTargetY, 1f, 0, 0, 0); } } } else if (Main.tile[num105, num106].type == TileID.MinecartTrack) { if (Minecart.FrameTrack(num105, num106, true, false) && Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 15, (float)Player.tileTargetX, (float)Player.tileTargetY, 1f, 0, 0, 0); } } else if (Main.tile[num105, num106].type == TileID.Traps) { if (Main.tile[num105, num106].frameX != 18) { Main.tile[num105, num106].frameX = 18; } else { Main.tile[num105, num106].frameX = 0; } if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, Player.tileTargetX, Player.tileTargetY, 1); } } else if ((Main.tile[num105, num106].halfBrick() || Main.tile[num105, num106].slope() != 0) && !Main.tileSolidTop[Main.tile[Player.tileTargetX, Player.tileTargetY].type]) { int num112 = 1; int num113 = 1; int num114 = 2; if ((WorldGen.SolidTile(num105 + 1, num106) || Main.tile[num105 + 1, num106].slope() == 1 || Main.tile[num105 + 1, num106].slope() == 3) && !WorldGen.SolidTile(num105 - 1, num106)) { num113 = 2; num114 = 1; } if (WorldGen.SolidTile(num105, num106 - 1) && !WorldGen.SolidTile(num105, num106 + 1)) { num112 = -1; } if (num112 == 1) { if (Main.tile[num105, num106].slope() == 0) { WorldGen.SlopeTile(num105, num106, num113); } else if (Main.tile[num105, num106].slope() == num113) { WorldGen.SlopeTile(num105, num106, num114); } else if (Main.tile[num105, num106].slope() == num114) { WorldGen.SlopeTile(num105, num106, num113 + 2); } else if (Main.tile[num105, num106].slope() != num113 + 2) { WorldGen.SlopeTile(num105, num106, 0); } else { WorldGen.SlopeTile(num105, num106, num114 + 2); } } else if (Main.tile[num105, num106].slope() == 0) { WorldGen.SlopeTile(num105, num106, num113 + 2); } else if (Main.tile[num105, num106].slope() == num113 + 2) { WorldGen.SlopeTile(num105, num106, num114 + 2); } else if (Main.tile[num105, num106].slope() == num114 + 2) { WorldGen.SlopeTile(num105, num106, num113); } else if (Main.tile[num105, num106].slope() != num113) { WorldGen.SlopeTile(num105, num106, 0); } else { WorldGen.SlopeTile(num105, num106, num114); } int num115 = Main.tile[num105, num106].slope(); if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 14, (float)Player.tileTargetX, (float)Player.tileTargetY, (float)num115, 0, 0, 0); } } else { WorldGen.PoundTile(num105, num106); if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 7, (float)Player.tileTargetX, (float)Player.tileTargetY, 1f, 0, 0, 0); } } this.poundRelease = false; } } } } } if (this.releaseUseItem) { this.poundRelease = true; } int num116 = Player.tileTargetX; int num117 = Player.tileTargetY; bool flag14 = true; if (Main.tile[num116, num117].wall > 0) { if (Main.wallHouse[Main.tile[num116, num117].wall]) { flag14 = false; } else { for (int g1 = num116 - 1; g1 < num116 + 2; g1++) { int num118 = num117 - 1; while (num118 < num117 + 2) { if (Main.tile[g1, num118].wall == Main.tile[num116, num117].wall) { num118++; } else { flag14 = false; break; } } } } } if (flag14 && !Main.tile[num116, num117].active()) { int num119 = -1; if ((double)(((float)Main.mouseX + Main.screenPosition.X) / 16f) < Math.Round((double)(((float)Main.mouseX + Main.screenPosition.X) / 16f))) { num119 = 0; } int num120 = -1; if ((double)(((float)Main.mouseY + Main.screenPosition.Y) / 16f) < Math.Round((double)(((float)Main.mouseY + Main.screenPosition.Y) / 16f))) { num120 = 0; } for (int h1 = Player.tileTargetX + num119; h1 <= Player.tileTargetX + num119 + 1; h1++) { for (int i2 = Player.tileTargetY + num120; i2 <= Player.tileTargetY + num120 + 1; i2++) { if (flag14) { num116 = h1; num117 = i2; if (Main.tile[num116, num117].wall > 0) { if (Main.wallHouse[Main.tile[num116, num117].wall]) { flag14 = false; } else { for (int j2 = num116 - 1; j2 < num116 + 2; j2++) { int num121 = num117 - 1; while (num121 < num117 + 2) { if (Main.tile[j2, num121].wall == Main.tile[num116, num117].wall) { num121++; } else { flag14 = false; break; } } } } } } } } } if (flag13 && Main.tile[num116, num117].wall > 0 && (!Main.tile[num116, num117].active() || num116 != Player.tileTargetX || num117 != Player.tileTargetY || !Main.tileHammer[Main.tile[num116, num117].type] && !this.poundRelease) && this.toolTime == 0 && this.itemAnimation > 0 && this.controlUseItem && item.hammer > 0) { bool flag15 = true; if (!Main.wallHouse[Main.tile[num116, num117].wall]) { flag15 = false; for (int k2 = num116 - 1; k2 < num116 + 2; k2++) { int num122 = num117 - 1; while (num122 < num117 + 2) { if (Main.tile[k2, num122].wall == WallID.None || Main.wallHouse[Main.tile[k2, num122].wall]) { flag15 = true; break; } else { num122++; } } } } if (flag15) { num103 = this.hitTile.HitObject(num116, num117, 2); num104 = num104 + (int)((float)item.hammer * 1.5f); if (this.hitTile.AddDamage(num103, num104, true) < 100) { WorldGen.KillWall(num116, num117, true); if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 2, (float)num116, (float)num117, 1f, 0, 0, 0); } } else { this.hitTile.Clear(num103); WorldGen.KillWall(num116, num117, false); if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 2, (float)num116, (float)num117, 0f, 0, 0, 0); } } if (num104 != 0) { this.hitTile.Prune(); } this.itemTime = item.useTime / 2; } } } if (Main.myPlayer == this.whoAmI && item.type == ItemID.RodofDiscord && this.itemAnimation > 0 && this.itemTime == 0) { this.itemTime = item.useTime; y.X = (float)Main.mouseX + Main.screenPosition.X; if (this.gravDir != 1f) { y.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY; } else { y.Y = (float)Main.mouseY + Main.screenPosition.Y - (float)this.height; } y.X = y.X - (float)(this.width / 2); if (y.X > 50f && y.X < (float)(Main.maxTilesX * 16 - 50) && y.Y > 50f && y.Y < (float)(Main.maxTilesY * 16 - 50)) { int x18 = (int)(y.X / 16f); int y19 = (int)(y.Y / 16f); if ((Main.tile[x18, y19].wall != WallID.LihzahrdBrickUnsafe || (double)y19 <= Main.worldSurface || NPC.downedPlantBoss) && !Collision.SolidCollision(y, this.width, this.height)) { this.Teleport(y, 1, 0); NetMessage.SendData((int)PacketTypes.Teleport, -1, -1, "", 0, (float)this.whoAmI, y.X, y.Y, 1, 0, 0); if (this.chaosState) { Player player8 = this; player8.statLife = player8.statLife - this.statLifeMax2 / 7; if (Lang.lang <= 1) { string str = " didn't materialize"; if (Main.rand.Next(2) == 0) { str = (!this.Male ? "'s legs appeared where her head should be" : "'s legs appeared where his head should be"); } if (this.statLife <= 0) { this.KillMe(1, 0, false, str); } } else if (this.statLife <= 0) { this.KillMe(1, 0, false, ""); } this.lifeRegenCount = 0; this.lifeRegenTime = 0; } this.AddBuff(BuffID.ChaosState, 360, true); } } } if (item.type == ItemID.LifeCrystal && this.itemAnimation > 0 && this.statLifeMax < 400 && this.itemTime == 0) { this.itemTime = item.useTime; Player player9 = this; player9.statLifeMax = player9.statLifeMax + 20; Player player10 = this; player10.statLifeMax2 = player10.statLifeMax2 + 20; Player player11 = this; player11.statLife = player11.statLife + 20; if (Main.myPlayer == this.whoAmI) { this.HealEffect(20, true); } AchievementsHelper.HandleSpecialEvent(this, 0); } if (item.type == ItemID.LifeFruit && this.itemAnimation > 0 && this.statLifeMax >= 400 && this.statLifeMax < 500 && this.itemTime == 0) { this.itemTime = item.useTime; Player player12 = this; player12.statLifeMax = player12.statLifeMax + 5; Player player13 = this; player13.statLifeMax2 = player13.statLifeMax2 + 5; Player player14 = this; player14.statLife = player14.statLife + 5; if (Main.myPlayer == this.whoAmI) { this.HealEffect(5, true); } AchievementsHelper.HandleSpecialEvent(this, 2); } if (item.type == ItemID.ManaCrystal && this.itemAnimation > 0 && this.statManaMax < 200 && this.itemTime == 0) { this.itemTime = item.useTime; Player player15 = this; player15.statManaMax = player15.statManaMax + 20; Player player16 = this; player16.statManaMax2 = player16.statManaMax2 + 20; Player player17 = this; player17.statMana = player17.statMana + 20; if (Main.myPlayer == this.whoAmI) { this.ManaEffect(20); } AchievementsHelper.HandleSpecialEvent(this, 1); } if (item.type == ItemID.DemonHeart && this.itemAnimation > 0 && !this.extraAccessory && Main.expertMode && this.itemTime == 0) { this.itemTime = item.useTime; this.extraAccessory = true; NetMessage.SendData((int)PacketTypes.PlayerInfo, -1, -1, Main.player[this.whoAmI].name, this.whoAmI, 0f, 0f, 0f, 0, 0, 0); } this.PlaceThing(); } if (item.type == ItemID.NebulaBlaze) { Vector2 offsetsPlayerOnhand = Main.OffsetsPlayerOnhand[this.bodyFrame.Y / 56] * 2f; if (this.direction != 1) { offsetsPlayerOnhand.X = (float)this.bodyFrame.Width - offsetsPlayerOnhand.X; } if (this.gravDir != 1f) { offsetsPlayerOnhand.Y = (float)this.bodyFrame.Height - offsetsPlayerOnhand.Y; } offsetsPlayerOnhand = offsetsPlayerOnhand - (new Vector2((float)(this.bodyFrame.Width - this.width), (float)(this.bodyFrame.Height - 42)) / 2f); } if ((item.damage >= 0 && item.type > 0 && !item.noMelee || item.type == ItemID.BubbleWand || item.type == ItemID.BugNet || item.type == ItemID.GoldenBugNet || item.type == ItemID.NebulaBlaze) && this.itemAnimation > 0) { bool flag16 = false; Rectangle rectangle = new Rectangle((int)this.itemLocation.X, (int)this.itemLocation.Y, 32, 32); rectangle.Width = (int)((float)rectangle.Width * item.scale); rectangle.Height = (int)((float)rectangle.Height * item.scale); if (this.direction == -1) { rectangle.X = rectangle.X - rectangle.Width; } if (this.gravDir == 1f) { rectangle.Y = rectangle.Y - rectangle.Height; } if (item.useStyle != 1) { if (item.useStyle == 3) { if ((double)this.itemAnimation <= (double)this.itemAnimationMax * 0.666) { if (this.direction == -1) { rectangle.X = rectangle.X - (int)((double)rectangle.Width * 1.4 - (double)rectangle.Width); } rectangle.Width = (int)((double)rectangle.Width * 1.4); rectangle.Y = rectangle.Y + (int)((double)rectangle.Height * 0.6); rectangle.Height = (int)((double)rectangle.Height * 0.6); } else { flag16 = true; } } } else if ((double)this.itemAnimation < (double)this.itemAnimationMax * 0.333) { if (this.direction == -1) { rectangle.X = rectangle.X - (int)((double)rectangle.Width * 1.4 - (double)rectangle.Width); } rectangle.Width = (int)((double)rectangle.Width * 1.4); rectangle.Y = rectangle.Y + (int)((double)rectangle.Height * 0.5 * (double)this.gravDir); rectangle.Height = (int)((double)rectangle.Height * 1.1); } else if ((double)this.itemAnimation >= (double)this.itemAnimationMax * 0.666) { if (this.direction == 1) { rectangle.X = rectangle.X - (int)((double)rectangle.Width * 1.2); } rectangle.Width = rectangle.Width * 2; rectangle.Y = rectangle.Y - (int)(((double)rectangle.Height * 1.4 - (double)rectangle.Height) * (double)this.gravDir); rectangle.Height = (int)((double)rectangle.Height * 1.4); } float single94 = this.gravDir; if (item.type == ItemID.NebulaBlaze) { flag16 = true; } if (!flag16) { if (Main.myPlayer == i && (item.type == ItemID.BugNet || item.type == ItemID.GoldenBugNet)) { for (int n2 = 0; n2 < 200; n2++) { if (Main.npc[n2].active && Main.npc[n2].catchItem > 0) { Rectangle rectangle1 = new Rectangle((int)Main.npc[n2].position.X, (int)Main.npc[n2].position.Y, Main.npc[n2].width, Main.npc[n2].height); if (rectangle.Intersects(rectangle1) && (item.type == ItemID.GoldenBugNet || Main.npc[n2].noTileCollide || Collision.CanHit(this.position, this.width, this.height, Main.npc[n2].position, Main.npc[n2].width, Main.npc[n2].height))) { NPC.CatchNPC(n2, i); } } } } if (Main.myPlayer == i && (item.damage > 0 || item.type == ItemID.GoldenBugNet)) { int num155 = (int)((float)item.damage * this.meleeDamage); float single102 = item.knockBack; float single103 = 1f; if (this.kbGlove) { single103 = single103 + 1f; } if (this.kbBuff) { single103 = single103 + 0.5f; } single102 = single102 * single103; if (this.inventory[this.selectedItem].type == 3106) { single102 = single102 + single102 * (1f - this.stealth); } List<ushort> nums1 = null; if (item.type == ItemID.StaffofRegrowth) { nums1 = new List<ushort>(new ushort[] { 3, 24, 52, 61, 62, 71, 73, 74, 82, 83, 84, 110, 113, 115, 184, 205, 201 }); } int x36 = rectangle.X / 16; int x37 = (rectangle.X + rectangle.Width) / 16 + 1; int y22 = rectangle.Y / 16; int y23 = (rectangle.Y + rectangle.Height) / 16 + 1; for (int o2 = x36; o2 < x37; o2++) { for (int p2 = y22; p2 < y23; p2++) { if (Main.tile[o2, p2] != null && Main.tileCut[Main.tile[o2, p2].type] && (nums1 == null || !nums1.Contains(Main.tile[o2, p2].type)) && Main.tile[o2, p2 + 1] != null && Main.tile[o2, p2 + 1].type != 78 && Main.tile[o2, p2 + 1].type != 380) { if (item.type != ItemID.Sickle) { WorldGen.KillTile(o2, p2, false, false, false); if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 0, (float)o2, (float)p2, 0f, 0, 0, 0); } } else { int num156 = Main.tile[o2, p2].type; WorldGen.KillTile(o2, p2, false, false, false); if (!Main.tile[o2, p2].active()) { int num157 = 0; if (num156 == 3 || num156 == 24 || num156 == 61 || num156 == 110 || num156 == 201) { num157 = Main.rand.Next(1, 3); } if (num156 == 73 || num156 == 74 || num156 == 113) { num157 = Main.rand.Next(2, 5); } if (num157 > 0) { int num158 = Item.NewItem(o2 * 16, p2 * 16, 16, 16, 1727, num157, false, 0, false); if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.ItemDrop, -1, -1, "", num158, 1f, 0f, 0f, 0, 0, 0); } } } if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 0, (float)o2, (float)p2, 0f, 0, 0, 0); } } } } } if (item.type != ItemID.GoldenBugNet) { for (int q2 = 0; q2 < 200; q2++) { if (Main.npc[q2].active && Main.npc[q2].immune[i] == 0 && this.attackCD == 0) { if (!Main.npc[q2].dontTakeDamage) { if (!Main.npc[q2].friendly || Main.npc[q2].type == NPCID.Guide && this.killGuide || Main.npc[q2].type == NPCID.Clothier && this.killClothier) { Rectangle rectangle2 = new Rectangle((int)Main.npc[q2].position.X, (int)Main.npc[q2].position.Y, Main.npc[q2].width, Main.npc[q2].height); if (rectangle.Intersects(rectangle2) && (Main.npc[q2].noTileCollide || Collision.CanHit(this.position, this.width, this.height, Main.npc[q2].position, Main.npc[q2].width, Main.npc[q2].height))) { bool flag17 = false; if (Main.rand.Next(1, 101) <= this.meleeCrit) { flag17 = true; } int num159 = Main.DamageVar((float)num155); int num160 = Item.NPCtoBanner(Main.npc[q2].BannerID()); if (num160 > 0 && this.NPCBannerBuff[num160]) { num155 = (!Main.expertMode ? (int)((double)num155 * 1.5) : num155 * 2); } this.StatusNPC(item.type, q2); this.OnHit(Main.npc[q2].Center.X, Main.npc[q2].Center.Y, Main.npc[q2]); if (this.armorPenetration > 0) { num159 = num159 + Main.npc[q2].checkArmorPenetration(this.armorPenetration); } int num161 = (int)Main.npc[q2].StrikeNPC(num159, single102, this.direction, flag17, false, false, this); if (this.inventory[this.selectedItem].type == 3211) { Vector2 vector286 = new Vector2((float)(this.direction * 100 + Main.rand.Next(-25, 26)), (float)Main.rand.Next(-75, 76)); vector286.Normalize(); vector286 = vector286 * ((float)Main.rand.Next(30, 41) * 0.1f); Vector2 center2 = new Vector2((float)(rectangle.X + Main.rand.Next(rectangle.Width)), (float)(rectangle.Y + Main.rand.Next(rectangle.Height))); center2 = (center2 + (Main.npc[q2].Center * 2f)) / 3f; Projectile.NewProjectile(center2.X, center2.Y, vector286.X, vector286.Y, 524, (int)((double)num155 * 0.7), single102 * 0.7f, this.whoAmI, 0f, 0f); } if (this.beetleOffense) { Player player18 = this; player18.beetleCounter = player18.beetleCounter + (float)num161; this.beetleCountdown = 0; } if (item.type == ItemID.TheHorsemansBlade && Main.npc[q2].@value > 0f) { this.pumpkinSword(q2, (int)((double)num155 * 1.5), single102); } if (this.meleeEnchant == 7) { Projectile.NewProjectile(Main.npc[q2].Center.X, Main.npc[q2].Center.Y, Main.npc[q2].velocity.X, Main.npc[q2].velocity.Y, 289, 0, 0f, this.whoAmI, 0f, 0f); } if (this.inventory[this.selectedItem].type == 3106) { this.stealth = 1f; if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.PlayerStealth, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } if (item.type == ItemID.BeeKeeper) { int num162 = Main.rand.Next(1, 4); if (this.strongBees && Main.rand.Next(3) == 0) { num162++; } for (int r2 = 0; r2 < num162; r2++) { float single104 = (float)(this.direction * 2) + (float)Main.rand.Next(-35, 36) * 0.02f; float single105 = (float)Main.rand.Next(-35, 36) * 0.02f; single104 = single104 * 0.2f; single105 = single105 * 0.2f; Projectile.NewProjectile((float)(rectangle.X + rectangle.Width / 2), (float)(rectangle.Y + rectangle.Height / 2), single104, single105, this.beeType(), this.beeDamage(num159 / 3), this.beeKB(0f), i, 0f, 0f); } } if (Main.npc[q2].@value > 0f && this.coins && Main.rand.Next(5) == 0) { int num163 = 71; if (Main.rand.Next(10) == 0) { num163 = 72; } if (Main.rand.Next(100) == 0) { num163 = 73; } int num164 = Item.NewItem((int)Main.npc[q2].position.X, (int)Main.npc[q2].position.Y, Main.npc[q2].width, Main.npc[q2].height, num163, 1, false, 0, false); Main.item[num164].stack = Main.rand.Next(1, 11); Main.item[num164].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f; Main.item[num164].velocity.X = (float)Main.rand.Next(10, 31) * 0.2f * (float)this.direction; if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.ItemDrop, -1, -1, "", num164, 0f, 0f, 0f, 0, 0, 0); } } int num165 = Item.NPCtoBanner(Main.npc[q2].BannerID()); if (num165 >= 0) { this.lastCreatureHit = num165; } if (Main.netMode != 0) { if (!flag17) { NetMessage.SendData((int)PacketTypes.NpcStrike, -1, -1, "", q2, (float)num159, single102, (float)this.direction, 0, 0, 0); } else { NetMessage.SendData((int)PacketTypes.NpcStrike, -1, -1, "", q2, (float)num159, single102, (float)this.direction, 1, 0, 0); } } if (this.accDreamCatcher) { this.addDPS(num159); } Main.npc[q2].immune[i] = this.itemAnimation; this.attackCD = (int)((double)this.itemAnimationMax * 0.33); } } } else if (Main.npc[q2].type == NPCID.BlueJellyfish || Main.npc[q2].type == NPCID.PinkJellyfish || Main.npc[q2].type == NPCID.GreenJellyfish || Main.npc[q2].type == NPCID.BloodJelly) { Rectangle rectangle3 = new Rectangle((int)Main.npc[q2].position.X, (int)Main.npc[q2].position.Y, Main.npc[q2].width, Main.npc[q2].height); if (rectangle.Intersects(rectangle3)) { this.Hurt((int)((double)Main.npc[q2].damage * 1.3), -this.direction, false, false, " was slain...", false); Main.npc[q2].immune[i] = this.itemAnimation; this.attackCD = (int)((double)this.itemAnimationMax * 0.33); } } } } if (this.hostile) { for (int s2 = 0; s2 < 255; s2++) { if (s2 != i && Main.player[s2].active && Main.player[s2].hostile && !Main.player[s2].immune && !Main.player[s2].dead && (Main.player[i].team == 0 || Main.player[i].team != Main.player[s2].team)) { Rectangle rectangle4 = new Rectangle((int)Main.player[s2].position.X, (int)Main.player[s2].position.Y, Main.player[s2].width, Main.player[s2].height); if (rectangle.Intersects(rectangle4) && Collision.CanHit(this.position, this.width, this.height, Main.player[s2].position, Main.player[s2].width, Main.player[s2].height)) { bool flag18 = false; if (Main.rand.Next(1, 101) <= 10) { flag18 = true; } int num166 = Main.DamageVar((float)num155); this.StatusPvP(item.type, s2); this.OnHit(Main.player[s2].Center.X, Main.player[s2].Center.Y, Main.player[s2]); int num167 = (int)Main.player[s2].Hurt(num166, this.direction, true, false, "", flag18); if (this.inventory[this.selectedItem].type == 3211) { Vector2 vector287 = new Vector2((float)(this.direction * 100 + Main.rand.Next(-25, 26)), (float)Main.rand.Next(-75, 76)); vector287.Normalize(); vector287 = vector287 * ((float)Main.rand.Next(30, 41) * 0.1f); Vector2 center3 = new Vector2((float)(rectangle.X + Main.rand.Next(rectangle.Width)), (float)(rectangle.Y + Main.rand.Next(rectangle.Height))); center3 = (center3 + (Main.player[s2].Center * 2f)) / 3f; Projectile.NewProjectile(center3.X, center3.Y, vector287.X, vector287.Y, 524, (int)((double)num155 * 0.7), single102 * 0.7f, this.whoAmI, 0f, 0f); } if (this.beetleOffense) { Player player19 = this; player19.beetleCounter = player19.beetleCounter + (float)num167; this.beetleCountdown = 0; } if (this.meleeEnchant == 7) { Projectile.NewProjectile(Main.player[s2].Center.X, Main.player[s2].Center.Y, Main.player[s2].velocity.X, Main.player[s2].velocity.Y, 289, 0, 0f, this.whoAmI, 0f, 0f); } if (item.type == ItemID.BeeKeeper) { int num168 = Main.rand.Next(1, 4); if (this.strongBees && Main.rand.Next(3) == 0) { num168++; } for (int t2 = 0; t2 < num168; t2++) { float single106 = (float)(this.direction * 2) + (float)Main.rand.Next(-35, 36) * 0.02f; float single107 = (float)Main.rand.Next(-35, 36) * 0.02f; single106 = single106 * 0.2f; single107 = single107 * 0.2f; Projectile.NewProjectile((float)(rectangle.X + rectangle.Width / 2), (float)(rectangle.Y + rectangle.Height / 2), single106, single107, this.beeType(), this.beeDamage(num166 / 3), this.beeKB(0f), i, 0f, 0f); } } if (this.inventory[this.selectedItem].type == 3106) { this.stealth = 1f; if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.PlayerStealth, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } if (item.type == ItemID.TheHorsemansBlade && Main.npc[s2].@value > 0f) { this.pumpkinSword(s2, (int)((double)num155 * 1.5), single102); } if (Main.netMode != 0) { if (!flag18) { NetMessage.SendData((int)PacketTypes.PlayerDamage, -1, -1, Lang.deathMsg(this.whoAmI, -1, -1, -1), s2, (float)this.direction, (float)num166, 1f, 0, 0, 0); } else { NetMessage.SendData((int)PacketTypes.PlayerDamage, -1, -1, Lang.deathMsg(this.whoAmI, -1, -1, -1), s2, (float)this.direction, (float)num166, 1f, 1, 0, 0); } } this.attackCD = (int)((double)this.itemAnimationMax * 0.33); } } } } if (item.type == ItemID.Hammush && (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.1) || this.itemAnimation == (int)((double)this.itemAnimationMax * 0.3) || this.itemAnimation == (int)((double)this.itemAnimationMax * 0.5) || this.itemAnimation == (int)((double)this.itemAnimationMax * 0.7) || this.itemAnimation == (int)((double)this.itemAnimationMax * 0.9))) { float single108 = 0f; float single109 = 0f; float single110 = 0f; float single111 = 0f; if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.9)) { single108 = -7f; } if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.7)) { single108 = -6f; single109 = 2f; } if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.5)) { single108 = -4f; single109 = 4f; } if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.3)) { single108 = -2f; single109 = 6f; } if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.1)) { single109 = 7f; } if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.7)) { single111 = 26f; } if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.3)) { single111 = single111 - 4f; single110 = single110 - 20f; } if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.1)) { single110 = single110 + 6f; } if (this.direction == -1) { if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.9)) { single111 = single111 - 8f; } if (this.itemAnimation == (int)((double)this.itemAnimationMax * 0.7)) { single111 = single111 - 6f; } } single108 = single108 * 1.5f; single109 = single109 * 1.5f; single111 = single111 * (float)this.direction; single110 = single110 * this.gravDir; Projectile.NewProjectile((float)(rectangle.X + rectangle.Width / 2) + single111, (float)(rectangle.Y + rectangle.Height / 2) + single110, (float)this.direction * single109, single108 * this.gravDir, 131, num155 / 2, 0f, i, 0f, 0f); } } } } } if (this.itemTime == 0 && this.itemAnimation > 0) { if (item.hairDye >= 0) { this.itemTime = item.useTime; if (this.whoAmI == Main.myPlayer) { this.hairDye = (byte)item.hairDye; NetMessage.SendData((int)PacketTypes.PlayerInfo, -1, -1, Main.player[this.whoAmI].name, this.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } if (item.healLife > 0) { Player player20 = this; player20.statLife = player20.statLife + item.healLife; this.itemTime = item.useTime; if (Main.myPlayer == this.whoAmI) { this.HealEffect(item.healLife, true); } } if (item.healMana > 0) { Player player21 = this; player21.statMana = player21.statMana + item.healMana; this.itemTime = item.useTime; if (Main.myPlayer == this.whoAmI) { this.AddBuff(BuffID.ManaSickness, Player.manaSickTime, true); this.ManaEffect(item.healMana); } } if (item.buffType > 0) { if (this.whoAmI == Main.myPlayer && item.buffType != 90 && item.buffType != 27) { this.AddBuff(item.buffType, item.buffTime, true); } this.itemTime = item.useTime; } if (item.type == ItemID.RedPotion) { this.itemTime = item.useTime; if (this.whoAmI == Main.myPlayer) { this.AddBuff(BuffID.Poisoned, 216000, true); this.AddBuff(BuffID.Darkness, 216000, true); this.AddBuff(BuffID.Cursed, 216000, true); this.AddBuff(BuffID.OnFire, 216000, true); this.AddBuff(BuffID.Bleeding, 216000, true); this.AddBuff(BuffID.Confused, 216000, true); this.AddBuff(BuffID.Slow, 216000, true); this.AddBuff(BuffID.Weak, 216000, true); this.AddBuff(BuffID.Silenced, 216000, true); this.AddBuff(BuffID.BrokenArmor, 216000, true); this.AddBuff(BuffID.Suffocation, 216000, true); } } } if (this.whoAmI == Main.myPlayer) { if (this.itemTime == 0 && this.itemAnimation > 0 && item.type == ItemID.GoblinBattleStandard && Main.CanStartInvasion(1, true)) { this.itemTime = item.useTime; if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.SpawnBossorInvasion, -1, -1, "", this.whoAmI, -1f, 0f, 0f, 0, 0, 0); } else if (Main.invasionType == 0) { Main.invasionDelay = 0; Main.StartInvasion(1); } } if (this.itemTime == 0 && this.itemAnimation > 0 && item.type == ItemID.SnowGlobe && Main.CanStartInvasion(2, true)) { this.itemTime = item.useTime; if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.SpawnBossorInvasion, -1, -1, "", this.whoAmI, -2f, 0f, 0f, 0, 0, 0); } else if (Main.invasionType == 0) { Main.invasionDelay = 0; Main.StartInvasion(2); } } if (this.itemTime == 0 && this.itemAnimation > 0 && item.type == ItemID.PirateMap && Main.CanStartInvasion(3, true)) { this.itemTime = item.useTime; if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.SpawnBossorInvasion, -1, -1, "", this.whoAmI, -3f, 0f, 0f, 0, 0, 0); } else if (Main.invasionType == 0) { Main.invasionDelay = 0; Main.StartInvasion(3); } } if (this.itemTime == 0 && this.itemAnimation > 0 && item.type == ItemID.PumpkinMoonMedallion && !Main.dayTime && !Main.pumpkinMoon && !Main.snowMoon) { this.itemTime = item.useTime; if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.SpawnBossorInvasion, -1, -1, "", this.whoAmI, -4f, 0f, 0f, 0, 0, 0); } else { Main.NewText(Lang.misc[31], 50, 255, 130, false); Main.startPumpkinMoon(); } } if (this.itemTime == 0 && this.itemAnimation > 0 && item.type == ItemID.LunarTablet && Main.dayTime && !Main.eclipse) { if (Main.netMode != 0) { NetMessage.SendData((int)PacketTypes.SpawnBossorInvasion, -1, -1, "", this.whoAmI, -6f, 0f, 0f, 0, 0, 0); } else { this.itemTime = item.useTime; Main.eclipse = true; Main.NewText(Lang.misc[20], 50, 255, 130, false); } } if (this.itemTime == 0 && this.itemAnimation > 0 && item.type == ItemID.CelestialSigil && NPC.downedGolemBoss && Main.hardMode && !NPC.AnyDanger() && !NPC.AnyoneNearCultists()) { this.itemTime = item.useTime; if (Main.netMode == 0) { WorldGen.StartImpendingDoom(); } else { NetMessage.SendData((int)PacketTypes.SpawnBossorInvasion, -1, -1, "", this.whoAmI, -8f, 0f, 0f, 0, 0, 0); } } if (this.itemTime == 0 && this.itemAnimation > 0 && item.type == ItemID.NaughtyPresent && !Main.dayTime && !Main.pumpkinMoon && !Main.snowMoon) { this.itemTime = item.useTime; if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.SpawnBossorInvasion, -1, -1, "", this.whoAmI, -5f, 0f, 0f, 0, 0, 0); } else { Main.NewText(Lang.misc[34], 50, 255, 130, false); Main.startSnowMoon(); } } if (this.itemTime == 0 && this.itemAnimation > 0 && item.makeNPC > 0 && this.controlUseItem && this.position.X / 16f - (float)Player.tileRangeX - (float)item.tileBoost <= (float)Player.tileTargetX && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)item.tileBoost - 1f >= (float)Player.tileTargetX && this.position.Y / 16f - (float)Player.tileRangeY - (float)item.tileBoost <= (float)Player.tileTargetY && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)item.tileBoost - 2f >= (float)Player.tileTargetY) { int x38 = Main.mouseX + (int)Main.screenPosition.X; int y24 = Main.mouseY + (int)Main.screenPosition.Y; this.itemTime = item.useTime; if (!WorldGen.SolidTile(x38 / 16, y24 / 16)) { NPC.ReleaseNPC(x38, y24, item.makeNPC, item.placeStyle, this.whoAmI); } } if (this.itemTime == 0 && this.itemAnimation > 0 && (item.type == ItemID.SuspiciousLookingEye || item.type == ItemID.WormFood || item.type == ItemID.MechanicalEye || item.type == ItemID.MechanicalWorm || item.type == ItemID.MechanicalSkull || item.type == ItemID.SlimeCrown || item.type == ItemID.Abeemination || item.type == ItemID.BloodySpine) && this.SummonItemCheck()) { if (item.type == ItemID.SlimeCrown) { this.itemTime = item.useTime; if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.SpawnBossorInvasion, -1, -1, "", this.whoAmI, 50f, 0f, 0f, 0, 0, 0); } else { NPC.SpawnOnPlayer(i, 50); } } else if (item.type == ItemID.SuspiciousLookingEye) { if (!Main.dayTime) { this.itemTime = item.useTime; if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.SpawnBossorInvasion, -1, -1, "", this.whoAmI, 4f, 0f, 0f, 0, 0, 0); } else { NPC.SpawnOnPlayer(i, 4); } } } else if (item.type == ItemID.WormFood) { if (this.ZoneCorrupt) { this.itemTime = item.useTime; if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.SpawnBossorInvasion, -1, -1, "", this.whoAmI, 13f, 0f, 0f, 0, 0, 0); } else { NPC.SpawnOnPlayer(i, 13); } } } else if (item.type == ItemID.MechanicalEye) { if (!Main.dayTime) { this.itemTime = item.useTime; if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.SpawnBossorInvasion, -1, -1, "", this.whoAmI, 125f, 0f, 0f, 0, 0, 0); NetMessage.SendData((int)PacketTypes.SpawnBossorInvasion, -1, -1, "", this.whoAmI, 126f, 0f, 0f, 0, 0, 0); } else { NPC.SpawnOnPlayer(i, 125); NPC.SpawnOnPlayer(i, 126); } } } else if (item.type == ItemID.MechanicalWorm) { if (!Main.dayTime) { this.itemTime = item.useTime; if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.SpawnBossorInvasion, -1, -1, "", this.whoAmI, 134f, 0f, 0f, 0, 0, 0); } else { NPC.SpawnOnPlayer(i, 134); } } } else if (item.type == ItemID.MechanicalSkull) { if (!Main.dayTime) { this.itemTime = item.useTime; if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.SpawnBossorInvasion, -1, -1, "", this.whoAmI, 127f, 0f, 0f, 0, 0, 0); } else { NPC.SpawnOnPlayer(i, 127); } } } else if (item.type == ItemID.Abeemination) { this.itemTime = item.useTime; if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.SpawnBossorInvasion, -1, -1, "", this.whoAmI, 222f, 0f, 0f, 0, 0, 0); } else { NPC.SpawnOnPlayer(i, 222); } } else if (item.type == ItemID.BloodySpine && this.ZoneCrimson) { this.itemTime = item.useTime; if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.SpawnBossorInvasion, -1, -1, "", this.whoAmI, 266f, 0f, 0f, 0, 0, 0); } else { NPC.SpawnOnPlayer(i, 266); } } } } if ((item.type == ItemID.MagicMirror || item.type == ItemID.CellPhone || item.type == ItemID.IceMirror) && this.itemAnimation > 0) { if (this.itemTime == 0) { this.itemTime = item.useTime; } else if (this.itemTime == item.useTime / 2) { this.grappling[0] = -1; this.grapCount = 0; for (int v2 = 0; v2 < 1000; v2++) { if (Main.projectile[v2].active && Main.projectile[v2].owner == i && Main.projectile[v2].aiStyle == 7) { Main.projectile[v2].Kill(); } } this.Spawn(); } } if (item.type == ItemID.RecallPotion && this.itemAnimation > 0) { if (this.itemTime == 0) { this.itemTime = item.useTime; } else if (this.itemTime == 2) { this.grappling[0] = -1; this.grapCount = 0; for (int y25 = 0; y25 < 1000; y25++) { if (Main.projectile[y25].active && Main.projectile[y25].owner == i && Main.projectile[y25].aiStyle == 7) { Main.projectile[y25].Kill(); } } bool flag19 = this.immune; int num175 = this.immuneTime; this.Spawn(); this.immune = flag19; this.immuneTime = num175; if (item.stack > 0) { Item item18 = item; item18.stack = item18.stack - 1; } } } if (item.type == ItemID.TeleportationPotion && this.itemAnimation > 0) { if (this.itemTime == 0) { this.itemTime = item.useTime; } else if (this.itemTime == 2) { if (Main.netMode == 0) { this.TeleportationPotion(); } else if (Main.netMode == 1 && this.whoAmI == Main.myPlayer) { NetMessage.SendData((int)PacketTypes.TeleportationPotion, -1, -1, "", 0, 0f, 0f, 0f, 0, 0, 0); } if (item.stack > 0) { Item item19 = item; item19.stack = item19.stack - 1; } } } if (item.type == ItemID.GenderChangePotion && this.itemAnimation > 0) { if (this.itemTime == 0) { this.itemTime = item.useTime; } else if (this.itemTime != 2) { } else { if (this.whoAmI == Main.myPlayer) { this.Male = !this.Male; if (Main.netMode == 1) { NetMessage.SendData((int)PacketTypes.PlayerInfo, -1, -1, this.name, this.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } if (item.stack > 0) { Item item20 = item; item20.stack = item20.stack - 1; } } } if (i == Main.myPlayer) { if (this.itemTime == (int)((float)item.useTime * this.tileSpeed) && item.tileWand > 0) { int num179 = item.tileWand; int num180 = 0; while (num180 < 58) { if (num179 != this.inventory[num180].type || this.inventory[num180].stack <= 0) { num180++; } else { Item item21 = this.inventory[num180]; item21.stack = item21.stack - 1; if (this.inventory[num180].stack > 0) { break; } this.inventory[num180] = new Item(); break; } } } if (item.createTile < 0) { num = (item.createWall <= 0 ? item.useTime : (int)((float)item.useTime * this.wallSpeed)); } else { num = (int)((float)item.useTime * this.tileSpeed); } if (this.itemTime == num && item.consumable) { bool flag20 = true; if (item.type == ItemID.RecallPotion || item.type == ItemID.TeleportationPotion) { flag20 = false; } if (item.type == ItemID.GenderChangePotion) { flag20 = false; } if (item.ranged) { if (this.ammoCost80 && Main.rand.Next(5) == 0) { flag20 = false; } if (this.ammoCost75 && Main.rand.Next(4) == 0) { flag20 = false; } } if (item.thrown) { if (this.thrownCost50 && Main.rand.Next(100) < 50) { flag20 = false; } if (this.thrownCost33 && Main.rand.Next(100) < 33) { flag20 = false; } } if (item.type >= ItemID.CopperCoin && item.type <= ItemID.PlatinumCoin) { flag20 = true; } if (flag20) { if (item.stack > 0) { Item item22 = item; item22.stack = item22.stack - 1; } if (item.stack <= 0) { this.itemTime = this.itemAnimation; Main.blockMouse = true; } } } if (item.stack <= 0 && this.itemAnimation == 0) { this.inventory[this.selectedItem] = new Item(); } if (this.selectedItem == 58) { if (this.itemAnimation == 0) { return; } Main.mouseItem = item.Clone(); } } }
public override void AI() { projectile.frameCounter = projectile.frameCounter + 1; Lighting.AddLight(projectile.Center, 0.3f, 0.45f, 0.5f); if (projectile.velocity == Vector2.Zero) { if (projectile.frameCounter >= projectile.extraUpdates * 2) { projectile.frameCounter = 0; bool flag = true; for (int index = 1; index < projectile.oldPos.Length; ++index) { if (projectile.oldPos[index] != projectile.oldPos[0]) { flag = false; } } if (flag) { projectile.Kill(); return; } } if (Main.rand.Next(projectile.extraUpdates) != 0) { return; } for (int index1 = 0; index1 < 2; ++index1) { float num1 = projectile.rotation + (float)((Main.rand.Next(2) == 1 ? -1.0 : 1.0) * 1.57079637050629); float num2 = (float)(Main.rand.NextDouble() * 0.800000011920929 + 1.0); Vector2 vector2 = new Vector2((float)Math.Cos((double)num1) * num2, (float)Math.Sin((double)num1) * num2); int index2 = Dust.NewDust(projectile.Center, 0, 0, 226, vector2.X, vector2.Y, 0, new Color(), 1f); Main.dust[index2].noGravity = true; Main.dust[index2].scale = 1.2f; } if (Main.rand.Next(5) != 0) { return; } int index3 = Dust.NewDust(projectile.Center + projectile.velocity.RotatedBy(1.57079637050629, new Vector2()) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width - Vector2.One * 4f, 8, 8, 31, 0.0f, 0.0f, 100, new Color(), 1.5f); Dust dust = Main.dust[index3]; dust.velocity = dust.velocity * 0.5f; Main.dust[index3].velocity.Y = -Math.Abs(Main.dust[index3].velocity.Y); } else { if (projectile.frameCounter < projectile.extraUpdates * 2) { return; } projectile.frameCounter = 0; float num1 = projectile.velocity.Length(); UnifiedRandom unifiedRandom = new UnifiedRandom((int)projectile.ai[1]); int num2 = 0; Vector2 spinningpoint = -Vector2.UnitY; Vector2 rotationVector2; int num3; do { int num4 = unifiedRandom.Next(); projectile.ai[1] = (float)num4; rotationVector2 = ((float)((double)(num4 % 100) / 100.0 * 6.28318548202515)).ToRotationVector2(); if ((double)rotationVector2.Y > 0.0) { rotationVector2.Y--; } bool flag = false; if ((double)rotationVector2.Y > -0.0199999995529652) { flag = true; } if ((double)rotationVector2.X * (double)(projectile.extraUpdates + 1) * 2.0 * (double)num1 + (double)projectile.localAI[0] > 40.0) { flag = true; } if ((double)rotationVector2.X * (double)(projectile.extraUpdates + 1) * 2.0 * (double)num1 + (double)projectile.localAI[0] < -40.0) { flag = true; } if (flag) { num3 = num2; num2 = num3 + 1; } else { goto label_3460; } }while (num3 < 100); projectile.velocity = Vector2.Zero; projectile.localAI[1] = 1f; goto label_3461; label_3460: spinningpoint = rotationVector2; label_3461: if (projectile.velocity == Vector2.Zero || projectile.velocity.Length() < 4f) { projectile.velocity = Vector2.UnitX.RotatedBy(projectile.ai[0]).RotatedByRandom(Math.PI / 4) * 7f; projectile.ai[1] = Main.rand.Next(100); projectile.netUpdate = true; return; } projectile.localAI[0] += (float)((double)spinningpoint.X * (double)(projectile.extraUpdates + 1) * 2.0) * num1; projectile.velocity = spinningpoint.RotatedBy((double)projectile.ai[0] + 1.57079637050629, new Vector2()) * num1; projectile.rotation = projectile.velocity.ToRotation() + 1.570796f; } }
public static bool CheckAABBvLineCollision(Vector2 objectPosition, Vector2 objectDimensions, Vector2 lineStart, Vector2 lineEnd, float lineWidth, ref float collisionPoint) { float num = lineWidth * 0.5f; Vector2 position = lineStart; Vector2 dimensions = lineEnd - lineStart; if (dimensions.X > 0f) { dimensions.X += lineWidth; position.X -= num; } else { position.X += dimensions.X - num; dimensions.X = -dimensions.X + lineWidth; } if (dimensions.Y > 0f) { dimensions.Y += lineWidth; position.Y -= num; } else { position.Y += dimensions.Y - num; dimensions.Y = -dimensions.Y + lineWidth; } if (!Collision.CheckAABBvAABBCollision(objectPosition, objectDimensions, position, dimensions)) { return false; } Vector2 vector = objectPosition - lineStart; Vector2 spinningpoint = vector + objectDimensions; Vector2 spinningpoint2 = new Vector2(vector.X, spinningpoint.Y); Vector2 spinningpoint3 = new Vector2(spinningpoint.X, vector.Y); Vector2 vector2 = lineEnd - lineStart; float num2 = vector2.Length(); float num3 = (float)Math.Atan2((double)vector2.Y, (double)vector2.X); Vector2[] array = new Vector2[] { vector.RotatedBy((double)(-(double)num3), default(Vector2)), spinningpoint3.RotatedBy((double)(-(double)num3), default(Vector2)), spinningpoint.RotatedBy((double)(-(double)num3), default(Vector2)), spinningpoint2.RotatedBy((double)(-(double)num3), default(Vector2)) }; collisionPoint = num2; bool result = false; for (int i = 0; i < array.Length; i++) { if (Math.Abs(array[i].Y) < num && array[i].X < collisionPoint && array[i].X >= 0f) { collisionPoint = array[i].X; result = true; } } Vector2 value = new Vector2(0f, num); Vector2 value2 = new Vector2(num2, num); Vector2 value3 = new Vector2(0f, -num); Vector2 value4 = new Vector2(num2, -num); for (int j = 0; j < array.Length; j++) { int num4 = (j + 1) % array.Length; Vector2 vector3 = value2 - value; Vector2 vector4 = array[num4] - array[j]; float num5 = vector3.X * vector4.Y - vector3.Y * vector4.X; if (num5 != 0f) { Vector2 vector5 = array[j] - value; float num6 = (vector5.X * vector4.Y - vector5.Y * vector4.X) / num5; if (num6 >= 0f && num6 <= 1f) { float num7 = (vector5.X * vector3.Y - vector5.Y * vector3.X) / num5; if (num7 >= 0f && num7 <= 1f) { result = true; collisionPoint = Math.Min(collisionPoint, value.X + num6 * vector3.X); } } } vector3 = value4 - value3; num5 = vector3.X * vector4.Y - vector3.Y * vector4.X; if (num5 != 0f) { Vector2 vector6 = array[j] - value3; float num8 = (vector6.X * vector4.Y - vector6.Y * vector4.X) / num5; if (num8 >= 0f && num8 <= 1f) { float num9 = (vector6.X * vector3.Y - vector6.Y * vector3.X) / num5; if (num9 >= 0f && num9 <= 1f) { result = true; collisionPoint = Math.Min(collisionPoint, value3.X + num8 * vector3.X); } } } } return result; }
public override void AI(NPC npc) { if (AzercadmiumWorld.devastation) { switch (npc.type) { case NPCID.DemonEye: if (AITimer == 0) { AITimer = Main.rand.Next(1, 480); } AITimer++; if (AITimer % 480 == 0 && npc.spriteDirection == 0) { Projectile.NewProjectile(npc.Center, new Vector2(0, 8).RotatedBy(npc.rotation + 90), ProjectileID.EyeLaser, npc.damage / 4, 0f, Main.myPlayer); } else if (AITimer % 480 == 0) { Projectile.NewProjectile(npc.Center, new Vector2(0, 8).RotatedBy(npc.rotation + 270), ProjectileID.EyeLaser, npc.damage / 4, 0f, Main.myPlayer); } break; case NPCID.ServantofCthulhu: if (AITimer == 0) { AITimer = Main.rand.Next(1, 480); } AITimer++; if (AITimer % 480 == 0 && npc.spriteDirection == 0) { Projectile.NewProjectile(npc.Center, new Vector2(0, 8).RotatedBy(npc.rotation + 180), ProjectileID.EyeLaser, npc.damage / 4, 0f, Main.myPlayer); } else if (AITimer % 480 == 0) { Projectile.NewProjectile(npc.Center, new Vector2(0, 8).RotatedBy(npc.rotation + 0), ProjectileID.EyeLaser, npc.damage / 4, 0f, Main.myPlayer); } break; case NPCID.KingSlime: AITimer++; if (AITimer % 300 == 299) { if ((double)npc.life < (double)npc.lifeMax * 0.5) { Projectile.NewProjectile(npc.Center.X, npc.Center.Y - 100, 0, 0, mod.ProjectileType("GiantSlimeSpike"), npc.damage / 3, 0f, Main.myPlayer); Projectile.NewProjectile(npc.Center.X, npc.Center.Y + 100, 0, 0, mod.ProjectileType("GiantSlimeSpike"), npc.damage / 3, 0f, Main.myPlayer); } Projectile.NewProjectile(npc.Center.X - 200, npc.Center.Y, 0, 0, mod.ProjectileType("GiantSlimeSpike"), npc.damage / 3, 0f, Main.myPlayer); Projectile.NewProjectile(npc.Center.X + 200, npc.Center.Y, 0, 0, mod.ProjectileType("GiantSlimeSpike"), npc.damage / 3, 0f, Main.myPlayer); } if (!(npc.ai[1] == 5f || npc.ai[1] == 6f)) { npc.ai[0] += 2f; } if (Main.player[npc.target].statLife < 1) { npc.TargetClosest(true); if (Main.player[npc.target].statLife < 1) { if (AITimer2 == 0) { AITimer2++; } } else { AITimer2 = 0; } } if (AITimer2 >= 1) { AITimer2++; npc.noTileCollide = true; npc.velocity.Y = -10f; if (AITimer2 >= 450) { npc.active = false; } } break; case NPCID.EyeofCthulhu: Player target = Main.player[npc.target]; //making dance eye while spin AITimer++; if (npc.ai[0] == 1 || npc.ai[0] == 2) { AITimer2++; if (AITimer2 % 60 == 5 && (NPC.CountNPCS(ModContent.NPCType <DreaminEye>()) < 6)) { NPC.NewNPC((int)npc.position.X, (int)npc.position.Y, mod.NPCType("DreaminEye")); } //fireballs everywhere while spin if (AITimer2 % 10 == 0) { Projectile.NewProjectile(npc.Center, new Vector2(0, 10).RotatedBy(npc.rotation), ProjectileID.Fireball, npc.damage / 4, 0f, Main.myPlayer); } } //fireballs lol if ((float)npc.life > (float)npc.lifeMax * 0.65f) { if (AITimer % (int)(240 * ((float)npc.life / (float)npc.lifeMax)) == 0) { Projectile.NewProjectile(npc.Center, new Vector2(0, 8).RotatedBy(npc.rotation), ProjectileID.Fireball, npc.damage / 4, 0f, Main.myPlayer); } if (AITimer % (int)(240 * ((float)npc.life / (float)npc.lifeMax)) == 20) { Projectile.NewProjectile(npc.Center, new Vector2(0, 8).RotatedBy(npc.rotation), ProjectileID.Fireball, npc.damage / 4, 0f, Main.myPlayer); } if (AITimer % (int)(240 * ((float)npc.life / (float)npc.lifeMax)) == 40) { Projectile.NewProjectile(npc.Center, new Vector2(0, 8).RotatedBy(npc.rotation), ProjectileID.Fireball, npc.damage / 4, 0f, Main.myPlayer); } } //keep on dreamin Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float num13 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector.X; float num14 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 200f - vector.Y; float num15 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); float num16 = num15; if ((npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && num16 < 500f) || (Main.expertMode && num16 < 500f)) { if (npc.ai[0] == 3 && (float)npc.life < (float)npc.lifeMax * 0.65f) { AITimer3++; if (AITimer3 >= 110f) { AITimer3 = 0; if (NPC.CountNPCS(ModContent.NPCType <DreaminEye>()) < 6) { NPC.NewNPC((int)npc.position.X, (int)npc.position.Y, mod.NPCType("DreaminEye")); } } } } if (Main.expertMode && (double)npc.life < (double)npc.lifeMax * 0.3f) { AIFlag = true; } if (Main.expertMode && (double)npc.life < (double)npc.lifeMax * 0.15f) { AIFlag2 = true; } if ((float)npc.life < (float)npc.lifeMax * 0.65f && !(npc.ai[0] == 1 || npc.ai[0] == 2)) { npc.damage = 57; npc.defense = 6; for (int i = 0; i < npc.life; i += npc.lifeMax / 20) { npc.damage += 2; npc.defense += 1; } if (AITimer % 120 == 0) { if (AIFlag2) { Vector2 projDir = Vector2.Normalize(target.Center - npc.Center) * 8; Projectile.NewProjectile(npc.Center, projDir.RotatedBy(-0.54f), ProjectileID.Fireball, npc.damage / 4, 0f, Main.myPlayer); Projectile.NewProjectile(npc.Center, projDir.RotatedBy(-0.27f), ProjectileID.Fireball, npc.damage / 4, 0f, Main.myPlayer); Projectile.NewProjectile(npc.Center, projDir, ProjectileID.Fireball, npc.damage / 4, 0f, Main.myPlayer); Projectile.NewProjectile(npc.Center, projDir.RotatedBy(0.27f), ProjectileID.Fireball, npc.damage / 4, 0f, Main.myPlayer); Projectile.NewProjectile(npc.Center, projDir.RotatedBy(0.54f), ProjectileID.Fireball, npc.damage / 4, 0f, Main.myPlayer); } else if (AIFlag) { Vector2 projDir = Vector2.Normalize(target.Center - npc.Center) * 8; Projectile.NewProjectile(npc.Center, projDir.RotatedBy(-0.27f), ProjectileID.Fireball, npc.damage / 4, 0f, Main.myPlayer); Projectile.NewProjectile(npc.Center, projDir, ProjectileID.Fireball, npc.damage / 4, 0f, Main.myPlayer); Projectile.NewProjectile(npc.Center, projDir.RotatedBy(0.27f), ProjectileID.Fireball, npc.damage / 4, 0f, Main.myPlayer); } else { Projectile.NewProjectile(npc.position, new Vector2(0, 8).RotatedBy(npc.rotation), ProjectileID.Fireball, npc.damage / 4, 0f, Main.myPlayer); } } if (AITimer % 5 == 0) { Projectile.NewProjectile(npc.Center, new Vector2(0, 0), mod.ProjectileType("FlameTrailEye"), npc.damage / 2, 0f, Main.myPlayer); } } else { npc.damage = 41; npc.defense = 17; } //dash upgrade if (npc.ai[1] == 2f && npc.ai[2] == 0f) { npc.velocity *= 2f; } break; case NPCID.EaterofWorldsHead: npc.noGravity = true; AITimer++; if (AITimer % 20 == 0) { Projectile.NewProjectile(npc.Center, new Vector2(0, -8).RotatedBy(npc.rotation + Main.rand.NextFloat(-0.25f, 0.26f)), ProjectileID.CursedFlameHostile, npc.damage / 4, 0f, Main.myPlayer); } if (!AIFlag && npc.life < npc.lifeMax * 0.5f) { AIFlag = true; NPC.NewNPC((int)npc.position.X, (int)npc.position.Y, mod.NPCType("VileObserver")); } break; case NPCID.EaterofWorldsBody: npc.noGravity = true; if (!AIFlag && npc.life < npc.lifeMax * 0.5f) { AIFlag = true; NPC.NewNPC((int)npc.position.X, (int)npc.position.Y, mod.NPCType("VileObserver")); } break; case NPCID.EaterofWorldsTail: npc.noGravity = true; if (!AIFlag && npc.life < npc.lifeMax * 0.5f) { AIFlag = true; NPC.NewNPC((int)npc.position.X, (int)npc.position.Y, mod.NPCType("VileObserver")); } break; case NPCID.BlazingWheel: AITimer++; if (AITimer % 5 == 0) { Projectile.NewProjectile(npc.Center, new Vector2(0, 0), mod.ProjectileType("FlameTrailEye"), npc.damage, 0f, Main.myPlayer); } break; case NPCID.MeteorHead: AITimer++; if (AITimer % 90 == 0) { NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.BurningSphere); } break; case NPCID.BrainofCthulhu: if (!AIFlag && npc.life <= npc.lifeMax * 0.5f) { for (int i = 0; i < 20; i++) { NPC.NewNPC((int)npc.position.X + Main.rand.Next(-20, 21), (int)npc.position.Y + Main.rand.Next(-20, 21), NPCID.Creeper); AIFlag = true; } } if (NPC.CountNPCS(NPCID.Creeper) > 0) { npc.dontTakeDamage = true; } else { npc.dontTakeDamage = false; } break; } } }
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int dimension = 24; int dimension2 = 90; for (int j = 0; j < 50; j++) { int randValue = Main.rand.Next(200 - j * 2, 400 + j * 2); Vector2 center = player.Center; center.X += Main.rand.Next(-randValue, randValue + 1); center.Y += Main.rand.Next(-randValue, randValue + 1); if (!Collision.SolidCollision(center, dimension, dimension) && !Collision.WetCollision(center, dimension, dimension)) { center.X += dimension / 2; center.Y += dimension / 2; if (Collision.CanHit(new Vector2(player.Center.X, player.position.Y), 1, 1, center, 1, 1) || Collision.CanHit(new Vector2(player.Center.X, player.position.Y - 50f), 1, 1, center, 1, 1)) { int x = (int)center.X / 16; int y = (int)center.Y / 16; bool flag = false; if (Main.rand.Next(4) == 0 && Main.tile[x, y] != null && Main.tile[x, y].wall > 0) { flag = true; } else { center.X -= dimension2 / 2; center.Y -= dimension2 / 2; if (Collision.SolidCollision(center, dimension2, dimension2)) { center.X += dimension2 / 2; center.Y += dimension2 / 2; flag = true; } } if (flag) { for (int k = 0; k < 1000; k++) { if (Main.projectile[k].active && Main.projectile[k].owner == player.whoAmI && Main.projectile[k].type == ModContent.ProjectileType <ShroomSummon>() && (center - Main.projectile[k].Center).Length() < 48f) { flag = false; break; } } if (flag && Main.myPlayer == player.whoAmI) { Projectile.NewProjectile(center.X, center.Y, 0f, 0f, ModContent.ProjectileType <ShroomSummon>(), damage, knockBack, player.whoAmI, 0f, 0f); } } } } } for (int k = 0; k < 15; k++) { Vector2 mouse = new Vector2(Main.mouseX, Main.mouseY) + Main.screenPosition; Vector2 offset = mouse - player.position; offset.Normalize(); if (speedX > 0) { offset = offset.RotatedBy(-0.2f); } else { offset = offset.RotatedBy(0.2f); } offset *= 58f; int dust = Dust.NewDust(player.Center + offset, player.width / 2, player.height / 2, DustID.Harpy); Main.dust[dust].velocity *= -1f; Main.dust[dust].noGravity = true; // Main.dust[dust].scale *= 2f; 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(50, 100) * 0.02f); Main.dust[dust].velocity = vector2_2; vector2_2.Normalize(); Vector2 vector2_3 = vector2_2 * 5f; Main.dust[dust].position = (player.Center + offset) + vector2_3; if (speedX > 0) { Main.dust[dust].velocity = new Vector2(speedX / 3f, speedY / 3f).RotatedBy(Main.rand.Next(-220, 180) / 100); } else { Main.dust[dust].velocity = new Vector2(speedX / 3f, speedY / 3f).RotatedBy(Main.rand.Next(-180, 220) / 100); } } return(false); }
public override void Kill(int timeLeft) { Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 14); for (int num615 = 0; num615 < 45; num615++) { int num616 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num616].velocity *= 1.4f; } for (int num617 = 0; num617 < 60; num617++) { int num618 = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default(Color), 3.5f); Main.dust[num618].noGravity = true; Main.dust[num618].velocity *= 7f; num618 = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num618].velocity *= 3f; } for (int num619 = 0; num619 < 3; num619++) { float scaleFactor9 = 0.4f; if (num619 == 1) { scaleFactor9 = 0.8f; } int num620 = Gore.NewGore(projectile.Center, default(Vector2), Main.rand.Next(61, 64)); Main.gore[num620].velocity *= scaleFactor9; Gore gore97 = Main.gore[num620]; gore97.velocity.X = gore97.velocity.X + 1f; Gore gore98 = Main.gore[num620]; gore98.velocity.Y = gore98.velocity.Y + 1f; num620 = Gore.NewGore(projectile.Center, default(Vector2), Main.rand.Next(61, 64)); Main.gore[num620].velocity *= scaleFactor9; Gore gore99 = Main.gore[num620]; gore99.velocity.X = gore99.velocity.X - 1f; Gore gore100 = Main.gore[num620]; gore100.velocity.Y = gore100.velocity.Y + 1f; num620 = Gore.NewGore(projectile.Center, default(Vector2), Main.rand.Next(61, 64)); Main.gore[num620].velocity *= scaleFactor9; Gore gore101 = Main.gore[num620]; gore101.velocity.X = gore101.velocity.X + 1f; Gore gore102 = Main.gore[num620]; gore102.velocity.Y = gore102.velocity.Y - 1f; num620 = Gore.NewGore(projectile.Center, default(Vector2), Main.rand.Next(61, 64)); Main.gore[num620].velocity *= scaleFactor9; Gore gore103 = Main.gore[num620]; gore103.velocity.X = gore103.velocity.X - 1f; Gore gore104 = Main.gore[num620]; gore104.velocity.Y = gore104.velocity.Y - 1f; } for (int k = 0; k < 40; k++) //make visual dust { Vector2 dustPos = projectile.position; dustPos.X += Main.rand.Next(projectile.width); dustPos.Y += Main.rand.Next(projectile.height); for (int i = 0; i < 30; i++) { int dust = Dust.NewDust(dustPos, 32, 32, 31, 0f, 0f, 100, default(Color), 3f); Main.dust[dust].velocity *= 1.4f; } for (int i = 0; i < 20; i++) { int dust = Dust.NewDust(dustPos, 32, 32, DustID.Fire, 0f, 0f, 100, default(Color), 3.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 7f; dust = Dust.NewDust(dustPos, 32, 32, DustID.Fire, 0f, 0f, 100, default(Color), 1.5f); Main.dust[dust].velocity *= 3f; } float scaleFactor9 = 0.5f; for (int j = 0; j < 4; j++) { int gore = Gore.NewGore(dustPos, default(Vector2), Main.rand.Next(61, 64)); Main.gore[gore].velocity *= scaleFactor9; Main.gore[gore].velocity.X += 1f; Main.gore[gore].velocity.Y += 1f; } } const int num226 = 80; for (int num227 = 0; num227 < num226; num227++) { Vector2 vector6 = Vector2.UnitX * 40f; vector6 = vector6.RotatedBy(((num227 - (num226 / 2 - 1)) * 6.28318548f / num226), default(Vector2)) + projectile.Center; Vector2 vector7 = vector6 - projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, DustID.Fire, 0f, 0f, 0, default(Color), 3f); Main.dust[num228].noGravity = true; Main.dust[num228].velocity = vector7; } }
public override void AI() { int ai1 = (int)projectile.ai[1]; if (projectile.ai[1] < 0 || projectile.ai[1] >= 200 || !Main.npc[ai1].CanBeChasedBy()) { TargetEnemies(); } projectile.ai[0]++; if (projectile.ai[0] <= 50) { if (Main.rand.Next(4) == 0) { Vector2 spinningpoint = Vector2.UnitY.RotatedByRandom(6.28318548202515); Dust dust = Main.dust[Dust.NewDust(projectile.Center - spinningpoint * 30f, 0, 0, 229, 0.0f, 0.0f, 0, new Color(), 1f)]; dust.noGravity = true; dust.position = projectile.Center - spinningpoint * Main.rand.Next(10, 21); dust.velocity = spinningpoint.RotatedBy(1.57079637050629, new Vector2()) * 4f; dust.scale = 0.5f + Main.rand.NextFloat(); dust.fadeIn = 0.5f; } if (Main.rand.Next(4) == 0) { Vector2 spinningpoint = Vector2.UnitY.RotatedByRandom(6.28318548202515); Dust dust = Main.dust[Dust.NewDust(projectile.Center - spinningpoint * 30f, 0, 0, 240, 0.0f, 0.0f, 0, new Color(), 1f)]; dust.noGravity = true; dust.position = projectile.Center - spinningpoint * 30f; dust.velocity = spinningpoint.RotatedBy(-1.57079637050629, new Vector2()) * 2f; dust.scale = 0.5f + Main.rand.NextFloat(); dust.fadeIn = 0.5f; } } else if (projectile.ai[0] <= 90) { projectile.scale = (projectile.ai[0] - 50) / 40; projectile.alpha = 255 - (int)(255 * projectile.scale); projectile.rotation = projectile.rotation - 0.1570796f; if (Main.rand.Next(2) == 0) { Vector2 spinningpoint = Vector2.UnitY.RotatedByRandom(6.28318548202515); Dust dust = Main.dust[Dust.NewDust(projectile.Center - spinningpoint * 30f, 0, 0, 229, 0.0f, 0.0f, 0, new Color(), 1f)]; dust.noGravity = true; dust.position = projectile.Center - spinningpoint * Main.rand.Next(10, 21); dust.velocity = spinningpoint.RotatedBy(1.57079637050629, new Vector2()) * 6f; dust.scale = 0.5f + Main.rand.NextFloat(); dust.fadeIn = 0.5f; dust.customData = projectile.Center; } if (Main.rand.Next(2) == 0) { Vector2 spinningpoint = Vector2.UnitY.RotatedByRandom(6.28318548202515); Dust dust = Main.dust[Dust.NewDust(projectile.Center - spinningpoint * 30f, 0, 0, 240, 0.0f, 0.0f, 0, new Color(), 1f)]; dust.noGravity = true; dust.position = projectile.Center - spinningpoint * 30f; dust.velocity = spinningpoint.RotatedBy(-1.57079637050629, new Vector2()) * 3f; dust.scale = 0.5f + Main.rand.NextFloat(); dust.fadeIn = 0.5f; dust.customData = projectile.Center; } /*Vector2 rotationVector2 = Main.npc[ai1].Center - projectile.Center; * rotationVector2.Normalize(); //projectile.ai[1].ToRotationVector2(); * Vector2 vector2_1 = rotationVector2.RotatedBy(1.57079637050629, new Vector2()) * (Main.rand.Next(2) == 0).ToDirectionInt() * (float)Main.rand.Next(10, 21); * Vector2 vector2_2 = (rotationVector2 * Main.rand.Next(-80, 81) - vector2_1) / 10f; * int Type = Utils.SelectRandom<int>(Main.rand, new int[2] { 229, 229 }); * Dust d = Main.dust[Dust.NewDust(projectile.Center, 0, 0, Type, 0.0f, 0.0f, 0, new Color(), 1f)]; * d.noGravity = true; * d.position = projectile.Center + vector2_1; * d.velocity = vector2_2; * d.scale = 0.5f + Main.rand.NextFloat(); * d.fadeIn = 0.5f;*/ if (projectile.ai[0] == 90 && projectile.ai[1] != -1 && Main.netMode != 1) { Vector2 rotationVector2 = Main.npc[ai1].Center - projectile.Center; rotationVector2.Normalize(); Vector2 vector2_3 = rotationVector2 * 8f; float ai_1 = Main.rand.Next(80); Projectile.NewProjectile(projectile.Center.X - vector2_3.X, projectile.Center.Y - vector2_3.Y, vector2_3.X, vector2_3.Y, mod.ProjectileType("LightningArc"), projectile.damage, projectile.knockBack, projectile.owner, rotationVector2.ToRotation(), ai_1); } } else if (projectile.ai[0] <= 120) { projectile.scale = 1f; projectile.alpha = 0; projectile.rotation = projectile.rotation - (float)Math.PI / 60f; if (Main.rand.Next(2) == 0) { Vector2 spinningpoint = Vector2.UnitY.RotatedByRandom(6.28318548202515); Dust dust = Main.dust[Dust.NewDust(projectile.Center - spinningpoint * 30f, 0, 0, 229, 0.0f, 0.0f, 0, new Color(), 1f)]; dust.noGravity = true; dust.position = projectile.Center - spinningpoint * Main.rand.Next(10, 21); dust.velocity = spinningpoint.RotatedBy(1.57079637050629, new Vector2()) * 6f; dust.scale = 0.5f + Main.rand.NextFloat(); dust.fadeIn = 0.5f; dust.customData = projectile.Center; } else { Vector2 spinningpoint = Vector2.UnitY.RotatedByRandom(6.28318548202515); Dust dust = Main.dust[Dust.NewDust(projectile.Center - spinningpoint * 30f, 0, 0, 240, 0.0f, 0.0f, 0, new Color(), 1f)]; dust.noGravity = true; dust.position = projectile.Center - spinningpoint * 30f; dust.velocity = spinningpoint.RotatedBy(-1.57079637050629, new Vector2()) * 3f; dust.scale = 0.5f + Main.rand.NextFloat(); dust.fadeIn = 0.5f; dust.customData = projectile.Center; } } else { projectile.scale = (float)(1.0 - (projectile.ai[0] - 120.0) / 60.0); projectile.alpha = 255 - (int)(255 * projectile.scale); projectile.rotation = projectile.rotation - (float)Math.PI / 30f; if (projectile.alpha >= 255) { projectile.Kill(); } for (int index = 0; index < 2; ++index) { switch (Main.rand.Next(3)) { case 0: Vector2 spinningpoint1 = Vector2.UnitY.RotatedByRandom(6.28318548202515) * projectile.scale; Dust dust1 = Main.dust[Dust.NewDust(projectile.Center - spinningpoint1 * 30f, 0, 0, 229, 0.0f, 0.0f, 0, new Color(), 1f)]; dust1.noGravity = true; dust1.position = projectile.Center - spinningpoint1 * Main.rand.Next(10, 21); dust1.velocity = spinningpoint1.RotatedBy(1.57079637050629, new Vector2()) * 6f; dust1.scale = 0.5f + Main.rand.NextFloat(); dust1.fadeIn = 0.5f; dust1.customData = projectile.Center; break; case 1: Vector2 spinningpoint2 = Vector2.UnitY.RotatedByRandom(6.28318548202515) * projectile.scale; Dust dust2 = Main.dust[Dust.NewDust(projectile.Center - spinningpoint2 * 30f, 0, 0, 240, 0.0f, 0.0f, 0, new Color(), 1f)]; dust2.noGravity = true; dust2.position = projectile.Center - spinningpoint2 * 30f; dust2.velocity = spinningpoint2.RotatedBy(-1.57079637050629, new Vector2()) * 3f; dust2.scale = 0.5f + Main.rand.NextFloat(); dust2.fadeIn = 0.5f; dust2.customData = projectile.Center; break; } } } }
public override void AI() { timer--; if (timer == 0) { Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ProjectileID.MolotovFire2, 30, projectile.knockBack, projectile.owner, 0f, 0f); timer = 30; } var list = Main.projectile.Where(x => x.Hitbox.Intersects(projectile.Hitbox)); foreach (var proj in list) { Player player = Main.player[projectile.owner]; projectile.ai[0] += .02f; projectile.Center = player.Center + offset.RotatedBy(projectile.ai[0] + projectile.ai[1] * (Math.PI * 10 / 1)); int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 109, 0f, 0f); Main.dust[dust].noGravity = true; Main.dust[dust].scale = 1.9f; int dust1 = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, 0f, 0f); Main.dust[dust1].noGravity = true; Main.dust[dust1].scale = 1.9f; projectile.rotation = projectile.velocity.ToRotation() + (float)(Math.PI / 2); } projectile.ai[1] += 1f; if (projectile.ai[1] >= 7200f) { projectile.alpha += 5; if (projectile.alpha > 255) { projectile.alpha = 255; projectile.Kill(); } } projectile.localAI[0] += 1f; if (projectile.localAI[0] >= 10f) { projectile.localAI[0] = 0f; int num416 = 0; int num417 = 0; float num418 = 0f; int num419 = projectile.type; for (int num420 = 0; num420 < 1000; num420++) { if (Main.projectile[num420].active && Main.projectile[num420].owner == projectile.owner && Main.projectile[num420].type == num419 && Main.projectile[num420].ai[1] < 3600f) { num416++; if (Main.projectile[num420].ai[1] > num418) { num417 = num420; num418 = Main.projectile[num420].ai[1]; } } if (num416 > 1) { Main.projectile[num417].netUpdate = true; Main.projectile[num417].ai[1] = 36000f; return; } } } }
public override void AI() { if (npc.localAI[3] == 0) //spawn friends { npc.TargetClosest(false); Movement(Main.player[npc.target].Center, 0.8f, 32f); if (npc.Distance(Main.player[npc.target].Center) < 2000) { npc.localAI[3] = 1; } else { return; } if (Main.netMode != 1) { int n = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType <NatureChampionHead>(), npc.whoAmI, 0f, npc.whoAmI, 0f, -3f, npc.target); if (n != Main.maxNPCs) { heads[0] = n; Main.npc[n].velocity.X = Main.rand.NextFloat(-24f, 24f); Main.npc[n].velocity.Y = Main.rand.NextFloat(-24f, 24f); if (Main.netMode == 2) { NetMessage.SendData(23, -1, -1, null, n); } } n = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType <NatureChampionHead>(), npc.whoAmI, 0f, npc.whoAmI, 0f, -2f, npc.target); if (n != Main.maxNPCs) { heads[1] = n; Main.npc[n].velocity.X = Main.rand.NextFloat(-24f, 24f); Main.npc[n].velocity.Y = Main.rand.NextFloat(-24f, 24f); if (Main.netMode == 2) { NetMessage.SendData(23, -1, -1, null, n); } } n = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType <NatureChampionHead>(), npc.whoAmI, 0f, npc.whoAmI, 0f, -1f, npc.target); if (n != Main.maxNPCs) { heads[2] = n; Main.npc[n].velocity.X = Main.rand.NextFloat(-24f, 24f); Main.npc[n].velocity.Y = Main.rand.NextFloat(-24f, 24f); if (Main.netMode == 2) { NetMessage.SendData(23, -1, -1, null, n); } } n = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType <NatureChampionHead>(), npc.whoAmI, 0f, npc.whoAmI, 0f, 1f, npc.target); if (n != Main.maxNPCs) { heads[3] = n; Main.npc[n].velocity.X = Main.rand.NextFloat(-24f, 24f); Main.npc[n].velocity.Y = Main.rand.NextFloat(-24f, 24f); if (Main.netMode == 2) { NetMessage.SendData(23, -1, -1, null, n); } } n = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType <NatureChampionHead>(), npc.whoAmI, 0f, npc.whoAmI, 0f, 2f, npc.target); if (n != Main.maxNPCs) { heads[4] = n; Main.npc[n].velocity.X = Main.rand.NextFloat(-24f, 24f); Main.npc[n].velocity.Y = Main.rand.NextFloat(-24f, 24f); if (Main.netMode == 2) { NetMessage.SendData(23, -1, -1, null, n); } } n = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType <NatureChampionHead>(), npc.whoAmI, 0f, npc.whoAmI, 0f, 3f, npc.target); if (n != Main.maxNPCs) { heads[5] = n; Main.npc[n].velocity.X = Main.rand.NextFloat(-24f, 24f); Main.npc[n].velocity.Y = Main.rand.NextFloat(-24f, 24f); if (Main.netMode == 2) { NetMessage.SendData(23, -1, -1, null, n); } } for (int i = 0; i < heads.Length; i++) //failsafe, die if couldnt spawn heads { if (heads[i] == -1 && Main.netMode != 1) { npc.active = false; return; } } } } EModeGlobalNPC.championBoss = npc.whoAmI; Player player = Main.player[npc.target]; Vector2 targetPos; if (npc.HasValidTarget && npc.Distance(player.Center) < 2500 && player.Center.Y >= Main.worldSurface * 16 && !player.ZoneUnderworldHeight) { npc.timeLeft = 600; } switch ((int)npc.ai[0]) { case 0: //think if (!player.active || player.dead || Vector2.Distance(npc.Center, player.Center) > 2500f || player.Center.Y < Main.worldSurface * 16 || player.ZoneUnderworldHeight) //despawn code { npc.TargetClosest(false); if (npc.timeLeft > 30) { npc.timeLeft = 30; } npc.noTileCollide = true; npc.noGravity = true; npc.velocity.Y += 1f; break; } npc.noTileCollide = false; npc.noGravity = false; if (++npc.ai[1] > 45) { npc.TargetClosest(); npc.ai[0]++; npc.ai[1] = 0; npc.ai[2] = 0; npc.ai[3] = 0; npc.netUpdate = true; } break; case 1: //stomp { void StompDust() { Main.PlaySound(2, npc.Center, 14); for (int k = -2; k <= 2; k++) //explosions { Vector2 dustPos = npc.Center; int width = npc.width / 5; dustPos.X += width * k + Main.rand.NextFloat(-width, width); dustPos.Y += Main.rand.NextFloat(npc.height / 2); for (int i = 0; i < 30; i++) { int dust = Dust.NewDust(dustPos, 32, 32, 31, 0f, 0f, 100, default(Color), 3f); Main.dust[dust].velocity *= 1.4f; } for (int i = 0; i < 20; i++) { int dust = Dust.NewDust(dustPos, 32, 32, 6, 0f, 0f, 100, default(Color), 3.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 7f; dust = Dust.NewDust(dustPos, 32, 32, 6, 0f, 0f, 100, default(Color), 1.5f); Main.dust[dust].velocity *= 3f; } float scaleFactor9 = 0.5f; for (int j = 0; j < 4; j++) { int gore = Gore.NewGore(dustPos, default(Vector2), Main.rand.Next(61, 64)); Main.gore[gore].velocity *= scaleFactor9; Main.gore[gore].velocity.X += 1f; Main.gore[gore].velocity.Y += 1f; } } } const int jumpTime = 40; npc.noGravity = true; npc.noTileCollide = true; if (npc.ai[2] == 0) //move over player { StompDust(); npc.ai[2] = 1; npc.netUpdate = true; targetPos = player.Center; targetPos.Y -= 600; npc.velocity = (targetPos - npc.Center) / jumpTime; } if (++npc.ai[1] > jumpTime + 18) //do the stomp { npc.noGravity = false; npc.noTileCollide = false; if (npc.velocity.Y == 0) //landed, now stomp { StompDust(); npc.TargetClosest(); npc.ai[0]++; npc.ai[1] = 0; npc.ai[2] = 0; npc.ai[3] = 0; npc.netUpdate = true; } } else if (npc.ai[1] > jumpTime) //falling { npc.velocity.X = 0; npc.velocity.Y = 30f; } } break; case 2: goto case 0; case 3: //decide an attack if (npc.ai[2] == 0) { npc.ai[2] = 1; npc.netUpdate = true; int nextHead = heads[Main.rand.Next(heads.Length)]; while (nextHead == lastHead) //dont choose same one twice ever { nextHead = heads[Main.rand.Next(heads.Length)]; } lastHead = nextHead; Main.npc[nextHead].ai[0] += Main.npc[nextHead].ai[3]; Main.npc[nextHead].netUpdate = true; Main.PlaySound(36, Main.npc[nextHead].Center, -1); int dustType; switch ((int)Main.npc[nextHead].ai[3]) { case -3: dustType = 183; break; case -2: dustType = 6; break; case -1: dustType = 87; break; case 1: dustType = 111; break; case 2: dustType = 89; break; case 3: dustType = 113; break; default: dustType = 1; break; } const int num226 = 70; for (int num227 = 0; num227 < num226; num227++) { Vector2 vector6 = Vector2.UnitX * 30f; vector6 = vector6.RotatedBy(((num227 - (num226 / 2 - 1)) * 6.28318548f / num226), default(Vector2)) + Main.npc[nextHead].Center; Vector2 vector7 = vector6 - Main.npc[nextHead].Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, dustType, 0f, 0f, 0, default(Color), 3f); Main.dust[num228].noGravity = true; Main.dust[num228].velocity = vector7; } } if (++npc.ai[1] > 300) //wait { npc.TargetClosest(); npc.ai[0]++; npc.ai[1] = 0; npc.ai[2] = 0; npc.ai[3] = 0; npc.netUpdate = true; } break; case 4: goto case 0; case 5: goto case 3; case 6: goto case 0; case 7: goto case 3; case 8: goto case 0; case 9: goto case 1; case 10: goto case 0; case 11: //deathrays if (npc.ai[2] == 0) { npc.ai[2] = 1; Main.PlaySound(15, npc.Center, 0); for (int i = 0; i < heads.Length; i++) //activate all heads { Main.npc[heads[i]].ai[0] = 4f; Main.npc[heads[i]].netUpdate = true; int dustType; switch ((int)Main.npc[heads[i]].ai[3]) { case -3: dustType = 183; break; case -2: dustType = 6; break; case -1: dustType = 87; break; case 1: dustType = 111; break; case 2: dustType = 89; break; case 3: dustType = 113; break; default: dustType = 1; break; } const int num226 = 70; for (int num227 = 0; num227 < num226; num227++) { Vector2 vector6 = Vector2.UnitX * 30f; vector6 = vector6.RotatedBy(((num227 - (num226 / 2 - 1)) * 6.28318548f / num226), default(Vector2)) + Main.npc[heads[i]].Center; Vector2 vector7 = vector6 - Main.npc[heads[i]].Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, dustType, 0f, 0f, 0, default(Color), 3f); Main.dust[num228].noGravity = true; Main.dust[num228].velocity = vector7; } } } if (++npc.ai[1] > 330) //wait { npc.TargetClosest(); npc.ai[0]++; npc.ai[1] = 0; npc.ai[2] = 0; npc.ai[3] = 0; npc.netUpdate = true; } break; default: npc.ai[0] = 0; goto case 0; } npc.direction = npc.spriteDirection = npc.position.X < player.position.X ? 1 : -1; }
public override void AI() { projectile.frameCounter++; if (projectile.frameCounter >= 7) { projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; projectile.frameCounter = 0; } Player player = Main.player[projectile.owner]; if (player.GetSpiritPlayer().SoulStone == true && player.active && !player.dead) { projectile.timeLeft = 2; } timer++; int range = 30; //How many tiles away the projectile targets NPCs int animSpeed = 2; //how many game frames per frame :P note: firing anims are twice as fast currently int targetingMax = 15; //how many frames allowed to target nearest instead of shooting float shootVelocity = 2f; //magnitude of the shoot vector (speed of arrows shot) //TARGET NEAREST NPC WITHIN RANGE float lowestDist = float.MaxValue; projectile.rotation = projectile.velocity.ToRotation() + 1.57f; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; float dist = projectile.Distance(npc.Center); if (dist / 16 < range) { projectile.ai[1] = npc.whoAmI; } } else { foreach (NPC npc in Main.npc) { //if npc is a valid target (active, not friendly, and not a critter) if (npc.active && !npc.friendly && npc.catchItem == 0) { //if npc is within 50 blocks float dist = projectile.Distance(npc.Center); if (dist / 16 < range) { //if npc is closer than closest found npc if (dist < lowestDist) { lowestDist = dist; //target this npc projectile.ai[1] = npc.whoAmI; } } } } } bool flag25 = false; int jim = 1; for (int index1 = 0; index1 < 200; index1++) { if (Main.npc[index1].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[index1].Center, 1, 1)) { float num23 = Main.npc[index1].position.X + (float)(Main.npc[index1].width / 2); float num24 = Main.npc[index1].position.Y + (float)(Main.npc[index1].height / 2); float num25 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num23) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num24); if (num25 < 500f) { flag25 = true; jim = index1; } } } if (flag25) { float num1 = 10f; Vector2 vector2 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); float num2 = Main.npc[jim].Center.X - vector2.X; float num3 = Main.npc[jim].Center.Y - vector2.Y; float num4 = (float)Math.Sqrt((double)num2 * (double)num2 + (double)num3 * (double)num3); float num5 = num1 / num4; float num6 = num2 * num5; float num7 = num3 * num5; int num8 = 10; projectile.velocity.X = (projectile.velocity.X * (float)(num8 - 1) + num6) / (float)num8; projectile.velocity.Y = (projectile.velocity.Y * (float)(num8 - 1) + num7) / (float)num8; } else { var list = Main.projectile.Where(x => x.Hitbox.Intersects(projectile.Hitbox)); foreach (var proj in list) { projectile.ai[0] += .02f; projectile.Center = player.Center - offset.RotatedBy(projectile.ai[0] + projectile.ai[1] * (Math.PI * 10 / 1)); projectile.rotation = projectile.velocity.ToRotation() + (float)(Math.PI / 2); } } }
public override void AI() { Player player = Main.player[projectile.owner]; AAPlayer modPlayer = player.GetModPlayer <AAPlayer>(mod); if ((int)Main.time % 120 == 0) { projectile.netUpdate = true; } if (!player.active) { projectile.active = false; return; } int num1038 = 10; if (player.dead) { modPlayer.DragonMinion = false; } if (modPlayer.DragonMinion) { projectile.timeLeft = 2; } num1038 = 30; bool flag67 = false; Vector2 value67 = Vector2.Zero; Vector2 arg_2D865_0 = Vector2.Zero; float num1052 = 0f; float scaleFactor16 = 0f; float scaleFactor17 = 1f; if (projectile.ai[1] == 1f) { projectile.ai[1] = 0f; projectile.netUpdate = true; } int byUUID = Projectile.GetByUUID(projectile.owner, (int)projectile.ai[0]); if (byUUID >= 0 && Main.projectile[byUUID].active) { flag67 = true; value67 = Main.projectile[byUUID].Center; Vector2 arg_2D957_0 = Main.projectile[byUUID].velocity; num1052 = Main.projectile[byUUID].rotation; float num1053 = MathHelper.Clamp(Main.projectile[byUUID].scale, 0f, 50f); scaleFactor17 = num1053; scaleFactor16 = 16f; int arg_2D9AD_0 = Main.projectile[byUUID].alpha; Main.projectile[byUUID].localAI[0] = projectile.localAI[0] + 1f; if (Main.projectile[byUUID].type != mod.ProjectileType("DragonHead")) { Main.projectile[byUUID].localAI[1] = projectile.whoAmI; } } if (!flag67) { return; } if (projectile.alpha > 0) { for (int num1054 = 0; num1054 < 2; num1054++) { int num1055 = Dust.NewDust(projectile.position, projectile.width, projectile.height, mod.DustType <Dusts.AkumaDust>(), 0f, 0f, 100, default(Color), 2f); Main.dust[num1055].noGravity = true; Main.dust[num1055].noLight = true; } } projectile.alpha -= 42; if (projectile.alpha < 0) { projectile.alpha = 0; } projectile.velocity = Vector2.Zero; Vector2 vector134 = value67 - projectile.Center; if (num1052 != projectile.rotation) { float num1056 = MathHelper.WrapAngle(num1052 - projectile.rotation); vector134 = vector134.RotatedBy(num1056 * 0.1f, default(Vector2)); } projectile.rotation = vector134.ToRotation() + 1.57079637f; projectile.position = projectile.Center; projectile.scale = scaleFactor17; projectile.width = projectile.height = (int)(num1038 * projectile.scale); projectile.Center = projectile.position; if (vector134 != Vector2.Zero) { projectile.Center = value67 - Vector2.Normalize(vector134) * scaleFactor16 * scaleFactor17; } projectile.spriteDirection = vector134.X > 0f ? 1 : -1; }
public override void AI() { Player player = Main.player[projectile.owner]; FargoPlayer modPlayer = player.GetModPlayer <FargoPlayer>(); if ((int)Main.time % 120 == 0) { projectile.netUpdate = true; } int num1038 = 30; bool flag67 = false; Vector2 value67 = Vector2.Zero; Vector2 arg_2D865_0 = Vector2.Zero; float num1052 = 0f; if (projectile.ai[1] == 1f) { projectile.ai[1] = 0f; projectile.netUpdate = true; } int byUUID = Projectile.GetByUUID(projectile.owner, (int)projectile.ai[0]); if (byUUID >= 0 && Main.projectile[byUUID].active) { flag67 = true; value67 = Main.projectile[byUUID].Center; Vector2 arg_2D957_0 = Main.projectile[byUUID].velocity; num1052 = Main.projectile[byUUID].rotation; float num1053 = MathHelper.Clamp(Main.projectile[byUUID].scale, 0f, 50f); int arg_2D9AD_0 = Main.projectile[byUUID].alpha; if (arg_2D9AD_0 == 0) { projectile.alpha -= 84; if (projectile.alpha < 0) { projectile.alpha = 0; } } Main.projectile[byUUID].localAI[0] = projectile.localAI[0] + 1f; if (Main.projectile[byUUID].type != mod.ProjectileType("DestroyerHead2")) { Main.projectile[byUUID].localAI[1] = projectile.whoAmI; } } if (!flag67) { return; } //projectile.alpha -= 42; //if (projectile.alpha < 0) projectile.alpha = 0; projectile.velocity = Vector2.Zero; Vector2 vector134 = value67 - projectile.Center; if (num1052 != projectile.rotation) { float num1056 = MathHelper.WrapAngle(num1052 - projectile.rotation); vector134 = vector134.RotatedBy(num1056 * 0.1f, default(Vector2)); } projectile.rotation = vector134.ToRotation() + 1.57079637f; projectile.position = projectile.Center; projectile.width = projectile.height = (int)(num1038 * projectile.scale); projectile.Center = projectile.position; if (vector134 != Vector2.Zero) { projectile.Center = value67 - Vector2.Normalize(vector134) * 36; } projectile.spriteDirection = vector134.X > 0f ? 1 : -1; }
public override void AI() { Player player = Main.player[projectile.owner]; float num = 1.57079637f; Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); projectile.ai[0] += 1f; int num2 = 0; if (projectile.ai[0] >= 30f) { num2++; } if (projectile.ai[0] >= 60f) { num2++; } if (projectile.ai[0] >= 90f) { num2++; } int num3 = 24; int num4 = 6; projectile.ai[1] += 1f; bool flag = false; if (projectile.ai[1] >= num3 - num4 * num2) { projectile.ai[1] = 0f; flag = true; } if (projectile.ai[1] == 1f && projectile.ai[0] != 1f) { Vector2 vector2 = Vector2.UnitX * 24f; vector2 = vector2.RotatedBy(projectile.rotation - 1.57079637f, default); Vector2 value = projectile.Center + vector2; for (int i = 0; i < chargeLevel; i++) { int type = chargeLevel >= 3 ? ModContent.DustType <Dusts.AkumaADust>() : ModContent.DustType <Dusts.AkumaDust>(); int num5 = Dust.NewDust(value - Vector2.One * 8f, 16, 16, type, projectile.velocity.X / 2f, projectile.velocity.Y / 2f, 100); Main.dust[num5].position.Y -= 0.3f; Main.dust[num5].velocity *= 0.66f; Main.dust[num5].noGravity = true; Main.dust[num5].scale = 1.4f; } } if (flag && Main.myPlayer == projectile.owner) { if (player.channel && !player.noItems && !player.CCed) { float scaleFactor = player.inventory[player.selectedItem].shootSpeed * projectile.scale; Vector2 vector3 = vector; Vector2 value2 = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY) - vector3; if (player.gravDir == -1f) { value2.Y = Main.screenHeight - Main.mouseY + Main.screenPosition.Y - vector3.Y; } Vector2 vector4 = Vector2.Normalize(value2); if (float.IsNaN(vector4.X) || float.IsNaN(vector4.Y)) { vector4 = -Vector2.UnitY; } vector4 *= scaleFactor; if (vector4.X != projectile.velocity.X || vector4.Y != projectile.velocity.Y) { projectile.netUpdate = true; } projectile.velocity = vector4; } } if (player.direction == 1) { projectile.Center = player.Center + new Vector2(10, 0); } if (player.direction == -1) { projectile.Center = player.Center + new Vector2(-18, 0); } projectile.rotation = projectile.velocity.ToRotation() + num; projectile.spriteDirection = projectile.direction; projectile.timeLeft = 2; player.ChangeDir(projectile.direction); player.heldProj = projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; player.itemRotation = (float)Math.Atan2(projectile.velocity.Y * projectile.direction, projectile.velocity.X * projectile.direction); counter++; if (counter >= 120) { GlowColor = AAColor.AkumaA; chargeLevel = 3; } else if (counter > 60) { GlowColor = Color.Goldenrod; chargeLevel = 2; } else if (counter <= 60) { chargeLevel = 1; } if (!player.channel) { projectile.Kill(); } }
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { //right click if (player.altFunctionUse == 2) { mode++; if (mode > 5) { mode = 1; } SetUpItem(); return(false); } switch (mode) { //melee case 1: Projectile.NewProjectile(position, new Vector2(speedX, speedY), mod.ProjectileType("PufferRang"), damage, knockBack, player.whoAmI); break; //range case 2: { Vector2 speed = new Vector2(speedX, speedY); int numBullets = 4; for (int num130 = 0; num130 < numBullets; num130++) //shotgun blast { Vector2 bulletSpeed = speed; bulletSpeed.X += Main.rand.NextFloat(-1f, 1f); bulletSpeed.Y += Main.rand.NextFloat(-1f, 1f); Projectile.NewProjectile(position, bulletSpeed, type, damage, knockBack, player.whoAmI); } for (int i = 0; i < Main.maxNPCs; i++) //shoot an extra bullet at every nearby enemy { if (Main.npc[i].active && Main.npc[i].CanBeChasedBy() && player.Distance(Main.npc[i].Center) < 1000f) { Vector2 bulletSpeed = 2f * speed.Length() * player.DirectionTo(Main.npc[i].Center); Projectile.NewProjectile(position, bulletSpeed, type, damage / 2, knockBack, player.whoAmI); } } } break; //magic case 3: { Vector2 speed = new Vector2(speedX, speedY); for (int i = -2; i <= 2; i++) { float modifier = 1f - 0.75f / 2f * Math.Abs(i); Projectile.NewProjectile(position, modifier * speed.RotatedBy(MathHelper.ToRadians(9) * i), mod.ProjectileType("Bubble"), damage, knockBack, player.whoAmI); } } break; //summon case 4: Projectile.NewProjectile(position, new Vector2(speedX, speedY), mod.ProjectileType("FishMinion"), damage, knockBack, player.whoAmI); break; //throwing default: for (int i = 0; i < 10; i++) { Projectile.NewProjectile(position, 4f * new Vector2(speedX + Main.rand.Next(-2, 2), speedY + Main.rand.Next(-2, 2)), mod.ProjectileType("SpikyLure"), damage, knockBack, player.whoAmI); } break; } return(false); }
public override void AI() { Lighting.AddLight(projectile.Center, .4f, 1.2f, .4f); //glow in the dark if (projectile.localAI[0] == 0) //random rotation direction { projectile.localAI[0] = Main.rand.Next(2) == 0 ? 1 : -1; } if (projectile.localAI[1] >= 0) { for (int i = 0; i < 4; i++) { int d = Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.Next(2) == 0 ? 107 : 157); Main.dust[d].noGravity = true; Main.dust[d].velocity *= 0.2f; Main.dust[d].scale = 1.5f; } if (++projectile.localAI[1] > 25) { projectile.localAI[1] = -1; if (projectile.ai[1] > 0) //propagate { Main.PlaySound(SoundID.Grass, projectile.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(projectile.Center, projectile.velocity, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, projectile.ai[0], projectile.ai[1] - 1); if (projectile.ai[0] == 1) { Projectile.NewProjectile(projectile.Center, projectile.velocity.RotatedBy(MathHelper.ToRadians(120)), projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 0, projectile.ai[1] - 1); } } } for (int index1 = 0; index1 < 30; ++index1) { int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.Next(2) == 0 ? 107 : 157, 0f, 0f, 0, new Color(), 2f); Main.dust[index2].noGravity = true; Main.dust[index2].velocity *= 5f; } projectile.localAI[0] = 50 * (projectile.ai[1] % 3); projectile.velocity = Vector2.Zero; projectile.netUpdate = true; } } else { projectile.tileCollide = true; projectile.localAI[0]--; if (projectile.localAI[0] >= -30) //delay { projectile.scale = 1f; } if (projectile.localAI[0] < -30 && projectile.localAI[0] > -120) { projectile.scale += 0.06f; projectile.rotation += 0.3f * projectile.localAI[0]; } else if (projectile.localAI[0] == -120) { const int max = 30; //make some indicator dusts for (int i = 0; i < max; i++) { Vector2 vector6 = Vector2.UnitY * 5f; vector6 = vector6.RotatedBy((i - (max / 2 - 1)) * 6.28318548f / max) + projectile.Center; Vector2 vector7 = vector6 - projectile.Center; int d = Dust.NewDust(vector6 + vector7, 0, 0, 107, 0f, 0f, 0, default(Color), 2f); Main.dust[d].noGravity = true; Main.dust[d].velocity = vector7; } } else if (projectile.localAI[0] < -150) //explode { projectile.localAI[0] = 0; projectile.netUpdate = true; Main.PlaySound(SoundID.Item, projectile.Center, 14); //spray if (Main.netMode != NetmodeID.MultiplayerClient) { bool planteraAlive = NPC.plantBoss > -1 && NPC.plantBoss < Main.maxNPCs && Main.npc[NPC.plantBoss].active && Main.npc[NPC.plantBoss].type == NPCID.Plantera; Vector2 halfwayPoint = Main.npc[NPC.plantBoss].Center + (projectile.Center - Main.npc[NPC.plantBoss].Center) / 2; //die after this many explosions, plantera is dead, or if i have no decent line of sight to plantera if (!planteraAlive || !Collision.CanHitLine(projectile.Center, 0, 0, halfwayPoint, 0, 0)) { projectile.Kill(); return; } else //do the actual attack { const int time = 12; const int max = 12; float rotation = Main.rand.NextFloat(MathHelper.TwoPi); for (int i = 0; i < max; i++) { int p = Projectile.NewProjectile(projectile.Center, range / time * Vector2.UnitX.RotatedBy(Math.PI * 2 / max * i + rotation), ModContent.ProjectileType <PoisonSeed2>(), projectile.damage, projectile.knockBack, projectile.owner); if (p != Main.maxProjectiles) { Main.projectile[p].timeLeft = time; } } } if (projectile.localAI[1]-- < -3) { projectile.Kill(); } } } } }
public override void Kill(int timeLeft) //vanilla explosion code echhhhhhhhhhh { SoundEngine.PlaySound(SoundID.Item89, Projectile.position); if (!Main.dedServ && Main.LocalPlayer.active) { Main.LocalPlayer.GetModPlayer <FargoSoulsPlayer>().Screenshake = 30; } if (Main.netMode != NetmodeID.MultiplayerClient) { const int max = 8; const float baseRotation = MathHelper.TwoPi / max; for (int i = 0; i < max; i++) { float rotation = baseRotation * (i + Main.rand.NextFloat(-0.5f, 0.5f)); Projectile.NewProjectile(Terraria.Entity.InheritSource(Projectile), Projectile.Center, Vector2.Zero, ModContent.ProjectileType <Masomode.MoonLordMoonBlast>(), 0, Projectile.knockBack, Projectile.owner, rotation, 3); } if (!FargoSoulsUtil.BossIsAlive(ref NPCs.EModeGlobalNPC.moonBoss, NPCID.MoonLordCore)) { Projectile.NewProjectile(Terraria.Entity.InheritSource(Projectile), Projectile.Center, Vector2.Zero, ModContent.ProjectileType <Masomode.MoonLordMoonBlast>(), 0, Projectile.knockBack, Projectile.owner, -Vector2.UnitY.ToRotation(), 32); } } Vector2 size = new Vector2(500, 500); Vector2 spawnPos = Projectile.Center; spawnPos.X -= size.X / 2; spawnPos.Y -= size.Y / 2; for (int num615 = 0; num615 < 30; num615++) { int num616 = Dust.NewDust(spawnPos, (int)size.X, (int)size.Y, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num616].velocity *= 1.4f; } for (int num617 = 0; num617 < 20; num617++) { int num618 = Dust.NewDust(spawnPos, (int)size.X, (int)size.Y, DustID.Torch, 0f, 0f, 100, default(Color), 3.5f); Main.dust[num618].noGravity = true; Main.dust[num618].velocity *= 7f; num618 = Dust.NewDust(spawnPos, (int)size.X, (int)size.Y, DustID.Torch, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num618].velocity *= 3f; } for (int num619 = 0; num619 < 2; num619++) { float scaleFactor9 = 0.4f; if (num619 == 1) { scaleFactor9 = 0.8f; } int num620 = Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.Center, default(Vector2), Main.rand.Next(61, 64)); Main.gore[num620].velocity *= scaleFactor9; Gore gore97 = Main.gore[num620]; gore97.velocity.X = gore97.velocity.X + 1f; Gore gore98 = Main.gore[num620]; gore98.velocity.Y = gore98.velocity.Y + 1f; num620 = Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.Center, default(Vector2), Main.rand.Next(61, 64)); Main.gore[num620].velocity *= scaleFactor9; Gore gore99 = Main.gore[num620]; gore99.velocity.X = gore99.velocity.X - 1f; Gore gore100 = Main.gore[num620]; gore100.velocity.Y = gore100.velocity.Y + 1f; num620 = Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.Center, default(Vector2), Main.rand.Next(61, 64)); Main.gore[num620].velocity *= scaleFactor9; Gore gore101 = Main.gore[num620]; gore101.velocity.X = gore101.velocity.X + 1f; Gore gore102 = Main.gore[num620]; gore102.velocity.Y = gore102.velocity.Y - 1f; num620 = Gore.NewGore(Projectile.GetSource_FromThis(), Projectile.Center, default(Vector2), Main.rand.Next(61, 64)); Main.gore[num620].velocity *= scaleFactor9; Gore gore103 = Main.gore[num620]; gore103.velocity.X = gore103.velocity.X - 1f; Gore gore104 = Main.gore[num620]; gore104.velocity.Y = gore104.velocity.Y - 1f; } for (int k = 0; k < 20; k++) //make visual dust { Vector2 dustPos = spawnPos; dustPos.X += Main.rand.Next((int)size.X); dustPos.Y += Main.rand.Next((int)size.Y); for (int i = 0; i < 15; i++) { int dust = Dust.NewDust(dustPos, 32, 32, 31, 0f, 0f, 100, default(Color), 3f); Main.dust[dust].velocity *= 1.4f; } for (int i = 0; i < 10; i++) { int dust = Dust.NewDust(dustPos, 32, 32, DustID.Torch, 0f, 0f, 100, default(Color), 3.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 7f; dust = Dust.NewDust(dustPos, 32, 32, DustID.Torch, 0f, 0f, 100, default(Color), 1.5f); Main.dust[dust].velocity *= 3f; } float scaleFactor9 = 0.5f; for (int j = 0; j < 2; j++) { int gore = Gore.NewGore(Projectile.GetSource_FromThis(), dustPos, default(Vector2), Main.rand.Next(61, 64)); Main.gore[gore].velocity *= scaleFactor9; Main.gore[gore].velocity.X += 1f; Main.gore[gore].velocity.Y += 1f; } } const int num226 = 30; for (int num227 = 0; num227 < num226; num227++) { Vector2 vector6 = Vector2.UnitX * 40f; vector6 = vector6.RotatedBy(((num227 - (num226 / 2 - 1)) * 6.28318548f / num226), default(Vector2)) + Projectile.Center; Vector2 vector7 = vector6 - Projectile.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, DustID.Torch, 0f, 0f, 0, default(Color), 3f); Main.dust[num228].noGravity = true; Main.dust[num228].velocity = vector7; } }
public override void AI() { Player player = Main.player[projectile.owner]; FargoPlayer modPlayer = player.GetModPlayer <FargoPlayer>(); if ((int)Main.time % 120 == 0) { projectile.netUpdate = true; } if (!player.active) { projectile.active = false; return; } int num1038 = 10; if (player.dead) { modPlayer.EaterMinion = false; } if (modPlayer.EaterMinion) { projectile.timeLeft = 2; } num1038 = 30; //D U S T /*if (Main.rand.Next(30) == 0) * { * int num1039 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 135, 0f, 0f, 0, default(Color), 2f); * Main.dust[num1039].noGravity = true; * Main.dust[num1039].fadeIn = 2f; * Point point4 = Main.dust[num1039].position.ToTileCoordinates(); * if (WorldGen.InWorld(point4.X, point4.Y, 5) && WorldGen.SolidTile(point4.X, point4.Y)) * { * Main.dust[num1039].noLight = true; * } * }*/ bool flag67 = false; Vector2 value67 = Vector2.Zero; Vector2 arg_2D865_0 = Vector2.Zero; float num1052 = 0f; if (projectile.ai[1] == 1f) { projectile.ai[1] = 0f; projectile.netUpdate = true; } int byUUID = Projectile.GetByUUID(projectile.owner, (int)projectile.ai[0]); if (byUUID >= 0 && Main.projectile[byUUID].active) { flag67 = true; value67 = Main.projectile[byUUID].Center; Vector2 arg_2D957_0 = Main.projectile[byUUID].velocity; num1052 = Main.projectile[byUUID].rotation; float num1053 = MathHelper.Clamp(Main.projectile[byUUID].scale, 0f, 50f); int arg_2D9AD_0 = Main.projectile[byUUID].alpha; Main.projectile[byUUID].localAI[0] = projectile.localAI[0] + 1f; if (Main.projectile[byUUID].type != mod.ProjectileType("EaterHead")) { Main.projectile[byUUID].localAI[1] = projectile.whoAmI; } if (projectile.owner == player.whoAmI && Main.projectile[byUUID].type == mod.ProjectileType("EaterHead")) { Main.projectile[byUUID].Kill(); projectile.Kill(); return; } } if (!flag67) { return; } if (projectile.alpha > 0) { for (int num1054 = 0; num1054 < 2; num1054++) { int num1055 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 135, 0f, 0f, 100, default(Color), 2f); Main.dust[num1055].noGravity = true; Main.dust[num1055].noLight = true; } } projectile.alpha -= 42; if (projectile.alpha < 0) { projectile.alpha = 0; } projectile.velocity = Vector2.Zero; Vector2 vector134 = value67 - projectile.Center; if (num1052 != projectile.rotation) { float num1056 = MathHelper.WrapAngle(num1052 - projectile.rotation); vector134 = vector134.RotatedBy(num1056 * 0.1f, default(Vector2)); } projectile.rotation = vector134.ToRotation() + 1.57079637f; projectile.position = projectile.Center; projectile.width = projectile.height = (int)(num1038 * projectile.scale); projectile.Center = projectile.position; if (vector134 != Vector2.Zero) { projectile.Center = value67 - Vector2.Normalize(vector134) * 35; } projectile.spriteDirection = vector134.X > 0f ? 1 : -1; }
/// <summary> /// The AI of the projectile /// </summary> public override void AI() { Vector2 mousePos = Main.MouseWorld; Player player = Main.player[projectile.owner]; #region Set projectile position if (projectile.owner == Main.myPlayer) // Multiplayer support { Vector2 diff = mousePos - player.Center; diff.Normalize(); projectile.velocity = diff; projectile.direction = Main.MouseWorld.X > player.position.X ? 1 : -1; projectile.netUpdate = true; } projectile.position = player.Center + projectile.velocity * MOVE_DISTANCE; projectile.timeLeft = 2; int dir = projectile.direction; player.ChangeDir(dir); player.heldProj = projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; player.itemRotation = (float)Math.Atan2(projectile.velocity.Y * dir, projectile.velocity.X * dir); #endregion #region Charging process // Kill the projectile if the player stops channeling if (!player.channel) { projectile.Kill(); } else { if (Main.time % 10 < 1 && !player.CheckMana(player.inventory[player.selectedItem].mana, true)) { projectile.Kill(); } Vector2 offset = projectile.velocity; offset *= MOVE_DISTANCE - 20; Vector2 pos = player.Center + offset - new Vector2(10, 10); if (Charge < MAX_CHARGE) { Charge++; } int chargeFact = (int)(Charge / 20f); Vector2 dustVelocity = Vector2.UnitX * 18f; dustVelocity = dustVelocity.RotatedBy(projectile.rotation - 1.57f, default(Vector2)); Vector2 spawnPos = projectile.Center + dustVelocity; for (int k = 0; k < chargeFact + 1; k++) { Vector2 spawn = spawnPos + ((float)Main.rand.NextDouble() * 6.28f).ToRotationVector2() * (12f - (chargeFact * 2)); Dust dust = Main.dust[Dust.NewDust(pos, 20, 20, 57, projectile.velocity.X / 2f, projectile.velocity.Y / 2f, 0, default(Color), 1f)]; dust.velocity = Vector2.Normalize(spawnPos - spawn) * 1.5f * (10f - chargeFact * 2f) / 10f; dust.noGravity = true; dust.scale = Main.rand.Next(10, 20) * 0.05f; } } #endregion #region Set laser tail position and dusts if (Charge < MAX_CHARGE) { return; } Vector2 start = player.Center; Vector2 unit = projectile.velocity; unit *= -1; for (Distance = MOVE_DISTANCE; Distance <= 2200f; Distance += 5f) { start = player.Center + projectile.velocity * Distance; if (!Collision.CanHit(player.Center, 1, 1, start, 1, 1)) { Distance -= 5f; break; } } Vector2 dustPos = player.Center + projectile.velocity * Distance; //Imported dust code from source because I'm lazy for (int i = 0; i < 2; ++i) { float num1 = projectile.velocity.ToRotation() + (Main.rand.Next(2) == 1 ? -1.0f : 1.0f) * 1.57f; float num2 = (float)(Main.rand.NextDouble() * 0.8f + 1.0f); Vector2 dustVel = new Vector2((float)Math.Cos(num1) * num2, (float)Math.Sin(num1) * num2); Dust dust = Main.dust[Dust.NewDust(dustPos, 0, 0, 57, dustVel.X, dustVel.Y, 0, new Color(), 1f)]; dust.noGravity = true; dust.scale = 1.2f; // At this part, I was messing with the dusts going across the laser beam very fast, but only really works properly horizontally now dust = Main.dust[Dust.NewDust(Main.player[projectile.owner].Center + unit * 5f, 0, 0, 57, unit.X, unit.Y, 0, new Color(), 1f)]; dust.fadeIn = 0f; dust.noGravity = true; dust.scale = 0.88f; } if (Main.rand.Next(5) == 0) { Vector2 offset = projectile.velocity.RotatedBy(1.57f, new Vector2()) * ((float)Main.rand.NextDouble() - 0.5f) * projectile.width; Dust dust = Main.dust[Dust.NewDust(dustPos + offset - Vector2.One * 4f, 8, 8, 57, 0.0f, 0.0f, 100, new Color(), 1.5f)]; dust.velocity = dust.velocity * 0.5f; dust.velocity.Y = -Math.Abs(dust.velocity.Y); unit = dustPos - Main.player[projectile.owner].Center; unit.Normalize(); dust = Main.dust[Dust.NewDust(Main.player[projectile.owner].Center + 55 * unit, 8, 8, 57, 0.0f, 0.0f, 100, new Color(), 1.5f)]; dust.velocity = dust.velocity * 0.5f; dust.velocity.Y = -Math.Abs(dust.velocity.Y); } #endregion //Add lights DelegateMethods.v3_1 = new Vector3(0.8f, 0.8f, 1f); Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * (Distance - MOVE_DISTANCE), 26, new Utils.PerLinePoint(DelegateMethods.CastLight)); }
public override bool PreAI() { Player player = Main.player[projectile.owner]; player.ChangeDir(Main.MouseWorld.X > player.position.X ? 1 : -1); player.itemTime = 10; // Set item time to 10 frames while we are used player.itemAnimation = 10; // Set item animation time to 10 frames while we are used projectile.position = player.Center; direction = Vector2.Normalize(Main.MouseWorld - (player.Center - new Vector2(4, 4))) * 10f; Vector2 dustUnit = (direction * 2.5f).RotatedBy(Main.rand.NextFloat(-1, 1)) * 0.03f; Vector2 pulseUnit = (direction * 2.5f) * 0.03f; Vector2 dustOffset = player.Center + (direction * (5f + 3 * (float)Math.Sqrt(projectile.localAI[0] / 100f))) + player.velocity; Color color = Color.Lerp(new Color(35, 57, 222), new Color(140, 238, 255), (float)Math.Sqrt(projectile.localAI[0] / 100f)); Vector2 spawnPos = dustOffset + (pulseUnit * 30); if (player.channel && !firing) { if (projectile.localAI[0] < 100) { maxCounter++; projectile.localAI[0]++; var dust = Dust.NewDustPerfect(dustOffset + (dustUnit * 30), 226); dust.velocity = Vector2.Zero - (dustUnit * 4); dust.noGravity = true; dust.scale = (float)Math.Sqrt(projectile.localAI[0] / 100f); if (projectile.localAI[0] % 10 == 9) { ParticleHandler.SpawnParticle(new PulseCircle(spawnPos, color * 0.4f, (.5f + .8f * (float)Math.Sqrt(projectile.localAI[0] / 100f)) * 100, 20, PulseCircle.MovementType.InwardsQuadratic) { Angle = player.itemRotation, ZRotation = 0.6f, RingColor = color, Velocity = Vector2.Zero - (pulseUnit * 1.5f) }); Main.PlaySound(SpiritMod.Instance.GetLegacySoundSlot(SoundType.Custom, "Sounds/EnergyCharge1").WithPitchVariance(0.1f).WithVolume(0.275f), player.Center); } } direction = direction.RotatedBy(Main.rand.NextFloat(0 - ((float)Math.Sqrt(projectile.localAI[0]) / 300f), ((float)Math.Sqrt(projectile.localAI[0]) / 300f))); player.itemRotation = direction.ToRotation(); if (player.direction != 1) { player.itemRotation -= 3.14f; } } else { firing = true; if (projectile.localAI[0] > 0) { Main.PlaySound(SpiritMod.Instance.GetLegacySoundSlot(SoundType.Custom, "Sounds/EnergyBlastMedium").WithPitchVariance(0.1f).WithVolume(0.275f), player.Center); ParticleHandler.SpawnParticle(new PulseCircle(dustOffset + (pulseUnit * 10), color * 0.4f, (.5f + .8f * (float)Math.Sqrt(projectile.localAI[0] / 100f)) * 100, 20, PulseCircle.MovementType.OutwardsQuadratic) { Angle = player.itemRotation, ZRotation = 0.6f, RingColor = color, Velocity = Vector2.Zero - (pulseUnit * 1.5f) }); } while (projectile.localAI[0] >= 0) { if (projectile.localAI[0] > 90) { for (int i = 0; i < 20; i++) { var dust = Dust.NewDustPerfect(dustOffset + (dustUnit * 30), 226); dust.velocity = Vector2.Zero + (Vector2.Normalize(Main.MouseWorld - (player.Center - new Vector2(4, 4))).RotatedByRandom(MathHelper.ToRadians(30)) * Main.rand.NextFloat(2f, 6f) * 3f); dust.noGravity = true; dust.scale = (float)Math.Sqrt(projectile.localAI[0] / 100f); } } projectile.localAI[0] -= 10; Vector2 toShoot = direction.RotatedBy(Main.rand.NextFloat(0 - ((float)Math.Sqrt(200 - maxCounter) / 40f), (float)Math.Sqrt(200 - maxCounter) / 40f)); player.itemRotation = (toShoot.ToRotation() + direction.ToRotation()) / 2; if (player.direction != 1) { player.itemRotation -= 3.14f; } projectile.velocity = toShoot; toShoot *= 2.3f; toShoot *= (float)Math.Pow(maxCounter, 0.18); player.GetModPlayer <MyPlayer>().Shake += 1; if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectileDirect(player.Center + (direction * 4), toShoot * new Vector2(Main.rand.NextFloat(.6f, 1.3f), Main.rand.NextFloat(0.6f, 1.2f)), ModContent.ProjectileType <HeavenfleetStar>(), projectile.damage, projectile.knockBack, projectile.owner); } } projectile.active = false; } return(true); }
public override void AI() { if (!spawned) { npc.TargetClosest(false); Movement(Main.player[npc.target].Center, 0.8f, 32f); if (npc.Distance(Main.player[npc.target].Center) < 2000) { spawned = true; } else { return; } } EModeGlobalNPC.championBoss = npc.whoAmI; if (!npc.HasValidTarget) { npc.TargetClosest(false); } Player player = Main.player[npc.target]; if (npc.HasValidTarget && npc.Distance(player.Center) < 2500 && player.ZoneUnderworldHeight) { npc.timeLeft = 600; } if (npc.localAI[2] == 0 && npc.life < npc.lifeMax * .66) { npc.localAI[2] = 1; npc.ai[0] = -1; npc.ai[1] = 0; npc.ai[2] = 0; npc.localAI[0] = 0; npc.netUpdate = true; } else if (npc.localAI[3] == 0 && npc.life < npc.lifeMax * .33) { npc.localAI[3] = 1; npc.ai[0] = -1; npc.ai[1] = 0; npc.ai[2] = 0; npc.localAI[0] = 0; npc.netUpdate = true; } npc.damage = npc.defDamage; switch ((int)npc.ai[0]) { case -1: { if (!npc.HasValidTarget) { npc.TargetClosest(false); } npc.damage = 0; npc.dontTakeDamage = true; npc.velocity *= 0.9f; if (++npc.ai[2] > 40) { npc.ai[2] = 0; Main.PlaySound(SoundID.Item92, npc.Center); npc.localAI[0] = npc.localAI[0] > 0 ? -1 : 1; if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] < 300) { const int max = 6; float offset = npc.localAI[0] > 0 && player.velocity != Vector2.Zero //aim to intercept ? Main.rand.NextFloat((float)Math.PI * 2) : player.velocity.ToRotation(); for (int i = 0; i < max; i++) { float rotation = offset + (float)Math.PI * 2 / max * i; Projectile.NewProjectile(player.Center + 450 * Vector2.UnitX.RotatedBy(rotation), Vector2.Zero, ModContent.ProjectileType <WillJavelin3>(), npc.defDamage / 4, 0f, Main.myPlayer, 0f, rotation + (float)Math.PI); } } } if (++npc.ai[1] == 1) { Main.PlaySound(SoundID.Item4, npc.Center); for (int i = 0; i < Main.maxProjectiles; i++) //purge leftover bombs { if (Main.projectile[i].active && Main.projectile[i].hostile && Main.projectile[i].type == ModContent.ProjectileType <WillBomb>()) { Main.projectile[i].Kill(); } } if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType <WillShell>(), 0, 0f, Main.myPlayer, 0f, npc.whoAmI); Projectile.NewProjectile(npc.Center, Vector2.UnitY * -12f, ModContent.ProjectileType <WillBomb>(), npc.defDamage / 4, 0f, Main.myPlayer, 0f, npc.whoAmI); } const int num226 = 80; for (int num227 = 0; num227 < num226; num227++) { Vector2 vector6 = Vector2.UnitX * 40f; vector6 = vector6.RotatedBy(((num227 - (num226 / 2 - 1)) * 6.28318548f / num226), default(Vector2)) + npc.Center; Vector2 vector7 = vector6 - npc.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 174, 0f, 0f, 0, default(Color), 3f); Main.dust[num228].noGravity = true; Main.dust[num228].velocity = vector7; } } else if (npc.ai[1] > 360) { npc.ai[0]++; npc.ai[1] = 0; npc.ai[2] = 0; npc.localAI[0] = 0; npc.localAI[1] = 0; npc.netUpdate = true; } /*const int delay = 7; * const int gap = 150; * * int threshold = delay * 2 * 1600 / gap; //rate of spawn * cover length twice * length / gap * if (++npc.ai[2] % delay == 0 && npc.ai[2] < threshold * 2) * { * Main.PlaySound(SoundID.Item92, npc.Center); * * Vector2 targetPos = new Vector2(npc.localAI[0], npc.localAI[1]); * Vector2 speed = new Vector2(Main.rand.NextFloat(-20f, 20f), Main.rand.NextFloat(-20f, 20f)); * if (Main.netMode != NetmodeID.MultiplayerClient) * { * Projectile.NewProjectile(npc.Center, speed, ModContent.ProjectileType<WillJavelin2>(), npc.defDamage / 4, 0f, Main.myPlayer, targetPos.X, targetPos.Y); * } * if (npc.ai[2] < threshold) * npc.localAI[0] += gap; * else * npc.localAI[0] -= gap; * } * * if (npc.ai[2] == threshold) * { * npc.localAI[0] += gap / 2; //offset halfway * } * else if (npc.ai[2] == threshold * 2 + 30) //final wave * { * npc.localAI[0] -= gap / 2; //revert offset * * for (int i = 0; i < 1600 / gap * 2; i++) * { * Vector2 targetPos = new Vector2(npc.localAI[0], npc.localAI[1]); * Vector2 speed = new Vector2(Main.rand.NextFloat(-20f, 20f), Main.rand.NextFloat(-20f, 20f)); * if (Main.netMode != NetmodeID.MultiplayerClient) * { * Projectile.NewProjectile(npc.Center, speed, ModContent.ProjectileType<WillJavelin2>(), npc.defDamage / 4, 0f, Main.myPlayer, targetPos.X, targetPos.Y); * } * npc.localAI[0] += gap; * } * } * * if (++npc.ai[1] == 1) * { * Main.PlaySound(SoundID.Item4, npc.Center); * * for (int i = 0; i < Main.maxProjectiles; i++) //purge leftover bombs * { * if (Main.projectile[i].active && Main.projectile[i].hostile && Main.projectile[i].type == ModContent.ProjectileType<WillBomb>()) * Main.projectile[i].Kill(); * } * * npc.localAI[0] = npc.Center.X - 1600; * npc.localAI[1] = npc.Center.Y - 200; * if (npc.position.Y < 2400) * npc.localAI[1] += 1200; * else * npc.localAI[1] -= 1200; * * if (Main.netMode != NetmodeID.MultiplayerClient) * { * Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType<WillShell>(), 0, 0f, Main.myPlayer, 0f, npc.whoAmI); * Projectile.NewProjectile(npc.Center, Vector2.UnitY * -12f, ModContent.ProjectileType<WillBomb>(), npc.defDamage / 4, 0f, Main.myPlayer, 0f, npc.whoAmI); * } * * const int num226 = 80; * for (int num227 = 0; num227 < num226; num227++) * { * Vector2 vector6 = Vector2.UnitX * 40f; * vector6 = vector6.RotatedBy(((num227 - (num226 / 2 - 1)) * 6.28318548f / num226), default(Vector2)) + npc.Center; * Vector2 vector7 = vector6 - npc.Center; * int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 174, 0f, 0f, 0, default(Color), 3f); * Main.dust[num228].noGravity = true; * Main.dust[num228].velocity = vector7; * } * } * else if (npc.ai[1] > threshold * 2 + 270) * { * npc.ai[0]++; * npc.ai[1] = 0; * npc.ai[2] = 0; * npc.localAI[0] = 0; * npc.localAI[1] = 0; * npc.netUpdate = true; * }*/ } break; case 0: //float at player npc.dontTakeDamage = false; if (!player.active || player.dead || Vector2.Distance(npc.Center, player.Center) > 2500f) //despawn code { if (npc.timeLeft > 30) { npc.timeLeft = 30; } npc.noTileCollide = true; npc.noGravity = true; npc.velocity.Y -= 1f; return; } else { if (++npc.ai[1] > 45f) //time to progress { npc.TargetClosest(false); npc.ai[0]++; npc.ai[1] = 0; //npc.ai[2] = 0; //npc.ai[3] = 0; npc.netUpdate = true; if (++npc.ai[2] > 4) //decide next action { npc.ai[2] = 0; if (++npc.ai[3] > 3) //count which attack to do next { npc.ai[3] = 1; } npc.ai[0] += npc.ai[3]; } else //actually just dash { npc.velocity = npc.DirectionTo(player.Center) * 33f; } } else //regular movement { Vector2 vel = player.Center - npc.Center; npc.rotation = vel.ToRotation(); const float moveSpeed = 2f; if (vel.X > 0) //im on left side of target { vel.X -= 450; npc.direction = npc.spriteDirection = 1; } else //im on right side of target { vel.X += 450; npc.direction = npc.spriteDirection = -1; } vel.Y -= 200f; vel.Normalize(); vel *= 20f; if (npc.velocity.X < vel.X) { npc.velocity.X += moveSpeed; if (npc.velocity.X < 0 && vel.X > 0) { npc.velocity.X += moveSpeed; } } else if (npc.velocity.X > vel.X) { npc.velocity.X -= moveSpeed; if (npc.velocity.X > 0 && vel.X < 0) { npc.velocity.X -= moveSpeed; } } if (npc.velocity.Y < vel.Y) { npc.velocity.Y += moveSpeed; if (npc.velocity.Y < 0 && vel.Y > 0) { npc.velocity.Y += moveSpeed; } } else if (npc.velocity.Y > vel.Y) { npc.velocity.Y -= moveSpeed; if (npc.velocity.Y > 0 && vel.Y < 0) { npc.velocity.Y -= moveSpeed; } } } } break; case 1: //dashing npc.rotation = npc.velocity.ToRotation(); npc.direction = npc.spriteDirection = npc.velocity.X > 0 ? 1 : -1; int num22 = 7; for (int index1 = 0; index1 < num22; ++index1) { Vector2 vector2_1 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((index1 - (num22 / 2 - 1)) * Math.PI / num22, new Vector2()) + npc.Center; Vector2 vector2_2 = ((float)(Main.rand.NextDouble() * 3.14159274101257) - 1.570796f).ToRotationVector2() * Main.rand.Next(3, 8); Vector2 vector2_3 = vector2_2; int index2 = Dust.NewDust(vector2_1 + vector2_3, 0, 0, 87, vector2_2.X * 2f, vector2_2.Y * 2f, 100, new Color(), 1.4f); Main.dust[index2].noGravity = true; Main.dust[index2].velocity /= 4f; Main.dust[index2].velocity -= npc.velocity; } if (--npc.localAI[0] < 0) { npc.localAI[0] = 2; if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[3] == 1) { Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType <WillFireball2>(), npc.damage / 4, 0f, Main.myPlayer); } } if (++npc.ai[1] > 30) { npc.ai[0]--; //return to previous step npc.ai[1] = 0; //npc.ai[2] = 0; //npc.ai[3] = 0; npc.localAI[0] = 2; npc.netUpdate = true; } break; case 2: //arena bomb npc.velocity *= 0.975f; npc.rotation = npc.DirectionTo(player.Center).ToRotation(); npc.direction = npc.spriteDirection = npc.Center.X < player.Center.X ? 1 : -1; if (++npc.ai[1] == 30) //spawn bomb { Main.PlaySound(SoundID.ForceRoar, npc.Center, -1); const int num226 = 40; for (int num227 = 0; num227 < num226; num227++) { Vector2 vector6 = Vector2.UnitX * 15f; vector6 = vector6.RotatedBy(((num227 - (num226 / 2 - 1)) * 6.28318548f / num226), default(Vector2)) + npc.Center; Vector2 vector7 = vector6 - npc.Center; int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 174, 0f, 0f, 0, default(Color), 2f); Main.dust[num228].noGravity = true; Main.dust[num228].velocity = vector7; } if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(npc.Center, Vector2.UnitY * -12f, ModContent.ProjectileType <WillBomb>(), npc.defDamage / 4, 0f, Main.myPlayer, 0f, npc.whoAmI); } } else if (npc.ai[1] > 120) { npc.ai[0] = 0; npc.ai[1] = 0; npc.netUpdate = true; } break; case 3: //spear barrage { Vector2 vel = player.Center - npc.Center; npc.rotation = vel.ToRotation(); const float moveSpeed = 0.25f; if (vel.X > 0) //im on left side of target { vel.X -= 450; npc.direction = npc.spriteDirection = 1; } else //im on right side of target { vel.X += 450; npc.direction = npc.spriteDirection = -1; } vel.Y -= 200f; vel.Normalize(); vel *= 16f; if (npc.velocity.X < vel.X) { npc.velocity.X += moveSpeed; if (npc.velocity.X < 0 && vel.X > 0) { npc.velocity.X += moveSpeed; } } else if (npc.velocity.X > vel.X) { npc.velocity.X -= moveSpeed; if (npc.velocity.X > 0 && vel.X < 0) { npc.velocity.X -= moveSpeed; } } if (npc.velocity.Y < vel.Y) { npc.velocity.Y += moveSpeed; if (npc.velocity.Y < 0 && vel.Y > 0) { npc.velocity.Y += moveSpeed; } } else if (npc.velocity.Y > vel.Y) { npc.velocity.Y -= moveSpeed; if (npc.velocity.Y > 0 && vel.Y < 0) { npc.velocity.Y -= moveSpeed; } } if (--npc.localAI[0] < 0) { npc.localAI[0] = npc.localAI[2] == 1 ? 30 : 40; if (npc.ai[1] < 110 || npc.localAI[3] == 1) { Main.PlaySound(SoundID.ForceRoar, npc.Center, -1); if (Main.netMode != NetmodeID.MultiplayerClient) { for (int i = 0; i < 15; i++) { float speed = Main.rand.NextFloat(4f, 12f); Vector2 velocity = speed * Vector2.UnitX.RotatedBy(Main.rand.NextDouble() * -Math.PI); float ai1 = speed / 120f; Projectile.NewProjectile(npc.Center, velocity, ModContent.ProjectileType <WillJavelin>(), npc.defDamage / 4, 0f, Main.myPlayer, 0f, ai1); } } } } if (++npc.ai[1] > 150) { npc.ai[0] = 0; npc.ai[1] = 0; npc.localAI[0] = 0; npc.netUpdate = true; } } break; case 4: //fireballs { Vector2 vel = player.Center - npc.Center; npc.rotation = vel.ToRotation(); const float moveSpeed = 0.25f; if (vel.X > 0) //im on left side of target { vel.X -= 550; npc.direction = npc.spriteDirection = 1; } else //im on right side of target { vel.X += 550; npc.direction = npc.spriteDirection = -1; } vel.Y -= 250f; vel.Normalize(); vel *= 16f; if (npc.velocity.X < vel.X) { npc.velocity.X += moveSpeed; if (npc.velocity.X < 0 && vel.X > 0) { npc.velocity.X += moveSpeed; } } else if (npc.velocity.X > vel.X) { npc.velocity.X -= moveSpeed; if (npc.velocity.X > 0 && vel.X < 0) { npc.velocity.X -= moveSpeed; } } if (npc.velocity.Y < vel.Y) { npc.velocity.Y += moveSpeed; if (npc.velocity.Y < 0 && vel.Y > 0) { npc.velocity.Y += moveSpeed; } } else if (npc.velocity.Y > vel.Y) { npc.velocity.Y -= moveSpeed; if (npc.velocity.Y > 0 && vel.Y < 0) { npc.velocity.Y -= moveSpeed; } } if (++npc.localAI[0] > 3) { npc.localAI[0] = 0; if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] < 90) //shoot fireball { Main.PlaySound(SoundID.Item34, npc.Center); Vector2 spawn = new Vector2(40, 50); if (npc.direction < 0) { spawn.X *= -1; spawn = spawn.RotatedBy(Math.PI); } spawn = spawn.RotatedBy(npc.rotation); spawn += npc.Center; Vector2 projVel = npc.DirectionTo(player.Center).RotatedBy((Main.rand.NextDouble() - 0.5) * Math.PI / 10); projVel.Normalize(); projVel *= Main.rand.NextFloat(8f, 12f); int type = ProjectileID.CultistBossFireBall; if (Main.rand.Next(2) == 0) { type = ModContent.ProjectileType <WillFireball>(); projVel *= 2.5f; } Projectile.NewProjectile(spawn, projVel, type, npc.defDamage / 4, 0f, Main.myPlayer); } } if (--npc.localAI[1] < 0) { npc.localAI[1] = npc.localAI[3] == 1 ? 35 : 180; if (npc.localAI[2] == 1 && Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(player.Center, Vector2.UnitY, ModContent.ProjectileType <WillDeathraySmall>(), npc.damage / 4, 0f, Main.myPlayer, 0f, npc.whoAmI); Projectile.NewProjectile(player.Center, -Vector2.UnitY, ModContent.ProjectileType <WillDeathraySmall>(), npc.damage / 4, 0f, Main.myPlayer, 0f, npc.whoAmI); } } if (++npc.ai[1] == 1) { Main.PlaySound(SoundID.ForceRoar, npc.Center, -1); } else if (npc.ai[1] > 120) { npc.ai[0] = 0; npc.ai[1] = 0; npc.localAI[0] = 0; npc.netUpdate = true; } } break; default: npc.ai[0] = 0; goto case 0; } if (npc.spriteDirection < 0 && npc.ai[0] != -1f) { npc.rotation += (float)Math.PI; } }
public override void UpdateArmorSet(Player player) { player.setBonus = @"20% increased damage Attack enemies to charge energy Reduces damage taken at the cost of some energy Double tap " + Terraria.Localization.Language.GetTextValue(Main.ReversedUpDownArmorSetBonuses ? "Key.UP" : "Key.DOWN") + @" to release energy as homing shots Brandish a blade of infernal magic when fully charged"; player.GetModPlayer <FargoPlayer>().AllDamageUp(0.2f); FargoPlayer fargoPlayer = player.GetModPlayer <FargoPlayer>(); fargoPlayer.StyxSet = true; int scytheType = ModContent.ProjectileType <StyxArmorScythe>(); const int maxProjs = 12; const int threshold = 1500000 / maxProjs; //based off mutant hp if (fargoPlayer.StyxMeter > threshold) { fargoPlayer.StyxMeter -= threshold; if (player.whoAmI == Main.myPlayer && player.ownedProjectileCounts[scytheType] < maxProjs) { Projectile.NewProjectile(player.Center, Vector2.Zero, scytheType, 0, 10f, player.whoAmI, player.ownedProjectileCounts[scytheType], -1f); } } bool doubleTap = Main.ReversedUpDownArmorSetBonuses ? player.controlUp && player.releaseUp && player.doubleTapCardinalTimer[1] > 0 && player.doubleTapCardinalTimer[1] != 15 : player.controlDown && player.releaseDown && player.doubleTapCardinalTimer[0] > 0 && player.doubleTapCardinalTimer[0] != 15; if (player.whoAmI == Main.myPlayer && doubleTap && player.ownedProjectileCounts[ModContent.ProjectileType <StyxGazerArmor>()] <= 0) { bool superAttack = player.ownedProjectileCounts[scytheType] >= maxProjs; for (int i = 0; i < Main.maxProjectiles; i++) { if (Main.projectile[i].active && Main.projectile[i].friendly && Main.projectile[i].type == scytheType && Main.projectile[i].owner == player.whoAmI) { if (!superAttack) { Projectile.NewProjectile(Main.projectile[i].Center, Vector2.Normalize(Main.projectile[i].velocity) * 24f, ModContent.ProjectileType <StyxArmorScythe2>(), Main.projectile[i].damage, Main.projectile[i].knockBack, player.whoAmI, -1, -1); } Main.projectile[i].Kill(); } } if (superAttack) { Vector2 speed = Vector2.Normalize(Main.MouseWorld - player.Center); bool flip = speed.X < 0; speed = speed.RotatedBy(MathHelper.PiOver2 * (flip ? 1 : -1)); Projectile.NewProjectile(player.Center, speed, ModContent.ProjectileType <StyxGazerArmor>(), 0, 14f, player.whoAmI, MathHelper.Pi / 120 * (flip ? -1 : 1)); player.controlUseItem = false; //this kills other heldprojs player.releaseUseItem = true; } } }
public void HitEffect(int hitDirection = 0, double dmg = 10) { int num; int num1; bool flag; int num2; int[] numArray; Color color; Vector2 vector2; if (!this.active) { return; } if (this.daybreak && this.life <= 0) { if (Main.netMode != 1) { for (int j = 0; j < 200; j++) { NPC nPC = Main.npc[j]; if (nPC.active && !nPC.buffImmune[189] && base.Distance(nPC.Center) < 100f && !nPC.dontTakeDamage) { nPC.AddBuff(189, 300, false); } } } } if (this.type == 398 && dmg == 1337) { MoonlordDeathDrama.ThrowPieces(base.Center, Main.rand.Next(100)); } if (this.type == 488) { this.localAI[0] = (float)((int)dmg); if (this.localAI[0] < 20f) { this.localAI[0] = 20f; } if (this.localAI[0] > 120f) { this.localAI[0] = 120f; } this.localAI[1] = (float)hitDirection; } else if (this.type == 426) { if (Main.netMode != 1) { for (int l1 = 0; l1 < 3; l1++) { int num73 = NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 428, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num73].velocity = (-Vector2.UnitY.RotatedByRandom(6.28318548202515) * (float)Main.rand.Next(3, 6)) - (Vector2.UnitY * 2f); Main.npc[num73].netUpdate = true; } } else { } } else if (this.type == 429) { if (this.life <= 0) { if (Main.netMode != 1) { Point tileCoordinates = base.Center.ToTileCoordinates(); Point point = Main.player[this.target].Center.ToTileCoordinates(); Vector2 center = Main.player[this.target].Center - base.Center; int num91 = 20; int num92 = 3; int num93 = 7; int num94 = 2; int num95 = 0; bool flag1 = false; if (center.Length() > 2000f) { flag1 = true; } do { Label1: if (flag1) { goto Label0; } if (num95 < 100) { num95++; num = Main.rand.Next(point.X - num91, point.X + num91 + 1); num1 = Main.rand.Next(point.Y - num91, point.Y - Math.Abs(num - point.X) + 1); if ((num1 < point.Y - num93 || num1 > point.Y + num93 || num < point.X - num93 || num > point.X + num93) && (num1 < tileCoordinates.Y - num92 || num1 > tileCoordinates.Y + num92 || num < tileCoordinates.X - num92 || num > tileCoordinates.X + num92) && !Main.tile[num, num1].nactive()) { flag = true; if (flag && Main.tile[num, num1].lava()) { flag = false; } if (flag && Collision.SolidTiles(num - num94, num + num94, num1 - num94, num1 + num94)) { flag = false; } if (!flag || Collision.CanHitLine(base.Center, 0, 0, Main.player[this.target].Center, 0, 0)) { continue; } flag = false; } else { goto Label1; } } else { goto Label0; } } while (!flag); Projectile.NewProjectile((float)(num * 16 + 8), (float)(num1 * 16 + 8), 0f, 0f, 578, 0, 1f, Main.myPlayer, 0f, 0f); flag1 = true; } } } else if (this.type == 406 || this.type == 405) { if (this.life <= 0) { if (this.type == 405) { int num150 = NPC.CountNPCS(406) + NPC.CountNPCS(405); int num151 = 4; if (num150 >= 4) { num151 = 3; } if (num150 >= 7) { num151 = 2; } if (num150 >= 10) { num151 = 1; } for (int g1 = 0; g1 < num151; g1++) { Vector2 vector268 = Vector2.UnitY.RotatedByRandom(6.28318548202515) * (3f + Main.rand.NextFloat() * 4f); int num152 = NPC.NewNPC((int)base.Center.X, (int)base.Bottom.Y, 406, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num152].velocity = vector268; } } } } else if (this.type == 402) { if (this.life <= 0) { for (int p2 = 0; p2 < (int)this.oldPos.Length; p2++) { if (Main.rand.Next(4) == 0) { if (this.oldPos[p2] == Vector2.Zero) { goto Label0; } } } } } else if (this.type == 491) { if (this.life <= 0) { if (Main.netMode != 1) { for (int c2 = 0; c2 < 4; c2++) { float directionInt = (float)(c2 < 2).ToDirectionInt() * (0.3926991f + 0.7853982f * Main.rand.NextFloat()); Vector2 vector2102 = new Vector2(0f, -Main.rand.NextFloat() * 0.5f - 0.5f); double num205 = (double)directionInt; vector2 = new Vector2(); Vector2 vector2103 = vector2102.RotatedBy(num205, vector2) * 6f; Projectile.NewProjectile(base.Center.X, base.Center.Y, vector2103.X, vector2103.Y, 594, 0, 0f, Main.myPlayer, 0f, 0f); } } } } Label0: if (this.type == 370) { if (this.life <= 0) { } else { } } else if (this.type == 381) { if (this.life <= 0) { } else { } } else if (this.type == 382 || this.type == 390) { if (this.life <= 0) { } else { } } else if (this.type == 383) { if (this.life <= 0) { } else { } } else if (this.type == 384) { if (this.life <= 0) { } else { } } else if (this.type == 385) { if (this.life <= 0) { } else { } } else if (this.type == 386) { if (this.life <= 0) { } else { } } if (this.type == 387) { if (this.life <= 0) { } else { } } if (this.type == 520) { if (this.life <= 0) { } else { } } else if (this.type == 389) { if (this.life <= 0) { } else { } } else if (this.type == 388) { if (this.life <= 0) { } else { } } else if (this.type == 399) { if (this.life <= 0) { } else { } } else if (this.type == 391) { if (this.life <= 0) { } else { } } if (this.type == 1 || this.type == 16 || this.type == 71 || this.type == 244 || this.type == 535) { if (this.life <= 0) { if (Main.netMode != 1 && this.type == 16) { int num398 = Main.rand.Next(2) + 2; for (int l6 = 0; l6 < num398; l6++) { int num399 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), 1, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num399].SetDefaults("Baby Slime"); Main.npc[num399].velocity.X = this.velocity.X * 2f; Main.npc[num399].velocity.Y = this.velocity.Y; Main.npc[num399].velocity.X = Main.npc[num399].velocity.X + ((float)Main.rand.Next(-20, 20) * 0.1f + (float)(l6 * this.direction) * 0.3f); Main.npc[num399].velocity.Y = Main.npc[num399].velocity.Y - ((float)Main.rand.Next(0, 10) * 0.1f + (float)l6); Main.npc[num399].ai[0] = (float)(-1000 * Main.rand.Next(3)); if (Main.netMode == 2 && num399 < 200) { NetMessage.SendData(23, -1, -1, "", num399, 0f, 0f, 0f, 0, 0, 0); } } } } } if (this.type >= 245 && this.type <= 249) { if (this.life > 0) { } else if (Main.netMode != 1) { NPC.NewNPC((int)base.Center.X, (int)this.position.Y + this.height, 249, this.whoAmI, 0f, 0f, 0f, 0f, 255); } } if (this.type == 81 || this.type == 121) { if (this.life <= 0) { if (Main.netMode != 1) { if (this.type == 121) { int num491 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), 81, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num491].SetDefaults("Slimer2"); Main.npc[num491].velocity.X = this.velocity.X; Main.npc[num491].velocity.Y = this.velocity.Y; if (Main.netMode == 2 && num491 < 200) { NetMessage.SendData(23, -1, -1, "", num491, 0f, 0f, 0f, 0, 0, 0); } } else if (this.scale >= 1f) { int num492 = Main.rand.Next(2) + 2; for (int n8 = 0; n8 < num492; n8++) { int num493 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), 1, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num493].SetDefaults("Slimeling"); Main.npc[num493].velocity.X = this.velocity.X * 3f; Main.npc[num493].velocity.Y = this.velocity.Y; Main.npc[num493].velocity.X = Main.npc[num493].velocity.X + ((float)Main.rand.Next(-10, 10) * 0.1f + (float)(n8 * this.direction) * 0.3f); Main.npc[num493].velocity.Y = Main.npc[num493].velocity.Y - ((float)Main.rand.Next(0, 10) * 0.1f + (float)n8); Main.npc[num493].ai[1] = (float)n8; if (Main.netMode == 2 && num493 < 200) { NetMessage.SendData(23, -1, -1, "", num493, 0f, 0f, 0f, 0, 0, 0); } } } } } } if (this.type == 63 || this.type == 64 || this.type == 103) { return; } if (this.type == 59 || this.type == 60 || this.type == 151) { if (this.life > 0) { return; } if (Main.expertMode && this.type == 59 && Main.netMode != 1) { try { int x10 = (int)(base.Center.X / 16f); int y10 = (int)(base.Center.Y / 16f); if (!WorldGen.SolidTile(x10, y10) && Main.tile[x10, y10].liquid == 0) { Main.tile[x10, y10].liquid = (byte)Main.rand.Next(50, 150); Main.tile[x10, y10].lava(true); Main.tile[x10, y10].honey(false); WorldGen.SquareTileFrame(x10, y10, true); } } catch (Exception ex) { #if DEBUG Console.WriteLine(ex); System.Diagnostics.Debugger.Break(); #endif } } } else if (this.type != 50) { if (this.type == 153) { if (this.life > 0) { return; } return; } if (this.type == 177) { if (this.life > 0) { return; } return; } if (this.type >= 494 && this.type <= 495) { if (this.life > 0) { return; } return; } if (this.type >= 496 && this.type <= 497) { if (this.life > 0) { return; } return; } if (this.type >= 498 && this.type <= 506) { if (this.life > 0) { return; } return; } if (this.type == 49 || this.type == 51 || this.type == 93 || this.type == 150 || this.type == 152 || this.type == 226) { if (this.life > 0) { return; } return; } if (this.type == 46 || this.type == 55 || this.type == 67 || this.type == 74 || this.type == 102 || this.type == 224 || this.type == 230 || this.type == 297 || this.type == 298 || this.type == 299 || this.type == 300 || this.type == 303 || this.type == 337 || this.type == 538) { if (this.life > 0) { return; } if (this.type == 46 || this.type == 303 || this.type == 337) { if (this.type == 303) { return; } } else { if (this.type == 67) { return; } if (this.type == 55 || this.type == 230) { return; } if (this.type == 74) { return; } if (this.type == 297) { return; } if (this.type == 298) { return; } if (this.type == 299) { return; } if (this.type == 538) { return; } if (this.type == 300) { return; } if (this.type == 102) { return; } if (this.type == 224) { return; } } } else if (this.type == 148 || this.type == 149 || this.type == 168 || this.type == 470) { if (this.life > 0) { return; } if (this.type == 148) { return; } if (this.type == 149) { return; } if (this.type == 168) { return; } if (this.type == 470) { return; } } else { if (this.type == 361) { if (this.life > 0) { return; } return; } if (this.type == 366 || this.type == 367) { if (this.life > 0) { return; } if (this.type == 366) { return; } return; } if (this.type >= 362 && this.type <= 365) { if (this.life > 0) { return; } if (this.type != 362 && this.type != 363) { return; } return; } if (this.type == 348 || this.type == 349) { if (this.life > 0) { return; } return; } if (this.type == 351) { if (this.life > 0) { return; } return; } if (this.type == 350) { if (this.life > 0) { return; } return; } if (this.type == 47 || this.type == 57 || this.type == 58 || this.type == 464 || this.type == 465) { if (this.life > 0) { return; } if (this.type == 57) { return; } if (this.type == 58) { return; } if (this.type == 464) { return; } if (this.type == 465) { return; } return; } if (this.type == 173 || this.type == 174 || this.type == 181 || this.type == 182 || this.type == 268) { if (this.life > 0) { return; } if (this.type == 173) { return; } if (this.type == 174) { return; } if (this.type == 181) { return; } if (this.type == 182) { return; } if (this.type == 268) { return; } } else { if (this.type == 2 || this.type == 190 || this.type == 191 || this.type == 192 || this.type == 193 || this.type == 194 || this.type == 317 || this.type == 318) { if (this.life > 0) { return; } if (this.type == 190) { return; } if (this.type == 191) { return; } if (this.type == 192) { return; } if (this.type == 193) { return; } if (this.type == 194) { return; } if (this.type == 317) { return; } if (this.type == 318) { return; } return; } if (this.type == 157) { if (this.life > 0) { return; } return; } if (this.type == 133) { if (this.life <= 0) { return; } if ((float)this.life < (float)this.lifeMax * 0.5f && this.localAI[0] == 0f) { this.localAI[0] = 1f; return; } } else if (this.type == 69 || this.type == 509 || this.type == 508) { if (this.life > 0) { return; } if (this.type == 69) { return; } if (this.type == 508) { return; } if (this.type == 509) { return; } } else { if (this.type == 61) { if (this.life > 0) { return; } return; } if (this.type == 301) { if (this.life > 0) { return; } return; } if (this.type == 252) { if (this.life > 0) { return; } return; } if (this.type == 489) { if (this.life > 0) { return; } return; } if (this.type == 534) { if (this.life > 0) { return; } return; } if (this.type == 490) { if (this.life > 0) { return; } return; } if (this.type == 65) { if (this.life > 0) { return; } return; } if (this.type == 195 || this.type == 196) { if (this.life > 0) { return; } return; } if (this.type == 198 || this.type == 199) { if (this.life > 0) { return; } return; } if (this.type == 206) { if (this.life > 0) { return; } return; } if (this.type == 342) { if (this.life > 0) { return; } return; } if (this.type >= 338 && this.type <= 340) { if (this.life > 0) { return; } return; } if (this.type == 343) { if (this.life > 0) { return; } return; } if ((this.type < 430 || this.type > 436) && this.type != 3 && this.type != 52 && this.type != 53 && this.type != 536 && this.type != 104 && this.type != 109 && this.type != 331 && this.type != 332 && this.type != 132 && this.type != 161 && this.type != 162 && this.type != 186 && this.type != 187 && this.type != 188 && this.type != 189 && this.type != 200 && this.type != 223 && this.type != 251 && this.type != 319 && this.type != 320 && this.type != 321) { if (this.type == 83 || this.type == 84 || this.type == 179) { if (this.life > 0) { return; } return; } if (this.type == 262 || this.type == 263 || this.type == 264) { if (this.life > 0) { return; } return; } else if (this.type != 265) { if (this.type == 266) { if (this.life > 0) { return; } return; } if (this.type == 267) { if (this.life > 0) { return; } return; } if (this.type == 4 || this.type == 126 || this.type == 125) { if (this.life > 0) { return; } if (this.type == 125 || this.type == 126) { return; } } else { if (this.type == 5) { if (this.life > 0) { return; } return; } if (this.type == 113 || this.type == 114) { if (this.life > 0) { return; } if (this.type == 114) { return; } if (Main.player[Main.myPlayer].position.Y / 16f > (float)(Main.maxTilesY - 250)) { int y12 = (int)Main.screenPosition.Y; int num700 = y12 + Main.screenWidth; int x12 = (int)this.position.X; if (this.direction > 0) { x12 = x12 - 80; } int num701 = x12 + 140; int num702 = x12; for (int j12 = y12; j12 < num700; j12 = j12 + 50) { while (num702 < num701) { num702 = num702 + 46; } num702 = x12; } return; } } else { if (this.type == 115 || this.type == 116) { if (this.life > 0) { return; } if (this.type != 115 || Main.netMode == 1) { return; } NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), 116, 0, 0f, 0f, 0f, 0f, 255); return; } if (this.type >= 117 && this.type <= 119) { if (this.life > 0) { return; } return; } if (this.type == 217 || this.type == 218 || this.type == 219) { if (this.life > 0) { return; } if (this.type == 219) { return; } } else { if (this.type == 222) { if (this.life > 0) { return; } return; } if (this.type == 6 || this.type == 94 || this.type == 166) { if (this.life > 0) { return; } if (this.type == 94) { return; } if (this.type == 166) { return; } return; } if (this.type == 101) { if (this.life > 0) { return; } return; } if (this.type == 7 || this.type == 8 || this.type == 9) { if (this.life > 0) { return; } return; } if (this.type == 98 || this.type == 99 || this.type == 100) { if (this.life > 0) { return; } return; } if (this.type == 10 || this.type == 11 || this.type == 12) { if (this.life > 0) { return; } return; } if (this.type == 95 || this.type == 96 || this.type == 97) { if (this.life > 0) { return; } return; } if (this.type == 13 || this.type == 14 || this.type == 15) { if (this.life > 0) { return; } if (this.type == 13) { return; } if (this.type == 14) { return; } return; } if (this.type == 17) { if (this.life > 0) { return; } return; } if (this.type == 441) { if (this.life > 0) { return; } return; } if (this.type == 86) { if (this.life > 0) { return; } return; } if (this.type == 155) { if (this.life > 0) { return; } return; } if (this.type == 329) { if (this.life > 0) { return; } return; } if (this.type == 163 || this.type == 238) { if (this.life > 0) { return; } return; } if (this.type == 164 || this.type == 165) { if (this.life > 0) { return; } return; } if (this.type == 239 || this.type == 240) { if (this.life > 0) { return; } return; } if (this.type == 236 || this.type == 237) { if (this.life > 0) { return; } return; } if (this.type == 241) { if (this.life > 0) { return; } return; } if (this.type == 242) { if (this.life > 0) { return; } return; } if (this.type >= 105 && this.type <= 108) { if (this.life > 0) { return; } if (this.type != 105 && this.type != 107) { return; } return; } if (this.type == 123 || this.type == 124) { if (this.life > 0) { return; } return; } if (this.type == 22) { if (this.life > 0) { return; } return; } if (this.type == 368) { if (this.life > 0) { return; } return; } if (this.type == 369 || this.type == 376) { if (this.life > 0) { return; } return; } if (this.type == 227) { if (this.life > 0) { return; } return; } if (this.type == 228) { if (this.life > 0) { return; } return; } if (this.type == 229) { if (this.life > 0) { return; } return; } if (this.type == 142) { if (this.life > 0) { return; } return; } if (this.type == 178) { if (this.life > 0) { return; } return; } if (this.type == 353 || this.type == 354) { if (this.life > 0) { return; } return; } if (this.type == 37 || this.type == 54) { if (this.life > 0) { return; } return; } if (this.type == 441) { if (this.life > 0) { return; } return; } if (this.type == 160) { if (this.life > 0) { return; } return; } if (this.type == 18) { if (this.life > 0) { return; } return; } if (this.type == 19) { if (this.life > 0) { return; } return; } if (this.type == 38) { if (this.life > 0) { return; } return; } if (this.type == 20) { if (this.life > 0) { return; } } if (this.type == 207) { if (this.life > 0) { return; } return; } if (this.type == 208) { if (this.life > 0) { return; } return; } if (this.type == 209) { if (this.life > 0) { return; } return; } if (this.type < 212 || this.type > 216) { if (this.type == 220 || this.type == 221) { if (this.life > 0) { return; } if (this.type != 221) { return; } return; } if (this.type == 21 || this.type == 31 || this.type == 294 || this.type == 295 || this.type == 296 || this.type == 32 || this.type == 44 || this.type == 45 || this.type == 77 || this.type == 110 || this.type == 167 || this.type == 197 || this.type == 201 || this.type == 202 || this.type == 203 || this.type == 287 || this.type == 291 || this.type == 292 || this.type == 293 || this.type >= 322 && this.type <= 324 || this.type == 481 || this.type >= 449 && this.type <= 452) { if (this.life > 0) { return; } if (this.type == 167) { return; } if (this.type == 197) { return; } if (this.type == 481) { return; } if (this.type == 201 || this.type == 450) { return; } if (this.type == 202 || this.type == 451) { return; } if (this.type == 203 || this.type == 452) { return; } if (this.type == 322) { return; } if (this.type == 323) { return; } if (this.type == 324) { return; } return; } if (this.type == 453) { if (this.life > 0) { return; } return; } if ((this.type < 269 || this.type > 276) && (this.type < 281 || this.type > 286)) { if (this.type >= 277 && this.type <= 280) { if (this.life > 0) { return; } return; } if (this.type == 341) { if (this.life > 0) { return; } } if (this.type == 85) { if (this.life > 0) { return; } return; } if (this.type == 473 || this.type == 474 || this.type == 475 || this.type == 476) { if (this.life > 0) { return; } return; } if (this.type == 169) { if (this.life <= 0) { return; } return; } if (this.type == 170 || this.type == 180) { if (this.life > 0) { return; } return; } if (this.type == 171) { if (this.life > 0) { return; } return; } if (this.type != 290) { if (this.type >= 87 && this.type <= 92) { if (this.life > 0) { return; } return; } if (this.type == 78 || this.type == 79 || this.type == 80) { if (this.life > 0) { return; } return; } if (this.type == 82 || this.type == 158 || this.type == 159 || this.type == 250 || this.type == 253) { if (this.life > 0) { return; } return; } if (this.type == 316 || this.type == 330) { if (this.life <= 0) { return; } return; } if (this.type == 315) { if (this.life > 0) { return; } return; } if (this.type == 254 || this.type == 255 || this.type == 256 || this.type == 257 || this.type == 258 || this.type == 259 || this.type == 260 || this.type == 261) { if (this.life > 0) { return; } if (this.type != 261) { return; } } else if (this.type != 140) { if (this.type == 39 || this.type == 40 || this.type == 41) { if (this.life > 0) { return; } return; } if (this.type == 34) { if (this.life <= 0) { return; } return; } if (this.type == 289) { if (this.life <= 0) { return; } return; } if (this.type == 35 || this.type == 36) { if (this.life > 0) { return; } if (this.type == 35) { return; } return; } if (this.type == 139) { if (this.life <= 0) { return; } } else if (this.type == 467) { if (this.life <= 0) { return; } } else if (this.type >= 134 && this.type <= 136) { if (this.type == 135 && this.life > 0 && Main.netMode != 1 && this.ai[2] == 0f && Main.rand.Next(25) == 0) { this.ai[2] = 1f; int num987 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), 139, 0, 0f, 0f, 0f, 0f, 255); if (Main.netMode == 2 && num987 < 200) { NetMessage.SendData(23, -1, -1, "", num987, 0f, 0f, 0f, 0, 0, 0); } this.netUpdate = true; } if (this.life <= 0) { if (Main.rand.Next(2) == 0) { return; } } } else if (this.type == 347) { if (this.life <= 0) { return; } } else if (this.type == 346) { if (this.life <= 0) { return; } } else if (this.type == 127) { if (this.life <= 0) { return; } } else if (this.type < 128 || this.type > 131) { if (this.type == 23) { if (this.life > 0) { return; } return; } if (this.type == 24) { if (this.life > 0) { return; } return; } if (this.type == 25) { return; } if (this.type == 33) { return; } if (this.type == 26 || this.type == 27 || this.type == 28 || this.type == 29 || this.type == 73 || this.type == 111) { if (this.life > 0) { return; } return; } if (this.type == 471) { if (this.life > 0) { return; } return; } if (this.type == 472) { if (this.life > 0) { return; } return; } if (this.type == 480) { if (this.life > 0) { return; } return; } if (this.type == 185) { if (this.life > 0) { return; } return; } if (this.type == 30) { return; } if (this.type == 42 || this.type == 176 || this.type == 205 || this.type >= 231 && this.type <= 235) { if (this.life > 0) { return; } if (this.type == 205) { return; } if (this.type == 176) { return; } return; } if (this.type == 43 || this.type == 56) { if (this.life > 0) { return; } return; } if (this.type == 175) { if (this.life > 0) { return; } return; } if (this.type == 48) { if (this.life > 0) { return; } return; } if (this.type == 62 || this.type == 66) { if (this.life > 0) { return; } return; } if (this.type == 156) { if (this.life > 0) { return; } } } else if (this.life <= 0) { return; } } else if (this.life <= 0) { return; } } else if (this.life <= 0) { return; } } else { if (this.life > 0) { return; } } } else { if (this.life > 0) { return; } } } } } } else if (this.life < 0) { return; } } else if (this.life <= 0) { return; } else { return; } } } } } else { if (Main.netMode != 1) { int num1127 = Main.rand.Next(4) + 4; for (int w19 = 0; w19 < num1127; w19++) { int x20 = (int)(this.position.X + (float)Main.rand.Next(this.width - 32)); int y20 = (int)(this.position.Y + (float)Main.rand.Next(this.height - 32)); int num1128 = NPC.NewNPC(x20, y20, 1, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num1128].SetDefaults(1, -1f); Main.npc[num1128].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; Main.npc[num1128].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; Main.npc[num1128].ai[0] = (float)(-1000 * Main.rand.Next(3)); Main.npc[num1128].ai[1] = 0f; if (Main.netMode == 2 && num1128 < 200) { NetMessage.SendData(23, -1, -1, "", num1128, 0f, 0f, 0f, 0, 0, 0); } } return; } } }
public override void AI() { //arc code int num3 = projectile.frameCounter; projectile.frameCounter = num3 + 1; Lighting.AddLight(projectile.Center, 0.3f, 0.45f, 0.5f); if (projectile.velocity == Vector2.Zero) { if (projectile.frameCounter >= projectile.extraUpdates * 2) { projectile.frameCounter = 0; bool flag36 = true; for (int num855 = 1; num855 < projectile.oldPos.Length; num855 = num3 + 1) { if (projectile.oldPos[num855] != projectile.oldPos[0]) { flag36 = false; } num3 = num855; } if (flag36) { projectile.Kill(); return; } } if (Main.rand.Next(projectile.extraUpdates) == 0) { for (int num856 = 0; num856 < 2; num856 = num3 + 1) { float num857 = projectile.rotation + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; float num858 = (float)Main.rand.NextDouble() * 0.8f + 1f; Vector2 vector96 = new Vector2((float)Math.Cos((double)num857) * num858, (float)Math.Sin((double)num857) * num858); int num859 = Dust.NewDust(projectile.Center, 0, 0, 226, vector96.X, vector96.Y, 0, default(Color), 1f); Main.dust[num859].noGravity = true; Main.dust[num859].scale = 1.2f; num3 = num856; } if (Main.rand.Next(5) == 0) { Vector2 value39 = projectile.velocity.RotatedBy(1.5707963705062866, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; int num860 = Dust.NewDust(projectile.Center + value39 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default(Color), 1.5f); Dust dust = Main.dust[num860]; dust.velocity *= 0.5f; Main.dust[num860].velocity.Y = -Math.Abs(Main.dust[num860].velocity.Y); return; } } } else if (projectile.frameCounter >= projectile.extraUpdates * 2) { projectile.frameCounter = 0; float num861 = projectile.velocity.Length(); UnifiedRandom unifiedRandom = new UnifiedRandom((int)projectile.ai[1]); int num862 = 0; Vector2 vector97 = -Vector2.UnitY; Vector2 vector98; do { int num863 = unifiedRandom.Next(); projectile.ai[1] = (float)num863; num863 %= 100; float f = (float)num863 / 100f * 6.28318548f; vector98 = f.ToRotationVector2(); if (vector98.Y > 0f) { vector98.Y *= -1f; } bool flag37 = false; if (vector98.Y > -0.02f) { flag37 = true; } if (vector98.X * (float)(projectile.extraUpdates + 1) * 2f * num861 + projectile.localAI[0] > 40f) { flag37 = true; } if (vector98.X * (float)(projectile.extraUpdates + 1) * 2f * num861 + projectile.localAI[0] < -40f) { flag37 = true; } if (!flag37) { goto IL_25086; } num3 = num862; num862 = num3 + 1; }while (num3 < 100); projectile.velocity = Vector2.Zero; projectile.localAI[1] = 1f; goto IL_25092; IL_25086: vector97 = vector98; IL_25092: if (projectile.velocity != Vector2.Zero) { projectile.localAI[0] += vector97.X * (float)(projectile.extraUpdates + 1) * 2f * num861; projectile.velocity = vector97.RotatedBy((double)(projectile.ai[0] + 1.57079637f), default(Vector2)) * num861; projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; return; } } }
public void AI() { if (this.aiStyle == 0) { for (int i = 0; i < 255; i++) { if (Main.player[i].active && Main.player[i].talkNPC == this.whoAmI) { if (this.type == NPCID.BoundGoblin) { this.Transform(107); return; } if (this.type == NPCID.BoundWizard) { this.Transform(108); return; } if (this.type == NPCID.BoundMechanic) { this.Transform(124); return; } if (this.type == NPCID.WebbedStylist) { this.Transform(353); return; } if (this.type == NPCID.SleepingAngler) { this.Transform(369); return; } } } if (this.type != NPCID.SleepingAngler) { this.TargetClosest(true); this.spriteDirection = this.direction; } if (this.type == NPCID.SleepingAngler) { if (this.wet || Main.tile[(int)(base.Center.X / 16f), (int)(this.position.Y - 4f) / 16].liquid > 0) { this.velocity.Y = -0.4f; int num = 1; if (base.Center.X / 16f > (float)(Main.maxTilesX / 2)) { num = -1; } int num2 = 12; int num3 = (int)base.Center.X / 16; int j = (int)base.Center.Y / 16; bool flag = false; if (num > 0) { for (int k = num3; k < num3 + num2; k++) { if (WorldGen.SolidTile(k, j)) { flag = true; } } } else { for (int l = num3; l > num3 - num2; l--) { if (WorldGen.SolidTile(l, j)) { flag = true; } } } if (flag) { this.velocity.X = this.velocity.X * 0.99f; if ((double)this.velocity.X > -0.01 && (double)this.velocity.X < 0.01) { this.velocity.X = 0f; return; } } else { this.velocity.X = this.velocity.X + (float)num * 0.01f; if (this.velocity.X > 0.2f) { this.velocity.X = this.velocity.X * 0.95f; } if (this.velocity.X < -0.2f) { this.velocity.X = this.velocity.X * 0.95f; return; } } } else { this.velocity.X = this.velocity.X * 0.93f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; return; } } } else { this.velocity.X = this.velocity.X * 0.93f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; return; } } } else if (this.aiStyle == 1) { if (this.type == NPCID.BlueSlime && (this.ai[1] == 1f || this.ai[1] == 2f || this.ai[1] == 3f)) { this.ai[1] = -1f; } if (this.type == NPCID.BlueSlime && this.ai[1] == 0f && Main.netMode != 1 && this.value > 0f) { this.ai[1] = -1f; if (Main.rand.Next(20) == 0) { int num4 = Main.rand.Next(4); if (num4 == 0) { num4 = Main.rand.Next(7); if (num4 == 0) { num4 = 290; } else if (num4 == 1) { num4 = 292; } else if (num4 == 2) { num4 = 296; } else if (num4 == 3) { num4 = 2322; } else if (Main.netMode != 0 && Main.rand.Next(2) == 0) { num4 = 2997; } else { num4 = 2350; } } else if (num4 == 1) { num4 = Main.rand.Next(4); if (num4 == 0) { num4 = 8; } else if (num4 == 1) { num4 = 166; } else if (num4 == 2) { num4 = 965; } else { num4 = 58; } } else if (num4 == 2) { if (Main.rand.Next(2) == 0) { num4 = Main.rand.Next(11, 15); } else { num4 = Main.rand.Next(699, 703); } } else { num4 = Main.rand.Next(3); if (num4 == 0) { num4 = 71; } else if (num4 == 1) { num4 = 72; } else { num4 = 73; } } this.ai[1] = (float)num4; this.netUpdate = true; } } if (this.type == NPCID.RainbowSlime) { float num5 = (float)Main.DiscoR / 255f; float num6 = (float)Main.DiscoG / 255f; float num7 = (float)Main.DiscoB / 255f; num5 *= 1f; num6 *= 1f; num7 *= 1f; this.color.R = (byte)Main.DiscoR; this.color.G = (byte)Main.DiscoG; this.color.B = (byte)Main.DiscoB; this.color.A = 100; this.alpha = 175; } bool flag2 = false; if (!Main.dayTime || this.life != this.lifeMax || (double)this.position.Y > Main.worldSurface * 16.0 || Main.slimeRain) { flag2 = true; } if (this.type == NPCID.CorruptSlime) { flag2 = true; } if ((this.type == NPCID.Grasshopper || this.type == NPCID.GoldGrasshopper) && this.target != 255 && !Main.player[this.target].dead && Vector2.Distance(base.Center, Main.player[this.target].Center) <= 200f) { flag2 = true; } if (this.type == NPCID.Crimslime) { flag2 = true; } if (this.type == NPCID.HoppinJack) { flag2 = true; } if (this.type == NPCID.IceSlime && Main.rand.Next(10) == 0) { } if (this.type == NPCID.RainbowSlime) { flag2 = true; this.ai[0] += 2f; } if (this.type == NPCID.SpikedIceSlime) { flag2 = true; if (this.localAI[0] > 0f) { this.localAI[0] -= 1f; } if (!this.wet && !Main.player[this.target].npcTypeNoAggro[this.type]) { Vector2 vector = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num11 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector.X; float num12 = Main.player[this.target].position.Y - vector.Y; float num13 = (float)Math.Sqrt((double)(num11 * num11 + num12 * num12)); if (Main.expertMode && num13 < 120f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height) && this.velocity.Y == 0f) { this.ai[0] = -40f; if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.9f; } if (Main.netMode != 1 && this.localAI[0] == 0f) { for (int m = 0; m < 5; m++) { Vector2 vector2 = new Vector2((float)(m - 2), -4f); vector2.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; vector2.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; vector2.Normalize(); vector2 *= 4f + (float)Main.rand.Next(-50, 51) * 0.01f; Projectile.NewProjectile(vector.X, vector.Y, vector2.X, vector2.Y, 174, 9, 0f, Main.myPlayer, 0f, 0f); this.localAI[0] = 30f; } } } else if (num13 < 200f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height) && this.velocity.Y == 0f) { this.ai[0] = -40f; if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.9f; } if (Main.netMode != 1 && this.localAI[0] == 0f) { num12 = Main.player[this.target].position.Y - vector.Y - (float)Main.rand.Next(0, 200); num13 = (float)Math.Sqrt((double)(num11 * num11 + num12 * num12)); num13 = 4.5f / num13; num11 *= num13; num12 *= num13; this.localAI[0] = 50f; Projectile.NewProjectile(vector.X, vector.Y, num11, num12, 174, 9, 0f, Main.myPlayer, 0f, 0f); } } } } if (this.type == NPCID.SlimeSpiked) { flag2 = true; if (this.localAI[0] > 0f) { this.localAI[0] -= 1f; } if (!this.wet && !Main.player[this.target].npcTypeNoAggro[this.type]) { Vector2 vector3 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num14 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector3.X; float num15 = Main.player[this.target].position.Y - vector3.Y; float num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); if (Main.expertMode && num16 < 120f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height) && this.velocity.Y == 0f) { this.ai[0] = -40f; if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.9f; } if (Main.netMode != 1 && this.localAI[0] == 0f) { for (int n = 0; n < 5; n++) { Vector2 vector4 = new Vector2((float)(n - 2), -4f); vector4.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; vector4.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; vector4.Normalize(); vector4 *= 4f + (float)Main.rand.Next(-50, 51) * 0.01f; Projectile.NewProjectile(vector3.X, vector3.Y, vector4.X, vector4.Y, 605, 9, 0f, Main.myPlayer, 0f, 0f); this.localAI[0] = 30f; } } } else if (num16 < 200f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height) && this.velocity.Y == 0f) { this.ai[0] = -40f; if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.9f; } if (Main.netMode != 1 && this.localAI[0] == 0f) { num15 = Main.player[this.target].position.Y - vector3.Y - (float)Main.rand.Next(0, 200); num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); num16 = 4.5f / num16; num14 *= num16; num15 *= num16; this.localAI[0] = 50f; Projectile.NewProjectile(vector3.X, vector3.Y, num14, num15, 605, 9, 0f, Main.myPlayer, 0f, 0f); } } } } if (this.type == NPCID.SpikedJungleSlime) { flag2 = true; if (this.localAI[0] > 0f) { this.localAI[0] -= 1f; } if (!this.wet && !Main.player[this.target].npcTypeNoAggro[this.type]) { Vector2 vector5 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num17 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector5.X; float num18 = Main.player[this.target].position.Y - vector5.Y; float num19 = (float)Math.Sqrt((double)(num17 * num17 + num18 * num18)); if (Main.expertMode && num19 < 200f && Collision.CanHit(new Vector2(this.position.X, this.position.Y - 20f), this.width, this.height + 20, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height) && this.velocity.Y == 0f) { this.ai[0] = -40f; if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.9f; } if (Main.netMode != 1 && this.localAI[0] == 0f) { for (int num20 = 0; num20 < 5; num20++) { Vector2 vector6 = new Vector2((float)(num20 - 2), -2f); vector6.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.02f; vector6.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.02f; vector6.Normalize(); vector6 *= 3f + (float)Main.rand.Next(-50, 51) * 0.01f; Projectile.NewProjectile(vector5.X, vector5.Y, vector6.X, vector6.Y, 176, 13, 0f, Main.myPlayer, 0f, 0f); this.localAI[0] = 80f; } } } if (num19 < 400f && Collision.CanHit(new Vector2(this.position.X, this.position.Y - 20f), this.width, this.height + 20, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height) && this.velocity.Y == 0f) { this.ai[0] = -80f; if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.9f; } if (Main.netMode != 1 && this.localAI[0] == 0f) { num18 = Main.player[this.target].position.Y - vector5.Y - (float)Main.rand.Next(-30, 20); num18 -= num19 * 0.05f; num17 = Main.player[this.target].position.X - vector5.X - (float)Main.rand.Next(-20, 20); num19 = (float)Math.Sqrt((double)(num17 * num17 + num18 * num18)); num19 = 7f / num19; num17 *= num19; num18 *= num19; this.localAI[0] = 65f; Projectile.NewProjectile(vector5.X, vector5.Y, num17, num18, 176, 13, 0f, Main.myPlayer, 0f, 0f); } } } } if (this.type == NPCID.Grasshopper || this.type == NPCID.GoldGrasshopper) { if (this.localAI[2] < 90f) { this.localAI[2] += 1f; } else { this.friendly = false; } } if (this.type == NPCID.LavaSlime) { } if (this.ai[2] > 1f) { this.ai[2] -= 1f; } if (this.wet) { if (this.collideY) { this.velocity.Y = -2f; } if (this.velocity.Y < 0f && this.ai[3] == this.position.X) { this.direction *= -1; this.ai[2] = 200f; } if (this.velocity.Y > 0f) { this.ai[3] = this.position.X; } if (this.type == NPCID.LavaSlime) { if (this.velocity.Y > 2f) { this.velocity.Y = this.velocity.Y * 0.9f; } else if (this.directionY < 0) { this.velocity.Y = this.velocity.Y - 0.8f; } this.velocity.Y = this.velocity.Y - 0.5f; if (this.velocity.Y < -10f) { this.velocity.Y = -10f; } } else { if (this.velocity.Y > 2f) { this.velocity.Y = this.velocity.Y * 0.9f; } this.velocity.Y = this.velocity.Y - 0.5f; if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } } if (this.ai[2] == 1f && flag2) { this.TargetClosest(true); } } this.aiAction = 0; if (this.ai[2] == 0f) { this.ai[0] = -100f; this.ai[2] = 1f; this.TargetClosest(true); } if (this.velocity.Y == 0f) { if (this.ai[3] == this.position.X) { this.direction *= -1; this.ai[2] = 200f; } this.ai[3] = 0f; this.velocity.X = this.velocity.X * 0.8f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } if (flag2) { this.ai[0] += 1f; } this.ai[0] += 1f; if (this.type == NPCID.LavaSlime) { this.ai[0] += 2f; } if (this.type == NPCID.DungeonSlime) { this.ai[0] += 3f; } if (this.type == NPCID.IlluminantSlime) { this.ai[0] += 2f; } if (this.type == NPCID.Crimslime) { this.ai[0] += 1f; } if (this.type == NPCID.HoppinJack) { float num22 = (float)((1 - this.life / this.lifeMax) * 10); this.ai[0] += num22; } if (this.type == NPCID.Grasshopper || this.type == NPCID.GoldGrasshopper) { this.ai[0] += 3f; } if (this.type == NPCID.CorruptSlime) { if (this.scale >= 0f) { this.ai[0] += 4f; } else { this.ai[0] += 1f; } } int num23 = 0; if (this.ai[0] >= 0f) { num23 = 1; } if (this.ai[0] >= -1000f && this.ai[0] <= -500f) { num23 = 2; } if (this.ai[0] >= -2000f && this.ai[0] <= -1500f) { num23 = 3; } if (num23 > 0) { this.netUpdate = true; if (flag2 && this.ai[2] == 1f) { this.TargetClosest(true); } if (num23 == 3) { this.velocity.Y = -8f; if (this.type == NPCID.LavaSlime) { this.velocity.Y = this.velocity.Y - 2f; } this.velocity.X = this.velocity.X + (float)(3 * this.direction); if (this.type == NPCID.LavaSlime) { this.velocity.X = this.velocity.X + 0.5f * (float)this.direction; } this.ai[0] = -200f; this.ai[3] = this.position.X; } else { this.velocity.Y = -6f; this.velocity.X = this.velocity.X + (float)(2 * this.direction); if (this.type == NPCID.LavaSlime) { this.velocity.X = this.velocity.X + (float)(2 * this.direction); } this.ai[0] = -120f; if (num23 == 1) { this.ai[0] -= 1000f; } else { this.ai[0] -= 2000f; } } if (this.type == NPCID.ToxicSludge) { this.velocity.Y = this.velocity.Y * 1.3f; this.velocity.X = this.velocity.X * 1.2f; } if (this.type == NPCID.Grasshopper || this.type == NPCID.GoldGrasshopper) { this.velocity.Y = this.velocity.Y * 0.9f; this.velocity.X = this.velocity.X * 0.6f; if (flag2) { this.direction = -this.direction; this.velocity.X = this.velocity.X * -1f; return; } } } else if (this.ai[0] >= -30f) { this.aiAction = 1; return; } } else if (this.target < 255 && ((this.direction == 1 && this.velocity.X < 3f) || (this.direction == -1 && this.velocity.X > -3f))) { if ((this.direction == -1 && (double)this.velocity.X < 0.1) || (this.direction == 1 && (double)this.velocity.X > -0.1)) { this.velocity.X = this.velocity.X + 0.2f * (float)this.direction; return; } this.velocity.X = this.velocity.X * 0.93f; return; } } else if (this.aiStyle == 2) { if ((this.type == NPCID.PigronCorruption || this.type == NPCID.PigronHallow || this.type == NPCID.PigronCrimson) && Main.rand.Next(1000) == 0) { } this.noGravity = true; if (!this.noTileCollide) { if (this.collideX) { this.velocity.X = this.oldVelocity.X * -0.5f; if (this.direction == -1 && this.velocity.X > 0f && this.velocity.X < 2f) { this.velocity.X = 2f; } if (this.direction == 1 && this.velocity.X < 0f && this.velocity.X > -2f) { this.velocity.X = -2f; } } if (this.collideY) { this.velocity.Y = this.oldVelocity.Y * -0.5f; if (this.velocity.Y > 0f && this.velocity.Y < 1f) { this.velocity.Y = 1f; } if (this.velocity.Y < 0f && this.velocity.Y > -1f) { this.velocity.Y = -1f; } } } if (Main.dayTime && (double)this.position.Y <= Main.worldSurface * 16.0 && (this.type == NPCID.DemonEye || this.type == NPCID.WanderingEye || this.type == NPCID.CataractEye || this.type == NPCID.SleepyEye || this.type == NPCID.DialatedEye || this.type == NPCID.GreenEye || this.type == NPCID.PurpleEye || this.type == NPCID.DemonEyeOwl || this.type == NPCID.DemonEyeSpaceship)) { if (this.timeLeft > 10) { this.timeLeft = 10; } this.directionY = -1; if (this.velocity.Y > 0f) { this.direction = 1; } this.direction = -1; if (this.velocity.X > 0f) { this.direction = 1; } } else { this.TargetClosest(true); } if (this.type == NPCID.PigronCorruption || this.type == NPCID.PigronHallow || this.type == NPCID.PigronCrimson) { if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { if (this.ai[1] > 0f && !Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[1] = 0f; this.ai[0] = 0f; this.netUpdate = true; } } else if (this.ai[1] == 0f) { this.ai[0] += 1f; } if (this.ai[0] >= 300f) { this.ai[1] = 1f; this.ai[0] = 0f; this.netUpdate = true; } if (this.ai[1] == 0f) { this.alpha = 0; this.noTileCollide = false; } else { this.wet = false; this.alpha = 200; this.noTileCollide = true; } this.rotation = this.velocity.Y * 0.1f * (float)this.direction; this.TargetClosest(true); if (this.direction == -1 && this.velocity.X > -4f && this.position.X > Main.player[this.target].position.X + (float)Main.player[this.target].width) { this.velocity.X = this.velocity.X - 0.08f; if (this.velocity.X > 4f) { this.velocity.X = this.velocity.X - 0.04f; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X - 0.2f; } if (this.velocity.X < -4f) { this.velocity.X = -4f; } } else if (this.direction == 1 && this.velocity.X < 4f && this.position.X + (float)this.width < Main.player[this.target].position.X) { this.velocity.X = this.velocity.X + 0.08f; if (this.velocity.X < -4f) { this.velocity.X = this.velocity.X + 0.04f; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X + 0.2f; } if (this.velocity.X > 4f) { this.velocity.X = 4f; } } if (this.directionY == -1 && (double)this.velocity.Y > -2.5 && this.position.Y > Main.player[this.target].position.Y + (float)Main.player[this.target].height) { this.velocity.Y = this.velocity.Y - 0.1f; if ((double)this.velocity.Y > 2.5) { this.velocity.Y = this.velocity.Y - 0.05f; } else if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y - 0.15f; } if ((double)this.velocity.Y < -2.5) { this.velocity.Y = -2.5f; } } else if (this.directionY == 1 && (double)this.velocity.Y < 2.5 && this.position.Y + (float)this.height < Main.player[this.target].position.Y) { this.velocity.Y = this.velocity.Y + 0.1f; if ((double)this.velocity.Y < -2.5) { this.velocity.Y = this.velocity.Y + 0.05f; } else if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y + 0.15f; } if ((double)this.velocity.Y > 2.5) { this.velocity.Y = 2.5f; } } } else if (this.type == NPCID.TheHungryII) { this.TargetClosest(true); if (this.direction == -1 && this.velocity.X > -6f) { this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > 6f) { this.velocity.X = this.velocity.X - 0.1f; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X - 0.2f; } if (this.velocity.X < -6f) { this.velocity.X = -6f; } } else if (this.direction == 1 && this.velocity.X < 6f) { this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -6f) { this.velocity.X = this.velocity.X + 0.1f; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X + 0.2f; } if (this.velocity.X > 6f) { this.velocity.X = 6f; } } if (this.directionY == -1 && (double)this.velocity.Y > -2.5) { this.velocity.Y = this.velocity.Y - 0.04f; if ((double)this.velocity.Y > 2.5) { this.velocity.Y = this.velocity.Y - 0.05f; } else if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y - 0.15f; } if ((double)this.velocity.Y < -2.5) { this.velocity.Y = -2.5f; } } else if (this.directionY == 1 && (double)this.velocity.Y < 1.5) { this.velocity.Y = this.velocity.Y + 0.04f; if ((double)this.velocity.Y < -2.5) { this.velocity.Y = this.velocity.Y + 0.05f; } else if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y + 0.15f; } if ((double)this.velocity.Y > 2.5) { this.velocity.Y = 2.5f; } } } else if (this.type == NPCID.WanderingEye) { if ((double)this.life < (double)this.lifeMax * 0.5) { if (this.direction == -1 && this.velocity.X > -6f) { this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > 6f) { this.velocity.X = this.velocity.X - 0.1f; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X + 0.05f; } if (this.velocity.X < -6f) { this.velocity.X = -6f; } } else if (this.direction == 1 && this.velocity.X < 6f) { this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -6f) { this.velocity.X = this.velocity.X + 0.1f; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X - 0.05f; } if (this.velocity.X > 6f) { this.velocity.X = 6f; } } if (this.directionY == -1 && this.velocity.Y > -4f) { this.velocity.Y = this.velocity.Y - 0.1f; if (this.velocity.Y > 4f) { this.velocity.Y = this.velocity.Y - 0.1f; } else if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y + 0.05f; } if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } } else if (this.directionY == 1 && this.velocity.Y < 4f) { this.velocity.Y = this.velocity.Y + 0.1f; if (this.velocity.Y < -4f) { this.velocity.Y = this.velocity.Y + 0.1f; } else if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y - 0.05f; } if (this.velocity.Y > 4f) { this.velocity.Y = 4f; } } } else { if (this.direction == -1 && this.velocity.X > -4f) { this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > 4f) { this.velocity.X = this.velocity.X - 0.1f; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X + 0.05f; } if (this.velocity.X < -4f) { this.velocity.X = -4f; } } else if (this.direction == 1 && this.velocity.X < 4f) { this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -4f) { this.velocity.X = this.velocity.X + 0.1f; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X - 0.05f; } if (this.velocity.X > 4f) { this.velocity.X = 4f; } } if (this.directionY == -1 && (double)this.velocity.Y > -1.5) { this.velocity.Y = this.velocity.Y - 0.04f; if ((double)this.velocity.Y > 1.5) { this.velocity.Y = this.velocity.Y - 0.05f; } else if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y + 0.03f; } if ((double)this.velocity.Y < -1.5) { this.velocity.Y = -1.5f; } } else if (this.directionY == 1 && (double)this.velocity.Y < 1.5) { this.velocity.Y = this.velocity.Y + 0.04f; if ((double)this.velocity.Y < -1.5) { this.velocity.Y = this.velocity.Y + 0.05f; } else if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y - 0.03f; } if ((double)this.velocity.Y > 1.5) { this.velocity.Y = 1.5f; } } } } else { float num25 = 4f; float num26 = 1.5f; num25 *= 1f + (1f - this.scale); num26 *= 1f + (1f - this.scale); if (this.direction == -1 && this.velocity.X > -num25) { this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > num25) { this.velocity.X = this.velocity.X - 0.1f; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X + 0.05f; } if (this.velocity.X < -num25) { this.velocity.X = -num25; } } else if (this.direction == 1 && this.velocity.X < num25) { this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -num25) { this.velocity.X = this.velocity.X + 0.1f; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X - 0.05f; } if (this.velocity.X > num25) { this.velocity.X = num25; } } if (this.directionY == -1 && this.velocity.Y > -num26) { this.velocity.Y = this.velocity.Y - 0.04f; if (this.velocity.Y > num26) { this.velocity.Y = this.velocity.Y - 0.05f; } else if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y + 0.03f; } if (this.velocity.Y < -num26) { this.velocity.Y = -num26; } } else if (this.directionY == 1 && this.velocity.Y < num26) { this.velocity.Y = this.velocity.Y + 0.04f; if (this.velocity.Y < -num26) { this.velocity.Y = this.velocity.Y + 0.05f; } else if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y - 0.03f; } if (this.velocity.Y > num26) { this.velocity.Y = num26; } } } if ((this.type == NPCID.DemonEye || this.type == NPCID.WanderingEye || this.type == NPCID.CataractEye || this.type == NPCID.SleepyEye || this.type == NPCID.DialatedEye || this.type == NPCID.GreenEye || this.type == NPCID.PurpleEye) && Main.rand.Next(40) == 0) { } if (this.wet && this.type != NPCID.PigronCorruption && this.type != NPCID.PigronHallow && this.type != NPCID.RuneWizard) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.95f; } this.velocity.Y = this.velocity.Y - 0.5f; if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } this.TargetClosest(true); return; } } else if (this.aiStyle == 3) { if (this.type == NPCID.Psycho) { int num28 = 200; if (this.ai[2] == 0f) { this.alpha = num28; this.TargetClosest(true); if (!Main.player[this.target].dead && (Main.player[this.target].Center - base.Center).Length() < 170f) { this.ai[2] = -16f; } if (this.velocity.X != 0f || this.velocity.Y < 0f || this.velocity.Y > 2f || this.justHit) { this.ai[2] = -16f; } return; } if (this.ai[2] < 0f) { if (this.alpha > 0) { this.alpha -= num28 / 16; if (this.alpha < 0) { this.alpha = 0; } } this.ai[2] += 1f; if (this.ai[2] == 0f) { this.ai[2] = 1f; this.velocity.X = (float)(this.direction * 2); } return; } this.alpha = 0; } if (this.type == NPCID.SwampThing) { if (Main.netMode != 1 && Main.rand.Next(240) == 0) { this.ai[2] = (float)Main.rand.Next(-480, -60); this.netUpdate = true; } if (this.ai[2] < 0f) { this.TargetClosest(true); if (this.justHit) { this.ai[2] = 0f; } if (Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[2] = 0f; } } if (this.ai[2] < 0f) { this.velocity.X = this.velocity.X * 0.9f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } this.ai[2] += 1f; if (this.ai[2] == 0f) { this.velocity.X = (float)this.direction * 0.1f; } return; } } if (this.type == NPCID.CreatureFromTheDeep) { if (this.wet) { this.knockBackResist = 0f; this.ai[3] = -0.10101f; this.noGravity = true; Vector2 center = base.Center; this.width = 34; this.height = 24; this.position.X = center.X - (float)(this.width / 2); this.position.Y = center.Y - (float)(this.height / 2); this.TargetClosest(true); if (this.collideX) { this.velocity.X = -this.oldVelocity.X; } if (this.velocity.X < 0f) { this.direction = -1; } if (this.velocity.X > 0f) { this.direction = 1; } if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].Center, 1, 1)) { Vector2 value = Main.player[this.target].Center - base.Center; value.Normalize(); value *= 5f; this.velocity = (this.velocity * 19f + value) / 20f; return; } float num29 = 5f; if (this.velocity.Y > 0f) { num29 = 3f; } if (this.velocity.Y < 0f) { num29 = 8f; } Vector2 value2 = new Vector2((float)this.direction, -1f); value2.Normalize(); value2 *= num29; if (num29 < 5f) { this.velocity = (this.velocity * 24f + value2) / 25f; return; } this.velocity = (this.velocity * 9f + value2) / 10f; return; } else { this.knockBackResist = 0.4f * Main.knockBackMultiplier; this.noGravity = false; Vector2 center2 = base.Center; this.width = 18; this.height = 40; this.position.X = center2.X - (float)(this.width / 2); this.position.Y = center2.Y - (float)(this.height / 2); if (this.ai[3] == -0.10101f) { this.ai[3] = 0f; float num30 = this.velocity.Length(); num30 *= 2f; if (num30 > 10f) { num30 = 10f; } this.velocity.Normalize(); this.velocity *= num30; if (this.velocity.X < 0f) { this.direction = -1; } if (this.velocity.X > 0f) { this.direction = 1; } this.spriteDirection = this.direction; } } } if (this.type == NPCID.CultistArcherBlue || this.type == NPCID.CultistArcherWhite) { if (this.ai[3] < 0f) { this.damage = 0; this.velocity.X = this.velocity.X * 0.93f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } int num31 = (int)(-this.ai[3] - 1f); int num32 = Math.Sign(Main.npc[num31].Center.X - base.Center.X); if (num32 != this.direction) { this.velocity.X = 0f; this.direction = num32; this.netUpdate = true; } if (this.justHit && Main.netMode != 1 && Main.npc[num31].localAI[0] == 0f) { Main.npc[num31].localAI[0] = 1f; } if (this.ai[0] < 1000f) { this.ai[0] = 1000f; } if ((this.ai[0] += 1f) >= 1300f) { this.ai[0] = 1000f; this.netUpdate = true; } return; } if (this.ai[0] >= 1000f) { this.ai[0] = 0f; } this.damage = this.defDamage; } if (this.type == NPCID.MartianOfficer && this.ai[2] == 0f && this.localAI[0] == 0f && Main.netMode != 1) { int num33 = NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 384, this.whoAmI, 0f, 0f, 0f, 0f, 255); this.ai[2] = (float)(num33 + 1); this.localAI[0] = -1f; this.netUpdate = true; Main.npc[num33].ai[0] = (float)this.whoAmI; Main.npc[num33].netUpdate = true; } if (this.type == NPCID.MartianOfficer) { int num34 = (int)this.ai[2] - 1; if (num34 != -1 && Main.npc[num34].active && Main.npc[num34].type == NPCID.ForceBubble) { this.dontTakeDamage = true; } else { this.dontTakeDamage = false; this.ai[2] = 0f; if (this.localAI[0] == -1f) { this.localAI[0] = 180f; } if (this.localAI[0] > 0f) { this.localAI[0] -= 1f; } } } if (this.type == NPCID.GraniteGolem) { int num35 = 300; int num36 = 120; this.dontTakeDamage = false; if (this.ai[2] < 0f) { this.dontTakeDamage = true; this.ai[2] += 1f; this.velocity.X = this.velocity.X * 0.9f; if ((double)Math.Abs(this.velocity.X) < 0.001) { this.velocity.X = 0.001f * (float)this.direction; } if (Math.Abs(this.velocity.Y) > 1f) { this.ai[2] += 10f; } if (this.ai[2] >= 0f) { this.netUpdate = true; this.velocity.X = this.velocity.X + (float)this.direction * 0.3f; } return; } if (this.ai[2] < (float)num35) { if (this.justHit) { this.ai[2] += 15f; } this.ai[2] += 1f; } else if (this.velocity.Y == 0f) { this.ai[2] = (float)(-(float)num36); this.netUpdate = true; } } if (this.type == NPCID.Medusa) { int num37 = 180; int num38 = 300; int num39 = 180; int num40 = 60; int num41 = 20; if (this.life < this.lifeMax / 3) { num37 = 120; num38 = 240; num39 = 240; num40 = 90; } if (this.ai[2] > 0f) { this.ai[2] -= 1f; } else if (this.ai[2] == 0f) { if (((Main.player[this.target].Center.X < base.Center.X && this.direction < 0) || (Main.player[this.target].Center.X > base.Center.X && this.direction > 0)) && this.velocity.Y == 0f && base.Distance(Main.player[this.target].Center) < 900f && Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[2] = (float)(-(float)num39 - num41); this.netUpdate = true; } } else { if (this.ai[2] < 0f && this.ai[2] < (float)(-(float)num39)) { this.velocity.X = this.velocity.X * 0.9f; if (this.velocity.Y < -2f || this.velocity.Y > 4f || this.justHit) { this.ai[2] = (float)num37; } else { this.ai[2] += 1f; if (this.ai[2] == 0f) { this.ai[2] = (float)num38; } } float num42 = this.ai[2] + (float)num39 + (float)num41; if (num42 == 1f) { } if (num42 < (float)num41) { } return; } if (this.ai[2] < 0f && this.ai[2] >= (float)(-(float)num39)) { this.velocity.X = this.velocity.X * 0.9f; if (this.velocity.Y < -2f || this.velocity.Y > 4f || this.justHit) { this.ai[2] = (float)num37; } else { this.ai[2] += 1f; if (this.ai[2] == 0f) { this.ai[2] = (float)num38; } } float num44 = this.ai[2] + (float)num39; if (num44 < 180f && (Main.rand.Next(3) == 0 || this.ai[2] % 3f == 0f)) { } if (Main.netMode != 2) { Player player = Main.player[Main.myPlayer]; int arg_44C1_0 = Main.myPlayer; if (!player.dead && player.active && player.HasBuff(BuffID.Stoned) == -1 && (player.Center - base.Center).Length() < 700f && ((player.Center.X < base.Center.X && this.direction < 0 && player.direction > 0) || (player.Center.X > base.Center.X && this.direction > 0 && player.direction < 0))) { bool flag3 = Collision.CanHitLine(base.Center, 1, 1, player.Center, 1, 1) || Collision.CanHitLine(base.Center - Vector2.UnitY * 16f, 1, 1, player.Center, 1, 1) || Collision.CanHitLine(base.Center + Vector2.UnitY * 8f, 1, 1, player.Center, 1, 1); if (flag3) { player.AddBuff(BuffID.Stoned, num40 + (int)this.ai[2] * -1, true); } } } return; } } } if (this.type == NPCID.GoblinSummoner) { if (this.ai[3] < 0f) { this.knockBackResist = 0f; this.defense = (int)((double)this.defDefense * 1.1); this.noGravity = true; this.noTileCollide = true; if (this.velocity.X < 0f) { this.direction = -1; } else if (this.velocity.X > 0f) { this.direction = 1; } this.rotation = this.velocity.X * 0.1f; if (Main.netMode != 1) { this.localAI[3] += 1f; if (this.localAI[3] > (float)Main.rand.Next(20, 180)) { this.localAI[3] = 0f; Vector2 value3 = base.Center; value3 += this.velocity; NPC.NewNPC((int)value3.X, (int)value3.Y, 30, 0, 0f, 0f, 0f, 0f, 255); } } } else { this.localAI[3] = 0f; this.knockBackResist = 0.35f * Main.knockBackMultiplier; this.rotation *= 0.9f; this.defense = this.defDefense; this.noGravity = false; this.noTileCollide = false; } if (this.ai[3] == 1f) { this.knockBackResist = 0f; this.defense += 10; } if (this.ai[3] == -1f) { this.TargetClosest(true); float num46 = 8f; float num47 = 40f; Vector2 value4 = Main.player[this.target].Center - base.Center; float num48 = value4.Length(); num46 += num48 / 200f; value4.Normalize(); value4 *= num46; this.velocity = (this.velocity * (num47 - 1f) + value4) / num47; if (num48 < 500f && !Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[3] = 0f; this.ai[2] = 0f; } return; } if (this.ai[3] == -2f) { this.velocity.Y = this.velocity.Y - 0.2f; if (this.velocity.Y < -10f) { this.velocity.Y = -10f; } if (Main.player[this.target].Center.Y - base.Center.Y > 200f) { this.TargetClosest(true); this.ai[3] = -3f; if (Main.player[this.target].Center.X > base.Center.X) { this.ai[2] = 1f; } else { this.ai[2] = -1f; } } this.velocity.X = this.velocity.X * 0.99f; return; } if (this.ai[3] == -3f) { if (this.direction == 0) { this.TargetClosest(true); } if (this.ai[2] == 0f) { this.ai[2] = (float)this.direction; } this.velocity.Y = this.velocity.Y * 0.9f; this.velocity.X = this.velocity.X + this.ai[2] * 0.3f; if (this.velocity.X > 10f) { this.velocity.X = 10f; } if (this.velocity.X < -10f) { this.velocity.X = -10f; } float num49 = Main.player[this.target].Center.X - base.Center.X; if ((this.ai[2] < 0f && num49 > 300f) || (this.ai[2] > 0f && num49 < -300f)) { this.ai[3] = -4f; this.ai[2] = 0f; return; } if (Math.Abs(num49) > 800f) { this.ai[3] = -1f; this.ai[2] = 0f; } return; } else { if (this.ai[3] == -4f) { this.ai[2] += 1f; this.velocity.Y = this.velocity.Y + 0.1f; if (this.velocity.Length() > 4f) { this.velocity *= 0.9f; } int num50 = (int)base.Center.X / 16; int num51 = (int)(this.position.Y + (float)this.height + 12f) / 16; bool flag4 = false; for (int num52 = num50 - 1; num52 <= num50 + 1; num52++) { if (Main.tile[num52, num51] == null) { Main.tile[num50, num51] = new Tile(); } if (Main.tile[num52, num51].active() && Main.tileSolid[(int)Main.tile[num52, num51].type]) { flag4 = true; } } if (flag4 && !Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[3] = 0f; this.ai[2] = 0f; } else if (this.ai[2] > 300f || base.Center.Y > Main.player[this.target].Center.Y + 200f) { this.ai[3] = -1f; this.ai[2] = 0f; } } else { if (this.ai[3] == 1f) { Vector2 center3 = base.Center; center3.Y -= 70f; this.velocity.X = this.velocity.X * 0.8f; this.ai[2] += 1f; if (this.ai[2] == 60f) { if (Main.netMode != 1) { NPC.NewNPC((int)center3.X, (int)center3.Y + 18, 472, 0, 0f, 0f, 0f, 0f, 255); } } else if (this.ai[2] >= 90f) { this.ai[3] = -2f; this.ai[2] = 0f; } return; } this.ai[2] += 1f; int num55 = 10; if (this.velocity.Y == 0f && NPC.CountNPCS(472) < num55) { if (this.ai[2] >= 180f) { this.ai[2] = 0f; this.ai[3] = 1f; } } else { if (NPC.CountNPCS(472) >= num55) { this.ai[2] += 1f; } if (this.ai[2] >= 360f) { this.ai[2] = 0f; this.ai[3] = -2f; this.velocity.Y = this.velocity.Y - 3f; } } if (this.target >= 0 && !Main.player[this.target].dead && (Main.player[this.target].Center - base.Center).Length() > 800f) { this.ai[3] = -1f; this.ai[2] = 0f; } } if (Main.player[this.target].dead) { this.TargetClosest(true); if (Main.player[this.target].dead && this.timeLeft > 1) { this.timeLeft = 1; } } } } if (this.type == NPCID.SolarSolenian) { this.reflectingProjectiles = false; this.takenDamageMultiplier = 1f; int num56 = 6; int num57 = 10; float scaleFactor3 = 16f; if (this.ai[2] > 0f) { this.ai[2] -= 1f; } if (this.ai[2] == 0f) { if (((Main.player[this.target].Center.X < base.Center.X && this.direction < 0) || (Main.player[this.target].Center.X > base.Center.X && this.direction > 0)) && Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[2] = -1f; this.netUpdate = true; this.TargetClosest(true); } } else { if (this.ai[2] < 0f && this.ai[2] > (float)(-(float)num56)) { this.ai[2] -= 1f; this.velocity.X = this.velocity.X * 0.9f; return; } if (this.ai[2] == (float)(-(float)num56)) { this.ai[2] -= 1f; this.TargetClosest(true); Vector2 vec = base.DirectionTo(Main.player[this.target].Top + new Vector2(0f, -30f)); if (vec.HasNaNs()) { vec = Vector2.Normalize(new Vector2((float)this.spriteDirection, -1f)); } this.velocity = vec * scaleFactor3; this.netUpdate = true; return; } if (this.ai[2] < (float)(-(float)num56)) { this.ai[2] -= 1f; if (this.velocity.Y == 0f) { this.ai[2] = 60f; } else if (this.ai[2] < (float)(-(float)num56 - num57)) { this.velocity.Y = this.velocity.Y + 0.15f; if (this.velocity.Y > 24f) { this.velocity.Y = 24f; } } this.reflectingProjectiles = true; this.takenDamageMultiplier = 3f; if (this.justHit) { this.ai[2] = 60f; this.netUpdate = true; } return; } } } if (this.type == NPCID.SolarDrakomire) { int num58 = 42; int num59 = 18; if (this.justHit) { this.ai[2] = 120f; this.netUpdate = true; } if (this.ai[2] > 0f) { this.ai[2] -= 1f; } if (this.ai[2] == 0f) { int num60 = 0; for (int num61 = 0; num61 < 200; num61++) { if (Main.npc[num61].active && Main.npc[num61].type == NPCID.SolarFlare) { num60++; } } if (num60 > 6) { this.ai[2] = 90f; } else if (((Main.player[this.target].Center.X < base.Center.X && this.direction < 0) || (Main.player[this.target].Center.X > base.Center.X && this.direction > 0)) && Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[2] = -1f; this.netUpdate = true; this.TargetClosest(true); } } else if (this.ai[2] < 0f && this.ai[2] > (float)(-(float)num58)) { this.ai[2] -= 1f; if (this.ai[2] == (float)(-(float)num58)) { this.ai[2] = (float)(180 + 30 * Main.rand.Next(10)); } this.velocity.X = this.velocity.X * 0.8f; if (this.ai[2] == (float)(-(float)num59) || this.ai[2] == (float)(-(float)num59 - 8) || this.ai[2] == (float)(-(float)num59 - 16)) { if (this.velocity.X > -0.5f && this.velocity.X < 0.5f) { this.velocity.X = 0f; } if (Main.netMode != 1) { NPC.NewNPC((int)base.Center.X + this.spriteDirection * 45, (int)base.Center.Y + 8, 516, 0, 0f, 0f, 0f, 0f, this.target); } } return; } } if (this.type == NPCID.VortexLarva) { this.localAI[0] += 1f; if (this.localAI[0] >= 300f) { int num63 = (int)base.Center.X / 16 - 1; int num64 = (int)base.Center.Y / 16 - 1; if (!Collision.SolidTiles(num63, num63 + 2, num64, num64 + 1) && Main.netMode != 1) { this.Transform(427); this.life = this.lifeMax; this.localAI[0] = 0f; return; } } } if (this.type == NPCID.VortexHornet) { this.localAI[0] += 1f; this.localAI[0] += Math.Abs(this.velocity.X) / 2f; if (this.localAI[0] >= 1200f && Main.netMode != 1) { int num65 = (int)base.Center.X / 16 - 2; int num66 = (int)base.Center.Y / 16 - 3; if (!Collision.SolidTiles(num65, num65 + 4, num66, num66 + 4)) { this.Transform(426); this.life = this.lifeMax; this.localAI[0] = 0f; return; } } } bool flag5 = false; if (this.velocity.X == 0f) { flag5 = true; } if (this.justHit) { flag5 = false; } if (Main.netMode != 1 && this.type == NPCID.Lihzahrd && (double)this.life <= (double)this.lifeMax * 0.55) { this.Transform(199); } if (Main.netMode != 1 && this.type == NPCID.Nutcracker && (double)this.life <= (double)this.lifeMax * 0.55) { this.Transform(349); } int num67 = 60; if (this.type == NPCID.ChaosElemental) { num67 = 180; if (this.ai[3] == -120f) { this.velocity *= 0f; this.ai[3] = 0f; Vector2 vector14 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num68 = this.oldPos[2].X + (float)this.width * 0.5f - vector14.X; float num69 = this.oldPos[2].Y + (float)this.height * 0.5f - vector14.Y; float num70 = (float)Math.Sqrt((double)(num68 * num68 + num69 * num69)); num70 = 2f / num70; num68 *= num70; num69 *= num70; } } bool flag6 = false; bool flag7 = true; if (this.type == NPCID.Yeti || this.type == NPCID.CorruptBunny || this.type == NPCID.Crab || this.type == NPCID.Clown || this.type == NPCID.SkeletonArcher || this.type == NPCID.GoblinArcher || this.type == NPCID.ChaosElemental || this.type == NPCID.BlackRecluse || this.type == NPCID.WallCreeper || this.type == NPCID.BloodCrawler || this.type == NPCID.CorruptPenguin || this.type == NPCID.LihzahrdCrawler || this.type == NPCID.IcyMerman || this.type == NPCID.PirateDeadeye || this.type == NPCID.PirateCrossbower || this.type == NPCID.PirateCaptain || this.type == NPCID.CochinealBeetle || this.type == NPCID.CyanBeetle || this.type == NPCID.LacBeetle || this.type == NPCID.SeaSnail || this.type == NPCID.FlyingSnake || this.type == NPCID.IceGolem || this.type == NPCID.Eyezor || this.type == NPCID.AnomuraFungus || this.type == NPCID.MushiLadybug || this.type == NPCID.Paladin || this.type == NPCID.SkeletonSniper || this.type == NPCID.TacticalSkeleton || this.type == NPCID.SkeletonCommando || this.type == NPCID.Scarecrow1 || this.type == NPCID.Scarecrow2 || this.type == NPCID.Scarecrow3 || this.type == NPCID.Scarecrow4 || this.type == NPCID.Scarecrow5 || this.type == NPCID.Nutcracker || this.type == NPCID.NutcrackerSpinning || this.type == NPCID.ElfArcher || this.type == NPCID.Krampus || this.type == NPCID.CultistArcherBlue || (this.type >= NPCID.ArmedZombie && this.type <= NPCID.ArmedZombieCenx) || (this.type == NPCID.CultistArcherWhite || this.type == NPCID.BrainScrambler || this.type == NPCID.RayGunner || this.type == NPCID.MartianOfficer || this.type == NPCID.MartianEngineer || this.type == NPCID.Scutlix || (this.type >= NPCID.BoneThrowingSkeleton && this.type <= NPCID.BoneThrowingSkeleton4)) || (this.type == NPCID.Psycho || this.type == NPCID.CrimsonBunny || this.type == NPCID.SwampThing || this.type == NPCID.ThePossessed || this.type == NPCID.DrManFly || this.type == NPCID.GoblinSummoner || this.type == NPCID.CrimsonPenguin || this.type == NPCID.Medusa || this.type == NPCID.GreekSkeleton || this.type == NPCID.GraniteGolem || this.type == NPCID.StardustSoldier || this.type == NPCID.NebulaSoldier || this.type == NPCID.StardustSpiderBig || (this.type >= NPCID.Crawdad && this.type <= NPCID.Salamander9)) || (this.type == NPCID.VortexRifleman || this.type == NPCID.VortexHornet || this.type == NPCID.VortexHornetQueen || this.type == NPCID.VortexLarva || this.type == NPCID.WalkingAntlion || this.type == NPCID.SolarDrakomire || this.type == NPCID.SolarSolenian || this.type == NPCID.MartianWalker || (this.type >= NPCID.DesertGhoul && this.type <= NPCID.DesertGhoulHallow)) || this.type == NPCID.DesertLamiaLight || this.type == NPCID.DesertLamiaDark || this.type == NPCID.DesertScorpionWalk || this.type == NPCID.DesertBeast) { flag7 = false; } bool flag8 = false; int num75 = this.type; if (num75 == 425 || num75 == 471) { flag8 = true; } bool flag9 = true; num75 = this.type; if (num75 <= 350) { if (num75 <= 206) { switch (num75) { case 110: case 111: break; default: if (num75 != 206) { goto IL_62C5; } break; } } else { switch (num75) { case 214: case 215: case 216: break; default: switch (num75) { case 291: case 292: case 293: break; default: if (num75 != 350) { goto IL_62C5; } break; } break; } } } else if (num75 <= 426) { switch (num75) { case 379: case 380: case 381: case 382: break; default: switch (num75) { case 409: case 411: break; case 410: goto IL_62C5; default: switch (num75) { case 424: case 426: break; case 425: goto IL_62C5; default: goto IL_62C5; } break; } break; } } else if (num75 != 466) { switch (num75) { case 498: case 499: case 500: case 501: case 502: case 503: case 504: case 505: case 506: break; default: if (num75 != 520) { goto IL_62C5; } break; } } if (this.ai[2] > 0f) { flag9 = false; } IL_62C5: if (!flag8 && flag9) { if (this.velocity.Y == 0f && ((this.velocity.X > 0f && this.direction < 0) || (this.velocity.X < 0f && this.direction > 0))) { flag6 = true; } if (this.position.X == this.oldPosition.X || this.ai[3] >= (float)num67 || flag6) { this.ai[3] += 1f; } else if ((double)Math.Abs(this.velocity.X) > 0.9 && this.ai[3] > 0f) { this.ai[3] -= 1f; } if (this.ai[3] > (float)(num67 * 10)) { this.ai[3] = 0f; } if (this.justHit) { this.ai[3] = 0f; } if (this.ai[3] == (float)num67) { this.netUpdate = true; } } if (this.type == NPCID.Nailhead && Main.netMode != 1) { if (this.localAI[3] > 0f) { this.localAI[3] -= 1f; } if (this.justHit && this.localAI[3] <= 0f && Main.rand.Next(3) == 0) { this.localAI[3] = 30f; int num76 = Main.rand.Next(3, 6); int[] array = new int[num76]; int num77 = 0; for (int num78 = 0; num78 < 255; num78++) { if (Main.player[num78].active && !Main.player[num78].dead && Collision.CanHitLine(this.position, this.width, this.height, Main.player[num78].position, Main.player[num78].width, Main.player[num78].height)) { array[num77] = num78; num77++; if (num77 == num76) { break; } } } if (num77 > 1) { for (int num79 = 0; num79 < 100; num79++) { int num80 = Main.rand.Next(num77); int num81; for (num81 = num80; num81 == num80; num81 = Main.rand.Next(num77)) { } int num82 = array[num80]; array[num80] = array[num81]; array[num81] = num82; } } Vector2 vector15 = new Vector2(-1f, -1f); for (int num83 = 0; num83 < num77; num83++) { Vector2 value6 = Main.npc[array[num83]].Center - base.Center; value6.Normalize(); vector15 += value6; } vector15.Normalize(); for (int num84 = 0; num84 < num76; num84++) { float scaleFactor4 = (float)Main.rand.Next(8, 13); Vector2 value7 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); value7.Normalize(); if (num77 > 0) { value7 += vector15; value7.Normalize(); } value7 *= scaleFactor4; if (num77 > 0) { num77--; value7 = Main.player[array[num77]].Center - base.Center; value7.Normalize(); value7 *= scaleFactor4; } Projectile.NewProjectile(base.Center.X, this.position.Y + (float)(this.width / 4), value7.X, value7.Y, 498, (int)((double)this.damage * 0.15), 1f, 255, 0f, 0f); } } } if (this.type == NPCID.Butcher) { if (this.velocity.Y < -NPC.gravity || this.velocity.Y > NPC.gravity) { this.knockBackResist = 0f; } else { this.knockBackResist = 0.25f * Main.knockBackMultiplier; } } if (this.type == NPCID.ThePossessed) { this.knockBackResist = 0.45f * Main.knockBackMultiplier; if (this.ai[2] == 1f) { this.knockBackResist = 0f; } bool flag10 = false; int num85 = (int)base.Center.X / 16; int num86 = (int)base.Center.Y / 16; for (int num87 = num85 - 1; num87 <= num85 + 1; num87++) { for (int num88 = num86 - 1; num88 <= num86 + 1; num88++) { if (Main.tile[num87, num88] != null && Main.tile[num87, num88].wall > 0) { flag10 = true; break; } } if (flag10) { break; } } if (this.ai[2] == 0f && flag10) { if (this.velocity.Y == 0f) { this.velocity.Y = -4.6f; this.velocity.X = this.velocity.X * 1.3f; } else if (this.velocity.Y > 0f) { this.ai[2] = 1f; } } if (flag10 && this.ai[2] == 1f && Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { Vector2 value8 = Main.player[this.target].Center - base.Center; float num89 = value8.Length(); value8.Normalize(); value8 *= 4.5f + num89 / 300f; this.velocity = (this.velocity * 29f + value8) / 30f; this.noGravity = true; this.ai[2] = 1f; return; } this.noGravity = false; this.ai[2] = 0f; } if (this.type == NPCID.Fritz && this.velocity.Y == 0f && (Main.player[this.target].Center - base.Center).Length() < 150f && Math.Abs(this.velocity.X) > 3f && ((this.velocity.X < 0f && base.Center.X > Main.player[this.target].Center.X) || (this.velocity.X > 0f && base.Center.X < Main.player[this.target].Center.X))) { this.velocity.X = this.velocity.X * 1.75f; this.velocity.Y = this.velocity.Y - 4.5f; if (base.Center.Y - Main.player[this.target].Center.Y > 20f) { this.velocity.Y = this.velocity.Y - 0.5f; } if (base.Center.Y - Main.player[this.target].Center.Y > 40f) { this.velocity.Y = this.velocity.Y - 1f; } if (base.Center.Y - Main.player[this.target].Center.Y > 80f) { this.velocity.Y = this.velocity.Y - 1.5f; } if (base.Center.Y - Main.player[this.target].Center.Y > 100f) { this.velocity.Y = this.velocity.Y - 1.5f; } if (Math.Abs(this.velocity.X) > 7f) { if (this.velocity.X < 0f) { this.velocity.X = -7f; } else { this.velocity.X = 7f; } } } if (this.ai[3] < (float)num67 && (Main.eclipse || !Main.dayTime || (double)this.position.Y > Main.worldSurface * 16.0 || (Main.invasionType == 1 && (this.type == NPCID.Yeti || this.type == NPCID.ElfArcher)) || (Main.invasionType == 1 && (this.type == NPCID.GoblinPeon || this.type == NPCID.GoblinThief || this.type == NPCID.GoblinWarrior || this.type == NPCID.GoblinArcher || this.type == NPCID.GoblinSummoner)) || (this.type == NPCID.GoblinScout || (Main.invasionType == 3 && this.type >= NPCID.PirateDeckhand && this.type <= NPCID.PirateCaptain)) || (Main.invasionType == 4 && (this.type == NPCID.BrainScrambler || this.type == NPCID.RayGunner || this.type == NPCID.MartianOfficer || this.type == NPCID.GrayGrunt || this.type == NPCID.MartianEngineer || this.type == NPCID.GigaZapper || this.type == NPCID.Scutlix || this.type == NPCID.MartianWalker)) || (this.type == NPCID.AngryBones || this.type == NPCID.AngryBonesBig || this.type == NPCID.AngryBonesBigMuscle || this.type == NPCID.AngryBonesBigHelmet || this.type == NPCID.CorruptBunny || this.type == NPCID.Crab || this.type == NPCID.ArmoredSkeleton || this.type == NPCID.Mummy || this.type == NPCID.DarkMummy || this.type == NPCID.LightMummy || this.type == NPCID.SkeletonArcher || this.type == NPCID.ChaosElemental || this.type == NPCID.CorruptPenguin || this.type == NPCID.FaceMonster || this.type == NPCID.SnowFlinx || this.type == NPCID.Lihzahrd || this.type == NPCID.LihzahrdCrawler || this.type == NPCID.IcyMerman || this.type == NPCID.CochinealBeetle || this.type == NPCID.CyanBeetle || this.type == NPCID.LacBeetle || this.type == NPCID.SeaSnail || this.type == NPCID.BloodCrawler || this.type == NPCID.IceGolem || this.type == NPCID.ZombieMushroom || this.type == NPCID.ZombieMushroomHat || this.type == NPCID.AnomuraFungus || this.type == NPCID.MushiLadybug || this.type == NPCID.SkeletonSniper || this.type == NPCID.TacticalSkeleton || this.type == NPCID.SkeletonCommando || this.type == NPCID.CultistArcherBlue || this.type == NPCID.CultistArcherWhite || this.type == NPCID.CrimsonBunny || this.type == NPCID.CrimsonPenguin || this.type == NPCID.NebulaSoldier || (this.type == NPCID.StardustSoldier && (this.ai[1] >= 180f || this.ai[1] < 90f))) || (this.type == NPCID.StardustSpiderBig || this.type == NPCID.VortexRifleman || this.type == NPCID.VortexSoldier || this.type == NPCID.VortexHornet || this.type == NPCID.VortexLarva || this.type == NPCID.WalkingAntlion || this.type == NPCID.SolarDrakomire || this.type == NPCID.SolarSolenian || (this.type >= NPCID.DesertGhoul && this.type <= NPCID.DesertGhoulHallow)) || this.type == NPCID.DesertLamiaLight || this.type == NPCID.DesertLamiaDark || this.type == NPCID.DesertScorpionWalk || this.type == NPCID.DesertBeast)) { if ((this.type == NPCID.Zombie || this.type == NPCID.ZombieXmas || this.type == NPCID.ZombieSweater || this.type == NPCID.Skeleton || (this.type >= NPCID.BoneThrowingSkeleton && this.type <= NPCID.BoneThrowingSkeleton4) || this.type == NPCID.AngryBones || this.type == NPCID.AngryBonesBig || this.type == NPCID.AngryBonesBigMuscle || this.type == NPCID.AngryBonesBigHelmet || this.type == NPCID.ArmoredSkeleton || this.type == NPCID.SkeletonArcher || this.type == NPCID.BaldZombie || this.type == NPCID.UndeadViking || this.type == NPCID.ZombieEskimo || this.type == NPCID.Frankenstein || this.type == NPCID.PincushionZombie || this.type == NPCID.SlimedZombie || this.type == NPCID.SwampZombie || this.type == NPCID.TwiggyZombie || this.type == NPCID.ArmoredViking || this.type == NPCID.FemaleZombie || this.type == NPCID.HeadacheSkeleton || this.type == NPCID.MisassembledSkeleton || this.type == NPCID.PantlessSkeleton || this.type == NPCID.ZombieRaincoat || this.type == NPCID.SkeletonSniper || this.type == NPCID.TacticalSkeleton || this.type == NPCID.SkeletonCommando || this.type == NPCID.ZombieSuperman || this.type == NPCID.ZombiePixie || this.type == NPCID.ZombieDoctor || this.type == NPCID.GreekSkeleton) && Main.rand.Next(1000) == 0) { } if (this.type == NPCID.BloodZombie && Main.rand.Next(800) == 0) { } if ((this.type == NPCID.Mummy || this.type == NPCID.DarkMummy || this.type == NPCID.LightMummy) && Main.rand.Next(500) == 0) { } if (this.type == NPCID.Vampire && Main.rand.Next(500) == 0) { } if (this.type == NPCID.Frankenstein && Main.rand.Next(500) == 0) { } if (this.type == NPCID.FaceMonster && Main.rand.Next(500) == 0) { } if (this.type >= NPCID.RustyArmoredBonesAxe && this.type <= NPCID.HellArmoredBonesSword && Main.rand.Next(1000) == 0) { } this.TargetClosest(true); } else if (this.ai[2] <= 0f || (this.type != NPCID.SkeletonArcher && this.type != NPCID.GoblinArcher && this.type != NPCID.IcyMerman && this.type != NPCID.PirateCaptain && this.type != NPCID.PirateDeadeye && this.type != NPCID.PirateCrossbower && this.type != NPCID.SkeletonSniper && this.type != NPCID.TacticalSkeleton && this.type != NPCID.SkeletonCommando && this.type != NPCID.ElfArcher && this.type != NPCID.BrainScrambler && this.type != NPCID.RayGunner && this.type != NPCID.MartianOfficer && this.type != NPCID.GrayGrunt && this.type != NPCID.MartianEngineer && this.type != NPCID.GigaZapper && this.type != NPCID.Scutlix && this.type != NPCID.ThePossessed && this.type != NPCID.SwampThing && this.type != NPCID.Psycho && this.type != NPCID.GoblinSummoner && this.type != NPCID.StardustSoldier && this.type != NPCID.StardustSpiderBig && this.type != NPCID.NebulaSoldier && this.type != NPCID.VortexRifleman && this.type != NPCID.VortexHornetQueen && this.type != NPCID.SolarDrakomire && this.type != NPCID.SolarSolenian && this.type != NPCID.MartianWalker)) { if (Main.dayTime && (double)(this.position.Y / 16f) < Main.worldSurface && this.timeLeft > 10) { this.timeLeft = 10; } if (this.velocity.X == 0f) { if (this.velocity.Y == 0f) { this.ai[0] += 1f; if (this.ai[0] >= 2f) { this.direction *= -1; this.spriteDirection = this.direction; this.ai[0] = 0f; } } } else { this.ai[0] = 0f; } if (this.direction == 0) { this.direction = 1; } } if (this.type == NPCID.Vampire || this.type == NPCID.NutcrackerSpinning) { if (this.type == NPCID.Vampire && ((this.velocity.X > 0f && this.direction < 0) || (this.velocity.X < 0f && this.direction > 0))) { this.velocity.X = this.velocity.X * 0.95f; } if (this.velocity.X < -6f || this.velocity.X > 6f) { if (this.velocity.Y == 0f) { this.velocity *= 0.8f; } } else if (this.velocity.X < 6f && this.direction == 1) { if (this.velocity.Y == 0f && this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.99f; } this.velocity.X = this.velocity.X + 0.07f; if (this.velocity.X > 6f) { this.velocity.X = 6f; } } else if (this.velocity.X > -6f && this.direction == -1) { if (this.velocity.Y == 0f && this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.99f; } this.velocity.X = this.velocity.X - 0.07f; if (this.velocity.X < -6f) { this.velocity.X = -6f; } } } else if (this.type == NPCID.LihzahrdCrawler) { if (this.velocity.X < -4f || this.velocity.X > 4f) { if (this.velocity.Y == 0f) { this.velocity *= 0.8f; } } else if (this.velocity.X < 4f && this.direction == 1) { if (this.velocity.Y == 0f && this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.8f; } this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X > 4f) { this.velocity.X = 4f; } } else if (this.velocity.X > -4f && this.direction == -1) { if (this.velocity.Y == 0f && this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.8f; } this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X < -4f) { this.velocity.X = -4f; } } } else if (this.type == NPCID.ChaosElemental || this.type == NPCID.SwampThing || this.type == NPCID.PirateCorsair || this.type == NPCID.MushiLadybug || this.type == NPCID.DesertLamiaLight || this.type == NPCID.DesertLamiaDark) { if (this.velocity.X < -3f || this.velocity.X > 3f) { if (this.velocity.Y == 0f) { this.velocity *= 0.8f; } } else if (this.velocity.X < 3f && this.direction == 1) { if (this.velocity.Y == 0f && this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.99f; } this.velocity.X = this.velocity.X + 0.07f; if (this.velocity.X > 3f) { this.velocity.X = 3f; } } else if (this.velocity.X > -3f && this.direction == -1) { if (this.velocity.Y == 0f && this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.99f; } this.velocity.X = this.velocity.X - 0.07f; if (this.velocity.X < -3f) { this.velocity.X = -3f; } } } else if (this.type == NPCID.CreatureFromTheDeep || this.type == NPCID.GoblinThief || this.type == NPCID.ArmoredSkeleton || this.type == NPCID.Werewolf || this.type == NPCID.BlackRecluse || this.type == NPCID.Frankenstein || this.type == NPCID.Nymph || this.type == NPCID.ArmoredViking || this.type == NPCID.PirateDeckhand || this.type == NPCID.AnomuraFungus || this.type == NPCID.Splinterling || this.type == NPCID.Yeti || this.type == NPCID.Nutcracker || this.type == NPCID.Krampus || (this.type >= NPCID.DesertGhoul && this.type <= NPCID.DesertGhoulHallow) || this.type == NPCID.DesertScorpionWalk) { if (this.velocity.X < -2f || this.velocity.X > 2f) { if (this.velocity.Y == 0f) { this.velocity *= 0.8f; } } else if (this.velocity.X < 2f && this.direction == 1) { this.velocity.X = this.velocity.X + 0.07f; if (this.velocity.X > 2f) { this.velocity.X = 2f; } } else if (this.velocity.X > -2f && this.direction == -1) { this.velocity.X = this.velocity.X - 0.07f; if (this.velocity.X < -2f) { this.velocity.X = -2f; } } } else if (this.type == NPCID.Clown) { if (this.velocity.X < -2f || this.velocity.X > 2f) { if (this.velocity.Y == 0f) { this.velocity *= 0.8f; } } else if (this.velocity.X < 2f && this.direction == 1) { this.velocity.X = this.velocity.X + 0.04f; if (this.velocity.X > 2f) { this.velocity.X = 2f; } } else if (this.velocity.X > -2f && this.direction == -1) { this.velocity.X = this.velocity.X - 0.04f; if (this.velocity.X < -2f) { this.velocity.X = -2f; } } } else if (this.type == NPCID.Skeleton || this.type == NPCID.GoblinPeon || this.type == NPCID.AngryBones || this.type == NPCID.AngryBonesBig || this.type == NPCID.AngryBonesBigMuscle || this.type == NPCID.AngryBonesBigHelmet || this.type == NPCID.CorruptBunny || this.type == NPCID.GoblinScout || this.type == NPCID.PossessedArmor || this.type == NPCID.WallCreeper || this.type == NPCID.BloodCrawler || this.type == NPCID.UndeadViking || this.type == NPCID.CorruptPenguin || this.type == NPCID.SnowFlinx || this.type == NPCID.Lihzahrd || this.type == NPCID.HeadacheSkeleton || this.type == NPCID.MisassembledSkeleton || this.type == NPCID.PantlessSkeleton || this.type == NPCID.CochinealBeetle || this.type == NPCID.CyanBeetle || this.type == NPCID.LacBeetle || this.type == NPCID.FlyingSnake || this.type == NPCID.FaceMonster || this.type == NPCID.ZombieMushroom || this.type == NPCID.ZombieElf || this.type == NPCID.ZombieElfBeard || this.type == NPCID.ZombieElfGirl || this.type == NPCID.GingerbreadMan || this.type == NPCID.GrayGrunt || this.type == NPCID.GigaZapper || this.type == NPCID.Fritz || this.type == NPCID.Nailhead || this.type == NPCID.Psycho || this.type == NPCID.CrimsonBunny || this.type == NPCID.ThePossessed || this.type == NPCID.CrimsonPenguin || this.type == NPCID.Medusa || this.type == NPCID.GraniteGolem || this.type == NPCID.VortexRifleman || this.type == NPCID.VortexSoldier) { float num90 = 1.5f; if (this.type == NPCID.AngryBonesBig) { num90 = 2f; } else if (this.type == NPCID.AngryBonesBigMuscle) { num90 = 1.75f; } else if (this.type == NPCID.AngryBonesBigHelmet) { num90 = 1.25f; } else if (this.type == NPCID.HeadacheSkeleton) { num90 = 1.1f; } else if (this.type == NPCID.MisassembledSkeleton) { num90 = 0.9f; } else if (this.type == NPCID.PantlessSkeleton) { num90 = 1.2f; } else if (this.type == NPCID.ZombieElf) { num90 = 1.75f; } else if (this.type == NPCID.ZombieElfBeard) { num90 = 1.25f; } else if (this.type == NPCID.ZombieElfGirl) { num90 = 2f; } else if (this.type == NPCID.GrayGrunt) { num90 = 1.8f; } else if (this.type == NPCID.GigaZapper) { num90 = 2.25f; } else if (this.type == NPCID.Fritz) { num90 = 4f; } else if (this.type == NPCID.Nailhead) { num90 = 0.75f; } else if (this.type == NPCID.Psycho) { num90 = 3.75f; } else if (this.type == NPCID.ThePossessed) { num90 = 3.25f; } else if (this.type == NPCID.Medusa) { num90 = 1.5f + (1f - (float)this.life / (float)this.lifeMax) * 2f; } else if (this.type == NPCID.VortexRifleman) { num90 = 6f; } else if (this.type == NPCID.VortexSoldier) { num90 = 4f; } if (this.type == NPCID.Skeleton || this.type == NPCID.HeadacheSkeleton || this.type == NPCID.MisassembledSkeleton || this.type == NPCID.PantlessSkeleton || this.type == NPCID.GingerbreadMan) { num90 *= 1f + (1f - this.scale); } if (this.velocity.X < -num90 || this.velocity.X > num90) { if (this.velocity.Y == 0f) { this.velocity *= 0.8f; } } else if (this.velocity.X < num90 && this.direction == 1) { if (this.type == NPCID.Psycho && this.velocity.X < -2f) { this.velocity.X = this.velocity.X * 0.9f; } this.velocity.X = this.velocity.X + 0.07f; if (this.velocity.X > num90) { this.velocity.X = num90; } } else if (this.velocity.X > -num90 && this.direction == -1) { if (this.type == NPCID.Psycho && this.velocity.X > 2f) { this.velocity.X = this.velocity.X * 0.9f; } this.velocity.X = this.velocity.X - 0.07f; if (this.velocity.X < -num90) { this.velocity.X = -num90; } } if (this.velocity.Y == 0f && this.type == NPCID.Fritz && ((this.direction > 0 && this.velocity.X < 0f) || (this.direction < 0 && this.velocity.X > 0f))) { this.velocity.X = this.velocity.X * 0.9f; } } else if (this.type >= NPCID.RustyArmoredBonesAxe && this.type <= NPCID.HellArmoredBonesSword) { float num91 = 1.5f; if (this.type == NPCID.RustyArmoredBonesAxe) { num91 = 2f; } if (this.type == NPCID.RustyArmoredBonesFlail) { num91 = 1f; } if (this.type == NPCID.RustyArmoredBonesSword) { num91 = 1.5f; } if (this.type == NPCID.RustyArmoredBonesSwordNoArmor) { num91 = 3f; } if (this.type == NPCID.BlueArmoredBones) { num91 = 1.25f; } if (this.type == NPCID.BlueArmoredBonesMace) { num91 = 3f; } if (this.type == NPCID.BlueArmoredBonesNoPants) { num91 = 3.25f; } if (this.type == NPCID.BlueArmoredBonesSword) { num91 = 2f; } if (this.type == NPCID.HellArmoredBones) { num91 = 2.75f; } if (this.type == NPCID.HellArmoredBonesSpikeShield) { num91 = 1.8f; } if (this.type == NPCID.HellArmoredBonesMace) { num91 = 1.3f; } if (this.type == NPCID.HellArmoredBonesSword) { num91 = 2.5f; } num91 *= 1f + (1f - this.scale); if (this.velocity.X < -num91 || this.velocity.X > num91) { if (this.velocity.Y == 0f) { this.velocity *= 0.8f; } } else if (this.velocity.X < num91 && this.direction == 1) { this.velocity.X = this.velocity.X + 0.07f; if (this.velocity.X > num91) { this.velocity.X = num91; } } else if (this.velocity.X > -num91 && this.direction == -1) { this.velocity.X = this.velocity.X - 0.07f; if (this.velocity.X < -num91) { this.velocity.X = -num91; } } } else if (this.type >= NPCID.Scarecrow1 && this.type <= NPCID.Scarecrow10) { float num92 = 1.5f; if (this.type == NPCID.Scarecrow1 || this.type == NPCID.Scarecrow6) { num92 = 2f; } if (this.type == NPCID.Scarecrow2 || this.type == NPCID.Scarecrow7) { num92 = 1.25f; } if (this.type == NPCID.Scarecrow3 || this.type == NPCID.Scarecrow8) { num92 = 2.25f; } if (this.type == NPCID.Scarecrow4 || this.type == NPCID.Scarecrow9) { num92 = 1.5f; } if (this.type == NPCID.Scarecrow5 || this.type == NPCID.Scarecrow10) { num92 = 1f; } if (this.type < 310) { if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.85f; if ((double)this.velocity.X > -0.3 && (double)this.velocity.X < 0.3) { this.velocity.Y = -7f; this.velocity.X = num92 * (float)this.direction; } } else if (this.spriteDirection == this.direction) { this.velocity.X = (this.velocity.X * 10f + num92 * (float)this.direction) / 11f; } } else if (this.velocity.X < -num92 || this.velocity.X > num92) { if (this.velocity.Y == 0f) { this.velocity *= 0.8f; } } else if (this.velocity.X < num92 && this.direction == 1) { this.velocity.X = this.velocity.X + 0.07f; if (this.velocity.X > num92) { this.velocity.X = num92; } } else if (this.velocity.X > -num92 && this.direction == -1) { this.velocity.X = this.velocity.X - 0.07f; if (this.velocity.X < -num92) { this.velocity.X = -num92; } } } else if (this.type == NPCID.Crab || this.type == NPCID.SeaSnail || this.type == NPCID.VortexLarva) { if (this.velocity.X < -0.5f || this.velocity.X > 0.5f) { if (this.velocity.Y == 0f) { this.velocity *= 0.7f; } } else if (this.velocity.X < 0.5f && this.direction == 1) { this.velocity.X = this.velocity.X + 0.03f; if (this.velocity.X > 0.5f) { this.velocity.X = 0.5f; } } else if (this.velocity.X > -0.5f && this.direction == -1) { this.velocity.X = this.velocity.X - 0.03f; if (this.velocity.X < -0.5f) { this.velocity.X = -0.5f; } } } else if (this.type == NPCID.Mummy || this.type == NPCID.DarkMummy || this.type == NPCID.LightMummy) { float num93 = 1f; float num94 = 0.05f; if (this.life < this.lifeMax / 2) { num93 = 2f; num94 = 0.1f; } if (this.type == NPCID.DarkMummy) { num93 *= 1.5f; } if (this.velocity.X < -num93 || this.velocity.X > num93) { if (this.velocity.Y == 0f) { this.velocity *= 0.7f; } } else if (this.velocity.X < num93 && this.direction == 1) { this.velocity.X = this.velocity.X + num94; if (this.velocity.X > num93) { this.velocity.X = num93; } } else if (this.velocity.X > -num93 && this.direction == -1) { this.velocity.X = this.velocity.X - num94; if (this.velocity.X < -num93) { this.velocity.X = -num93; } } } else if (this.type == NPCID.BoneLee) { float num95 = 5f; float num96 = 0.2f; if (this.velocity.X < -num95 || this.velocity.X > num95) { if (this.velocity.Y == 0f) { this.velocity *= 0.7f; } } else if (this.velocity.X < num95 && this.direction == 1) { this.velocity.X = this.velocity.X + num96; if (this.velocity.X > num95) { this.velocity.X = num95; } } else if (this.velocity.X > -num95 && this.direction == -1) { this.velocity.X = this.velocity.X - num96; if (this.velocity.X < -num95) { this.velocity.X = -num95; } } } else if (this.type == NPCID.IceGolem) { float num97 = 1f; float num98 = 0.07f; num97 += (1f - (float)this.life / (float)this.lifeMax) * 1.5f; num98 += (1f - (float)this.life / (float)this.lifeMax) * 0.15f; if (this.velocity.X < -num97 || this.velocity.X > num97) { if (this.velocity.Y == 0f) { this.velocity *= 0.7f; } } else if (this.velocity.X < num97 && this.direction == 1) { this.velocity.X = this.velocity.X + num98; if (this.velocity.X > num97) { this.velocity.X = num97; } } else if (this.velocity.X > -num97 && this.direction == -1) { this.velocity.X = this.velocity.X - num98; if (this.velocity.X < -num97) { this.velocity.X = -num97; } } } else if (this.type == NPCID.Eyezor) { float num99 = 1f; float num100 = 0.08f; num99 += (1f - (float)this.life / (float)this.lifeMax) * 2f; num100 += (1f - (float)this.life / (float)this.lifeMax) * 0.2f; if (this.velocity.X < -num99 || this.velocity.X > num99) { if (this.velocity.Y == 0f) { this.velocity *= 0.7f; } } else if (this.velocity.X < num99 && this.direction == 1) { this.velocity.X = this.velocity.X + num100; if (this.velocity.X > num99) { this.velocity.X = num99; } } else if (this.velocity.X > -num99 && this.direction == -1) { this.velocity.X = this.velocity.X - num100; if (this.velocity.X < -num99) { this.velocity.X = -num99; } } } else if (this.type == NPCID.MartianEngineer) { if (this.ai[2] > 0f) { if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.8f; } } else { float num101 = 0.15f; float num102 = 1.5f; if (this.velocity.X < -num102 || this.velocity.X > num102) { if (this.velocity.Y == 0f) { this.velocity *= 0.7f; } } else if (this.velocity.X < num102 && this.direction == 1) { this.velocity.X = this.velocity.X + num101; if (this.velocity.X > num102) { this.velocity.X = num102; } } else if (this.velocity.X > -num102 && this.direction == -1) { this.velocity.X = this.velocity.X - num101; if (this.velocity.X < -num102) { this.velocity.X = -num102; } } } } else if (this.type == NPCID.Butcher) { float num103 = 3f; float num104 = 0.1f; if (Math.Abs(this.velocity.X) > 2f) { num104 *= 0.8f; } if ((double)Math.Abs(this.velocity.X) > 2.5) { num104 *= 0.8f; } if (Math.Abs(this.velocity.X) > 3f) { num104 *= 0.8f; } if ((double)Math.Abs(this.velocity.X) > 3.5) { num104 *= 0.8f; } if (Math.Abs(this.velocity.X) > 4f) { num104 *= 0.8f; } if ((double)Math.Abs(this.velocity.X) > 4.5) { num104 *= 0.8f; } if (Math.Abs(this.velocity.X) > 5f) { num104 *= 0.8f; } if ((double)Math.Abs(this.velocity.X) > 5.5) { num104 *= 0.8f; } num103 += (1f - (float)this.life / (float)this.lifeMax) * 3f; if (this.velocity.X < -num103 || this.velocity.X > num103) { if (this.velocity.Y == 0f) { this.velocity *= 0.7f; } } else if (this.velocity.X < num103 && this.direction == 1) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.93f; } this.velocity.X = this.velocity.X + num104; if (this.velocity.X > num103) { this.velocity.X = num103; } } else if (this.velocity.X > -num103 && this.direction == -1) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.93f; } this.velocity.X = this.velocity.X - num104; if (this.velocity.X < -num103) { this.velocity.X = -num103; } } } else if (this.type == NPCID.WalkingAntlion) { float num105 = 2.5f; float num106 = 40f; float num107 = Math.Abs(this.velocity.X); if (num107 > 2.75f) { num105 = 3.5f; num106 += 80f; } else if ((double)num107 > 2.25) { num105 = 3f; num106 += 60f; } if ((double)Math.Abs(this.velocity.Y) < 0.5) { if (this.velocity.X > 0f && this.direction < 0) { this.velocity *= 0.9f; } if (this.velocity.X < 0f && this.direction > 0) { this.velocity *= 0.9f; } } if (Math.Abs(this.velocity.Y) > NPC.gravity) { num106 *= 3f; } if (this.velocity.X <= 0f && this.direction < 0) { this.velocity.X = (this.velocity.X * num106 - num105) / (num106 + 1f); } else if (this.velocity.X >= 0f && this.direction > 0) { this.velocity.X = (this.velocity.X * num106 + num105) / (num106 + 1f); } else if (Math.Abs(base.Center.X - Main.player[this.target].Center.X) > 20f && Math.Abs(this.velocity.Y) <= NPC.gravity) { this.velocity.X = this.velocity.X * 0.99f; this.velocity.X = this.velocity.X + (float)this.direction * 0.025f; } } else if (this.type == NPCID.Scutlix || this.type == NPCID.VortexHornet || this.type == NPCID.SolarDrakomire || this.type == NPCID.SolarSolenian || this.type == NPCID.SolarSpearman || this.type == NPCID.DesertBeast) { float num108 = 5f; float num109 = 0.25f; float scaleFactor5 = 0.7f; if (this.type == NPCID.VortexHornet) { num108 = 6f; num109 = 0.2f; scaleFactor5 = 0.8f; } else if (this.type == NPCID.SolarDrakomire) { num108 = 4f; num109 = 0.1f; scaleFactor5 = 0.95f; } else if (this.type == NPCID.SolarSolenian) { num108 = 6f; num109 = 0.15f; scaleFactor5 = 0.85f; } else if (this.type == NPCID.SolarSpearman) { num108 = 5f; num109 = 0.1f; scaleFactor5 = 0.95f; } else if (this.type == NPCID.DesertBeast) { num108 = 5f; num109 = 0.15f; scaleFactor5 = 0.98f; } if (this.velocity.X < -num108 || this.velocity.X > num108) { if (this.velocity.Y == 0f) { this.velocity *= scaleFactor5; } } else if (this.velocity.X < num108 && this.direction == 1) { this.velocity.X = this.velocity.X + num109; if (this.velocity.X > num108) { this.velocity.X = num108; } } else if (this.velocity.X > -num108 && this.direction == -1) { this.velocity.X = this.velocity.X - num109; if (this.velocity.X < -num108) { this.velocity.X = -num108; } } } else if ((this.type >= NPCID.ArmedZombie && this.type <= NPCID.ArmedZombieCenx) || this.type == NPCID.Crawdad || this.type == NPCID.Crawdad2) { if (this.ai[2] == 0f) { this.damage = this.defDamage; float num110 = 1f; num110 *= 1f + (1f - this.scale); if (this.velocity.X < -num110 || this.velocity.X > num110) { if (this.velocity.Y == 0f) { this.velocity *= 0.8f; } } else if (this.velocity.X < num110 && this.direction == 1) { this.velocity.X = this.velocity.X + 0.07f; if (this.velocity.X > num110) { this.velocity.X = num110; } } else if (this.velocity.X > -num110 && this.direction == -1) { this.velocity.X = this.velocity.X - 0.07f; if (this.velocity.X < -num110) { this.velocity.X = -num110; } } if (this.velocity.Y == 0f && (!Main.dayTime || (double)this.position.Y > Main.worldSurface * 16.0) && !Main.player[this.target].dead) { Vector2 vector16 = base.Center - Main.player[this.target].Center; int num111 = 50; if (this.type >= NPCID.Crawdad && this.type <= NPCID.Crawdad2) { num111 = 42; } if (vector16.Length() < (float)num111 && Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.velocity.X = this.velocity.X * 0.7f; this.ai[2] = 1f; } } } else { this.damage = (int)((double)this.defDamage * 1.5); this.ai[3] = 1f; this.velocity.X = this.velocity.X * 0.9f; if ((double)Math.Abs(this.velocity.X) < 0.1) { this.velocity.X = 0f; } this.ai[2] += 1f; if (this.ai[2] >= 20f || this.velocity.Y != 0f || (Main.dayTime && (double)this.position.Y < Main.worldSurface * 16.0)) { this.ai[2] = 0f; } } } else if (this.type != NPCID.SkeletonArcher && this.type != NPCID.GoblinArcher && this.type != NPCID.IcyMerman && this.type != NPCID.PirateDeadeye && this.type != NPCID.PirateCrossbower && this.type != NPCID.PirateCaptain && this.type != NPCID.Paladin && this.type != NPCID.SkeletonSniper && this.type != NPCID.TacticalSkeleton && this.type != NPCID.SkeletonCommando && this.type != NPCID.ElfArcher && this.type != NPCID.CultistArcherBlue && this.type != NPCID.CultistArcherWhite && this.type != NPCID.BrainScrambler && this.type != NPCID.RayGunner && (this.type < 449 || this.type > 452) && this.type != NPCID.DrManFly && this.type != NPCID.GreekSkeleton && this.type != NPCID.StardustSoldier && this.type != NPCID.StardustSpiderBig && (this.type < 498 || this.type > 506) && this.type != NPCID.NebulaSoldier && this.type != NPCID.VortexHornetQueen && this.type != NPCID.MartianWalker) { float num112 = 1f; if (this.type == NPCID.PincushionZombie) { num112 = 1.1f; } if (this.type == NPCID.SlimedZombie) { num112 = 0.9f; } if (this.type == NPCID.SwampZombie) { num112 = 1.2f; } if (this.type == NPCID.TwiggyZombie) { num112 = 0.8f; } if (this.type == NPCID.BaldZombie) { num112 = 0.95f; } if (this.type == NPCID.FemaleZombie) { num112 = 0.87f; } if (this.type == NPCID.ZombieRaincoat) { num112 = 1.05f; } if (this.type == NPCID.BloodZombie) { float num113 = (Main.player[this.target].Center - base.Center).Length(); num113 *= 0.0025f; if ((double)num113 > 1.5) { num113 = 1.5f; } if (Main.expertMode) { num112 = 3f - num113; } else { num112 = 2.5f - num113; } num112 *= 0.8f; } if (this.type == NPCID.BloodZombie || this.type == NPCID.Zombie || this.type == NPCID.BaldZombie || this.type == NPCID.PincushionZombie || this.type == NPCID.SlimedZombie || this.type == NPCID.SwampZombie || this.type == NPCID.TwiggyZombie || this.type == NPCID.FemaleZombie || this.type == NPCID.ZombieRaincoat || this.type == NPCID.ZombieXmas || this.type == NPCID.ZombieSweater) { num112 *= 1f + (1f - this.scale); } if (this.velocity.X < -num112 || this.velocity.X > num112) { if (this.velocity.Y == 0f) { this.velocity *= 0.8f; } } else if (this.velocity.X < num112 && this.direction == 1) { this.velocity.X = this.velocity.X + 0.07f; if (this.velocity.X > num112) { this.velocity.X = num112; } } else if (this.velocity.X > -num112 && this.direction == -1) { this.velocity.X = this.velocity.X - 0.07f; if (this.velocity.X < -num112) { this.velocity.X = -num112; } } } if (this.type >= NPCID.HellArmoredBones && this.type <= NPCID.HellArmoredBonesSword) { } else if (this.type == NPCID.MartianWalker) { } else if (this.type == NPCID.DesertGhoulCorruption) { } else if (this.type == NPCID.DesertGhoulCrimson) { } else if (this.type == NPCID.DesertGhoulHallow) { } else if (this.type == NPCID.SolarDrakomire) { this.hide = false; for (int num114 = 0; num114 < 200; num114++) { if (Main.npc[num114].active && Main.npc[num114].type == NPCID.SolarDrakomireRider && Main.npc[num114].ai[0] == (float)this.whoAmI) { this.hide = true; break; } } } else if (this.type == NPCID.MushiLadybug) { if (this.velocity.Y != 0f) { this.TargetClosest(true); this.spriteDirection = this.direction; if (Main.player[this.target].Center.X < this.position.X && this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.95f; } else if (Main.player[this.target].Center.X > this.position.X + (float)this.width && this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.95f; } if (Main.player[this.target].Center.X < this.position.X && this.velocity.X > -5f) { this.velocity.X = this.velocity.X - 0.1f; } else if (Main.player[this.target].Center.X > this.position.X + (float)this.width && this.velocity.X < 5f) { this.velocity.X = this.velocity.X + 0.1f; } } else if (Main.player[this.target].Center.Y + 50f < this.position.Y && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.velocity.Y = -7f; } } else if (this.type == NPCID.VortexRifleman) { if (this.velocity.Y == 0f) { this.ai[2] = 0f; } if (this.velocity.Y != 0f && this.ai[2] == 1f) { this.TargetClosest(true); this.spriteDirection = -this.direction; if (Collision.CanHit(base.Center, 0, 0, Main.player[this.target].Center, 0, 0)) { float num115 = Main.player[this.target].Center.X - (float)(this.direction * 400) - base.Center.X; float num116 = Main.player[this.target].Bottom.Y - base.Bottom.Y; if (num115 < 0f && this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.9f; } else if (num115 > 0f && this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.9f; } if (num115 < 0f && this.velocity.X > -5f) { this.velocity.X = this.velocity.X - 0.1f; } else if (num115 > 0f && this.velocity.X < 5f) { this.velocity.X = this.velocity.X + 0.1f; } if (this.velocity.X > 6f) { this.velocity.X = 6f; } if (this.velocity.X < -6f) { this.velocity.X = -6f; } if (num116 < -20f && this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.8f; } else if (num116 > 20f && this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.8f; } if (num116 < -20f && this.velocity.Y > -5f) { this.velocity.Y = this.velocity.Y - 0.3f; } else if (num116 > 20f && this.velocity.Y < 5f) { this.velocity.Y = this.velocity.Y + 0.3f; } } for (int num117 = 0; num117 < 200; num117++) { if (num117 != this.whoAmI && Main.npc[num117].active && Main.npc[num117].type == this.type && Math.Abs(this.position.X - Main.npc[num117].position.X) + Math.Abs(this.position.Y - Main.npc[num117].position.Y) < (float)this.width) { if (this.position.X < Main.npc[num117].position.X) { this.velocity.X = this.velocity.X - 0.05f; } else { this.velocity.X = this.velocity.X + 0.05f; } if (this.position.Y < Main.npc[num117].position.Y) { this.velocity.Y = this.velocity.Y - 0.05f; } else { this.velocity.Y = this.velocity.Y + 0.05f; } } } } else if (Main.player[this.target].Center.Y + 100f < this.position.Y && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.velocity.Y = -5f; this.ai[2] = 1f; } if (Main.netMode != 1) { this.localAI[2] += 1f; if (this.localAI[2] >= (float)(360 + Main.rand.Next(360)) && base.Distance(Main.player[this.target].Center) < 400f && Math.Abs(base.DirectionTo(Main.player[this.target].Center).Y) < 0.5f && Collision.CanHitLine(base.Center, 0, 0, Main.player[this.target].Center, 0, 0)) { this.localAI[2] = 0f; Vector2 vector17 = base.Center + new Vector2((float)(this.direction * 30), 2f); Vector2 vector18 = base.DirectionTo(Main.player[this.target].Center) * 7f; if (vector18.HasNaNs()) { vector18 = new Vector2((float)(this.direction * 8), 0f); } int num118 = Main.expertMode ? 50 : 75; for (int num119 = 0; num119 < 4; num119++) { Vector2 vector19 = vector18 + Utils.RandomVector2(Main.rand, -0.8f, 0.8f); Projectile.NewProjectile(vector17.X, vector17.Y, vector19.X, vector19.Y, 577, num118, 1f, Main.myPlayer, 0f, 0f); } } } } else if (this.type == NPCID.VortexHornet) { if (this.velocity.Y == 0f) { this.ai[2] = 0f; this.rotation = 0f; } else { this.rotation = this.velocity.X * 0.1f; } if (this.velocity.Y != 0f && this.ai[2] == 1f) { this.TargetClosest(true); this.spriteDirection = -this.direction; if (Collision.CanHit(base.Center, 0, 0, Main.player[this.target].Center, 0, 0)) { float num120 = Main.player[this.target].Center.X - base.Center.X; float num121 = Main.player[this.target].Center.Y - base.Center.Y; if (num120 < 0f && this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.98f; } else if (num120 > 0f && this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.98f; } if (num120 < -20f && this.velocity.X > -6f) { this.velocity.X = this.velocity.X - 0.015f; } else if (num120 > 20f && this.velocity.X < 6f) { this.velocity.X = this.velocity.X + 0.015f; } if (this.velocity.X > 6f) { this.velocity.X = 6f; } if (this.velocity.X < -6f) { this.velocity.X = -6f; } if (num121 < -20f && this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.98f; } else if (num121 > 20f && this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.98f; } if (num121 < -20f && this.velocity.Y > -6f) { this.velocity.Y = this.velocity.Y - 0.15f; } else if (num121 > 20f && this.velocity.Y < 6f) { this.velocity.Y = this.velocity.Y + 0.15f; } } for (int num122 = 0; num122 < 200; num122++) { if (num122 != this.whoAmI && Main.npc[num122].active && Main.npc[num122].type == this.type && Math.Abs(this.position.X - Main.npc[num122].position.X) + Math.Abs(this.position.Y - Main.npc[num122].position.Y) < (float)this.width) { if (this.position.X < Main.npc[num122].position.X) { this.velocity.X = this.velocity.X - 0.05f; } else { this.velocity.X = this.velocity.X + 0.05f; } if (this.position.Y < Main.npc[num122].position.Y) { this.velocity.Y = this.velocity.Y - 0.05f; } else { this.velocity.Y = this.velocity.Y + 0.05f; } } } } else if (Main.player[this.target].Center.Y + 100f < this.position.Y && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.velocity.Y = -5f; this.ai[2] = 1f; } } else if (this.type == NPCID.VortexHornetQueen) { if (this.ai[1] > 0f && this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.85f; if (this.velocity.Y == 0f) { this.velocity.Y = -0.4f; } } if (this.velocity.Y != 0f) { this.TargetClosest(true); this.spriteDirection = this.direction; if (Collision.CanHit(base.Center, 0, 0, Main.player[this.target].Center, 0, 0)) { float num123 = Main.player[this.target].Center.X - (float)(this.direction * 300) - base.Center.X; if (num123 < 40f && this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.98f; } else if (num123 > 40f && this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.98f; } if (num123 < 40f && this.velocity.X > -5f) { this.velocity.X = this.velocity.X - 0.2f; } else if (num123 > 40f && this.velocity.X < 5f) { this.velocity.X = this.velocity.X + 0.2f; } if (this.velocity.X > 6f) { this.velocity.X = 6f; } if (this.velocity.X < -6f) { this.velocity.X = -6f; } } } else if (Main.player[this.target].Center.Y + 100f < this.position.Y && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.velocity.Y = -6f; } for (int num124 = 0; num124 < 200; num124++) { if (num124 != this.whoAmI && Main.npc[num124].active && Main.npc[num124].type == this.type && Math.Abs(this.position.X - Main.npc[num124].position.X) + Math.Abs(this.position.Y - Main.npc[num124].position.Y) < (float)this.width) { if (this.position.X < Main.npc[num124].position.X) { this.velocity.X = this.velocity.X - 0.1f; } else { this.velocity.X = this.velocity.X + 0.1f; } if (this.position.Y < Main.npc[num124].position.Y) { this.velocity.Y = this.velocity.Y - 0.1f; } else { this.velocity.Y = this.velocity.Y + 0.1f; } } } } else if (this.type == NPCID.SnowFlinx) { if (this.velocity.Y == 0f) { this.rotation = 0f; this.localAI[0] = 0f; } else if (this.localAI[0] == 1f) { this.rotation += this.velocity.X * 0.05f; } } else if (this.type == NPCID.VortexLarva) { if (this.velocity.Y == 0f) { this.rotation = 0f; } else { this.rotation += this.velocity.X * 0.08f; } } if (this.type == NPCID.Vampire && Main.netMode != 1) { Vector2 vector20 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num126 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector20.X; float num127 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector20.Y; float num128 = (float)Math.Sqrt((double)(num126 * num126 + num127 * num127)); if (num128 > 300f) { this.Transform(158); } } if (this.type == NPCID.WallCreeper && Main.netMode != 1 && this.velocity.Y == 0f) { int num129 = (int)base.Center.X / 16; int num130 = (int)base.Center.Y / 16; bool flag11 = false; for (int num131 = num129 - 1; num131 <= num129 + 1; num131++) { for (int num132 = num130 - 1; num132 <= num130 + 1; num132++) { if (Main.tile[num131, num132].wall > 0) { flag11 = true; } } } if (flag11) { this.Transform(165); } } if (this.type == NPCID.BloodCrawler && Main.netMode != 1 && this.velocity.Y == 0f) { int num133 = (int)base.Center.X / 16; int num134 = (int)base.Center.Y / 16; bool flag12 = false; for (int num135 = num133 - 1; num135 <= num133 + 1; num135++) { for (int num136 = num134 - 1; num136 <= num134 + 1; num136++) { if (Main.tile[num135, num136].wall > 0) { flag12 = true; } } } if (flag12) { this.Transform(240); } } if (this.type == NPCID.DesertScorpionWalk && Main.netMode != 1 && this.velocity.Y == 0f) { int num137 = (int)base.Center.X / 16; int num138 = (int)base.Center.Y / 16; bool flag13 = false; for (int num139 = num137 - 1; num139 <= num137 + 1; num139++) { for (int num140 = num138 - 1; num140 <= num138 + 1; num140++) { if (Main.tile[num139, num140].wall > 0) { flag13 = true; } } } if (flag13) { this.Transform(531); } } if (Main.netMode != 1 && Main.expertMode && this.target >= 0 && (this.type == NPCID.BlackRecluse || this.type == NPCID.BlackRecluseWall) && Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.localAI[0] += 1f; if (this.justHit) { this.localAI[0] -= (float)Main.rand.Next(20, 60); if (this.localAI[0] < 0f) { this.localAI[0] = 0f; } } if (this.localAI[0] > (float)Main.rand.Next(180, 900)) { this.localAI[0] = 0f; Vector2 vector21 = Main.player[this.target].Center - base.Center; vector21.Normalize(); vector21 *= 8f; Projectile.NewProjectile(base.Center.X, base.Center.Y, vector21.X, vector21.Y, 472, 18, 0f, Main.myPlayer, 0f, 0f); } } if (this.type == NPCID.BlackRecluse && Main.netMode != 1 && this.velocity.Y == 0f) { int num141 = (int)base.Center.X / 16; int num142 = (int)base.Center.Y / 16; bool flag14 = false; for (int num143 = num141 - 1; num143 <= num141 + 1; num143++) { for (int num144 = num142 - 1; num144 <= num142 + 1; num144++) { if (Main.tile[num143, num144].wall > 0) { flag14 = true; } } } if (flag14) { this.Transform(238); } } if (this.type == NPCID.JungleCreeper && Main.netMode != 1 && this.velocity.Y == 0f) { int num145 = (int)base.Center.X / 16; int num146 = (int)base.Center.Y / 16; bool flag15 = false; for (int num147 = num145 - 1; num147 <= num145 + 1; num147++) { for (int num148 = num146 - 1; num148 <= num146 + 1; num148++) { if (Main.tile[num147, num148].wall > 0) { flag15 = true; } } } if (flag15) { this.Transform(237); } } if (this.type == NPCID.IceGolem) { if (this.justHit && Main.rand.Next(3) == 0) { this.ai[2] -= (float)Main.rand.Next(30); } if (this.ai[2] < 0f) { this.ai[2] = 0f; } if (this.confused) { this.ai[2] = 0f; } this.ai[2] += 1f; float num149 = (float)Main.rand.Next(30, 900); num149 *= (float)this.life / (float)this.lifeMax; num149 += 30f; if (Main.netMode != 1 && this.ai[2] >= num149 && this.velocity.Y == 0f && !Main.player[this.target].dead && !Main.player[this.target].frozen && ((this.direction > 0 && base.Center.X < Main.player[this.target].Center.X) || (this.direction < 0 && base.Center.X > Main.player[this.target].Center.X)) && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { float num150 = 15f; Vector2 vector22 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + 20f); vector22.X += (float)(10 * this.direction); float num151 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector22.X; float num152 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector22.Y; num151 += (float)Main.rand.Next(-40, 41); num152 += (float)Main.rand.Next(-40, 41); float num153 = (float)Math.Sqrt((double)(num151 * num151 + num152 * num152)); this.netUpdate = true; num153 = num150 / num153; num151 *= num153; num152 *= num153; int num154 = 32; int num155 = 257; vector22.X += num151 * 3f; vector22.Y += num152 * 3f; Projectile.NewProjectile(vector22.X, vector22.Y, num151, num152, num155, num154, 0f, Main.myPlayer, 0f, 0f); this.ai[2] = 0f; } } if (this.type == NPCID.Eyezor) { if (this.justHit) { this.ai[2] -= (float)Main.rand.Next(30); } if (this.ai[2] < 0f) { this.ai[2] = 0f; } if (this.confused) { this.ai[2] = 0f; } this.ai[2] += 1f; float num156 = (float)Main.rand.Next(60, 1800); num156 *= (float)this.life / (float)this.lifeMax; num156 += 15f; if (Main.netMode != 1 && this.ai[2] >= num156 && this.velocity.Y == 0f && !Main.player[this.target].dead && !Main.player[this.target].frozen && ((this.direction > 0 && base.Center.X < Main.player[this.target].Center.X) || (this.direction < 0 && base.Center.X > Main.player[this.target].Center.X)) && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { float num157 = 15f; Vector2 vector23 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + 12f); vector23.X += (float)(6 * this.direction); float num158 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector23.X; float num159 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector23.Y; num158 += (float)Main.rand.Next(-40, 41); num159 += (float)Main.rand.Next(-30, 0); float num160 = (float)Math.Sqrt((double)(num158 * num158 + num159 * num159)); this.netUpdate = true; num160 = num157 / num160; num158 *= num160; num159 *= num160; int num161 = 30; int num162 = 83; vector23.X += num158 * 3f; vector23.Y += num159 * 3f; Projectile.NewProjectile(vector23.X, vector23.Y, num158, num159, num162, num161, 0f, Main.myPlayer, 0f, 0f); this.ai[2] = 0f; } } if (this.type == NPCID.MartianEngineer) { if (this.confused) { this.ai[2] = -60f; } else { if (this.ai[2] < 60f) { this.ai[2] += 1f; } if (this.ai[2] > 0f && NPC.CountNPCS(387) >= 4 * NPC.CountNPCS(386)) { this.ai[2] = 0f; } if (this.justHit) { this.ai[2] = -30f; } if (this.ai[2] == 30f) { int num163 = (int)this.position.X / 16; int num164 = (int)this.position.Y / 16; int num165 = (int)this.position.X / 16; int num166 = (int)this.position.Y / 16; int num167 = 5; int num168 = 0; bool flag16 = false; int num169 = 2; int num170 = 0; while (!flag16 && num168 < 100) { num168++; int num171 = Main.rand.Next(num163 - num167, num163 + num167); int num172 = Main.rand.Next(num164 - num167, num164 + num167); for (int num173 = num172; num173 < num164 + num167; num173++) { if ((num173 < num164 - num169 || num173 > num164 + num169 || num171 < num163 - num169 || num171 > num163 + num169) && (num173 < num166 - num170 || num173 > num166 + num170 || num171 < num165 - num170 || num171 > num165 + num170) && Main.tile[num171, num173].nactive()) { bool flag17 = true; if (Main.tile[num171, num173 - 1].lava()) { flag17 = false; } if (flag17 && Main.tileSolid[(int)Main.tile[num171, num173].type] && !Collision.SolidTiles(num171 - 1, num171 + 1, num173 - 4, num173 - 1)) { int num174 = NPC.NewNPC(num171 * 16 - this.width / 2, num173 * 16, 387, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num174].position.Y = (float)(num173 * 16 - Main.npc[num174].height); flag16 = true; this.netUpdate = true; break; } } } } } if (this.ai[2] == 60f) { this.ai[2] = -120f; } } } if (this.type == NPCID.GigaZapper) { if (this.confused) { this.ai[2] = -60f; } else { if (this.ai[2] < 20f) { this.ai[2] += 1f; } if (this.justHit) { this.ai[2] = -30f; } if (this.ai[2] == 20f && Main.netMode != 1) { this.ai[2] = (float)(-10 + Main.rand.Next(3) * -10); Projectile.NewProjectile(base.Center.X, base.Center.Y + 8f, (float)(this.direction * 6), 0f, 437, 25, 1f, Main.myPlayer, 0f, 0f); } } } if (this.type == NPCID.SkeletonArcher || this.type == NPCID.GoblinArcher || this.type == NPCID.IcyMerman || this.type == NPCID.PirateDeadeye || this.type == NPCID.PirateCrossbower || this.type == NPCID.PirateCaptain || this.type == NPCID.Paladin || this.type == NPCID.SkeletonSniper || this.type == NPCID.TacticalSkeleton || this.type == NPCID.SkeletonCommando || this.type == NPCID.ElfArcher || this.type == NPCID.CultistArcherBlue || this.type == NPCID.CultistArcherWhite || this.type == NPCID.BrainScrambler || this.type == NPCID.RayGunner || (this.type >= NPCID.BoneThrowingSkeleton && this.type <= NPCID.BoneThrowingSkeleton4) || (this.type == NPCID.DrManFly || this.type == NPCID.GreekSkeleton || this.type == NPCID.StardustSoldier || this.type == NPCID.StardustSpiderBig || (this.type >= NPCID.Salamander && this.type <= NPCID.Salamander9)) || this.type == NPCID.NebulaSoldier || this.type == NPCID.VortexHornetQueen || this.type == NPCID.MartianWalker) { bool flag18 = this.type == NPCID.BrainScrambler || this.type == NPCID.RayGunner || this.type == NPCID.MartianWalker; bool flag19 = this.type == NPCID.VortexHornetQueen; bool flag20 = true; int num175 = -1; int num176 = -1; if (this.type == NPCID.StardustSoldier) { flag18 = true; num175 = 90; num176 = 90; if (this.ai[1] <= 150f) { flag20 = false; } } if (this.confused) { this.ai[2] = 0f; } else { if (this.ai[1] > 0f) { this.ai[1] -= 1f; } if (this.justHit) { this.ai[1] = 30f; this.ai[2] = 0f; } int num177 = 70; if (this.type == NPCID.CultistArcherBlue || this.type == NPCID.CultistArcherWhite) { num177 = 80; } if (this.type == NPCID.BrainScrambler || this.type == NPCID.RayGunner) { num177 = 80; } if (this.type == NPCID.MartianWalker) { num177 = 15; } if (this.type == NPCID.ElfArcher) { num177 = 110; } if (this.type == NPCID.SkeletonSniper) { num177 = 200; } if (this.type == NPCID.TacticalSkeleton) { num177 = 120; } if (this.type == NPCID.SkeletonCommando) { num177 = 90; } if (this.type == NPCID.GoblinArcher) { num177 = 180; } if (this.type == NPCID.IcyMerman) { num177 = 50; } if (this.type == NPCID.PirateDeadeye) { num177 = 40; } if (this.type == NPCID.PirateCrossbower) { num177 = 80; } if (this.type == NPCID.Paladin) { num177 = 30; } if (this.type == NPCID.StardustSoldier) { num177 = 300; } if (this.type == NPCID.StardustSpiderBig) { num177 = 60; } if (this.type == NPCID.NebulaSoldier) { num177 = 180; } if (this.type == NPCID.VortexHornetQueen) { num177 = 60; } bool flag21 = false; if (this.type == NPCID.PirateCaptain) { if (this.localAI[2] >= 20f) { flag21 = true; } if (flag21) { num177 = 60; } else { num177 = 8; } } int num178 = num177 / 2; if (this.type == NPCID.NebulaSoldier) { num178 = num177 - 1; } if (this.type == NPCID.VortexHornetQueen) { num178 = num177 - 1; } if (this.ai[2] > 0f) { if (flag20) { this.TargetClosest(true); } if (this.ai[1] == (float)num178) { if (this.type == NPCID.PirateCaptain) { this.localAI[2] += 1f; } float num179 = 11f; if (this.type == NPCID.GoblinArcher) { num179 = 9f; } if (this.type == NPCID.IcyMerman) { num179 = 7f; } if (this.type == NPCID.Paladin) { num179 = 9f; } if (this.type == NPCID.SkeletonCommando) { num179 = 4f; } if (this.type == NPCID.PirateDeadeye) { num179 = 14f; } if (this.type == NPCID.PirateCrossbower) { num179 = 16f; } if (this.type == NPCID.RayGunner) { num179 = 7f; } if (this.type == NPCID.MartianWalker) { num179 = 8f; } if (this.type == NPCID.StardustSpiderBig) { num179 = 4f; } if (this.type >= NPCID.BoneThrowingSkeleton && this.type <= NPCID.BoneThrowingSkeleton4) { num179 = 7f; } if (this.type == NPCID.GreekSkeleton) { num179 = 9f; } if (this.type == NPCID.DrManFly) { num179 = 7.5f; } if (this.type == NPCID.StardustSoldier) { num179 = 1f; } if (this.type >= NPCID.Salamander && this.type <= NPCID.Salamander9) { num179 = 7f; } Vector2 value9 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); if (this.type == NPCID.GreekSkeleton) { value9.Y -= 14f; } if (this.type == NPCID.IcyMerman) { value9.Y -= 10f; } if (this.type == NPCID.Paladin) { value9.Y -= 10f; } if (this.type == NPCID.BrainScrambler || this.type == NPCID.RayGunner) { value9.Y += 6f; } if (this.type == NPCID.MartianWalker) { value9.Y = this.position.Y + 20f; } if (this.type >= NPCID.Salamander && this.type <= NPCID.Salamander9) { value9.Y -= 8f; } if (this.type == NPCID.VortexHornetQueen) { value9 += new Vector2((float)(this.spriteDirection * 2), -12f); } float num180 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - value9.X; float num181 = Math.Abs(num180) * 0.1f; if (this.type == NPCID.SkeletonSniper || this.type == NPCID.TacticalSkeleton) { num181 = 0f; } if (this.type == NPCID.PirateCrossbower) { num181 = Math.Abs(num180) * 0.08f; } if (this.type == NPCID.PirateDeadeye || (this.type == NPCID.PirateCaptain && !flag21)) { num181 = 0f; } if (this.type == NPCID.BrainScrambler || this.type == NPCID.RayGunner || this.type == NPCID.MartianWalker) { num181 = 0f; } if (this.type >= NPCID.BoneThrowingSkeleton && this.type <= NPCID.BoneThrowingSkeleton4) { num181 = Math.Abs(num180) * (float)Main.rand.Next(10, 50) * 0.01f; } if (this.type == NPCID.DrManFly) { num181 = Math.Abs(num180) * (float)Main.rand.Next(10, 50) * 0.01f; } if (this.type == NPCID.GreekSkeleton) { num181 = Math.Abs(num180) * (float)Main.rand.Next(-10, 11) * 0.0025f; } if (this.type >= NPCID.Salamander && this.type <= NPCID.Salamander9) { num181 = Math.Abs(num180) * (float)Main.rand.Next(1, 11) * 0.0025f; } float num182 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - value9.Y - num181; if (this.type == NPCID.SkeletonSniper) { num180 += (float)Main.rand.Next(-40, 41) * 0.2f; num182 += (float)Main.rand.Next(-40, 41) * 0.2f; } else if (this.type == NPCID.BrainScrambler || this.type == NPCID.RayGunner || this.type == NPCID.MartianWalker) { num180 += (float)Main.rand.Next(-100, 101) * 0.4f; num182 += (float)Main.rand.Next(-100, 101) * 0.4f; num180 *= (float)Main.rand.Next(85, 116) * 0.01f; num182 *= (float)Main.rand.Next(85, 116) * 0.01f; if (this.type == NPCID.MartianWalker) { num180 += (float)Main.rand.Next(-100, 101) * 0.6f; num182 += (float)Main.rand.Next(-100, 101) * 0.6f; num180 *= (float)Main.rand.Next(85, 116) * 0.015f; num182 *= (float)Main.rand.Next(85, 116) * 0.015f; } } else if (this.type == NPCID.GreekSkeleton) { num180 += (float)Main.rand.Next(-40, 41) * 0.4f; num182 += (float)Main.rand.Next(-40, 41) * 0.4f; } else if (this.type >= NPCID.Salamander && this.type <= NPCID.Salamander9) { num180 += (float)Main.rand.Next(-40, 41) * 0.3f; num182 += (float)Main.rand.Next(-40, 41) * 0.3f; } else if (this.type != NPCID.TacticalSkeleton) { num180 += (float)Main.rand.Next(-40, 41); num182 += (float)Main.rand.Next(-40, 41); } float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); this.netUpdate = true; num183 = num179 / num183; num180 *= num183; num182 *= num183; int num184 = 35; int num185 = 82; if (this.type == NPCID.GoblinArcher) { num184 = 11; } if (this.type == NPCID.IcyMerman) { num184 = 37; } if (this.type == NPCID.CultistArcherBlue || this.type == NPCID.CultistArcherWhite) { num184 = 40; } if (this.type == NPCID.ElfArcher) { num184 = 45; } if (this.type == NPCID.DrManFly) { num184 = 50; } if (this.type == NPCID.GoblinArcher) { num185 = 81; } if (this.type == NPCID.CultistArcherBlue || this.type == NPCID.CultistArcherWhite) { num185 = 81; } if (this.type == NPCID.BrainScrambler) { num185 = 436; num184 = 24; } if (this.type == NPCID.RayGunner) { num185 = 438; num184 = 30; } if (this.type == NPCID.MartianWalker) { num185 = 592; num184 = 35; } if (this.type >= NPCID.BoneThrowingSkeleton && this.type <= NPCID.BoneThrowingSkeleton4) { num185 = 471; num184 = 20; } if (this.type >= NPCID.Salamander && this.type <= NPCID.Salamander9) { num185 = 572; num184 = 14; } if (this.type == NPCID.GreekSkeleton) { num185 = 508; num184 = 24; } if (this.type == NPCID.IcyMerman) { num185 = 177; } if (this.type == NPCID.DrManFly) { num185 = 501; } if (this.type == NPCID.StardustSoldier) { num185 = 537; num184 = (Main.expertMode ? 45 : 60); } if (this.type == NPCID.NebulaSoldier) { num185 = 573; num184 = (Main.expertMode ? 45 : 60); } if (this.type == NPCID.VortexHornetQueen) { num185 = 581; num184 = (Main.expertMode ? 45 : 60); } if (this.type == NPCID.SkeletonSniper) { num185 = 302; num184 = 100; } if (this.type == NPCID.Paladin) { num185 = 300; num184 = 60; } if (this.type == NPCID.SkeletonCommando) { num185 = 303; num184 = 60; } if (this.type == NPCID.PirateDeadeye) { num185 = 180; num184 = 25; } if (this.type == NPCID.PirateCrossbower) { num185 = 82; num184 = 40; } if (this.type == NPCID.TacticalSkeleton) { num184 = 50; num185 = 180; } if (this.type == NPCID.PirateCaptain) { num185 = 180; num184 = 30; if (flag21) { num184 = 100; num185 = 240; this.localAI[2] = 0f; } } value9.X += num180; value9.Y += num182; if (Main.expertMode && this.type == NPCID.Paladin) { num184 = (int)((double)num184 * 0.75); } if (Main.expertMode && this.type >= NPCID.BrainScrambler && this.type <= NPCID.MartianSaucer) { num184 = (int)((double)num184 * 0.8); } if (Main.netMode != 1) { if (this.type == NPCID.TacticalSkeleton) { for (int num186 = 0; num186 < 4; num186++) { num180 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - value9.X; num182 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - value9.Y; num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); num183 = 12f / num183; num180 += (float)Main.rand.Next(-40, 41); num182 += (float)Main.rand.Next(-40, 41); num180 *= num183; num182 *= num183; Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); } } else if (this.type == NPCID.StardustSoldier) { Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, (float)this.whoAmI); } else if (this.type == NPCID.NebulaSoldier) { for (int num187 = 0; num187 < 4; num187++) { Projectile.NewProjectile(base.Center.X - (float)(this.spriteDirection * 4), base.Center.Y + 6f, (float)(-3 + 2 * num187) * 0.15f, (float)(-(float)Main.rand.Next(0, 3)) * 0.2f - 0.1f, num185, num184, 0f, Main.myPlayer, 0f, (float)this.whoAmI); } } else if (this.type == NPCID.StardustSpiderBig) { int num188 = NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 410, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num188].velocity = new Vector2(num180, -6f + num182); } else { Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); } } if (Math.Abs(num182) > Math.Abs(num180) * 2f) { if (num182 > 0f) { this.ai[2] = 1f; } else { this.ai[2] = 5f; } } else if (Math.Abs(num180) > Math.Abs(num182) * 2f) { this.ai[2] = 3f; } else if (num182 > 0f) { this.ai[2] = 2f; } else { this.ai[2] = 4f; } } if ((this.velocity.Y != 0f && !flag19) || this.ai[1] <= 0f) { this.ai[2] = 0f; this.ai[1] = 0f; } else if (!flag18 || (num175 != -1 && this.ai[1] >= (float)num175 && this.ai[1] < (float)(num175 + num176) && (!flag19 || this.velocity.Y == 0f))) { this.velocity.X = this.velocity.X * 0.9f; this.spriteDirection = this.direction; } } if (this.type == NPCID.DrManFly && !Main.eclipse) { flag18 = true; } else if ((this.ai[2] <= 0f || flag18) && (this.velocity.Y == 0f || flag19) && this.ai[1] <= 0f && !Main.player[this.target].dead) { bool flag22 = Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height); if (this.type == NPCID.MartianWalker) { flag22 = Collision.CanHitLine(base.Top + new Vector2(0f, 20f), 0, 0, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height); } if (Main.player[this.target].stealth == 0f && Main.player[this.target].itemAnimation == 0) { flag22 = false; } if (flag22) { float num189 = 10f; Vector2 vector24 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num190 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector24.X; float num191 = Math.Abs(num190) * 0.1f; float num192 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector24.Y - num191; num190 += (float)Main.rand.Next(-40, 41); num192 += (float)Main.rand.Next(-40, 41); float num193 = (float)Math.Sqrt((double)(num190 * num190 + num192 * num192)); float num194 = 700f; if (this.type == NPCID.PirateDeadeye) { num194 = 550f; } if (this.type == NPCID.PirateCrossbower) { num194 = 800f; } if (this.type >= NPCID.Salamander && this.type <= NPCID.Salamander9) { num194 = 190f; } if (this.type >= NPCID.BoneThrowingSkeleton && this.type <= NPCID.BoneThrowingSkeleton4) { num194 = 200f; } if (this.type == NPCID.GreekSkeleton) { num194 = 400f; } if (this.type == NPCID.DrManFly) { num194 = 400f; } if (num193 < num194) { this.netUpdate = true; this.velocity.X = this.velocity.X * 0.5f; num193 = num189 / num193; num190 *= num193; num192 *= num193; this.ai[2] = 3f; this.ai[1] = (float)num177; if (Math.Abs(num192) > Math.Abs(num190) * 2f) { if (num192 > 0f) { this.ai[2] = 1f; } else { this.ai[2] = 5f; } } else if (Math.Abs(num190) > Math.Abs(num192) * 2f) { this.ai[2] = 3f; } else if (num192 > 0f) { this.ai[2] = 2f; } else { this.ai[2] = 4f; } } } } if (this.ai[2] <= 0f || (flag18 && (num175 == -1 || this.ai[1] < (float)num175 || this.ai[1] >= (float)(num175 + num176)))) { float num195 = 1f; float num196 = 0.07f; float scaleFactor6 = 0.8f; if (this.type == NPCID.PirateDeadeye) { num195 = 2f; num196 = 0.09f; } else if (this.type == NPCID.PirateCrossbower) { num195 = 1.5f; num196 = 0.08f; } else if (this.type == NPCID.BrainScrambler || this.type == NPCID.RayGunner) { num195 = 2f; num196 = 0.5f; } else if (this.type == NPCID.MartianWalker) { num195 = 4f; num196 = 1f; scaleFactor6 = 0.7f; } else if (this.type == NPCID.StardustSoldier) { num195 = 2f; num196 = 0.5f; } else if (this.type == NPCID.StardustSpiderBig) { num195 = 2f; num196 = 0.5f; } bool flag23 = false; if ((this.type == NPCID.BrainScrambler || this.type == NPCID.RayGunner) && Vector2.Distance(base.Center, Main.player[this.target].Center) < 300f && Collision.CanHitLine(base.Center, 0, 0, Main.player[this.target].Center, 0, 0)) { flag23 = true; this.ai[3] = 0f; } if (this.type == NPCID.MartianWalker && Vector2.Distance(base.Center, Main.player[this.target].Center) < 400f && Collision.CanHitLine(base.Center, 0, 0, Main.player[this.target].Center, 0, 0)) { flag23 = true; this.ai[3] = 0f; } if (this.velocity.X < -num195 || this.velocity.X > num195 || flag23) { if (this.velocity.Y == 0f) { this.velocity *= scaleFactor6; } } else if (this.velocity.X < num195 && this.direction == 1) { this.velocity.X = this.velocity.X + num196; if (this.velocity.X > num195) { this.velocity.X = num195; } } else if (this.velocity.X > -num195 && this.direction == -1) { this.velocity.X = this.velocity.X - num196; if (this.velocity.X < -num195) { this.velocity.X = -num195; } } } if (this.type == NPCID.MartianWalker) { this.localAI[2] += 1f; if (this.localAI[2] >= 6f) { this.localAI[2] = 0f; this.localAI[3] = Main.player[this.target].DirectionFrom(base.Top + new Vector2(0f, 20f)).ToRotation(); } } } } if (this.type == NPCID.Clown && Main.netMode != 1 && !Main.player[this.target].dead) { if (this.justHit) { this.ai[2] = 0f; } this.ai[2] += 1f; if (this.ai[2] > 450f) { Vector2 vector25 = new Vector2(this.position.X + (float)this.width * 0.5f - (float)(this.direction * 24), this.position.Y + 4f); int num197 = 3 * this.direction; int num198 = -5; int num199 = Projectile.NewProjectile(vector25.X, vector25.Y, (float)num197, (float)num198, 75, 0, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num199].timeLeft = 300; this.ai[2] = 0f; } } bool flag24 = false; if (this.velocity.Y == 0f) { int num200 = (int)(this.position.Y + (float)this.height + 7f) / 16; int num201 = (int)this.position.X / 16; int num202 = (int)(this.position.X + (float)this.width) / 16; for (int num203 = num201; num203 <= num202; num203++) { if (Main.tile[num203, num200] == null) { return; } if (Main.tile[num203, num200].nactive() && Main.tileSolid[(int)Main.tile[num203, num200].type]) { flag24 = true; break; } } } if (this.type == NPCID.VortexLarva) { flag24 = false; } if (this.velocity.Y >= 0f) { int num204 = 0; if (this.velocity.X < 0f) { num204 = -1; } if (this.velocity.X > 0f) { num204 = 1; } Vector2 position2 = this.position; position2.X += this.velocity.X; int num205 = (int)((position2.X + (float)(this.width / 2) + (float)((this.width / 2 + 1) * num204)) / 16f); int num206 = (int)((position2.Y + (float)this.height - 1f) / 16f); if (Main.tile[num205, num206] == null) { Main.tile[num205, num206] = new Tile(); } if (Main.tile[num205, num206 - 1] == null) { Main.tile[num205, num206 - 1] = new Tile(); } if (Main.tile[num205, num206 - 2] == null) { Main.tile[num205, num206 - 2] = new Tile(); } if (Main.tile[num205, num206 - 3] == null) { Main.tile[num205, num206 - 3] = new Tile(); } if (Main.tile[num205, num206 + 1] == null) { Main.tile[num205, num206 + 1] = new Tile(); } if (Main.tile[num205 - num204, num206 - 3] == null) { Main.tile[num205 - num204, num206 - 3] = new Tile(); } if ((float)(num205 * 16) < position2.X + (float)this.width && (float)(num205 * 16 + 16) > position2.X && ((Main.tile[num205, num206].nactive() && !Main.tile[num205, num206].topSlope() && !Main.tile[num205, num206 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num205, num206].type] && !Main.tileSolidTop[(int)Main.tile[num205, num206].type]) || (Main.tile[num205, num206 - 1].halfBrick() && Main.tile[num205, num206 - 1].nactive())) && (!Main.tile[num205, num206 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num205, num206 - 1].type] || Main.tileSolidTop[(int)Main.tile[num205, num206 - 1].type] || (Main.tile[num205, num206 - 1].halfBrick() && (!Main.tile[num205, num206 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num205, num206 - 4].type] || Main.tileSolidTop[(int)Main.tile[num205, num206 - 4].type]))) && (!Main.tile[num205, num206 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num205, num206 - 2].type] || Main.tileSolidTop[(int)Main.tile[num205, num206 - 2].type]) && (!Main.tile[num205, num206 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num205, num206 - 3].type] || Main.tileSolidTop[(int)Main.tile[num205, num206 - 3].type]) && (!Main.tile[num205 - num204, num206 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num205 - num204, num206 - 3].type])) { float num207 = (float)(num206 * 16); if (Main.tile[num205, num206].halfBrick()) { num207 += 8f; } if (Main.tile[num205, num206 - 1].halfBrick()) { num207 -= 8f; } if (num207 < position2.Y + (float)this.height) { float num208 = position2.Y + (float)this.height - num207; float num209 = 16.1f; if (this.type == NPCID.BlackRecluse || this.type == NPCID.WallCreeper || this.type == NPCID.JungleCreeper || this.type == NPCID.BloodCrawler || this.type == NPCID.DesertScorpionWalk) { num209 += 8f; } if (num208 <= num209) { this.gfxOffY += this.position.Y + (float)this.height - num207; this.position.Y = num207 - (float)this.height; if (num208 < 9f) { this.stepSpeed = 1f; } else { this.stepSpeed = 2f; } } } } } if (flag24) { int num210 = (int)((this.position.X + (float)(this.width / 2) + (float)(15 * this.direction)) / 16f); int num211 = (int)((this.position.Y + (float)this.height - 15f) / 16f); if (this.type == NPCID.Clown || this.type == NPCID.BlackRecluse || this.type == NPCID.WallCreeper || this.type == NPCID.LihzahrdCrawler || this.type == NPCID.JungleCreeper || this.type == NPCID.BloodCrawler || this.type == NPCID.AnomuraFungus || this.type == NPCID.MushiLadybug || this.type == NPCID.Paladin || this.type == NPCID.Scutlix || this.type == NPCID.VortexRifleman || this.type == NPCID.VortexHornet || this.type == NPCID.VortexHornetQueen || this.type == NPCID.WalkingAntlion || this.type == NPCID.SolarDrakomire || this.type == NPCID.DesertScorpionWalk || this.type == NPCID.DesertBeast) { num210 = (int)((this.position.X + (float)(this.width / 2) + (float)((this.width / 2 + 16) * this.direction)) / 16f); } if (Main.tile[num210, num211] == null) { Main.tile[num210, num211] = new Tile(); } if (Main.tile[num210, num211 - 1] == null) { Main.tile[num210, num211 - 1] = new Tile(); } if (Main.tile[num210, num211 - 2] == null) { Main.tile[num210, num211 - 2] = new Tile(); } if (Main.tile[num210, num211 - 3] == null) { Main.tile[num210, num211 - 3] = new Tile(); } if (Main.tile[num210, num211 + 1] == null) { Main.tile[num210, num211 + 1] = new Tile(); } if (Main.tile[num210 + this.direction, num211 - 1] == null) { Main.tile[num210 + this.direction, num211 - 1] = new Tile(); } if (Main.tile[num210 + this.direction, num211 + 1] == null) { Main.tile[num210 + this.direction, num211 + 1] = new Tile(); } if (Main.tile[num210 - this.direction, num211 + 1] == null) { Main.tile[num210 - this.direction, num211 + 1] = new Tile(); } Main.tile[num210, num211 + 1].halfBrick(); if (Main.tile[num210, num211 - 1].nactive() && (Main.tile[num210, num211 - 1].type == 10 || Main.tile[num210, num211 - 1].type == 388) && flag7) { this.ai[2] += 1f; this.ai[3] = 0f; if (this.ai[2] >= 60f) { if (!Main.bloodMoon && (this.type == NPCID.Zombie || this.type == NPCID.ZombieXmas || this.type == NPCID.ZombieSweater || this.type == NPCID.BaldZombie || this.type == NPCID.ZombieEskimo || this.type == NPCID.PincushionZombie || this.type == NPCID.SlimedZombie || this.type == NPCID.SwampZombie || this.type == NPCID.TwiggyZombie || this.type == NPCID.FemaleZombie || this.type == NPCID.ZombieRaincoat || this.type == NPCID.ZombieSuperman || this.type == NPCID.ZombiePixie || this.type == NPCID.ZombieDoctor)) { this.ai[1] = 0f; } this.velocity.X = 0.5f * (float)(-(float)this.direction); int num212 = 5; if (Main.tile[num210, num211 - 1].type == 388) { num212 = 2; } this.ai[1] += (float)num212; if (this.type == NPCID.GoblinThief) { this.ai[1] += 1f; } if (this.type == NPCID.AngryBones || this.type == NPCID.AngryBonesBig || this.type == NPCID.AngryBonesBigMuscle || this.type == NPCID.AngryBonesBigHelmet) { this.ai[1] += 6f; } this.ai[2] = 0f; bool flag25 = false; if (this.ai[1] >= 10f) { flag25 = true; this.ai[1] = 10f; } if (this.type == NPCID.Butcher) { flag25 = true; } WorldGen.KillTile(num210, num211 - 1, true, false, false); if ((Main.netMode != 1 || !flag25) && flag25 && Main.netMode != 1) { if (this.type == NPCID.GoblinPeon) { WorldGen.KillTile(num210, num211 - 1, false, false, false); if (Main.netMode == 2) { NetMessage.SendData((int)PacketTypes.Tile, -1, -1, "", 0, (float)num210, (float)(num211 - 1), 0f, 0, 0, 0); } } else { if (Main.tile[num210, num211 - 1].type == 10) { bool flag26 = WorldGen.OpenDoor(num210, num211 - 1, this.direction); if (!flag26) { this.ai[3] = (float)num67; this.netUpdate = true; } if (Main.netMode == 2 && flag26) { NetMessage.SendData((int)PacketTypes.DoorUse, -1, -1, "", 0, (float)num210, (float)(num211 - 1), (float)this.direction, 0, 0, 0); } } if (Main.tile[num210, num211 - 1].type == 388) { bool flag27 = WorldGen.ShiftTallGate(num210, num211 - 1, false); if (!flag27) { this.ai[3] = (float)num67; this.netUpdate = true; } if (Main.netMode == 2 && flag27) { NetMessage.SendData((int)PacketTypes.DoorUse, -1, -1, "", 4, (float)num210, (float)(num211 - 1), 0f, 0, 0, 0); } } } } } } else { int num213 = this.spriteDirection; if (this.type == NPCID.VortexRifleman) { num213 *= -1; } if ((this.velocity.X < 0f && num213 == -1) || (this.velocity.X > 0f && num213 == 1)) { if (this.height >= 32 && Main.tile[num210, num211 - 2].nactive() && Main.tileSolid[(int)Main.tile[num210, num211 - 2].type]) { if (Main.tile[num210, num211 - 3].nactive() && Main.tileSolid[(int)Main.tile[num210, num211 - 3].type]) { this.velocity.Y = -8f; this.netUpdate = true; } else { this.velocity.Y = -7f; this.netUpdate = true; } } else if (Main.tile[num210, num211 - 1].nactive() && Main.tileSolid[(int)Main.tile[num210, num211 - 1].type]) { this.velocity.Y = -6f; this.netUpdate = true; } else if (this.position.Y + (float)this.height - (float)(num211 * 16) > 20f && Main.tile[num210, num211].nactive() && !Main.tile[num210, num211].topSlope() && Main.tileSolid[(int)Main.tile[num210, num211].type]) { this.velocity.Y = -5f; this.netUpdate = true; } else if (this.directionY < 0 && this.type != NPCID.Crab && (!Main.tile[num210, num211 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num210, num211 + 1].type]) && (!Main.tile[num210 + this.direction, num211 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num210 + this.direction, num211 + 1].type])) { this.velocity.Y = -8f; this.velocity.X = this.velocity.X * 1.5f; this.netUpdate = true; } else if (flag7) { this.ai[1] = 0f; this.ai[2] = 0f; } if (this.velocity.Y == 0f && flag5 && this.ai[3] == 1f) { this.velocity.Y = -5f; } } if ((this.type == NPCID.AngryBones || this.type == NPCID.AngryBonesBig || this.type == NPCID.AngryBonesBigMuscle || this.type == NPCID.AngryBonesBigHelmet || this.type == NPCID.CorruptBunny || this.type == NPCID.ArmoredSkeleton || this.type == NPCID.Werewolf || this.type == NPCID.CorruptPenguin || this.type == NPCID.Nymph || this.type == NPCID.GrayGrunt || this.type == NPCID.GigaZapper || this.type == NPCID.CrimsonBunny || this.type == NPCID.CrimsonPenguin || (this.type >= NPCID.DesertGhoul && this.type <= NPCID.DesertGhoulHallow)) && this.velocity.Y == 0f && Math.Abs(this.position.X + (float)(this.width / 2) - (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2))) < 100f && Math.Abs(this.position.Y + (float)(this.height / 2) - (Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2))) < 50f && ((this.direction > 0 && this.velocity.X >= 1f) || (this.direction < 0 && this.velocity.X <= -1f))) { this.velocity.X = this.velocity.X * 2f; if (this.velocity.X > 3f) { this.velocity.X = 3f; } if (this.velocity.X < -3f) { this.velocity.X = -3f; } this.velocity.Y = -4f; this.netUpdate = true; } if (this.type == NPCID.ChaosElemental && this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 1.1f; } if (this.type == NPCID.BoneLee && this.velocity.Y == 0f && Math.Abs(this.position.X + (float)(this.width / 2) - (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2))) < 150f && Math.Abs(this.position.Y + (float)(this.height / 2) - (Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2))) < 50f && ((this.direction > 0 && this.velocity.X >= 1f) || (this.direction < 0 && this.velocity.X <= -1f))) { this.velocity.X = (float)(8 * this.direction); this.velocity.Y = -4f; this.netUpdate = true; } if (this.type == NPCID.BoneLee && this.velocity.Y < 0f) { this.velocity.X = this.velocity.X * 1.2f; this.velocity.Y = this.velocity.Y * 1.1f; } if (this.type == NPCID.Butcher && this.velocity.Y < 0f) { this.velocity.X = this.velocity.X * 1.3f; this.velocity.Y = this.velocity.Y * 1.1f; } } } else if (flag7) { this.ai[1] = 0f; this.ai[2] = 0f; } if (Main.netMode != 1 && this.type == NPCID.ChaosElemental && this.ai[3] >= (float)num67) { int num214 = (int)Main.player[this.target].position.X / 16; int num215 = (int)Main.player[this.target].position.Y / 16; int num216 = (int)this.position.X / 16; int num217 = (int)this.position.Y / 16; int num218 = 20; int num219 = 0; bool flag28 = false; if (Math.Abs(this.position.X - Main.player[this.target].position.X) + Math.Abs(this.position.Y - Main.player[this.target].position.Y) > 2000f) { num219 = 100; flag28 = true; } while (!flag28) { if (num219 >= 100) { return; } num219++; int num220 = Main.rand.Next(num214 - num218, num214 + num218); int num221 = Main.rand.Next(num215 - num218, num215 + num218); for (int num222 = num221; num222 < num215 + num218; num222++) { if ((num222 < num215 - 4 || num222 > num215 + 4 || num220 < num214 - 4 || num220 > num214 + 4) && (num222 < num217 - 1 || num222 > num217 + 1 || num220 < num216 - 1 || num220 > num216 + 1) && Main.tile[num220, num222].nactive()) { bool flag29 = true; if (this.type == NPCID.DarkCaster && Main.tile[num220, num222 - 1].wall == 0) { flag29 = false; } else if (Main.tile[num220, num222 - 1].lava()) { flag29 = false; } if (flag29 && Main.tileSolid[(int)Main.tile[num220, num222].type] && !Collision.SolidTiles(num220 - 1, num220 + 1, num222 - 4, num222 - 1)) { this.position.X = (float)(num220 * 16 - this.width / 2); this.position.Y = (float)(num222 * 16 - this.height); this.netUpdate = true; this.ai[3] = -120f; } } } } } } else if (this.aiStyle == 4) { bool flag30 = false; if (Main.expertMode && (double)this.life < (double)this.lifeMax * 0.12) { flag30 = true; } bool flag31 = false; if (Main.expertMode && (double)this.life < (double)this.lifeMax * 0.04) { flag31 = true; } float num223 = 20f; if (flag31) { num223 = 10f; } if (this.target < 0 || this.target == 255 || Main.player[this.target].dead || !Main.player[this.target].active) { this.TargetClosest(true); } bool dead = Main.player[this.target].dead; float num224 = this.position.X + (float)(this.width / 2) - Main.player[this.target].position.X - (float)(Main.player[this.target].width / 2); float num225 = this.position.Y + (float)this.height - 59f - Main.player[this.target].position.Y - (float)(Main.player[this.target].height / 2); float num226 = (float)Math.Atan2((double)num225, (double)num224) + 1.57f; if (num226 < 0f) { num226 += 6.283f; } else if ((double)num226 > 6.283) { num226 -= 6.283f; } float num227 = 0f; if (this.ai[0] == 0f && this.ai[1] == 0f) { num227 = 0.02f; } if (this.ai[0] == 0f && this.ai[1] == 2f && this.ai[2] > 40f) { num227 = 0.05f; } if (this.ai[0] == 3f && this.ai[1] == 0f) { num227 = 0.05f; } if (this.ai[0] == 3f && this.ai[1] == 2f && this.ai[2] > 40f) { num227 = 0.08f; } if (this.ai[0] == 3f && this.ai[1] == 4f && this.ai[2] > num223) { num227 = 0.15f; } if (this.ai[0] == 3f && this.ai[1] == 5f) { num227 = 0.05f; } if (Main.expertMode) { num227 *= 1.5f; } if (flag31 && Main.expertMode) { num227 = 0f; } if (this.rotation < num226) { if ((double)(num226 - this.rotation) > 3.1415) { this.rotation -= num227; } else { this.rotation += num227; } } else if (this.rotation > num226) { if ((double)(this.rotation - num226) > 3.1415) { this.rotation += num227; } else { this.rotation -= num227; } } if (this.rotation > num226 - num227 && this.rotation < num226 + num227) { this.rotation = num226; } if (this.rotation < 0f) { this.rotation += 6.283f; } else if ((double)this.rotation > 6.283) { this.rotation -= 6.283f; } if (this.rotation > num226 - num227 && this.rotation < num226 + num227) { this.rotation = num226; } if (Main.dayTime || dead) { this.velocity.Y = this.velocity.Y - 0.04f; if (this.timeLeft > 10) { this.timeLeft = 10; return; } } else if (this.ai[0] == 0f) { if (this.ai[1] == 0f) { float num229 = 5f; float num230 = 0.04f; if (Main.expertMode) { num230 = 0.15f; num229 = 7f; } Vector2 vector26 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num231 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector26.X; float num232 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - 200f - vector26.Y; float num233 = (float)Math.Sqrt((double)(num231 * num231 + num232 * num232)); float num234 = num233; num233 = num229 / num233; num231 *= num233; num232 *= num233; if (this.velocity.X < num231) { this.velocity.X = this.velocity.X + num230; if (this.velocity.X < 0f && num231 > 0f) { this.velocity.X = this.velocity.X + num230; } } else if (this.velocity.X > num231) { this.velocity.X = this.velocity.X - num230; if (this.velocity.X > 0f && num231 < 0f) { this.velocity.X = this.velocity.X - num230; } } if (this.velocity.Y < num232) { this.velocity.Y = this.velocity.Y + num230; if (this.velocity.Y < 0f && num232 > 0f) { this.velocity.Y = this.velocity.Y + num230; } } else if (this.velocity.Y > num232) { this.velocity.Y = this.velocity.Y - num230; if (this.velocity.Y > 0f && num232 < 0f) { this.velocity.Y = this.velocity.Y - num230; } } this.ai[2] += 1f; float num235 = 600f; if (Main.expertMode) { num235 *= 0.35f; } if (this.ai[2] >= num235) { this.ai[1] = 1f; this.ai[2] = 0f; this.ai[3] = 0f; this.target = 255; this.netUpdate = true; } else if ((this.position.Y + (float)this.height < Main.player[this.target].position.Y && num234 < 500f) || (Main.expertMode && num234 < 500f)) { if (!Main.player[this.target].dead) { this.ai[3] += 1f; } float num236 = 110f; if (Main.expertMode) { num236 *= 0.4f; } if (this.ai[3] >= num236) { this.ai[3] = 0f; this.rotation = num226; float num237 = 5f; if (Main.expertMode) { num237 = 6f; } float num238 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector26.X; float num239 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector26.Y; float num240 = (float)Math.Sqrt((double)(num238 * num238 + num239 * num239)); num240 = num237 / num240; Vector2 position3 = vector26; Vector2 vector27; vector27.X = num238 * num240; vector27.Y = num239 * num240; position3.X += vector27.X * 10f; position3.Y += vector27.Y * 10f; if (Main.netMode != 1) { int num241 = NPC.NewNPC((int)position3.X, (int)position3.Y, 5, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num241].velocity.X = vector27.X; Main.npc[num241].velocity.Y = vector27.Y; if (Main.netMode == 2 && num241 < 200) { NetMessage.SendData((int)PacketTypes.NpcUpdate, -1, -1, "", num241, 0f, 0f, 0f, 0, 0, 0); } } } } } else if (this.ai[1] == 1f) { this.rotation = num226; float num243 = 6f; if (Main.expertMode) { num243 = 7f; } Vector2 vector28 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num244 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector28.X; float num245 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector28.Y; float num246 = (float)Math.Sqrt((double)(num244 * num244 + num245 * num245)); num246 = num243 / num246; this.velocity.X = num244 * num246; this.velocity.Y = num245 * num246; this.ai[1] = 2f; this.netUpdate = true; if (this.netSpam > 10) { this.netSpam = 10; } } else if (this.ai[1] == 2f) { this.ai[2] += 1f; if (this.ai[2] >= 40f) { this.velocity *= 0.98f; if (Main.expertMode) { this.velocity *= 0.985f; } if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1) { this.velocity.Y = 0f; } } else { this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 1.57f; } int num247 = 150; if (Main.expertMode) { num247 = 100; } if (this.ai[2] >= (float)num247) { this.ai[3] += 1f; this.ai[2] = 0f; this.target = 255; this.rotation = num226; if (this.ai[3] >= 3f) { this.ai[1] = 0f; this.ai[3] = 0f; } else { this.ai[1] = 1f; } } } float num248 = 0.5f; if (Main.expertMode) { num248 = 0.65f; } if ((float)this.life < (float)this.lifeMax * num248) { this.ai[0] = 1f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; if (this.netSpam > 10) { this.netSpam = 10; return; } } } else if (this.ai[0] == 1f || this.ai[0] == 2f) { if (this.ai[0] == 1f) { this.ai[2] += 0.005f; if ((double)this.ai[2] > 0.5) { this.ai[2] = 0.5f; } } else { this.ai[2] -= 0.005f; if (this.ai[2] < 0f) { this.ai[2] = 0f; } } this.rotation += this.ai[2]; this.ai[1] += 1f; if (Main.expertMode && this.ai[1] % 20f == 0f) { float num249 = 5f; Vector2 vector29 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num250 = (float)Main.rand.Next(-200, 200); float num251 = (float)Main.rand.Next(-200, 200); float num252 = (float)Math.Sqrt((double)(num250 * num250 + num251 * num251)); num252 = num249 / num252; Vector2 position4 = vector29; Vector2 vector30; vector30.X = num250 * num252; vector30.Y = num251 * num252; position4.X += vector30.X * 10f; position4.Y += vector30.Y * 10f; if (Main.netMode != 1) { int num253 = NPC.NewNPC((int)position4.X, (int)position4.Y, 5, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num253].velocity.X = vector30.X; Main.npc[num253].velocity.Y = vector30.Y; if (Main.netMode == 2 && num253 < 200) { NetMessage.SendData((int)PacketTypes.NpcUpdate, -1, -1, "", num253, 0f, 0f, 0f, 0, 0, 0); } } } if (this.ai[1] == 100f) { this.ai[0] += 1f; this.ai[1] = 0f; if (this.ai[0] == 3f) { this.ai[2] = 0f; } } this.velocity.X *= 0.98f; this.velocity.Y *= 0.98f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1) { this.velocity.Y = 0f; return; } } else { this.defense = 0; this.damage = 23; if (Main.expertMode) { if (flag30) { this.defense = -15; } if (flag31) { this.damage = (int)(20f * Main.expertDamage); this.defense = -30; } else { this.damage = (int)(18f * Main.expertDamage); } } if (this.ai[1] == 0f && flag30) { this.ai[1] = 5f; } if (this.ai[1] == 0f) { float num257 = 6f; float num258 = 0.07f; Vector2 vector31 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num259 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector31.X; float num260 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - 120f - vector31.Y; float num261 = (float)Math.Sqrt((double)(num259 * num259 + num260 * num260)); if (num261 > 400f && Main.expertMode) { num257 += 1f; num258 += 0.05f; if (num261 > 600f) { num257 += 1f; num258 += 0.05f; if (num261 > 800f) { num257 += 1f; num258 += 0.05f; } } } num261 = num257 / num261; num259 *= num261; num260 *= num261; if (this.velocity.X < num259) { this.velocity.X = this.velocity.X + num258; if (this.velocity.X < 0f && num259 > 0f) { this.velocity.X = this.velocity.X + num258; } } else if (this.velocity.X > num259) { this.velocity.X = this.velocity.X - num258; if (this.velocity.X > 0f && num259 < 0f) { this.velocity.X = this.velocity.X - num258; } } if (this.velocity.Y < num260) { this.velocity.Y = this.velocity.Y + num258; if (this.velocity.Y < 0f && num260 > 0f) { this.velocity.Y = this.velocity.Y + num258; } } else if (this.velocity.Y > num260) { this.velocity.Y = this.velocity.Y - num258; if (this.velocity.Y > 0f && num260 < 0f) { this.velocity.Y = this.velocity.Y - num258; } } this.ai[2] += 1f; if (this.ai[2] >= 200f) { this.ai[1] = 1f; this.ai[2] = 0f; this.ai[3] = 0f; if (Main.expertMode && (double)this.life < (double)this.lifeMax * 0.35) { this.ai[1] = 3f; } this.target = 255; this.netUpdate = true; } if (Main.expertMode && flag31) { this.TargetClosest(true); this.netUpdate = true; this.ai[1] = 3f; this.ai[2] = 0f; this.ai[3] -= 1000f; } } else if (this.ai[1] == 1f) { this.rotation = num226; float num262 = 6.8f; if (Main.expertMode && this.ai[3] == 1f) { num262 *= 1.15f; } if (Main.expertMode && this.ai[3] == 2f) { num262 *= 1.3f; } Vector2 vector32 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num263 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector32.X; float num264 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector32.Y; float num265 = (float)Math.Sqrt((double)(num263 * num263 + num264 * num264)); num265 = num262 / num265; this.velocity.X = num263 * num265; this.velocity.Y = num264 * num265; this.ai[1] = 2f; this.netUpdate = true; if (this.netSpam > 10) { this.netSpam = 10; } } else if (this.ai[1] == 2f) { float num266 = 40f; this.ai[2] += 1f; if (Main.expertMode) { num266 = 50f; } if (this.ai[2] >= num266) { this.velocity *= 0.97f; if (Main.expertMode) { this.velocity *= 0.98f; } if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1) { this.velocity.Y = 0f; } } else { this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 1.57f; } int num267 = 130; if (Main.expertMode) { num267 = 90; } if (this.ai[2] >= (float)num267) { this.ai[3] += 1f; this.ai[2] = 0f; this.target = 255; this.rotation = num226; if (this.ai[3] >= 3f) { this.ai[1] = 0f; this.ai[3] = 0f; if (Main.expertMode && Main.netMode != 1 && (double)this.life < (double)this.lifeMax * 0.5) { this.ai[1] = 3f; this.ai[3] += (float)Main.rand.Next(1, 4); } this.netUpdate = true; if (this.netSpam > 10) { this.netSpam = 10; } } else { this.ai[1] = 1f; } } } else if (this.ai[1] == 3f) { if (this.ai[3] == 4f && flag30 && base.Center.Y > Main.player[this.target].Center.Y) { this.TargetClosest(true); this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; if (this.netSpam > 10) { this.netSpam = 10; } } else if (Main.netMode != 1) { this.TargetClosest(true); float num268 = 20f; Vector2 vector33 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num269 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector33.X; float num270 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector33.Y; float num271 = Math.Abs(Main.player[this.target].velocity.X) + Math.Abs(Main.player[this.target].velocity.Y) / 4f; num271 += 10f - num271; if (num271 < 5f) { num271 = 5f; } if (num271 > 15f) { num271 = 15f; } if (this.ai[2] == -1f && !flag31) { num271 *= 4f; num268 *= 1.3f; } if (flag31) { num271 *= 2f; } num269 -= Main.player[this.target].velocity.X * num271; num270 -= Main.player[this.target].velocity.Y * num271 / 4f; num269 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; num270 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; if (flag31) { num269 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; num270 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; } float num272 = (float)Math.Sqrt((double)(num269 * num269 + num270 * num270)); float num273 = num272; num272 = num268 / num272; this.velocity.X = num269 * num272; this.velocity.Y = num270 * num272; this.velocity.X = this.velocity.X + (float)Main.rand.Next(-20, 21) * 0.1f; this.velocity.Y = this.velocity.Y + (float)Main.rand.Next(-20, 21) * 0.1f; if (flag31) { this.velocity.X = this.velocity.X + (float)Main.rand.Next(-50, 51) * 0.1f; this.velocity.Y = this.velocity.Y + (float)Main.rand.Next(-50, 51) * 0.1f; float num274 = Math.Abs(this.velocity.X); float num275 = Math.Abs(this.velocity.Y); if (base.Center.X > Main.player[this.target].Center.X) { num275 *= -1f; } if (base.Center.Y > Main.player[this.target].Center.Y) { num274 *= -1f; } this.velocity.X = num275 + this.velocity.X; this.velocity.Y = num274 + this.velocity.Y; this.velocity.Normalize(); this.velocity *= num268; this.velocity.X = this.velocity.X + (float)Main.rand.Next(-20, 21) * 0.1f; this.velocity.Y = this.velocity.Y + (float)Main.rand.Next(-20, 21) * 0.1f; } else if (num273 < 100f) { if (Math.Abs(this.velocity.X) > Math.Abs(this.velocity.Y)) { float num276 = Math.Abs(this.velocity.X); float num277 = Math.Abs(this.velocity.Y); if (base.Center.X > Main.player[this.target].Center.X) { num277 *= -1f; } if (base.Center.Y > Main.player[this.target].Center.Y) { num276 *= -1f; } this.velocity.X = num277; this.velocity.Y = num276; } } else if (Math.Abs(this.velocity.X) > Math.Abs(this.velocity.Y)) { float num278 = (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) / 2f; float num279 = num278; if (base.Center.X > Main.player[this.target].Center.X) { num279 *= -1f; } if (base.Center.Y > Main.player[this.target].Center.Y) { num278 *= -1f; } this.velocity.X = num279; this.velocity.Y = num278; } this.ai[1] = 4f; this.netUpdate = true; if (this.netSpam > 10) { this.netSpam = 10; } } } else if (this.ai[1] == 4f) { float num280 = num223; this.ai[2] += 1f; if (this.ai[2] == num280 && Vector2.Distance(this.position, Main.player[this.target].position) < 200f) { this.ai[2] -= 1f; } if (this.ai[2] >= num280) { this.velocity *= 0.95f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1) { this.velocity.Y = 0f; } } else { this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 1.57f; } float num281 = num280 + 13f; if (this.ai[2] >= num281) { this.netUpdate = true; if (this.netSpam > 10) { this.netSpam = 10; } this.ai[3] += 1f; this.ai[2] = 0f; if (this.ai[3] >= 5f) { this.ai[1] = 0f; this.ai[3] = 0f; } else { this.ai[1] = 3f; } } } else if (this.ai[1] == 5f) { float num282 = 600f; float num283 = 9f; float num284 = 0.3f; Vector2 vector34 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num285 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector34.X; float num286 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) + num282 - vector34.Y; float num287 = (float)Math.Sqrt((double)(num285 * num285 + num286 * num286)); num287 = num283 / num287; num285 *= num287; num286 *= num287; if (this.velocity.X < num285) { this.velocity.X = this.velocity.X + num284; if (this.velocity.X < 0f && num285 > 0f) { this.velocity.X = this.velocity.X + num284; } } else if (this.velocity.X > num285) { this.velocity.X = this.velocity.X - num284; if (this.velocity.X > 0f && num285 < 0f) { this.velocity.X = this.velocity.X - num284; } } if (this.velocity.Y < num286) { this.velocity.Y = this.velocity.Y + num284; if (this.velocity.Y < 0f && num286 > 0f) { this.velocity.Y = this.velocity.Y + num284; } } else if (this.velocity.Y > num286) { this.velocity.Y = this.velocity.Y - num284; if (this.velocity.Y > 0f && num286 < 0f) { this.velocity.Y = this.velocity.Y - num284; } } this.ai[2] += 1f; if (this.ai[2] >= 70f) { this.TargetClosest(true); this.ai[1] = 3f; this.ai[2] = -1f; this.ai[3] = (float)Main.rand.Next(-3, 1); this.netUpdate = true; } } if (flag31 && this.ai[1] == 5f) { this.ai[1] = 3f; return; } } } else if (this.aiStyle == 5) { if (this.target < 0 || this.target == 255 || Main.player[this.target].dead) { this.TargetClosest(true); } float num288 = 6f; float num289 = 0.05f; if (this.type == NPCID.EaterofSouls || this.type == NPCID.Crimera) { num288 = 4f; num289 = 0.02f; if (this.type == NPCID.EaterofSouls && Main.expertMode) { num289 = 0.035f; } } else if (this.type == NPCID.Corruptor) { num288 = 4.2f; num289 = 0.022f; } else if (this.type == NPCID.Parrot) { if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { num288 = 6f; num289 = 0.1f; } else { num289 = 0.01f; num288 = 2f; } } else if (this.type == NPCID.Hornet || (this.type >= NPCID.HornetFatty && this.type <= NPCID.HornetStingy)) { num288 = 3.5f; num289 = 0.021f; if (this.type == NPCID.HornetFatty) { num288 = 3f; num289 = 0.017f; } num288 *= 1f - this.scale; num289 *= 1f - this.scale; } else if (this.type == NPCID.Moth) { num288 = 3.25f; num289 = 0.018f; } else if (this.type == NPCID.MossHornet) { num288 = 4f; num289 = 0.017f; } else if (this.type == NPCID.MeteorHead) { num288 = 1f; num289 = 0.03f; } else if (this.type == NPCID.ServantofCthulhu) { num288 = 5f; num289 = 0.03f; } else if (this.type == NPCID.Bee || this.type == NPCID.BeeSmall) { this.localAI[0] += 1f; float num290 = (this.localAI[0] - 60f) / 60f; if (num290 > 1f) { num290 = 1f; } else { if (this.velocity.X > 6f) { this.velocity.X = 6f; } if (this.velocity.X < -6f) { this.velocity.X = -6f; } if (this.velocity.Y > 6f) { this.velocity.Y = 6f; } if (this.velocity.Y < -6f) { this.velocity.Y = -6f; } } num288 = 5f; num289 = 0.1f; num289 *= num290; } Vector2 vector35 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num291 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2); float num292 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2); num291 = (float)((int)(num291 / 8f) * 8); num292 = (float)((int)(num292 / 8f) * 8); vector35.X = (float)((int)(vector35.X / 8f) * 8); vector35.Y = (float)((int)(vector35.Y / 8f) * 8); num291 -= vector35.X; num292 -= vector35.Y; float num293 = (float)Math.Sqrt((double)(num291 * num291 + num292 * num292)); float num294 = num293; bool flag32 = false; if (num293 > 600f) { flag32 = true; } if (num293 == 0f) { num291 = this.velocity.X; num292 = this.velocity.Y; } else { num293 = num288 / num293; num291 *= num293; num292 *= num293; } if (this.type == NPCID.EaterofSouls || this.type == NPCID.Hornet || this.type == NPCID.Corruptor || this.type == NPCID.Probe || this.type == NPCID.Crimera || this.type == NPCID.MossHornet || this.type == NPCID.Moth || this.type == NPCID.Bee || this.type == NPCID.BeeSmall || (this.type >= NPCID.HornetFatty && this.type <= NPCID.HornetStingy)) { if (num294 > 100f || this.type == NPCID.Hornet || this.type == NPCID.Corruptor || this.type == NPCID.MossHornet || this.type == NPCID.Bee || this.type == NPCID.BeeSmall || (this.type >= NPCID.HornetFatty && this.type <= NPCID.HornetStingy)) { this.ai[0] += 1f; if (this.ai[0] > 0f) { this.velocity.Y = this.velocity.Y + 0.023f; } else { this.velocity.Y = this.velocity.Y - 0.023f; } if (this.ai[0] < -100f || this.ai[0] > 100f) { this.velocity.X = this.velocity.X + 0.023f; } else { this.velocity.X = this.velocity.X - 0.023f; } if (this.ai[0] > 200f) { this.ai[0] = -200f; } } if (num294 < 150f && (this.type == NPCID.EaterofSouls || this.type == NPCID.Corruptor || this.type == NPCID.Crimera)) { this.velocity.X = this.velocity.X + num291 * 0.007f; this.velocity.Y = this.velocity.Y + num292 * 0.007f; } } if (Main.player[this.target].dead) { num291 = (float)this.direction * num288 / 2f; num292 = -num288 / 2f; } if (this.velocity.X < num291) { this.velocity.X = this.velocity.X + num289; if (this.type != NPCID.Crimera && this.type != NPCID.EaterofSouls && this.type != NPCID.Hornet && (this.type < 231 || this.type > 235) && this.type != NPCID.Corruptor && this.type != NPCID.Probe && this.velocity.X < 0f && num291 > 0f) { this.velocity.X = this.velocity.X + num289; } } else if (this.velocity.X > num291) { this.velocity.X = this.velocity.X - num289; if (this.type != NPCID.Crimera && this.type != NPCID.EaterofSouls && this.type != NPCID.Hornet && (this.type < 231 || this.type > 235) && this.type != NPCID.Corruptor && this.type != NPCID.Probe && this.velocity.X > 0f && num291 < 0f) { this.velocity.X = this.velocity.X - num289; } } if (this.velocity.Y < num292) { this.velocity.Y = this.velocity.Y + num289; if (this.type != NPCID.Crimera && this.type != NPCID.EaterofSouls && this.type != NPCID.Hornet && (this.type < 231 || this.type > 235) && this.type != NPCID.Corruptor && this.type != NPCID.Probe && this.velocity.Y < 0f && num292 > 0f) { this.velocity.Y = this.velocity.Y + num289; } } else if (this.velocity.Y > num292) { this.velocity.Y = this.velocity.Y - num289; if (this.type != NPCID.Crimera && this.type != NPCID.EaterofSouls && this.type != NPCID.Hornet && (this.type < 231 || this.type > 235) && this.type != NPCID.Corruptor && this.type != NPCID.Probe && this.velocity.Y > 0f && num292 < 0f) { this.velocity.Y = this.velocity.Y - num289; } } if (this.type == NPCID.MeteorHead) { if (num291 > 0f) { this.spriteDirection = 1; this.rotation = (float)Math.Atan2((double)num292, (double)num291); } else if (num291 < 0f) { this.spriteDirection = -1; this.rotation = (float)Math.Atan2((double)num292, (double)num291) + 3.14f; } } else if (this.type == NPCID.Probe) { this.localAI[0] += 1f; if (this.justHit) { this.localAI[0] = 0f; } if (Main.netMode != 1 && this.localAI[0] >= 120f) { this.localAI[0] = 0f; if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { int num295 = 25; if (Main.expertMode) { num295 = 22; } int num296 = 84; Projectile.NewProjectile(vector35.X, vector35.Y, num291, num292, num296, num295, 0f, Main.myPlayer, 0f, 0f); } } int num297 = (int)this.position.X + this.width / 2; int num298 = (int)this.position.Y + this.height / 2; num297 /= 16; num298 /= 16; if (num291 > 0f) { this.spriteDirection = 1; this.rotation = (float)Math.Atan2((double)num292, (double)num291); } if (num291 < 0f) { this.spriteDirection = -1; this.rotation = (float)Math.Atan2((double)num292, (double)num291) + 3.14f; } } else if (this.type == NPCID.EaterofSouls || this.type == NPCID.Corruptor || this.type == NPCID.Crimera) { this.rotation = (float)Math.Atan2((double)num292, (double)num291) - 1.57f; } else if (this.type == NPCID.Hornet || this.type == NPCID.MossHornet || this.type == NPCID.Moth || (this.type >= NPCID.HornetFatty && this.type <= NPCID.HornetStingy)) { if (this.velocity.X > 0f) { this.spriteDirection = 1; } if (this.velocity.X < 0f) { this.spriteDirection = -1; } this.rotation = this.velocity.X * 0.1f; } else { this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 1.57f; } if (this.type == NPCID.EaterofSouls || this.type == NPCID.MeteorHead || this.type == NPCID.Hornet || this.type == NPCID.Corruptor || this.type == NPCID.Probe || this.type == NPCID.Crimera || this.type == NPCID.MossHornet || this.type == NPCID.Moth || this.type == NPCID.Bee || this.type == NPCID.BeeSmall || (this.type >= NPCID.HornetFatty && this.type <= NPCID.HornetStingy)) { float num299 = 0.7f; if (this.type == NPCID.EaterofSouls || this.type == NPCID.Crimera) { num299 = 0.4f; } if (this.collideX) { this.netUpdate = true; this.velocity.X = this.oldVelocity.X * -num299; if (this.direction == -1 && this.velocity.X > 0f && this.velocity.X < 2f) { this.velocity.X = 2f; } if (this.direction == 1 && this.velocity.X < 0f && this.velocity.X > -2f) { this.velocity.X = -2f; } } if (this.collideY) { this.netUpdate = true; this.velocity.Y = this.oldVelocity.Y * -num299; if (this.velocity.Y > 0f && (double)this.velocity.Y < 1.5) { this.velocity.Y = 2f; } if (this.velocity.Y < 0f && (double)this.velocity.Y > -1.5) { this.velocity.Y = -2f; } } } if ((this.type == NPCID.EaterofSouls || this.type == NPCID.Corruptor || this.type == NPCID.Crimera) && this.wet) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.95f; } this.velocity.Y = this.velocity.Y - 0.3f; if (this.velocity.Y < -2f) { this.velocity.Y = -2f; } } if (this.type == NPCID.Moth && this.wet) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.95f; } this.velocity.Y = this.velocity.Y - 0.5f; if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } this.TargetClosest(true); } if (this.type == NPCID.Hornet || this.type == NPCID.MossHornet || (this.type >= NPCID.HornetFatty && this.type <= NPCID.HornetStingy)) { if (this.wet) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.95f; } this.velocity.Y = this.velocity.Y - 0.5f; if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } this.TargetClosest(true); } if (this.ai[1] == 101f) { this.ai[1] = 0f; } if (Main.netMode != 1) { this.ai[1] += (float)Main.rand.Next(5, 20) * 0.1f * this.scale; if (this.type == NPCID.MossHornet) { this.ai[1] += (float)Main.rand.Next(5, 20) * 0.1f * this.scale; } if (Main.player[this.target].stealth == 0f && Main.player[this.target].itemAnimation == 0) { this.ai[1] = 0f; } if (this.ai[1] >= 130f) { if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { float num304 = 8f; Vector2 vector36 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)(this.height / 2)); float num305 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector36.X + (float)Main.rand.Next(-20, 21); float num306 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector36.Y + (float)Main.rand.Next(-20, 21); if ((num305 < 0f && this.velocity.X < 0f) || (num305 > 0f && this.velocity.X > 0f)) { float num307 = (float)Math.Sqrt((double)(num305 * num305 + num306 * num306)); num307 = num304 / num307; num305 *= num307; num306 *= num307; int num308 = (int)(10f * this.scale); if (this.type == NPCID.MossHornet) { num308 = (int)(30f * this.scale); } int num309 = 55; int num310 = Projectile.NewProjectile(vector36.X, vector36.Y, num305, num306, num309, num308, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num310].timeLeft = 300; this.ai[1] = 101f; this.netUpdate = true; } else { this.ai[1] = 0f; } } else { this.ai[1] = 0f; } } } } if (this.type == NPCID.Probe && flag32) { if ((this.velocity.X > 0f && num291 > 0f) || (this.velocity.X < 0f && num291 < 0f)) { if (Math.Abs(this.velocity.X) < 12f) { this.velocity.X = this.velocity.X * 1.05f; } } else { this.velocity.X = this.velocity.X * 0.9f; } } if (Main.netMode != 1 && this.type == NPCID.Corruptor && !Main.player[this.target].dead) { if (this.justHit) { this.localAI[0] = 0f; } this.localAI[0] += 1f; if (this.localAI[0] == 180f) { if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { NPC.NewNPC((int)(this.position.X + (float)(this.width / 2) + this.velocity.X), (int)(this.position.Y + (float)(this.height / 2) + this.velocity.Y), 112, 0, 0f, 0f, 0f, 0f, 255); } this.localAI[0] = 0f; } } if ((Main.dayTime && this.type != NPCID.Crimera && this.type != NPCID.EaterofSouls && this.type != NPCID.MeteorHead && this.type != NPCID.Hornet && this.type != NPCID.Corruptor && this.type != NPCID.MossHornet && this.type != NPCID.Moth && this.type != NPCID.Bee && this.type != NPCID.BeeSmall && this.type != NPCID.Parrot && (this.type < 231 || this.type > 235)) || Main.player[this.target].dead) { this.velocity.Y = this.velocity.Y - num289 * 2f; if (this.timeLeft > 10) { this.timeLeft = 10; } } if (((this.velocity.X > 0f && this.oldVelocity.X < 0f) || (this.velocity.X < 0f && this.oldVelocity.X > 0f) || (this.velocity.Y > 0f && this.oldVelocity.Y < 0f) || (this.velocity.Y < 0f && this.oldVelocity.Y > 0f)) && !this.justHit) { this.netUpdate = true; return; } } else if (this.aiStyle == 6) { if (this.type == NPCID.LeechHead && this.localAI[1] == 0f) { this.localAI[1] = 1f; } if (this.type == NPCID.CultistDragonHead && this.localAI[3] == 0f) { this.localAI[3] = 1f; } if (this.type >= NPCID.CultistDragonHead && this.type <= NPCID.CultistDragonTail) { this.dontTakeDamage = (this.alpha > 0); if (this.type == NPCID.CultistDragonHead || (this.type != NPCID.CultistDragonHead && Main.npc[(int)this.ai[1]].alpha < 85)) { this.alpha -= 42; if (this.alpha < 0) { this.alpha = 0; } } } else if (this.type == NPCID.StardustWormHead && this.ai[1] == 0f) { this.ai[1] = (float)Main.rand.Next(-2, 0); this.netUpdate = true; } if (Main.netMode != 1 && Main.expertMode) { if (this.type == NPCID.EaterofWorldsBody && (double)(this.position.Y / 16f) < Main.worldSurface) { if (Main.rand.Next(900) == 0) { this.TargetClosest(true); if (Collision.CanHitLine(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { NPC.NewNPC((int)(this.position.X + (float)(this.width / 2) + this.velocity.X), (int)(this.position.Y + (float)(this.height / 2) + this.velocity.Y), 112, 0, 0f, 1f, 0f, 0f, 255); } } } else if (this.type == NPCID.EaterofWorldsHead) { int num315 = 90; num315 += (int)((float)this.life / (float)this.lifeMax * 60f * 5f); if (Main.rand.Next(num315) == 0) { this.TargetClosest(true); if (Collision.CanHitLine(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { NPC.NewNPC((int)(this.position.X + (float)(this.width / 2) + this.velocity.X), (int)(this.position.Y + (float)(this.height / 2) + this.velocity.Y), 112, 0, 0f, 1f, 0f, 0f, 255); } } } } if (this.type >= NPCID.EaterofWorldsHead && this.type <= NPCID.EaterofWorldsTail) { this.realLife = -1; } else if (this.ai[3] > 0f) { this.realLife = (int)this.ai[3]; } if (this.target < 0 || this.target == 255 || Main.player[this.target].dead) { this.TargetClosest(true); } if (Main.player[this.target].dead && this.timeLeft > 300) { this.timeLeft = 300; } if (Main.netMode != 1) { if (this.type == NPCID.WyvernHead && this.ai[0] == 0f) { this.ai[3] = (float)this.whoAmI; this.realLife = this.whoAmI; int num316 = this.whoAmI; for (int num317 = 0; num317 < 14; num317++) { int num318 = 89; if (num317 == 1 || num317 == 8) { num318 = 88; } else if (num317 == 11) { num318 = 90; } else if (num317 == 12) { num318 = 91; } else if (num317 == 13) { num318 = 92; } int num319 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), num318, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num319].ai[3] = (float)this.whoAmI; Main.npc[num319].realLife = this.whoAmI; Main.npc[num319].ai[1] = (float)num316; Main.npc[num316].ai[0] = (float)num319; NetMessage.SendData((int)PacketTypes.NpcUpdate, -1, -1, "", num319, 0f, 0f, 0f, 0, 0, 0); num316 = num319; } } if (this.type == NPCID.CultistDragonHead && this.ai[0] == 0f) { this.ai[3] = (float)this.whoAmI; this.realLife = this.whoAmI; int num320 = this.whoAmI; for (int num321 = 0; num321 < 30; num321++) { int num322 = 456; if ((num321 - 2) % 4 == 0 && num321 < 26) { num322 = 455; } else if (num321 == 27) { num322 = 457; } else if (num321 == 28) { num322 = 458; } else if (num321 == 29) { num322 = 459; } int num323 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), num322, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num323].ai[3] = (float)this.whoAmI; Main.npc[num323].realLife = this.whoAmI; Main.npc[num323].ai[1] = (float)num320; Main.npc[num320].ai[0] = (float)num323; NetMessage.SendData((int)PacketTypes.NpcUpdate, -1, -1, "", num323, 0f, 0f, 0f, 0, 0, 0); num320 = num323; } } if (this.type == NPCID.TombCrawlerHead && this.ai[0] == 0f) { this.ai[3] = (float)this.whoAmI; this.realLife = this.whoAmI; int num324 = this.whoAmI; int num325 = Main.rand.Next(6, 10); for (int num326 = 0; num326 < num325; num326++) { int num327 = 514; if (num326 == num325 - 1) { num327 = 515; } int num328 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), num327, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num328].ai[3] = (float)this.whoAmI; Main.npc[num328].realLife = this.whoAmI; Main.npc[num328].ai[1] = (float)num324; Main.npc[num324].ai[0] = (float)num328; NetMessage.SendData((int)PacketTypes.NpcUpdate, -1, -1, "", num328, 0f, 0f, 0f, 0, 0, 0); num324 = num328; } } if (this.type == NPCID.DuneSplicerHead && this.ai[0] == 0f) { this.ai[3] = (float)this.whoAmI; this.realLife = this.whoAmI; int num329 = this.whoAmI; int num330 = Main.rand.Next(12, 21); for (int num331 = 0; num331 < num330; num331++) { int num332 = 511; if (num331 == num330 - 1) { num332 = 512; } int num333 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), num332, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num333].ai[3] = (float)this.whoAmI; Main.npc[num333].realLife = this.whoAmI; Main.npc[num333].ai[1] = (float)num329; Main.npc[num329].ai[0] = (float)num333; NetMessage.SendData((int)PacketTypes.NpcUpdate, -1, -1, "", num333, 0f, 0f, 0f, 0, 0, 0); num329 = num333; } } else if ((this.type == NPCID.DevourerHead || this.type == NPCID.DevourerBody || this.type == NPCID.GiantWormHead || this.type == NPCID.GiantWormBody || this.type == NPCID.EaterofWorldsHead || this.type == NPCID.EaterofWorldsBody || this.type == NPCID.BoneSerpentHead || this.type == NPCID.BoneSerpentBody || this.type == NPCID.DiggerHead || this.type == NPCID.DiggerBody || this.type == NPCID.SeekerHead || this.type == NPCID.SeekerBody || this.type == NPCID.LeechHead || this.type == NPCID.LeechBody) && this.ai[0] == 0f) { if (this.type == NPCID.DevourerHead || this.type == NPCID.GiantWormHead || this.type == NPCID.EaterofWorldsHead || this.type == NPCID.BoneSerpentHead || this.type == NPCID.DiggerHead || this.type == NPCID.SeekerHead || this.type == NPCID.LeechHead) { if (this.type < 13 || this.type > 15) { this.ai[3] = (float)this.whoAmI; this.realLife = this.whoAmI; } this.ai[2] = (float)Main.rand.Next(8, 13); if (this.type == NPCID.GiantWormHead) { this.ai[2] = (float)Main.rand.Next(4, 7); } if (this.type == NPCID.EaterofWorldsHead) { this.ai[2] = (float)Main.rand.Next(45, 56); if (Main.expertMode) { this.ai[2] = (float)((int)(this.ai[2] * 1.1f)); } } if (this.type == NPCID.BoneSerpentHead) { this.ai[2] = (float)Main.rand.Next(12, 19); } if (this.type == NPCID.DiggerHead) { this.ai[2] = (float)Main.rand.Next(6, 12); } if (this.type == NPCID.SeekerHead) { this.ai[2] = (float)Main.rand.Next(20, 26); } if (this.type == NPCID.LeechHead) { this.ai[2] = (float)Main.rand.Next(3, 6); } this.ai[0] = (float)NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), this.type + 1, this.whoAmI, 0f, 0f, 0f, 0f, 255); } else if ((this.type == NPCID.DevourerBody || this.type == NPCID.GiantWormBody || this.type == NPCID.EaterofWorldsBody || this.type == NPCID.BoneSerpentBody || this.type == NPCID.DiggerBody || this.type == NPCID.SeekerBody || this.type == NPCID.LeechBody) && this.ai[2] > 0f) { this.ai[0] = (float)NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), this.type, this.whoAmI, 0f, 0f, 0f, 0f, 255); } else { this.ai[0] = (float)NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), this.type + 1, this.whoAmI, 0f, 0f, 0f, 0f, 255); } if (this.type < 13 || this.type > 15) { Main.npc[(int)this.ai[0]].ai[3] = this.ai[3]; Main.npc[(int)this.ai[0]].realLife = this.realLife; } Main.npc[(int)this.ai[0]].ai[1] = (float)this.whoAmI; Main.npc[(int)this.ai[0]].ai[2] = this.ai[2] - 1f; this.netUpdate = true; } if (this.type == NPCID.SolarCrawltipedeHead && this.ai[0] == 0f) { this.ai[3] = (float)this.whoAmI; this.realLife = this.whoAmI; int num334 = this.whoAmI; int num335 = 30; for (int num336 = 0; num336 < num335; num336++) { int num337 = 413; if (num336 == num335 - 1) { num337 = 414; } int num338 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), num337, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num338].ai[3] = (float)this.whoAmI; Main.npc[num338].realLife = this.whoAmI; Main.npc[num338].ai[1] = (float)num334; Main.npc[num334].ai[0] = (float)num338; NetMessage.SendData((int)PacketTypes.NpcUpdate, -1, -1, "", num338, 0f, 0f, 0f, 0, 0, 0); num334 = num338; } } int num75 = this.type; if (num75 <= 100) { switch (num75) { case 8: case 9: case 11: case 12: break; case 10: goto IL_15374; default: switch (num75) { case 40: case 41: break; default: switch (num75) { case 88: case 89: case 90: case 91: case 92: case 96: case 97: case 99: case 100: break; case 93: case 94: case 95: case 98: goto IL_15374; default: goto IL_15374; } break; } break; } } else if (num75 <= 414) { switch (num75) { case 118: case 119: break; default: switch (num75) { case 413: case 414: break; default: goto IL_15374; } break; } } else { switch (num75) { case 455: case 456: case 457: case 458: case 459: break; default: switch (num75) { case 511: case 512: case 514: case 515: break; case 513: goto IL_15374; default: goto IL_15374; } break; } } if (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].aiStyle != this.aiStyle) { this.life = 0; this.HitEffect(0, 10.0); this.active = false; NetMessage.SendData((int)PacketTypes.NpcStrike, -1, -1, "", this.whoAmI, -1f, 0f, 0f, 0, 0, 0); } IL_15374: num75 = this.type; if (num75 <= 99) { switch (num75) { case 7: case 8: case 10: case 11: break; case 9: goto IL_154F7; default: switch (num75) { case 39: case 40: break; default: switch (num75) { case 87: case 88: case 89: case 90: case 91: case 95: case 96: case 98: case 99: break; case 92: case 93: case 94: case 97: goto IL_154F7; default: goto IL_154F7; } break; } break; } } else if (num75 <= 413) { switch (num75) { case 117: case 118: break; default: switch (num75) { case 412: case 413: break; default: goto IL_154F7; } break; } } else { switch (num75) { case 454: case 455: case 456: case 457: case 458: break; default: switch (num75) { case 510: case 511: case 513: case 514: break; case 512: goto IL_154F7; default: goto IL_154F7; } break; } } if (!Main.npc[(int)this.ai[0]].active || Main.npc[(int)this.ai[0]].aiStyle != this.aiStyle) { this.life = 0; this.HitEffect(0, 10.0); this.active = false; NetMessage.SendData((int)PacketTypes.NpcStrike, -1, -1, "", this.whoAmI, -1f, 0f, 0f, 0, 0, 0); } IL_154F7: if (this.type == NPCID.EaterofWorldsHead || this.type == NPCID.EaterofWorldsBody || this.type == NPCID.EaterofWorldsTail) { if (!Main.npc[(int)this.ai[1]].active && !Main.npc[(int)this.ai[0]].active) { this.life = 0; this.HitEffect(0, 10.0); this.checkDead(); this.active = false; NetMessage.SendData((int)PacketTypes.NpcStrike, -1, -1, "", this.whoAmI, -1f, 0f, 0f, 0, 0, 0); } if (this.type == NPCID.EaterofWorldsHead && !Main.npc[(int)this.ai[0]].active) { this.life = 0; this.HitEffect(0, 10.0); this.checkDead(); this.active = false; NetMessage.SendData((int)PacketTypes.NpcStrike, -1, -1, "", this.whoAmI, -1f, 0f, 0f, 0, 0, 0); } if (this.type == NPCID.EaterofWorldsTail && !Main.npc[(int)this.ai[1]].active) { this.life = 0; this.HitEffect(0, 10.0); this.checkDead(); this.active = false; NetMessage.SendData((int)PacketTypes.NpcStrike, -1, -1, "", this.whoAmI, -1f, 0f, 0f, 0, 0, 0); } if (this.type == NPCID.EaterofWorldsBody && (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].aiStyle != this.aiStyle)) { this.type = 13; int whoAmI = this.whoAmI; float num339 = (float)this.life / (float)this.lifeMax; float num340 = this.ai[0]; this.SetDefaultsKeepPlayerInteraction(this.type); this.life = (int)((float)this.lifeMax * num339); this.ai[0] = num340; this.TargetClosest(true); this.netUpdate = true; this.whoAmI = whoAmI; } if (this.type == NPCID.EaterofWorldsBody && (!Main.npc[(int)this.ai[0]].active || Main.npc[(int)this.ai[0]].aiStyle != this.aiStyle)) { int whoAmI2 = this.whoAmI; float num341 = (float)this.life / (float)this.lifeMax; float num342 = this.ai[1]; this.SetDefaultsKeepPlayerInteraction(this.type); this.life = (int)((float)this.lifeMax * num341); this.ai[1] = num342; this.TargetClosest(true); this.netUpdate = true; this.whoAmI = whoAmI2; } } if (!this.active && Main.netMode == 2) { NetMessage.SendData((int)PacketTypes.NpcStrike, -1, -1, "", this.whoAmI, -1f, 0f, 0f, 0, 0, 0); } } int num343 = (int)(this.position.X / 16f) - 1; int num344 = (int)((this.position.X + (float)this.width) / 16f) + 2; int num345 = (int)(this.position.Y / 16f) - 1; int num346 = (int)((this.position.Y + (float)this.height) / 16f) + 2; if (num343 < 0) { num343 = 0; } if (num344 > Main.maxTilesX) { num344 = Main.maxTilesX; } if (num345 < 0) { num345 = 0; } if (num346 > Main.maxTilesY) { num346 = Main.maxTilesY; } bool flag33 = false; if (this.type >= NPCID.WyvernHead && this.type <= NPCID.WyvernTail) { flag33 = true; } if (this.type >= NPCID.CultistDragonHead && this.type <= NPCID.CultistDragonTail) { flag33 = true; } if (this.type == NPCID.StardustWormHead && this.ai[1] == -1f) { flag33 = true; } if (this.type >= NPCID.SolarCrawltipedeHead && this.type <= NPCID.SolarCrawltipedeTail) { flag33 = true; } if (!flag33) { for (int num347 = num343; num347 < num344; num347++) { for (int num348 = num345; num348 < num346; num348++) { if (Main.tile[num347, num348] != null && ((Main.tile[num347, num348].nactive() && (Main.tileSolid[(int)Main.tile[num347, num348].type] || (Main.tileSolidTop[(int)Main.tile[num347, num348].type] && Main.tile[num347, num348].frameY == 0))) || Main.tile[num347, num348].liquid > 64)) { Vector2 vector37; vector37.X = (float)(num347 * 16); vector37.Y = (float)(num348 * 16); if (this.position.X + (float)this.width > vector37.X && this.position.X < vector37.X + 16f && this.position.Y + (float)this.height > vector37.Y && this.position.Y < vector37.Y + 16f) { flag33 = true; if (Main.rand.Next(100) == 0 && this.type != NPCID.LeechHead && Main.tile[num347, num348].nactive()) { WorldGen.KillTile(num347, num348, true, true, false); } } } } } } if (!flag33 && (this.type == NPCID.DevourerHead || this.type == NPCID.GiantWormHead || this.type == NPCID.EaterofWorldsHead || this.type == NPCID.BoneSerpentHead || this.type == NPCID.DiggerHead || this.type == NPCID.SeekerHead || this.type == NPCID.LeechHead || this.type == NPCID.TruffleWormDigger || this.type == NPCID.CultistDragonHead || this.type == NPCID.DuneSplicerHead || this.type == NPCID.TombCrawlerHead)) { Rectangle rectangle = new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height); int num349 = 1000; bool flag34 = true; for (int num350 = 0; num350 < 255; num350++) { if (Main.player[num350].active) { Rectangle rectangle2 = new Rectangle((int)Main.player[num350].position.X - num349, (int)Main.player[num350].position.Y - num349, num349 * 2, num349 * 2); if (rectangle.Intersects(rectangle2)) { flag34 = false; break; } } } if (flag34) { flag33 = true; } } if ((this.type >= NPCID.WyvernHead && this.type <= NPCID.WyvernTail) || (this.type >= NPCID.CultistDragonHead && this.type <= NPCID.CultistDragonTail)) { if (this.velocity.X < 0f) { this.spriteDirection = 1; } else if (this.velocity.X > 0f) { this.spriteDirection = -1; } } if (this.type == NPCID.SolarCrawltipedeTail) { if (this.justHit) { this.localAI[3] = 3f; } if (this.localAI[2] > 0f) { this.localAI[2] -= 16f; if (this.localAI[2] == 0f) { this.localAI[2] = -128f; } } else if (this.localAI[2] < 0f) { this.localAI[2] += 16f; } else if (this.localAI[3] > 0f) { this.localAI[2] = 128f; this.localAI[3] -= 1f; } } float num351 = 8f; float num352 = 0.07f; if (this.type == NPCID.DiggerHead) { num351 = 5.5f; num352 = 0.045f; } if (this.type == NPCID.GiantWormHead) { num351 = 6f; num352 = 0.05f; } if (this.type == NPCID.TombCrawlerHead) { num351 = 7f; num352 = 0.03f; } if (this.type == NPCID.EaterofWorldsHead) { num351 = 10f; num352 = 0.07f; if (Main.expertMode) { num351 = 12f; num352 = 0.15f; } } if (this.type == NPCID.DuneSplicerHead) { num351 = 10f; num352 = 0.25f; } if (this.type == NPCID.WyvernHead) { num351 = 11f; num352 = 0.25f; } if (this.type == NPCID.TruffleWormDigger) { num351 = 6f; num352 = 0.15f; } if (this.type == NPCID.CultistDragonHead) { num351 = 20f; num352 = 0.55f; } if (this.type == NPCID.StardustWormHead) { num351 = 6f; num352 = 0.2f; } if (this.type == NPCID.LeechHead && Main.wof >= 0) { float num353 = (float)Main.npc[Main.wof].life / (float)Main.npc[Main.wof].lifeMax; if ((double)num353 < 0.5) { num351 += 1f; num352 += 0.1f; } if ((double)num353 < 0.25) { num351 += 1f; num352 += 0.1f; } if ((double)num353 < 0.1) { num351 += 2f; num352 += 0.1f; } } Vector2 vector38 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num354 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2); float num355 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2); if (this.type == NPCID.SolarCrawltipedeHead) { num351 = 10f; num352 = 0.3f; int num356 = -1; int num357 = (int)(Main.player[this.target].Center.X / 16f); int num358 = (int)(Main.player[this.target].Center.Y / 16f); for (int num359 = num357 - 2; num359 <= num357 + 2; num359++) { for (int num360 = num358; num360 <= num358 + 15; num360++) { if (WorldGen.SolidTile2(num359, num360)) { num356 = num360; break; } } if (num356 > 0) { break; } } if (num356 > 0) { num356 *= 16; float num361 = (float)(num356 - 800); if (Main.player[this.target].position.Y > num361) { num355 = num361; if (Math.Abs(base.Center.X - Main.player[this.target].Center.X) < 500f) { if (this.velocity.X > 0f) { num354 = Main.player[this.target].Center.X + 600f; } else { num354 = Main.player[this.target].Center.X - 600f; } } } } else { num351 = 14f; num352 = 0.5f; } float num362 = num351 * 1.3f; float num363 = num351 * 0.7f; float num364 = this.velocity.Length(); if (num364 > 0f) { if (num364 > num362) { this.velocity.Normalize(); this.velocity *= num362; } else if (num364 < num363) { this.velocity.Normalize(); this.velocity *= num363; } } if (num356 > 0) { for (int num365 = 0; num365 < 200; num365++) { if (Main.npc[num365].active && Main.npc[num365].type == this.type && num365 != this.whoAmI) { Vector2 vector39 = Main.npc[num365].Center - base.Center; if (vector39.Length() < 400f) { vector39.Normalize(); vector39 *= 1000f; num354 -= vector39.X; num355 -= vector39.Y; } } } } else { for (int num366 = 0; num366 < 200; num366++) { if (Main.npc[num366].active && Main.npc[num366].type == this.type && num366 != this.whoAmI) { Vector2 vector40 = Main.npc[num366].Center - base.Center; if (vector40.Length() < 60f) { vector40.Normalize(); vector40 *= 200f; num354 -= vector40.X; num355 -= vector40.Y; } } } } } num354 = (float)((int)(num354 / 16f) * 16); num355 = (float)((int)(num355 / 16f) * 16); vector38.X = (float)((int)(vector38.X / 16f) * 16); vector38.Y = (float)((int)(vector38.Y / 16f) * 16); num354 -= vector38.X; num355 -= vector38.Y; if (this.type == NPCID.TruffleWormDigger) { num354 *= -1f; num355 *= -1f; } float num367 = (float)Math.Sqrt((double)(num354 * num354 + num355 * num355)); if (this.ai[1] > 0f && this.ai[1] < (float)Main.npc.Length) { try { vector38 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); num354 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - vector38.X; num355 = Main.npc[(int)this.ai[1]].position.Y + (float)(Main.npc[(int)this.ai[1]].height / 2) - vector38.Y; } catch { } this.rotation = (float)Math.Atan2((double)num355, (double)num354) + 1.57f; num367 = (float)Math.Sqrt((double)(num354 * num354 + num355 * num355)); int num368 = this.width; if (this.type >= NPCID.WyvernHead && this.type <= NPCID.WyvernTail) { num368 = 42; } if (this.type >= NPCID.CultistDragonHead && this.type <= NPCID.CultistDragonTail) { num368 = 36; } if (this.type >= NPCID.EaterofWorldsHead && this.type <= NPCID.EaterofWorldsTail) { num368 = (int)((float)num368 * this.scale); } if (this.type >= NPCID.SolarCrawltipedeHead && this.type <= NPCID.SolarCrawltipedeTail) { num368 += 6; } num367 = (num367 - (float)num368) / num367; num354 *= num367; num355 *= num367; this.velocity = Vector2.Zero; this.position.X = this.position.X + num354; this.position.Y = this.position.Y + num355; if (this.type >= NPCID.WyvernHead && this.type <= NPCID.WyvernTail) { if (num354 < 0f) { this.spriteDirection = 1; } else if (num354 > 0f) { this.spriteDirection = -1; } } if (this.type >= NPCID.CultistDragonHead && this.type <= NPCID.CultistDragonTail) { if (num354 < 0f) { this.spriteDirection = 1; return; } if (num354 > 0f) { this.spriteDirection = -1; return; } } } else { if (!flag33) { this.TargetClosest(true); this.velocity.Y = this.velocity.Y + 0.11f; if (this.velocity.Y > num351) { this.velocity.Y = num351; } if ((double)(Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) < (double)num351 * 0.4) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X - num352 * 1.1f; } else { this.velocity.X = this.velocity.X + num352 * 1.1f; } } else if (this.velocity.Y == num351) { if (this.velocity.X < num354) { this.velocity.X = this.velocity.X + num352; } else if (this.velocity.X > num354) { this.velocity.X = this.velocity.X - num352; } } else if (this.velocity.Y > 4f) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X + num352 * 0.9f; } else { this.velocity.X = this.velocity.X - num352 * 0.9f; } } } else { if (this.type != NPCID.WyvernHead && this.type != NPCID.LeechHead && this.type != NPCID.CultistDragonHead && this.type != NPCID.SolarCrawltipedeHead && this.soundDelay == 0) { float num369 = num367 / 40f; if (num369 < 10f) { num369 = 10f; } if (num369 > 20f) { num369 = 20f; } this.soundDelay = (int)num369; } num367 = (float)Math.Sqrt((double)(num354 * num354 + num355 * num355)); float num370 = Math.Abs(num354); float num371 = Math.Abs(num355); float num372 = num351 / num367; num354 *= num372; num355 *= num372; bool flag35 = false; if ((this.type == NPCID.DevourerHead || this.type == NPCID.EaterofWorldsHead) && !Main.player[this.target].ZoneCorrupt && !Main.player[this.target].ZoneCrimson) { flag35 = true; } if (this.type == NPCID.TombCrawlerHead && (double)Main.player[this.target].position.Y < Main.worldSurface * 16.0) { flag35 = true; } if (this.type == NPCID.DuneSplicerHead && (double)Main.player[this.target].position.Y < Main.worldSurface * 16.0) { flag35 = true; } if (flag35) { bool flag36 = true; for (int num373 = 0; num373 < 255; num373++) { if (Main.player[num373].active && !Main.player[num373].dead && Main.player[num373].ZoneCorrupt) { flag36 = false; } } if (flag36) { if (Main.netMode != 1 && (double)(this.position.Y / 16f) > (Main.rockLayer + (double)Main.maxTilesY) / 2.0) { this.active = false; int num374 = (int)this.ai[0]; while (num374 > 0 && num374 < 200 && Main.npc[num374].active && Main.npc[num374].aiStyle == this.aiStyle) { int num375 = (int)Main.npc[num374].ai[0]; Main.npc[num374].active = false; this.life = 0; if (Main.netMode == 2) { NetMessage.SendData((int)PacketTypes.NpcUpdate, -1, -1, "", num374, 0f, 0f, 0f, 0, 0, 0); } num374 = num375; } if (Main.netMode == 2) { NetMessage.SendData((int)PacketTypes.NpcUpdate, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } num354 = 0f; num355 = num351; } } bool flag37 = false; if (this.type == NPCID.WyvernHead) { if (((this.velocity.X > 0f && num354 < 0f) || (this.velocity.X < 0f && num354 > 0f) || (this.velocity.Y > 0f && num355 < 0f) || (this.velocity.Y < 0f && num355 > 0f)) && Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) > num352 / 2f && num367 < 300f) { flag37 = true; if (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) < num351) { this.velocity *= 1.1f; } } if (this.position.Y > Main.player[this.target].position.Y || (double)(Main.player[this.target].position.Y / 16f) > Main.worldSurface || Main.player[this.target].dead) { flag37 = true; if (Math.Abs(this.velocity.X) < num351 / 2f) { if (this.velocity.X == 0f) { this.velocity.X = this.velocity.X - (float)this.direction; } this.velocity.X = this.velocity.X * 1.1f; } else if (this.velocity.Y > -num351) { this.velocity.Y = this.velocity.Y - num352; } } } if (this.type == NPCID.CultistDragonHead) { if (((this.velocity.X > 0f && num354 < 0f) || (this.velocity.X < 0f && num354 > 0f) || (this.velocity.Y > 0f && num355 < 0f) || (this.velocity.Y < 0f && num355 > 0f)) && Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) > num352 / 2f && num367 < 300f) { flag37 = true; if (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) < num351) { this.velocity *= 1.1f; } } if (this.position.Y > Main.player[this.target].position.Y || Main.player[this.target].dead) { flag37 = true; if (Math.Abs(this.velocity.X) < num351 / 2f) { if (this.velocity.X == 0f) { this.velocity.X = this.velocity.X - (float)this.direction; } this.velocity.X = this.velocity.X * 1.1f; } else if (this.velocity.Y > -num351) { this.velocity.Y = this.velocity.Y - num352; } } } if (!flag37) { if ((this.velocity.X > 0f && num354 > 0f) || (this.velocity.X < 0f && num354 < 0f) || (this.velocity.Y > 0f && num355 > 0f) || (this.velocity.Y < 0f && num355 < 0f)) { if (this.velocity.X < num354) { this.velocity.X = this.velocity.X + num352; } else if (this.velocity.X > num354) { this.velocity.X = this.velocity.X - num352; } if (this.velocity.Y < num355) { this.velocity.Y = this.velocity.Y + num352; } else if (this.velocity.Y > num355) { this.velocity.Y = this.velocity.Y - num352; } if ((double)Math.Abs(num355) < (double)num351 * 0.2 && ((this.velocity.X > 0f && num354 < 0f) || (this.velocity.X < 0f && num354 > 0f))) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y + num352 * 2f; } else { this.velocity.Y = this.velocity.Y - num352 * 2f; } } if ((double)Math.Abs(num354) < (double)num351 * 0.2 && ((this.velocity.Y > 0f && num355 < 0f) || (this.velocity.Y < 0f && num355 > 0f))) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X + num352 * 2f; } else { this.velocity.X = this.velocity.X - num352 * 2f; } } } else if (num370 > num371) { if (this.velocity.X < num354) { this.velocity.X = this.velocity.X + num352 * 1.1f; } else if (this.velocity.X > num354) { this.velocity.X = this.velocity.X - num352 * 1.1f; } if ((double)(Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) < (double)num351 * 0.5) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y + num352; } else { this.velocity.Y = this.velocity.Y - num352; } } } else { if (this.velocity.Y < num355) { this.velocity.Y = this.velocity.Y + num352 * 1.1f; } else if (this.velocity.Y > num355) { this.velocity.Y = this.velocity.Y - num352 * 1.1f; } if ((double)(Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) < (double)num351 * 0.5) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X + num352; } else { this.velocity.X = this.velocity.X - num352; } } } } } this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f; if (this.type == NPCID.DevourerHead || this.type == NPCID.GiantWormHead || this.type == NPCID.EaterofWorldsHead || this.type == NPCID.BoneSerpentHead || this.type == NPCID.DiggerHead || this.type == NPCID.SeekerHead || this.type == NPCID.LeechHead || this.type == NPCID.DuneSplicerHead || this.type == NPCID.TombCrawlerHead) { if (flag33) { if (this.localAI[0] != 1f) { this.netUpdate = true; } this.localAI[0] = 1f; } else { if (this.localAI[0] != 0f) { this.netUpdate = true; } this.localAI[0] = 0f; } if (((this.velocity.X > 0f && this.oldVelocity.X < 0f) || (this.velocity.X < 0f && this.oldVelocity.X > 0f) || (this.velocity.Y > 0f && this.oldVelocity.Y < 0f) || (this.velocity.Y < 0f && this.oldVelocity.Y > 0f)) && !this.justHit) { this.netUpdate = true; } } if (this.type == NPCID.CultistDragonHead) { float num376 = Vector2.Distance(Main.player[this.target].Center, base.Center); int num377 = 0; if (Vector2.Normalize(Main.player[this.target].Center - base.Center).ToRotation().AngleTowards(this.velocity.ToRotation(), 1.57079637f) == this.velocity.ToRotation() && num376 < 350f) { num377 = 4; } if ((double)num377 > this.frameCounter) { this.frameCounter += 1.0; } if ((double)num377 < this.frameCounter) { this.frameCounter -= 1.0; } if (this.frameCounter < 0.0) { this.frameCounter = 0.0; } if (this.frameCounter > 4.0) { this.frameCounter = 4.0; return; } } } } else if (this.aiStyle == 7) { bool flag38 = Main.raining; if (!Main.dayTime) { flag38 = true; } if (Main.eclipse) { flag38 = true; } if (Main.slimeRain) { flag38 = true; } float num378 = 1f; if (Main.expertMode) { this.defense = (this.dryadWard ? (this.defDefense + 10) : this.defDefense); } else { this.defense = (this.dryadWard ? (this.defDefense + 6) : this.defDefense); } if (this.townNPC || this.type == NPCID.SkeletonMerchant) { if (NPC.downedBoss1) { num378 += 0.1f; this.defense += 3; } if (NPC.downedBoss2) { num378 += 0.1f; this.defense += 3; } if (NPC.downedBoss3) { num378 += 0.1f; this.defense += 3; } if (NPC.downedQueenBee) { num378 += 0.1f; this.defense += 3; } if (Main.hardMode) { num378 += 0.4f; this.defense += 12; } if (NPC.downedMechBoss1) { num378 += 0.15f; this.defense += 6; } if (NPC.downedMechBoss2) { num378 += 0.15f; this.defense += 6; } if (NPC.downedMechBoss3) { num378 += 0.15f; this.defense += 6; } if (NPC.downedPlantBoss) { num378 += 0.15f; this.defense += 8; } if (NPC.downedGolemBoss) { num378 += 0.15f; this.defense += 8; } if (NPC.downedAncientCultist) { num378 += 0.15f; this.defense += 8; } } if (this.type == NPCID.SantaClaus && Main.netMode != 1 && !Main.xMas) { this.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); if (Main.netMode == 2) { NetMessage.SendData((int)PacketTypes.NpcStrike, -1, -1, "", this.whoAmI, 9999f, 0f, 0f, 0, 0, 0); } } if ((this.type == NPCID.Penguin || this.type == NPCID.PenguinBlack) && this.localAI[0] == 0f) { this.localAI[0] = (float)Main.rand.Next(1, 5); } if (this.type == NPCID.Mechanic) { bool flag39 = false; for (int num379 = 0; num379 < 1000; num379++) { if (Main.projectile[num379].active && Main.projectile[num379].type == ProjectileID.MechanicWrench && Main.projectile[num379].ai[1] == (float)this.whoAmI) { flag39 = true; break; } } this.localAI[0] = (float)flag39.ToInt(); } if ((this.type == NPCID.Duck || this.type == NPCID.DuckWhite) && Main.netMode != 1 && (this.velocity.Y > 4f || this.velocity.Y < -4f || this.wet)) { int direction = this.direction; this.Transform(this.type + 1); this.TargetClosest(true); this.direction = direction; this.netUpdate = true; return; } int num75 = this.type; if (num75 <= 124) { switch (num75) { case 107: NPC.savedGoblin = true; break; case 108: NPC.savedWizard = true; break; default: if (num75 == 124) { NPC.savedMech = true; } break; } } else if (num75 != 353) { if (num75 != 369) { if (num75 == 441) { NPC.savedTaxCollector = true; } } else { NPC.savedAngler = true; } } else { NPC.savedStylist = true; } if (this.type >= NPCID.None && this.type < 540 && NPCID.Sets.TownCritter[this.type] && this.target == 255) { this.TargetClosest(true); if (this.position.X < Main.player[this.target].position.X) { this.direction = 1; this.spriteDirection = this.direction; } if (this.position.X > Main.player[this.target].position.X) { this.direction = -1; this.spriteDirection = this.direction; } if (this.homeTileX == -1) { this.homeTileX = (int)((this.position.X + (float)(this.width / 2)) / 16f); } } else if (this.homeTileX == -1 && this.homeTileY == -1 && this.velocity.Y == 0f) { this.homeTileX = (int)base.Center.X / 16; this.homeTileY = (int)(this.position.Y + (float)this.height + 4f) / 16; } bool flag40 = false; int num380 = this.homeTileY; if (this.type == NPCID.TaxCollector) { NPC.taxCollector = true; } this.directionY = -1; if (this.direction == 0) { this.direction = 1; } for (int num381 = 0; num381 < 255; num381++) { if (Main.player[num381].active && Main.player[num381].talkNPC == this.whoAmI) { flag40 = true; if (this.ai[0] != 0f) { this.netUpdate = true; } this.ai[0] = 0f; this.ai[1] = 300f; this.localAI[3] = 100f; if (Main.player[num381].position.X + (float)(Main.player[num381].width / 2) < this.position.X + (float)(this.width / 2)) { this.direction = -1; } else { this.direction = 1; } } } if (this.ai[3] == 1f) { this.life = -1; this.HitEffect(0, 10.0); this.active = false; this.netUpdate = true; return; } if (this.type == NPCID.OldMan && Main.netMode != 1) { this.homeless = false; this.homeTileX = Main.dungeonX; this.homeTileY = Main.dungeonY; if (NPC.downedBoss3) { this.ai[3] = 1f; this.netUpdate = true; } } if (Main.netMode != 1 && this.homeTileY > 0) { while (!WorldGen.SolidTile(this.homeTileX, num380) && num380 < Main.maxTilesY - 20) { num380++; } } if (this.type == NPCID.TravellingMerchant) { this.homeless = true; if (!Main.dayTime) { this.homeTileX = (int)(base.Center.X / 16f); this.homeTileY = (int)(this.position.Y + (float)this.height + 2f) / 16; if (!flag40) { this.ai[0] = 1f; this.ai[1] = 200f; } flag38 = false; } } if (this.type == NPCID.Angler && this.homeless && this.wet) { if (base.Center.X / 16f < 380f || base.Center.X / 16f > (float)(Main.maxTilesX - 380)) { this.homeTileX = Main.spawnTileX; this.homeTileY = Main.spawnTileY; this.ai[0] = 1f; this.ai[1] = 200f; } if (this.position.X / 16f < 200f) { this.direction = 1; } else if (this.position.X / 16f > (float)(Main.maxTilesX - 200)) { this.direction = -1; } } int num382 = (int)(this.position.X + (float)(this.width / 2)) / 16; int num383 = (int)(this.position.Y + (float)this.height + 1f) / 16; if (!WorldGen.InWorld(num382, num383, 0) || Main.tile[num382, num383] == null) { return; } if (!this.homeless && Main.netMode != 1 && this.townNPC && (flag38 || Main.tileDungeon[(int)Main.tile[num382, num383].type]) && (num382 != this.homeTileX || num383 != num380)) { bool flag41 = true; for (int num384 = 0; num384 < 2; num384++) { Rectangle rectangle3 = new Rectangle((int)(this.position.X + (float)(this.width / 2) - (float)(NPC.sWidth / 2) - (float)NPC.safeRangeX), (int)(this.position.Y + (float)(this.height / 2) - (float)(NPC.sHeight / 2) - (float)NPC.safeRangeY), NPC.sWidth + NPC.safeRangeX * 2, NPC.sHeight + NPC.safeRangeY * 2); if (num384 == 1) { rectangle3 = new Rectangle(this.homeTileX * 16 + 8 - NPC.sWidth / 2 - NPC.safeRangeX, num380 * 16 + 8 - NPC.sHeight / 2 - NPC.safeRangeY, NPC.sWidth + NPC.safeRangeX * 2, NPC.sHeight + NPC.safeRangeY * 2); } for (int num385 = 0; num385 < 255; num385++) { if (Main.player[num385].active) { Rectangle rectangle4 = new Rectangle((int)Main.player[num385].position.X, (int)Main.player[num385].position.Y, Main.player[num385].width, Main.player[num385].height); if (rectangle4.Intersects(rectangle3)) { flag41 = false; break; } } if (!flag41) { break; } } } if (flag41) { if (this.type == NPCID.OldMan || !Collision.SolidTiles(this.homeTileX - 1, this.homeTileX + 1, num380 - 3, num380 - 1)) { this.velocity.X = 0f; this.velocity.Y = 0f; this.position.X = (float)(this.homeTileX * 16 + 8 - this.width / 2); this.position.Y = (float)(num380 * 16 - this.height) - 0.1f; this.netUpdate = true; } else { this.homeless = true; WorldGen.QuickFindHome(this.whoAmI); } } } bool flag42 = this.type == NPCID.Mouse || this.type == NPCID.GoldMouse; float num386 = 200f; if (NPCID.Sets.DangerDetectRange[this.type] != -1) { num386 = (float)NPCID.Sets.DangerDetectRange[this.type]; } bool flag43 = false; bool flag44 = false; float num387 = -1f; float num388 = -1f; int num389 = 0; int num390 = -1; int num391 = -1; if (Main.netMode != 1 && !flag40) { for (int num392 = 0; num392 < 200; num392++) { if (Main.npc[num392].active && !Main.npc[num392].friendly && Main.npc[num392].damage > 0 && Main.npc[num392].Distance(base.Center) < num386 && (this.type != NPCID.SkeletonMerchant || !NPCID.Sets.Skeletons.Contains(Main.npc[num392].netID))) { flag43 = true; float num393 = Main.npc[num392].Center.X - base.Center.X; if (num393 < 0f && (num387 == -1f || num393 > num387)) { num387 = num393; num390 = num392; } if (num393 > 0f && (num388 == -1f || num393 < num388)) { num388 = num393; num391 = num392; } } } if (flag43) { if (num387 == -1f) { num389 = 1; } else if (num388 == -1f) { num389 = -1; } else { num389 = (num388 < -num387).ToDirectionInt(); } float num394 = 0f; if (num387 != -1f) { num394 = -num387; } if (num394 == 0f || (num388 < num394 && num388 > 0f)) { num394 = num388; } if (this.ai[0] == 8f) { if (this.direction == -num389) { this.ai[0] = 1f; this.ai[1] = (float)(300 + Main.rand.Next(300)); this.ai[2] = 0f; this.localAI[3] = 0f; this.netUpdate = true; } } else if (this.ai[0] != 10f && this.ai[0] != 12f && this.ai[0] != 13f && this.ai[0] != 14f && this.ai[0] != 15f) { if (NPCID.Sets.PrettySafe[this.type] != -1 && (float)NPCID.Sets.PrettySafe[this.type] < num394) { flag43 = false; flag44 = true; } else if (this.ai[0] != 1f) { bool flag45 = this.ai[0] == 3f || this.ai[0] == 4f || this.ai[0] == 16f || this.ai[0] == 17f; if (flag45) { NPC nPC = Main.npc[(int)this.ai[2]]; if (nPC.active) { nPC.ai[0] = 1f; nPC.ai[1] = (float)(120 + Main.rand.Next(120)); nPC.ai[2] = 0f; nPC.localAI[3] = 0f; nPC.direction = -num389; nPC.netUpdate = true; } } this.ai[0] = 1f; this.ai[1] = (float)(120 + Main.rand.Next(120)); this.ai[2] = 0f; this.localAI[3] = 0f; this.direction = -num389; this.netUpdate = true; } else if (this.ai[0] == 1f && this.direction != -num389) { this.direction = -num389; this.netUpdate = true; } } } } if (this.ai[0] == 0f) { if (this.localAI[3] > 0f) { this.localAI[3] -= 1f; } if (flag38 && !flag40 && !NPCID.Sets.TownCritter[this.type]) { if (Main.netMode != 1) { if (num382 == this.homeTileX && num383 == num380) { if (this.velocity.X != 0f) { this.netUpdate = true; } if (this.velocity.X > 0.1f) { this.velocity.X = this.velocity.X - 0.1f; } else if (this.velocity.X < -0.1f) { this.velocity.X = this.velocity.X + 0.1f; } else { this.velocity.X = 0f; } } else { if (num382 > this.homeTileX) { this.direction = -1; } else { this.direction = 1; } this.ai[0] = 1f; this.ai[1] = (float)(200 + Main.rand.Next(200)); this.ai[2] = 0f; this.localAI[3] = 0f; this.netUpdate = true; } } } else { if (flag42) { this.velocity.X = this.velocity.X * 0.5f; } if (this.velocity.X > 0.1f) { this.velocity.X = this.velocity.X - 0.1f; } else if (this.velocity.X < -0.1f) { this.velocity.X = this.velocity.X + 0.1f; } else { this.velocity.X = 0f; } if (Main.netMode != 1) { if (this.ai[1] > 0f) { this.ai[1] -= 1f; } if (this.ai[1] <= 0f) { this.ai[0] = 1f; this.ai[1] = (float)(200 + Main.rand.Next(300)); this.ai[2] = 0f; if (NPCID.Sets.TownCritter[this.type]) { this.ai[1] += (float)Main.rand.Next(200, 400); } this.localAI[3] = 0f; this.netUpdate = true; } } } if (Main.netMode != 1 && (!flag38 || (num382 == this.homeTileX && num383 == num380))) { if (num382 < this.homeTileX - 25 || num382 > this.homeTileX + 25) { if (this.localAI[3] == 0f) { if (num382 < this.homeTileX - 50 && this.direction == -1) { this.direction = 1; this.netUpdate = true; } else if (num382 > this.homeTileX + 50 && this.direction == 1) { this.direction = -1; this.netUpdate = true; } } } else if (Main.rand.Next(80) == 0 && this.localAI[3] == 0f) { this.localAI[3] = 200f; this.direction *= -1; this.netUpdate = true; } } } else if (this.ai[0] == 1f) { if (Main.netMode != 1 && flag38 && num382 == this.homeTileX && num383 == this.homeTileY && !NPCID.Sets.TownCritter[this.type]) { this.ai[0] = 0f; this.ai[1] = (float)(200 + Main.rand.Next(200)); this.localAI[3] = 60f; this.netUpdate = true; } else { bool flag46 = Collision.DrownCollision(this.position, this.width, this.height, 1f); if (!flag46) { if (Main.netMode != 1 && !this.homeless && !Main.tileDungeon[(int)Main.tile[num382, num383].type] && (num382 < this.homeTileX - 35 || num382 > this.homeTileX + 35)) { if (this.position.X < (float)(this.homeTileX * 16) && this.direction == -1) { this.ai[1] -= 5f; } else if (this.position.X > (float)(this.homeTileX * 16) && this.direction == 1) { this.ai[1] -= 5f; } } this.ai[1] -= 1f; } if (this.ai[1] <= 0f) { this.ai[0] = 0f; this.ai[1] = (float)(300 + Main.rand.Next(300)); this.ai[2] = 0f; if (NPCID.Sets.TownCritter[this.type]) { this.ai[1] -= (float)Main.rand.Next(100); } else { this.ai[1] += (float)Main.rand.Next(900); } this.localAI[3] = 60f; this.netUpdate = true; } if (this.closeDoor && ((this.position.X + (float)(this.width / 2)) / 16f > (float)(this.doorX + 2) || (this.position.X + (float)(this.width / 2)) / 16f < (float)(this.doorX - 2))) { Tile tileSafely = Framing.GetTileSafely(this.doorX, this.doorY); if (tileSafely.type == 11) { bool flag47 = WorldGen.CloseDoor(this.doorX, this.doorY, false); if (flag47) { this.closeDoor = false; NetMessage.SendData((int)PacketTypes.DoorUse, -1, -1, "", 1, (float)this.doorX, (float)this.doorY, (float)this.direction, 0, 0, 0); } if ((this.position.X + (float)(this.width / 2)) / 16f > (float)(this.doorX + 4) || (this.position.X + (float)(this.width / 2)) / 16f < (float)(this.doorX - 4) || (this.position.Y + (float)(this.height / 2)) / 16f > (float)(this.doorY + 4) || (this.position.Y + (float)(this.height / 2)) / 16f < (float)(this.doorY - 4)) { this.closeDoor = false; } } else if (tileSafely.type == 389) { bool flag48 = WorldGen.ShiftTallGate(this.doorX, this.doorY, true); if (flag48) { this.closeDoor = false; NetMessage.SendData((int)PacketTypes.DoorUse, -1, -1, "", 5, (float)this.doorX, (float)this.doorY, 0f, 0, 0, 0); } if ((this.position.X + (float)(this.width / 2)) / 16f > (float)(this.doorX + 4) || (this.position.X + (float)(this.width / 2)) / 16f < (float)(this.doorX - 4) || (this.position.Y + (float)(this.height / 2)) / 16f > (float)(this.doorY + 4) || (this.position.Y + (float)(this.height / 2)) / 16f < (float)(this.doorY - 4)) { this.closeDoor = false; } } else { this.closeDoor = false; } } float num395 = 1f; float num396 = 0.07f; if (this.type == NPCID.Squirrel || this.type == NPCID.SquirrelGold || this.type == NPCID.SquirrelRed) { num395 = 1.5f; } if (flag42) { num395 = 2f; num396 = 1f; } if (this.friendly && (flag43 || flag46)) { num395 = 1.5f; float num397 = 1f - (float)this.life / (float)this.lifeMax; num395 += num397 * 0.9f; num396 = 0.1f; } if (this.velocity.X < -num395 || this.velocity.X > num395) { if (this.velocity.Y == 0f) { this.velocity *= 0.8f; } } else if (this.velocity.X < num395 && this.direction == 1) { this.velocity.X = this.velocity.X + num396; if (this.velocity.X > num395) { this.velocity.X = num395; } } else if (this.velocity.X > -num395 && this.direction == -1) { this.velocity.X = this.velocity.X - num396; if (this.velocity.X > num395) { this.velocity.X = num395; } } bool holdsMatching = true; if ((float)(this.homeTileY * 16 - 32) > this.position.Y) { holdsMatching = false; } if ((this.direction == 1 && this.position.Y + (float)(this.width / 2) > (float)(this.homeTileX * 16)) || (this.direction == -1 && this.position.Y + (float)(this.width / 2) < (float)(this.homeTileX * 16))) { holdsMatching = true; } if (this.velocity.Y == 0f) { Collision.StepDown(ref this.position, ref this.velocity, this.width, this.height, ref this.stepSpeed, ref this.gfxOffY, 1, false); } if (this.velocity.Y >= 0f) { Collision.StepUp(ref this.position, ref this.velocity, this.width, this.height, ref this.stepSpeed, ref this.gfxOffY, 1, holdsMatching, 1); } if (this.velocity.Y == 0f) { int num398 = (int)((this.position.X + (float)(this.width / 2) + (float)(15 * this.direction)) / 16f); int num399 = (int)((this.position.Y + (float)this.height - 16f) / 16f); bool flag49 = false; bool flag50 = true; if (this.townNPC && this.ai[1] < 30f) { flag49 = !Utils.PlotTileLine(base.Top, base.Bottom, (float)this.width, new Utils.PerLinePoint(DelegateMethods.SearchAvoidedByNPCs)); if (!flag49) { Rectangle hitbox = base.Hitbox; hitbox.X -= 20; hitbox.Width += 40; for (int num400 = 0; num400 < 200; num400++) { if (Main.npc[num400].active && Main.npc[num400].friendly && num400 != this.whoAmI && Main.npc[num400].velocity.X == 0f && hitbox.Intersects(Main.npc[num400].Hitbox)) { flag49 = true; break; } } } } if (!flag49 && flag46) { flag49 = true; } if (flag50 && (NPCID.Sets.TownCritter[this.type] || num382 < this.homeTileX - 35 || num382 > this.homeTileX + 35)) { flag50 = false; } if (flag50) { int num401 = 0; for (int num402 = -1; num402 <= 4; num402++) { Tile tileSafely2 = Framing.GetTileSafely(num398 - this.direction * num401, num399 + num402); if (tileSafely2.lava() && tileSafely2.liquid > 0) { flag50 = true; break; } if (tileSafely2.nactive() && Main.tileSolid[(int)tileSafely2.type]) { flag50 = false; } } } if (!flag50 && this.wet) { bool flag51 = flag46; bool flag52 = false; if (!flag51) { flag52 = Collision.DrownCollision(this.position + new Vector2((float)(this.width * this.direction), 0f), this.width, this.height, 1f); } flag52 = (flag52 || Collision.DrownCollision(this.position + new Vector2((float)(this.width * this.direction), (float)(this.height * 2 - 16 - (flag51 ? 16 : 0))), this.width, 16 + (flag51 ? 16 : 0), 1f)); if (flag52 && this.localAI[3] <= 0f) { flag50 = true; this.localAI[3] = 600f; } } if (this.position.X == this.localAI[3]) { this.direction *= -1; this.netUpdate = true; this.localAI[3] = 600f; } if (flag46) { if (this.localAI[3] > 0f) { this.localAI[3] -= 1f; } } else { this.localAI[3] = -1f; } Tile tileSafely3 = Framing.GetTileSafely(num398, num399); Tile tileSafely4 = Framing.GetTileSafely(num398, num399 - 1); Tile tileSafely5 = Framing.GetTileSafely(num398, num399 - 2); if (this.townNPC && tileSafely5.nactive() && (tileSafely5.type == 10 || tileSafely5.type == 388) && (Main.rand.Next(10) == 0 || flag38)) { if (Main.netMode != 1) { if (WorldGen.OpenDoor(num398, num399 - 2, this.direction)) { this.closeDoor = true; this.doorX = num398; this.doorY = num399 - 2; NetMessage.SendData((int)PacketTypes.DoorUse, -1, -1, "", 0, (float)num398, (float)(num399 - 2), (float)this.direction, 0, 0, 0); this.netUpdate = true; this.ai[1] += 80f; } else if (WorldGen.OpenDoor(num398, num399 - 2, -this.direction)) { this.closeDoor = true; this.doorX = num398; this.doorY = num399 - 2; NetMessage.SendData((int)PacketTypes.DoorUse, -1, -1, "", 0, (float)num398, (float)(num399 - 2), (float)(-(float)this.direction), 0, 0, 0); this.netUpdate = true; this.ai[1] += 80f; } else if (WorldGen.ShiftTallGate(num398, num399 - 2, false)) { this.closeDoor = true; this.doorX = num398; this.doorY = num399 - 2; NetMessage.SendData((int)PacketTypes.DoorUse, -1, -1, "", 4, (float)num398, (float)(num399 - 2), 0f, 0, 0, 0); this.netUpdate = true; this.ai[1] += 80f; } else { this.direction *= -1; this.netUpdate = true; } } } else { if ((this.velocity.X < 0f && this.spriteDirection == -1) || (this.velocity.X > 0f && this.spriteDirection == 1)) { if (tileSafely5.nactive() && Main.tileSolid[(int)tileSafely5.type] && !Main.tileSolidTop[(int)tileSafely5.type]) { if (!Collision.SolidTilesVersatile(num398 - this.direction * 2, num398 - this.direction, num399 - 5, num399 - 1) && !Collision.SolidTiles(num398, num398, num399 - 5, num399 - 3)) { this.velocity.Y = -6f; this.netUpdate = true; } else if (flag42) { if (WorldGen.SolidTile((int)(base.Center.X / 16f) + this.direction, (int)(base.Center.Y / 16f))) { this.direction *= -1; this.velocity.X = this.velocity.X * 0f; this.netUpdate = true; } } else if (flag43) { flag49 = false; this.velocity.X = 0f; this.direction *= -1; this.netUpdate = true; this.ai[0] = 8f; this.ai[1] = 240f; } else { this.direction *= -1; this.netUpdate = true; } } else if (tileSafely4.nactive() && Main.tileSolid[(int)tileSafely4.type] && !Main.tileSolidTop[(int)tileSafely4.type]) { if (!Collision.SolidTilesVersatile(num398 - this.direction * 2, num398 - this.direction, num399 - 4, num399 - 1) && !Collision.SolidTiles(num398, num398, num399 - 4, num399 - 2)) { this.velocity.Y = -5f; this.netUpdate = true; } else if (flag43) { flag49 = false; this.velocity.X = 0f; this.direction *= -1; this.netUpdate = true; this.ai[0] = 8f; this.ai[1] = 240f; } else { this.direction *= -1; this.netUpdate = true; } } else if (this.position.Y + (float)this.height - (float)(num399 * 16) > 20f && tileSafely3.nactive() && Main.tileSolid[(int)tileSafely3.type] && !tileSafely3.topSlope()) { if (!Collision.SolidTilesVersatile(num398 - this.direction * 2, num398, num399 - 3, num399 - 1)) { this.velocity.Y = -4.4f; this.netUpdate = true; } else if (flag43) { flag49 = false; this.velocity.X = 0f; this.direction *= -1; this.netUpdate = true; this.ai[0] = 8f; this.ai[1] = 240f; } else { this.direction *= -1; this.netUpdate = true; } } else if (flag50) { this.direction *= -1; this.velocity.X = this.velocity.X * -1f; this.netUpdate = true; if (flag43) { flag49 = false; this.velocity.X = 0f; this.ai[0] = 8f; this.ai[1] = 240f; } } if (flag49) { this.ai[1] = 90f; this.netUpdate = true; } if (this.velocity.Y < 0f) { this.localAI[3] = this.position.X; } } if (this.velocity.Y < 0f && this.wet) { this.velocity.Y = this.velocity.Y * 1.2f; } if (this.velocity.Y < 0f && NPCID.Sets.TownCritter[this.type] && !flag42) { this.velocity.Y = this.velocity.Y * 1.2f; } } } } } else if (this.ai[0] == 2f || this.ai[0] == 11f) { if (Main.netMode != 1) { this.localAI[3] -= 1f; if (Main.rand.Next(60) == 0 && this.localAI[3] == 0f) { this.localAI[3] = 60f; this.direction *= -1; this.netUpdate = true; } } this.ai[1] -= 1f; this.velocity.X = this.velocity.X * 0.8f; if (this.ai[1] <= 0f) { this.localAI[3] = 40f; this.ai[0] = 0f; this.ai[1] = (float)(60 + Main.rand.Next(60)); this.netUpdate = true; } } else if (this.ai[0] == 3f || this.ai[0] == 4f || this.ai[0] == 5f || this.ai[0] == 8f || this.ai[0] == 9f || this.ai[0] == 16f || this.ai[0] == 17f) { this.velocity.X = this.velocity.X * 0.8f; this.ai[1] -= 1f; if (this.ai[0] == 8f && this.ai[1] < 60f && flag43) { this.ai[1] = 180f; this.netUpdate = true; } if (this.ai[0] == 5f) { Point point = base.Center.ToTileCoordinates(); Tile tile = Main.tile[point.X, point.Y]; if (tile.type != TileID.Chairs) { this.ai[1] = 0f; } } if (this.ai[1] <= 0f) { this.ai[0] = 0f; this.ai[1] = (float)(60 + Main.rand.Next(60)); this.ai[2] = 0f; this.localAI[3] = (float)(30 + Main.rand.Next(60)); this.netUpdate = true; } } else if (this.ai[0] == 6f || this.ai[0] == 7f) { this.velocity.X = this.velocity.X * 0.8f; this.ai[1] -= 1f; int num403 = (int)this.ai[2]; if (num403 < 0 || num403 > 255 || !Main.player[num403].active || Main.player[num403].dead || Main.player[num403].Distance(base.Center) > 200f || !Collision.CanHitLine(base.Top, 0, 0, Main.player[num403].Top, 0, 0)) { this.ai[1] = 0f; } if (this.ai[1] > 0f) { int num404 = (base.Center.X < Main.player[num403].Center.X) ? 1 : -1; if (num404 != this.direction) { this.netUpdate = true; } this.direction = num404; } else { this.ai[0] = 0f; this.ai[1] = (float)(60 + Main.rand.Next(60)); this.ai[2] = 0f; this.localAI[3] = (float)(30 + Main.rand.Next(60)); this.netUpdate = true; } } else if (this.ai[0] == 10f) { int num405 = 0; int num406 = 0; float knockBack = 0f; float scaleFactor7 = 0f; int num407 = 0; int num408 = 0; int maxValue3 = 0; float num409 = 0f; float num410 = (float)NPCID.Sets.DangerDetectRange[this.type]; float num411 = 0f; if ((float)NPCID.Sets.AttackTime[this.type] == this.ai[1]) { this.frameCounter = 0.0; this.localAI[3] = 0f; } if (this.type == NPCID.Demolitionist) { num405 = 30; scaleFactor7 = 6f; num406 = 20; num407 = 10; num408 = 180; maxValue3 = 120; num409 = 16f; knockBack = 7f; } else if (this.type == NPCID.PartyGirl) { num405 = 588; scaleFactor7 = 6f; num406 = 30; num407 = 10; num408 = 60; maxValue3 = 120; num409 = 16f; knockBack = 6f; } else if (this.type == NPCID.Merchant) { num405 = 48; scaleFactor7 = 9f; num406 = 12; num407 = 10; num408 = 60; maxValue3 = 60; num409 = 16f; knockBack = 1.5f; } else if (this.type == NPCID.Angler) { num405 = 520; scaleFactor7 = 12f; num406 = 10; num407 = 10; num408 = 0; maxValue3 = 1; num409 = 16f; knockBack = 3f; } else if (this.type == NPCID.SkeletonMerchant) { num405 = 21; scaleFactor7 = 14f; num406 = 14; num407 = 10; num408 = 0; maxValue3 = 1; num409 = 16f; knockBack = 3f; } else if (this.type == NPCID.GoblinTinkerer) { num405 = 24; scaleFactor7 = 5f; num406 = 15; num407 = 10; num408 = 60; maxValue3 = 60; num409 = 16f; knockBack = 1f; } else if (this.type == NPCID.Mechanic) { num405 = 582; scaleFactor7 = 10f; num406 = 11; num407 = 1; num408 = 30; maxValue3 = 30; knockBack = 3.5f; } else if (this.type == NPCID.Nurse) { num405 = 583; scaleFactor7 = 8f; num406 = 8; num407 = 1; num408 = 15; maxValue3 = 10; knockBack = 2f; num409 = 10f; } else if (this.type == NPCID.SantaClaus) { num405 = 589; scaleFactor7 = 7f; num406 = 22; num407 = 1; num408 = 10; maxValue3 = 1; knockBack = 2f; num409 = 10f; } if (Main.expertMode) { num406 = (int)((float)num406 * Main.expertNPCDamage); } num406 = (int)((float)num406 * num378); this.velocity.X = this.velocity.X * 0.8f; this.ai[1] -= 1f; this.localAI[3] += 1f; if (this.localAI[3] == (float)num407 && Main.netMode != 1) { Vector2 vector41 = -Vector2.UnitY; if (num389 == 1 && this.spriteDirection == 1 && num391 != -1) { vector41 = base.DirectionTo(Main.npc[num391].Center + new Vector2(0f, -num409 * MathHelper.Clamp(base.Distance(Main.npc[num391].Center) / num410, 0f, 1f))); } if (num389 == -1 && this.spriteDirection == -1 && num390 != -1) { vector41 = base.DirectionTo(Main.npc[num390].Center + new Vector2(0f, -num409 * MathHelper.Clamp(base.Distance(Main.npc[num390].Center) / num410, 0f, 1f))); } if (vector41.HasNaNs() || Math.Sign(vector41.X) != this.spriteDirection) { vector41 = new Vector2((float)this.spriteDirection, -1f); } vector41 *= scaleFactor7; vector41 += Utils.RandomVector2(Main.rand, -num411, num411); int num412; if (this.type == NPCID.Mechanic) { num412 = Projectile.NewProjectile(base.Center.X + (float)(this.spriteDirection * 16), base.Center.Y - 2f, vector41.X, vector41.Y, num405, num406, knockBack, Main.myPlayer, 0f, (float)this.whoAmI); } else if (this.type == NPCID.SantaClaus) { num412 = Projectile.NewProjectile(base.Center.X + (float)(this.spriteDirection * 16), base.Center.Y - 2f, vector41.X, vector41.Y, num405, num406, knockBack, Main.myPlayer, 0f, (float)Main.rand.Next(5)); } else { num412 = Projectile.NewProjectile(base.Center.X + (float)(this.spriteDirection * 16), base.Center.Y - 2f, vector41.X, vector41.Y, num405, num406, knockBack, Main.myPlayer, 0f, 0f); } Main.projectile[num412].npcProj = true; Main.projectile[num412].noDropItem = true; } if (this.ai[1] <= 0f && !false) { this.ai[0] = (float)((this.localAI[2] == 8f && flag43) ? 8 : 0); this.ai[1] = (float)(num408 + Main.rand.Next(maxValue3)); this.ai[2] = 0f; this.localAI[1] = (this.localAI[3] = (float)(num408 / 2 + Main.rand.Next(maxValue3))); this.netUpdate = true; } } else if (this.ai[0] == 12f) { int num413 = 0; int num414 = 0; float scaleFactor8 = 0f; int num415 = 0; int num416 = 0; int maxValue4 = 0; float knockBack2 = 0f; int num417 = 0; bool flag53 = false; float num418 = 0f; if ((float)NPCID.Sets.AttackTime[this.type] == this.ai[1]) { this.frameCounter = 0.0; this.localAI[3] = 0f; } int num419 = -1; if (num389 == 1 && this.spriteDirection == 1) { num419 = num391; } if (num389 == -1 && this.spriteDirection == -1) { num419 = num390; } if (this.type == NPCID.ArmsDealer) { num413 = 14; scaleFactor8 = 13f; num414 = 24; num416 = 14; maxValue4 = 4; knockBack2 = 3f; num415 = 1; num418 = 0.5f; if ((float)NPCID.Sets.AttackTime[this.type] == this.ai[1]) { this.frameCounter = 0.0; this.localAI[3] = 0f; } if (Main.hardMode) { num414 = 15; if (this.localAI[3] > (float)num415) { num415 = 10; flag53 = true; } if (this.localAI[3] > (float)num415) { num415 = 20; flag53 = true; } if (this.localAI[3] > (float)num415) { num415 = 30; flag53 = true; } } } else if (this.type == NPCID.Painter) { num413 = 587; scaleFactor8 = 10f; num414 = 8; num416 = 10; maxValue4 = 1; knockBack2 = 1.75f; num415 = 1; num418 = 0.5f; if (this.localAI[3] > (float)num415) { num415 = 12; flag53 = true; } if (this.localAI[3] > (float)num415) { num415 = 24; flag53 = true; } if (Main.hardMode) { num414 += 2; } } else if (this.type == NPCID.TravellingMerchant) { num413 = 14; scaleFactor8 = 13f; num414 = 24; num416 = 12; maxValue4 = 5; knockBack2 = 2f; num415 = 1; num418 = 0.2f; if (Main.hardMode) { num414 = 30; num413 = 357; } } else if (this.type == NPCID.Guide) { scaleFactor8 = 10f; num414 = 8; num415 = 1; if (Main.hardMode) { num413 = 2; num416 = 15; maxValue4 = 10; num414 += 6; } else { num413 = 1; num416 = 30; maxValue4 = 20; } knockBack2 = 2.75f; num417 = 4; num418 = 0.7f; } else if (this.type == NPCID.WitchDoctor) { num413 = 267; scaleFactor8 = 14f; num414 = 20; num415 = 1; num416 = 10; maxValue4 = 1; knockBack2 = 3f; num417 = 6; num418 = 0.4f; } else if (this.type == NPCID.Steampunker) { num413 = 242; scaleFactor8 = 13f; num414 = 15; num416 = 10; maxValue4 = 1; knockBack2 = 2f; num415 = 1; if (this.localAI[3] > (float)num415) { num415 = 8; flag53 = true; } if (this.localAI[3] > (float)num415) { num415 = 16; flag53 = true; } num418 = 0.3f; } else if (this.type == NPCID.Pirate) { num413 = 14; scaleFactor8 = 14f; num414 = 24; num416 = 10; maxValue4 = 1; knockBack2 = 2f; num415 = 1; num418 = 0.7f; if (this.localAI[3] > (float)num415) { num415 = 16; flag53 = true; } if (this.localAI[3] > (float)num415) { num415 = 24; flag53 = true; } if (this.localAI[3] > (float)num415) { num415 = 32; flag53 = true; } if (this.localAI[3] > (float)num415) { num415 = 40; flag53 = true; } if (this.localAI[3] > (float)num415) { num415 = 48; flag53 = true; } if (this.localAI[3] == 0f && num419 != -1 && base.Distance(Main.npc[num419].Center) < (float)NPCID.Sets.PrettySafe[this.type]) { num418 = 0.1f; num413 = 162; num414 = 50; knockBack2 = 10f; scaleFactor8 = 24f; } } else if (this.type == NPCID.Cyborg) { int num420 = Utils.SelectRandom<int>(Main.rand, new int[] { 134, 133, 135 }); num413 = num420; num415 = 1; if (num413 == 135) { scaleFactor8 = 12f; num414 = 30; num416 = 30; maxValue4 = 10; knockBack2 = 7f; num418 = 0.2f; } else if (num413 == 133) { scaleFactor8 = 10f; num414 = 25; num416 = 10; maxValue4 = 1; knockBack2 = 6f; num418 = 0.2f; } else if (num413 == 134) { scaleFactor8 = 13f; num414 = 20; num416 = 20; maxValue4 = 10; knockBack2 = 4f; num418 = 0.1f; } } if (Main.expertMode) { num414 = (int)((float)num414 * Main.expertNPCDamage); } num414 = (int)((float)num414 * num378); this.velocity.X = this.velocity.X * 0.8f; this.ai[1] -= 1f; this.localAI[3] += 1f; if (this.localAI[3] == (float)num415 && Main.netMode != 1) { Vector2 vector42 = Vector2.Zero; if (num419 != -1) { vector42 = base.DirectionTo(Main.npc[num419].Center + new Vector2(0f, (float)(-(float)num417))); } if (vector42.HasNaNs() || Math.Sign(vector42.X) != this.spriteDirection) { vector42 = new Vector2((float)this.spriteDirection, 0f); } vector42 *= scaleFactor8; vector42 += Utils.RandomVector2(Main.rand, -num418, num418); int num421; if (this.type == NPCID.Painter) { num421 = Projectile.NewProjectile(base.Center.X + (float)(this.spriteDirection * 16), base.Center.Y - 2f, vector42.X, vector42.Y, num413, num414, knockBack2, Main.myPlayer, 0f, (float)Main.rand.Next(12) / 6f); } else { num421 = Projectile.NewProjectile(base.Center.X + (float)(this.spriteDirection * 16), base.Center.Y - 2f, vector42.X, vector42.Y, num413, num414, knockBack2, Main.myPlayer, 0f, 0f); } Main.projectile[num421].npcProj = true; Main.projectile[num421].noDropItem = true; } if (this.localAI[3] == (float)num415 && flag53 && num419 != -1) { Vector2 vector43 = base.DirectionTo(Main.npc[num419].Center); if (vector43.Y <= 0.5f && vector43.Y >= -0.5f) { this.ai[2] = vector43.Y; } } if (this.ai[1] <= 0f && !false) { this.ai[0] = (float)((this.localAI[2] == 8f && flag43) ? 8 : 0); this.ai[1] = (float)(num416 + Main.rand.Next(maxValue4)); this.ai[2] = 0f; this.localAI[1] = (this.localAI[3] = (float)(num416 / 2 + Main.rand.Next(maxValue4))); this.netUpdate = true; } } else if (this.ai[0] == 13f) { this.velocity.X = this.velocity.X * 0.8f; if ((float)NPCID.Sets.AttackTime[this.type] == this.ai[1]) { this.frameCounter = 0.0; } this.ai[1] -= 1f; this.localAI[3] += 1f; if (this.localAI[3] == 1f && Main.netMode != 1) { Vector2 vec2 = base.DirectionTo(Main.npc[(int)this.ai[2]].Center + new Vector2(0f, -20f)); if (vec2.HasNaNs() || Math.Sign(vec2.X) == -this.spriteDirection) { vec2 = new Vector2((float)this.spriteDirection, -1f); } vec2 *= 8f; int num422 = Projectile.NewProjectile(base.Center.X + (float)(this.spriteDirection * 16), base.Center.Y - 2f, vec2.X, vec2.Y, 584, 0, 0f, Main.myPlayer, this.ai[2], 0f); Main.projectile[num422].npcProj = true; Main.projectile[num422].noDropItem = true; } if (this.ai[1] <= 0f) { this.ai[0] = 0f; this.ai[1] = (float)(10 + Main.rand.Next(10)); this.ai[2] = 0f; this.localAI[3] = (float)(5 + Main.rand.Next(10)); this.netUpdate = true; } } else if (this.ai[0] == 14f) { int num423 = 0; int num424 = 0; float scaleFactor9 = 0f; int num425 = 0; int num426 = 0; int maxValue5 = 0; float knockBack3 = 0f; float num427 = 0f; float num428 = (float)NPCID.Sets.DangerDetectRange[this.type]; float num429 = 1f; float num430 = 0f; if ((float)NPCID.Sets.AttackTime[this.type] == this.ai[1]) { this.frameCounter = 0.0; this.localAI[3] = 0f; } int num431 = -1; if (num389 == 1 && this.spriteDirection == 1) { num431 = num391; } if (num389 == -1 && this.spriteDirection == -1) { num431 = num390; } if (this.type == NPCID.Clothier) { num423 = 585; scaleFactor9 = 10f; num424 = 16; num425 = 30; num426 = 20; maxValue5 = 15; knockBack3 = 2f; num430 = 1f; } else if (this.type == NPCID.Wizard) { num423 = 15; scaleFactor9 = 6f; num424 = 18; num425 = 15; num426 = 15; maxValue5 = 5; knockBack3 = 3f; num427 = 20f; } else if (this.type == NPCID.Truffle) { num423 = 590; num424 = 40; num425 = 15; num426 = 10; maxValue5 = 1; knockBack3 = 3f; while (this.localAI[3] > (float)num425) { num425 += 15; } } else if (this.type == NPCID.Dryad) { num423 = 586; num425 = 24; num426 = 10; maxValue5 = 1; knockBack3 = 3f; } if (Main.expertMode) { num424 = (int)((float)num424 * Main.expertNPCDamage); } num424 = (int)((float)num424 * num378); this.velocity.X = this.velocity.X * 0.8f; this.ai[1] -= 1f; this.localAI[3] += 1f; if (this.localAI[3] == (float)num425 && Main.netMode != 1) { Vector2 vector44 = Vector2.Zero; if (num431 != -1) { vector44 = base.DirectionTo(Main.npc[num431].Center + new Vector2(0f, -num427 * MathHelper.Clamp(base.Distance(Main.npc[num431].Center) / num428, 0f, 1f))); } if (vector44.HasNaNs() || Math.Sign(vector44.X) != this.spriteDirection) { vector44 = new Vector2((float)this.spriteDirection, 0f); } vector44 *= scaleFactor9; vector44 += Utils.RandomVector2(Main.rand, -num430, num430); if (this.type == NPCID.Wizard) { int num432 = Utils.SelectRandom<int>(Main.rand, new int[] { 1, 1, 1, 1, 2, 2, 3 }); for (int num433 = 0; num433 < num432; num433++) { Vector2 vector45 = Utils.RandomVector2(Main.rand, -3.4f, 3.4f); int num434 = Projectile.NewProjectile(base.Center.X + (float)(this.spriteDirection * 16), base.Center.Y - 2f, vector44.X + vector45.X, vector44.Y + vector45.Y, num423, num424, knockBack3, Main.myPlayer, 0f, 0f); Main.projectile[num434].npcProj = true; Main.projectile[num434].noDropItem = true; } } else if (this.type == NPCID.Truffle) { if (num431 != -1) { Vector2 vector46 = Main.npc[num431].position - Main.npc[num431].Size * 2f + Main.npc[num431].Size * Utils.RandomVector2(Main.rand, 0f, 1f) * 5f; int num435 = 10; while (num435 > 0 && WorldGen.SolidTile(Framing.GetTileSafely((int)vector46.X / 16, (int)vector46.Y / 16))) { num435--; vector46 = Main.npc[num431].position - Main.npc[num431].Size * 2f + Main.npc[num431].Size * Utils.RandomVector2(Main.rand, 0f, 1f) * 5f; } int num436 = Projectile.NewProjectile(vector46.X, vector46.Y, 0f, 0f, num423, num424, knockBack3, Main.myPlayer, 0f, 0f); Main.projectile[num436].npcProj = true; Main.projectile[num436].noDropItem = true; } } else if (this.type == NPCID.Dryad) { int num437 = Projectile.NewProjectile(base.Center.X + (float)(this.spriteDirection * 16), base.Center.Y - 2f, vector44.X, vector44.Y, num423, num424, knockBack3, Main.myPlayer, 0f, (float)this.whoAmI); Main.projectile[num437].npcProj = true; Main.projectile[num437].noDropItem = true; } else { int num438 = Projectile.NewProjectile(base.Center.X + (float)(this.spriteDirection * 16), base.Center.Y - 2f, vector44.X, vector44.Y, num423, num424, knockBack3, Main.myPlayer, 0f, 0f); Main.projectile[num438].npcProj = true; Main.projectile[num438].noDropItem = true; } } if (num429 > 0f) { Vector3 vector47 = NPCID.Sets.MagicAuraColor[this.type].ToVector3() * num429; } if (this.ai[1] <= 0f && !false) { this.ai[0] = (float)((this.localAI[2] == 8f && flag43) ? 8 : 0); this.ai[1] = (float)(num426 + Main.rand.Next(maxValue5)); this.ai[2] = 0f; this.localAI[1] = (this.localAI[3] = (float)(num426 / 2 + Main.rand.Next(maxValue5))); this.netUpdate = true; } } else if (this.ai[0] == 15f) { int num439 = 0; int maxValue6 = 0; if ((float)NPCID.Sets.AttackTime[this.type] == this.ai[1]) { this.frameCounter = 0.0; this.localAI[3] = 0f; } int num440 = 0; float num441 = 0f; int num442 = 0; int num443 = 0; if (num389 == 1) { int arg_1BD94_0 = this.spriteDirection; } if (num389 == -1) { int arg_1BDA4_0 = this.spriteDirection; } if (this.type == NPCID.DyeTrader) { num440 = 11; num443 = (num442 = 32); num439 = 12; maxValue6 = 6; num441 = 4.25f; } else if (this.type == NPCID.TaxCollector) { num440 = 9; num443 = (num442 = 28); num439 = 9; maxValue6 = 3; num441 = 3.5f; } else if (this.type == NPCID.Stylist) { num440 = 10; num443 = (num442 = 32); num439 = 15; maxValue6 = 8; num441 = 5f; } if (Main.expertMode) { num440 = (int)((float)num440 * Main.expertNPCDamage); } num440 = (int)((float)num440 * num378); this.velocity.X = this.velocity.X * 0.8f; this.ai[1] -= 1f; if (Main.netMode != 1) { Tuple<Vector2, float> swingStats = this.GetSwingStats(NPCID.Sets.AttackTime[this.type] * 2, (int)this.ai[1], this.spriteDirection, num442, num443); Rectangle rectangle5 = new Rectangle((int)swingStats.Item1.X, (int)swingStats.Item1.Y, num442, num443); if (this.spriteDirection == -1) { rectangle5.X -= num442; } rectangle5.Y -= num443; this.TweakSwingStats(NPCID.Sets.AttackTime[this.type] * 2, (int)this.ai[1], this.spriteDirection, ref rectangle5); int myPlayer = Main.myPlayer; for (int num444 = 0; num444 < 200; num444++) { NPC nPC2 = Main.npc[num444]; if (nPC2.active && nPC2.immune[myPlayer] == 0 && !nPC2.dontTakeDamage && !nPC2.friendly && nPC2.damage > 0 && rectangle5.Intersects(nPC2.Hitbox) && (nPC2.noTileCollide || Collision.CanHit(this.position, this.width, this.height, nPC2.position, nPC2.width, nPC2.height))) { nPC2.StrikeNPCNoInteraction(num440, num441, this.spriteDirection, false, false, false); if (Main.netMode != 0) { NetMessage.SendData((int)PacketTypes.NpcStrike, -1, -1, "", num444, (float)num440, num441, (float)this.spriteDirection, 0, 0, 0); } nPC2.netUpdate = true; nPC2.immune[myPlayer] = (int)this.ai[1] + 2; } } } if (this.ai[1] <= 0f) { bool flag54 = false; if (flag43) { int num445 = -num389; if (!Collision.CanHit(base.Center, 0, 0, base.Center + Vector2.UnitX * (float)num445 * 32f, 0, 0) || this.localAI[2] == 8f) { flag54 = true; } if (flag54) { int num446 = NPCID.Sets.AttackTime[this.type]; int num447 = (num389 == 1) ? num391 : num390; int num448 = (num389 == 1) ? num390 : num391; if (num447 != -1 && !Collision.CanHit(base.Center, 0, 0, Main.npc[num447].Center, 0, 0)) { if (num448 != -1 && Collision.CanHit(base.Center, 0, 0, Main.npc[num448].Center, 0, 0)) { num447 = num448; } else { num447 = -1; } } if (num447 != -1) { this.ai[0] = 15f; this.ai[1] = (float)num446; this.ai[2] = 0f; this.localAI[3] = 0f; this.direction = ((this.position.X < Main.npc[num447].position.X) ? 1 : -1); this.netUpdate = true; } else { flag54 = false; } } } if (!flag54) { this.ai[0] = (float)((this.localAI[2] == 8f && flag43) ? 8 : 0); this.ai[1] = (float)(num439 + Main.rand.Next(maxValue6)); this.ai[2] = 0f; this.localAI[1] = (this.localAI[3] = (float)(num439 / 2 + Main.rand.Next(maxValue6))); this.netUpdate = true; } } } if (Main.netMode != 1 && (this.townNPC || this.type == NPCID.SkeletonMerchant) && !flag40) { bool flag55 = this.ai[0] < 2f && !flag43; bool flag56 = (this.ai[0] < 2f || this.ai[0] == 8f) && (flag43 || flag44); if (this.localAI[1] > 0f) { this.localAI[1] -= 1f; } if (this.localAI[1] > 0f) { flag56 = false; } if (flag56 && this.type == NPCID.Mechanic && this.localAI[0] == 1f) { flag56 = false; } if (flag56 && this.type == NPCID.Dryad) { flag56 = false; for (int num449 = 0; num449 < 200; num449++) { NPC nPC3 = Main.npc[num449]; if (nPC3.active && nPC3.townNPC && base.Distance(nPC3.Center) <= 1200f && nPC3.HasBuff(BuffID.DryadsWard) == -1) { flag56 = true; break; } } } if (flag55 && this.ai[0] == 0f && this.velocity.Y == 0f && Main.rand.Next(300) == 0) { int num450 = 420; if (Main.rand.Next(2) == 0) { num450 *= Main.rand.Next(1, 4); } else { num450 *= Main.rand.Next(1, 3); } int num451 = 100; int num452 = 20; for (int num453 = 0; num453 < 200; num453++) { NPC nPC4 = Main.npc[num453]; bool flag57 = (nPC4.ai[0] == 1f && nPC4.closeDoor) || (nPC4.ai[0] == 1f && nPC4.ai[1] > 200f) || nPC4.ai[0] > 1f; if (nPC4 != this && nPC4.active && nPC4.CanTalk && !flag57 && nPC4.Distance(base.Center) < (float)num451 && nPC4.Distance(base.Center) > (float)num452 && Collision.CanHit(base.Center, 0, 0, nPC4.Center, 0, 0)) { int num454 = (this.position.X < nPC4.position.X).ToDirectionInt(); this.ai[0] = 3f; this.ai[1] = (float)num450; this.ai[2] = (float)num453; this.direction = num454; this.netUpdate = true; nPC4.ai[0] = 4f; nPC4.ai[1] = (float)num450; nPC4.ai[2] = (float)this.whoAmI; nPC4.direction = -num454; nPC4.netUpdate = true; break; } } } else if (flag55 && this.ai[0] == 0f && this.velocity.Y == 0f && Main.rand.Next(1800) == 0) { int num455 = 420; if (Main.rand.Next(2) == 0) { num455 *= Main.rand.Next(1, 4); } else { num455 *= Main.rand.Next(1, 3); } int num456 = 100; int num457 = 20; for (int num458 = 0; num458 < 200; num458++) { NPC nPC5 = Main.npc[num458]; bool flag58 = (nPC5.ai[0] == 1f && nPC5.closeDoor) || (nPC5.ai[0] == 1f && nPC5.ai[1] > 200f) || nPC5.ai[0] > 1f; if (nPC5 != this && nPC5.active && nPC5.CanTalk && !flag58 && nPC5.Distance(base.Center) < (float)num456 && nPC5.Distance(base.Center) > (float)num457 && Collision.CanHit(base.Center, 0, 0, nPC5.Center, 0, 0)) { int num459 = (this.position.X < nPC5.position.X).ToDirectionInt(); this.ai[0] = 16f; this.ai[1] = (float)num455; this.ai[2] = (float)num458; this.localAI[2] = (float)Main.rand.Next(4); this.localAI[3] = (float)Main.rand.Next(3 - (int)this.localAI[2]); this.direction = num459; this.netUpdate = true; nPC5.ai[0] = 17f; nPC5.ai[1] = (float)num455; nPC5.ai[2] = (float)this.whoAmI; nPC5.localAI[2] = 0f; nPC5.localAI[3] = 0f; nPC5.direction = -num459; nPC5.netUpdate = true; break; } } } else if (flag55 && this.ai[0] == 0f && this.velocity.Y == 0f && Main.rand.Next(1200) == 0 && this.type == NPCID.PartyGirl) { int num460 = 300; int num461 = 150; for (int num462 = 0; num462 < 255; num462++) { Player player2 = Main.player[num462]; if (player2.active && !player2.dead && player2.Distance(base.Center) < (float)num461 && Collision.CanHitLine(base.Top, 0, 0, player2.Top, 0, 0)) { int direction2 = (this.position.X < player2.position.X).ToDirectionInt(); this.ai[0] = 6f; this.ai[1] = (float)num460; this.ai[2] = (float)num462; this.direction = direction2; this.netUpdate = true; break; } } } else if (flag55 && this.ai[0] == 0f && this.velocity.Y == 0f && Main.rand.Next(1800) == 0) { this.ai[0] = 2f; this.ai[1] = (float)(45 * Main.rand.Next(1, 2)); this.netUpdate = true; } else if (flag55 && this.ai[0] == 0f && this.velocity.Y == 0f && Main.rand.Next(600) == 0 && this.type == NPCID.Pirate && !flag44) { this.ai[0] = 11f; this.ai[1] = (float)(30 * Main.rand.Next(1, 4)); this.netUpdate = true; } else if (flag55 && this.ai[0] == 0f && this.velocity.Y == 0f && Main.rand.Next(1200) == 0) { int num463 = 220; int num464 = 150; for (int num465 = 0; num465 < 255; num465++) { Player player3 = Main.player[num465]; if (player3.active && !player3.dead && player3.Distance(base.Center) < (float)num464 && Collision.CanHitLine(base.Top, 0, 0, player3.Top, 0, 0)) { int direction3 = (this.position.X < player3.position.X).ToDirectionInt(); this.ai[0] = 7f; this.ai[1] = (float)num463; this.ai[2] = (float)num465; this.direction = direction3; this.netUpdate = true; break; } } } else if (flag55 && this.ai[0] == 1f && this.velocity.Y == 0f && Main.rand.Next(300) == 0) { Point b = base.Center.ToTileCoordinates(); bool flag59 = WorldGen.InWorld(b.X, b.Y, 1); if (flag59) { for (int num466 = 0; num466 < 200; num466++) { if (Main.npc[num466].active && Main.npc[num466].aiStyle == 7 && Main.npc[num466].townNPC && Main.npc[num466].ai[0] == 5f) { Point a = Main.npc[num466].Center.ToTileCoordinates(); if (a == b) { flag59 = false; break; } } } } if (flag59) { Tile tile2 = Main.tile[b.X, b.Y]; flag59 = (tile2.type == 15); if (flag59 && tile2.frameY == 1080) { flag59 = false; } if (flag59) { this.ai[0] = 5f; this.ai[1] = (float)(900 + Main.rand.Next(10800)); this.direction = ((tile2.frameX == 0) ? -1 : 1); base.Bottom = new Vector2((float)(b.X * 16 + 8 + 2 * this.direction), (float)(b.Y * 16 + 32)); this.velocity = Vector2.Zero; this.localAI[3] = 0f; this.netUpdate = true; } } } else if (flag55 && this.ai[0] == 1f && this.velocity.Y == 0f && Main.rand.Next(600) == 0 && Utils.PlotTileLine(base.Top, base.Bottom, (float)this.width, new Utils.PerLinePoint(DelegateMethods.SearchAvoidedByNPCs))) { Point point2 = (base.Center + new Vector2((float)(this.direction * 10), 0f)).ToTileCoordinates(); bool flag60 = WorldGen.InWorld(point2.X, point2.Y, 1); if (flag60) { Tile tileSafely6 = Framing.GetTileSafely(point2.X, point2.Y); if (!tileSafely6.nactive() || !TileID.Sets.InteractibleByNPCs[(int)tileSafely6.type]) { flag60 = false; } } if (flag60) { this.ai[0] = 9f; this.ai[1] = (float)(40 + Main.rand.Next(90)); this.velocity = Vector2.Zero; this.localAI[3] = 0f; this.netUpdate = true; } } if (this.ai[0] < 2f && this.velocity.Y == 0f && this.type == NPCID.Nurse) { int num467 = -1; for (int num468 = 0; num468 < 200; num468++) { NPC nPC6 = Main.npc[num468]; if (nPC6.active && nPC6.townNPC && nPC6.life != nPC6.lifeMax && (num467 == -1 || nPC6.lifeMax - nPC6.life > Main.npc[num467].lifeMax - Main.npc[num467].life) && Collision.CanHitLine(this.position, this.width, this.height, nPC6.position, nPC6.width, nPC6.height) && base.Distance(nPC6.Center) < 500f) { num467 = num468; } } if (num467 != -1) { this.ai[0] = 13f; this.ai[1] = 34f; this.ai[2] = (float)num467; this.localAI[3] = 0f; this.direction = ((this.position.X < Main.npc[num467].position.X) ? 1 : -1); this.netUpdate = true; } } if (flag56 && this.velocity.Y == 0f && NPCID.Sets.AttackType[this.type] == 0 && NPCID.Sets.AttackAverageChance[this.type] > 0 && Main.rand.Next(NPCID.Sets.AttackAverageChance[this.type] * 2) == 0) { int num469 = NPCID.Sets.AttackTime[this.type]; int num470 = (num389 == 1) ? num391 : num390; int num471 = (num389 == 1) ? num390 : num391; if (num470 != -1 && !Collision.CanHit(base.Center, 0, 0, Main.npc[num470].Center, 0, 0)) { if (num471 != -1 && Collision.CanHit(base.Center, 0, 0, Main.npc[num471].Center, 0, 0)) { num470 = num471; } else { num470 = -1; } } if (num470 != -1) { this.localAI[2] = this.ai[0]; this.ai[0] = 10f; this.ai[1] = (float)num469; this.ai[2] = 0f; this.localAI[3] = 0f; this.direction = ((this.position.X < Main.npc[num470].position.X) ? 1 : -1); this.netUpdate = true; } } else if (flag56 && this.velocity.Y == 0f && NPCID.Sets.AttackType[this.type] == 1 && NPCID.Sets.AttackAverageChance[this.type] > 0 && Main.rand.Next(NPCID.Sets.AttackAverageChance[this.type] * 2) == 0) { int num472 = NPCID.Sets.AttackTime[this.type]; int num473 = (num389 == 1) ? num391 : num390; int num474 = (num389 == 1) ? num390 : num391; if (num473 != -1 && !Collision.CanHitLine(base.Center, 0, 0, Main.npc[num473].Center, 0, 0)) { if (num474 != -1 && Collision.CanHitLine(base.Center, 0, 0, Main.npc[num474].Center, 0, 0)) { num473 = num474; } else { num473 = -1; } } if (num473 != -1) { Vector2 vector48 = base.DirectionTo(Main.npc[num473].Center); if (vector48.Y <= 0.5f && vector48.Y >= -0.5f) { this.localAI[2] = this.ai[0]; this.ai[0] = 12f; this.ai[1] = (float)num472; this.ai[2] = vector48.Y; this.localAI[3] = 0f; this.direction = ((this.position.X < Main.npc[num473].position.X) ? 1 : -1); this.netUpdate = true; } } } if (flag56 && this.velocity.Y == 0f && NPCID.Sets.AttackType[this.type] == 2 && NPCID.Sets.AttackAverageChance[this.type] > 0 && Main.rand.Next(NPCID.Sets.AttackAverageChance[this.type] * 2) == 0) { int num475 = NPCID.Sets.AttackTime[this.type]; int num476 = (num389 == 1) ? num391 : num390; int num477 = (num389 == 1) ? num390 : num391; if (num476 != -1 && !Collision.CanHitLine(base.Center, 0, 0, Main.npc[num476].Center, 0, 0)) { if (num477 != -1 && Collision.CanHitLine(base.Center, 0, 0, Main.npc[num477].Center, 0, 0)) { num476 = num477; } else { num476 = -1; } } if (num476 != -1) { this.localAI[2] = this.ai[0]; this.ai[0] = 14f; this.ai[1] = (float)num475; this.ai[2] = 0f; this.localAI[3] = 0f; this.direction = ((this.position.X < Main.npc[num476].position.X) ? 1 : -1); this.netUpdate = true; } else if (this.type == NPCID.Dryad) { this.localAI[2] = this.ai[0]; this.ai[0] = 14f; this.ai[1] = (float)num475; this.ai[2] = 0f; this.localAI[3] = 0f; this.netUpdate = true; } } if (flag56 && this.velocity.Y == 0f && NPCID.Sets.AttackType[this.type] == 3 && NPCID.Sets.AttackAverageChance[this.type] > 0 && Main.rand.Next(NPCID.Sets.AttackAverageChance[this.type] * 2) == 0) { int num478 = NPCID.Sets.AttackTime[this.type]; int num479 = (num389 == 1) ? num391 : num390; int num480 = (num389 == 1) ? num390 : num391; if (num479 != -1 && !Collision.CanHit(base.Center, 0, 0, Main.npc[num479].Center, 0, 0)) { if (num480 != -1 && Collision.CanHit(base.Center, 0, 0, Main.npc[num480].Center, 0, 0)) { num479 = num480; } else { num479 = -1; } } if (num479 != -1) { this.localAI[2] = this.ai[0]; this.ai[0] = 15f; this.ai[1] = (float)num478; this.ai[2] = 0f; this.localAI[3] = 0f; this.direction = ((this.position.X < Main.npc[num479].position.X) ? 1 : -1); this.netUpdate = true; return; } } } } else if (this.aiStyle == 8) { this.TargetClosest(true); this.velocity.X = this.velocity.X * 0.93f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } if (this.ai[0] == 0f) { this.ai[0] = 500f; } if (this.type == NPCID.RuneWizard) { if (this.alpha < 255) { this.alpha++; } if (this.justHit) { this.alpha = 0; } } if (this.ai[2] != 0f && this.ai[3] != 0f) { if (this.type == NPCID.RuneWizard) { this.alpha = 255; } this.position.X = this.ai[2] * 16f - (float)(this.width / 2) + 8f; this.position.Y = this.ai[3] * 16f - (float)this.height; this.velocity.X = 0f; this.velocity.Y = 0f; this.ai[2] = 0f; this.ai[3] = 0f; } this.ai[0] += 1f; if (this.type == NPCID.Necromancer || this.type == NPCID.NecromancerArmored) { if (this.ai[0] == 50f || this.ai[0] == 100f || this.ai[0] == 150f || this.ai[0] == 200f || this.ai[0] == 250f) { this.ai[1] = 30f; this.netUpdate = true; } if (this.ai[0] >= 400f) { this.ai[0] = 700f; } } else if (this.type == NPCID.RuneWizard) { if (this.ai[0] == 75f || this.ai[0] == 150f || this.ai[0] == 225f || this.ai[0] == 300f || this.ai[0] == 375f || this.ai[0] == 450f) { this.ai[1] = 30f; this.netUpdate = true; } } else if (this.type == NPCID.DesertDjinn) { if (this.ai[0] == 180f) { this.ai[1] = 181f; this.netUpdate = true; } } else if (this.type == NPCID.RaggedCaster || this.type == NPCID.RaggedCasterOpenCoat) { if (this.ai[0] == 20f || this.ai[0] == 40f || this.ai[0] == 60f || this.ai[0] == 120f || this.ai[0] == 140f || this.ai[0] == 160f || this.ai[0] == 220f || this.ai[0] == 240f || this.ai[0] == 260f) { this.ai[1] = 30f; this.netUpdate = true; } if (this.ai[0] >= 460f) { this.ai[0] = 700f; } } else if (this.ai[0] == 100f || this.ai[0] == 200f || this.ai[0] == 300f) { this.ai[1] = 30f; this.netUpdate = true; } if ((this.type == NPCID.DiabolistRed || this.type == NPCID.DiabolistWhite) && this.ai[0] > 400f) { this.ai[0] = 650f; } if (this.type == NPCID.DesertDjinn && this.ai[0] >= 360f) { this.ai[0] = 650f; } if (this.ai[0] >= 650f && Main.netMode != 1) { this.ai[0] = 1f; int num499 = (int)Main.player[this.target].position.X / 16; int num500 = (int)Main.player[this.target].position.Y / 16; int num501 = (int)this.position.X / 16; int num502 = (int)this.position.Y / 16; int num503 = 20; int num504 = 0; bool flag61 = false; if (Math.Abs(this.position.X - Main.player[this.target].position.X) + Math.Abs(this.position.Y - Main.player[this.target].position.Y) > 2000f) { num504 = 100; flag61 = true; } while (!flag61 && num504 < 100) { num504++; int num505 = Main.rand.Next(num499 - num503, num499 + num503); int num506 = Main.rand.Next(num500 - num503, num500 + num503); for (int num507 = num506; num507 < num500 + num503; num507++) { if ((num507 < num500 - 4 || num507 > num500 + 4 || num505 < num499 - 4 || num505 > num499 + 4) && (num507 < num502 - 1 || num507 > num502 + 1 || num505 < num501 - 1 || num505 > num501 + 1) && Main.tile[num505, num507].nactive()) { bool flag62 = true; if ((this.type == NPCID.DarkCaster || (this.type >= NPCID.RaggedCaster && this.type <= NPCID.DiabolistWhite)) && !Main.wallDungeon[(int)Main.tile[num505, num507 - 1].wall]) { flag62 = false; } else if (Main.tile[num505, num507 - 1].lava()) { flag62 = false; } if (flag62 && Main.tileSolid[(int)Main.tile[num505, num507].type] && !Collision.SolidTiles(num505 - 1, num505 + 1, num507 - 4, num507 - 1)) { this.ai[1] = 20f; this.ai[2] = (float)num505; this.ai[3] = (float)num507; flag61 = true; break; } } } } this.netUpdate = true; } if (this.ai[1] > 0f) { this.ai[1] -= 1f; if (this.type == NPCID.DesertDjinn) { if (this.ai[1] % 30f == 0f && this.ai[1] / 30f < 5f) { if (Main.netMode != 1) { Point point3 = base.Center.ToTileCoordinates(); Point point4 = Main.player[this.target].Center.ToTileCoordinates(); Vector2 vector49 = Main.player[this.target].Center - base.Center; int num508 = 6; int num509 = 6; int num510 = 0; int num511 = 2; int num512 = 0; bool flag63 = false; if (vector49.Length() > 2000f) { flag63 = true; } while (!flag63) { if (num512 >= 50) { break; } num512++; int num513 = Main.rand.Next(point4.X - num508, point4.X + num508 + 1); int num514 = Main.rand.Next(point4.Y - num508, point4.Y + num508 + 1); if ((num514 < point4.Y - num510 || num514 > point4.Y + num510 || num513 < point4.X - num510 || num513 > point4.X + num510) && (num514 < point3.Y - num509 || num514 > point3.Y + num509 || num513 < point3.X - num509 || num513 > point3.X + num509) && !Main.tile[num513, num514].nactive()) { bool flag64 = true; if (flag64 && Main.tile[num513, num514].lava()) { flag64 = false; } if (flag64 && Collision.SolidTiles(num513 - num511, num513 + num511, num514 - num511, num514 + num511)) { flag64 = false; } if (flag64) { Projectile.NewProjectile((float)(num513 * 16 + 8), (float)(num514 * 16 + 8), 0f, 0f, 596, 0, 1f, Main.myPlayer, (float)this.target, 0f); break; } } } } } } else if (this.ai[1] == 25f) { if (this.type >= NPCID.RaggedCaster && this.type <= NPCID.DiabolistWhite) { if (Main.netMode != 1) { float num515 = 6f; if (this.type == NPCID.DiabolistRed || this.type == NPCID.DiabolistWhite) { num515 = 8f; } if (this.type == NPCID.RaggedCaster || this.type == NPCID.RaggedCasterOpenCoat) { num515 = 4f; } Vector2 vector50 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y); float num516 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector50.X; float num517 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector50.Y; if (this.type == NPCID.Necromancer || this.type == NPCID.NecromancerArmored) { num516 += (float)Main.rand.Next(-30, 31); num517 += (float)Main.rand.Next(-30, 31); num516 -= Main.player[this.target].velocity.X * 10f; num517 -= Main.player[this.target].velocity.Y * 10f; } float num518 = (float)Math.Sqrt((double)(num516 * num516 + num517 * num517)); num518 = num515 / num518; num516 *= num518; num517 *= num518; int num519 = 30; int num520 = 290; if (this.type == NPCID.DiabolistRed || this.type == NPCID.DiabolistWhite) { num520 = 291; num519 = 40; } if (this.type == NPCID.RaggedCaster || this.type == NPCID.RaggedCasterOpenCoat) { num520 = 293; num519 = 40; } if (Main.expertMode) { num519 = (int)((double)num519 * 0.8); } int num521 = Projectile.NewProjectile(vector50.X, vector50.Y, num516, num517, num520, num519, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num521].timeLeft = 300; if (num520 == 291) { Main.projectile[num521].ai[0] = Main.player[this.target].Center.X; Main.projectile[num521].ai[1] = Main.player[this.target].Center.Y; Main.projectile[num521].netUpdate = true; } this.localAI[0] = 0f; } } else { if (Main.netMode != 1) { if (this.type == NPCID.GoblinSorcerer || this.type == NPCID.Tim) { NPC.NewNPC((int)this.position.X + this.width / 2, (int)this.position.Y - 8, 30, 0, 0f, 0f, 0f, 0f, 255); } else if (this.type == NPCID.DarkCaster) { NPC.NewNPC((int)this.position.X + this.width / 2, (int)this.position.Y - 8, 33, 0, 0f, 0f, 0f, 0f, 255); } else if (this.type == NPCID.RuneWizard) { float num522 = 10f; Vector2 vector51 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num523 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector51.X + (float)Main.rand.Next(-10, 11); float num524 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector51.Y + (float)Main.rand.Next(-10, 11); float num525 = (float)Math.Sqrt((double)(num523 * num523 + num524 * num524)); num525 = num522 / num525; num523 *= num525; num524 *= num525; int num526 = 40; int num527 = 129; int num528 = Projectile.NewProjectile(vector51.X, vector51.Y, num523, num524, num527, num526, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num528].timeLeft = 300; this.localAI[0] = 0f; } else { NPC.NewNPC((int)this.position.X + this.width / 2 + this.direction * 8, (int)this.position.Y + 20, 25, 0, 0f, 0f, 0f, 0f, 255); } } } } } if (this.type == NPCID.GoblinSorcerer || this.type == NPCID.Tim) { if (Main.rand.Next(5) == 0) { return; } } else if (this.type == NPCID.DarkCaster) { if (Main.rand.Next(3) != 0) { return; } } else { if (this.type == NPCID.RuneWizard) { return; } if (this.type == NPCID.Necromancer || this.type == NPCID.NecromancerArmored) { if (Main.rand.Next(2) == 0) { return; } } else if (this.type == NPCID.DiabolistRed || this.type == NPCID.DiabolistWhite) { if (Main.rand.Next(2) == 0) { return; } } else if (this.type == NPCID.RaggedCaster || this.type == NPCID.RaggedCasterOpenCoat) { if (Main.rand.Next(2) == 0) { return; } } else { if (this.type == NPCID.DesertDjinn) { return; } if (Main.rand.Next(2) == 0) { return; } } } } else if (this.aiStyle == 9) { if (this.type == NPCID.SolarFlare) { if (this.alpha < 220) { this.alpha += 40; } if (this.ai[0] == 0f) { this.ai[0] = 1f; Vector2 vector52 = Main.player[this.target].Center - base.Center; vector52.Normalize(); if (vector52.HasNaNs()) { vector52 = -Vector2.UnitY; } vector52 = vector52.RotatedByRandom(1.5707963705062866).RotatedBy(-0.78539818525314331, default(Vector2)); if (vector52.Y > 0.2f) { vector52.Y = 0.2f; } this.velocity = vector52 * (6f + Main.rand.NextFloat() * 4f); } if (this.collideX || this.collideY || base.Distance(Main.player[this.target].Center) < 20f) { this.StrikeNPCNoInteraction(9999, 0f, this.direction, false, false, false); } } if (this.target == 255) { this.TargetClosest(true); float num538 = 6f; if (this.type == NPCID.BurningSphere) { num538 = 5f; } if (this.type == NPCID.VileSpit) { num538 = 7f; } Vector2 vector53 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num539 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector53.X; float num540 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector53.Y; float num541 = (float)Math.Sqrt((double)(num539 * num539 + num540 * num540)); num541 = num538 / num541; this.velocity.X = num539 * num541; this.velocity.Y = num540 * num541; } if (this.type == NPCID.VileSpit) { this.damage = ((this.ai[1] == 1f) ? 65 : this.defDamage); this.ai[0] += 1f; if (this.ai[0] > 3f) { this.ai[0] = 3f; } if (this.ai[0] == 2f) { this.position += this.velocity; } } if (this.type == NPCID.VileSpit && Collision.SolidCollision(this.position, this.width, this.height)) { int arg_1FD8D_0 = Main.netMode; this.StrikeNPCNoInteraction(999, 0f, 0, false, false, false); } if (this.timeLeft > 100) { this.timeLeft = 100; } if (this.type != NPCID.SolarFlare) { for (int num544 = 0; num544 < 2; num544++) { if (this.type == NPCID.ChaosBall) { this.alpha = 255; } } this.rotation += 0.4f * (float)this.direction; return; } this.rotation += 0.1f * (float)this.direction; float num556 = 15f; float num557 = 0.0833333358f; Vector2 center4 = base.Center; Vector2 center5 = Main.player[this.target].Center; Vector2 vec3 = center5 - center4; vec3.Normalize(); if (vec3.HasNaNs()) { vec3 = new Vector2((float)this.direction, 0f); } this.velocity = (this.velocity * (num556 - 1f) + vec3 * (this.velocity.Length() + num557)) / num556; if (this.velocity.Length() < 6f) { this.velocity *= 1.05f; return; } } else if (this.aiStyle == 10) { float num558 = 1f; float num559 = 0.011f; this.TargetClosest(true); Vector2 vector54 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num560 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector54.X; float num561 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector54.Y; float num562 = (float)Math.Sqrt((double)(num560 * num560 + num561 * num561)); float num563 = num562; this.ai[1] += 1f; if (this.ai[1] > 600f) { num559 *= 8f; num558 = 4f; if (this.ai[1] > 650f) { this.ai[1] = 0f; } } else if (num563 < 250f) { this.ai[0] += 0.9f; if (this.ai[0] > 0f) { this.velocity.Y = this.velocity.Y + 0.019f; } else { this.velocity.Y = this.velocity.Y - 0.019f; } if (this.ai[0] < -100f || this.ai[0] > 100f) { this.velocity.X = this.velocity.X + 0.019f; } else { this.velocity.X = this.velocity.X - 0.019f; } if (this.ai[0] > 200f) { this.ai[0] = -200f; } } if (num563 > 350f) { num558 = 5f; num559 = 0.3f; } else if (num563 > 300f) { num558 = 3f; num559 = 0.2f; } else if (num563 > 250f) { num558 = 1.5f; num559 = 0.1f; } num562 = num558 / num562; num560 *= num562; num561 *= num562; if (Main.player[this.target].dead) { num560 = (float)this.direction * num558 / 2f; num561 = -num558 / 2f; } if (this.velocity.X < num560) { this.velocity.X = this.velocity.X + num559; } else if (this.velocity.X > num560) { this.velocity.X = this.velocity.X - num559; } if (this.velocity.Y < num561) { this.velocity.Y = this.velocity.Y + num559; } else if (this.velocity.Y > num561) { this.velocity.Y = this.velocity.Y - num559; } if (num560 > 0f) { this.spriteDirection = -1; this.rotation = (float)Math.Atan2((double)num561, (double)num560); } if (num560 < 0f) { this.spriteDirection = 1; this.rotation = (float)Math.Atan2((double)num561, (double)num560) + 3.14f; } if (this.type == NPCID.GiantCursedSkull) { if (this.justHit) { this.ai[2] = 0f; this.ai[3] = 0f; } vector54 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); num560 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector54.X; num561 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector54.Y; num562 = (float)Math.Sqrt((double)(num560 * num560 + num561 * num561)); if (num562 > 500f) { this.ai[2] = 0f; this.ai[3] = 0f; return; } this.ai[2] += 1f; if (this.ai[3] == 0f) { if (this.ai[2] > 120f) { this.ai[2] = 0f; this.ai[3] = 1f; this.netUpdate = true; return; } } else { if (this.ai[2] > 40f) { this.ai[3] = 0f; } if (Main.netMode != 1 && this.ai[2] == 20f) { float num564 = 6f; int num565 = 25; int num566 = 299; num562 = num564 / num562; num560 *= num562; num561 *= num562; Projectile.NewProjectile(vector54.X, vector54.Y, num560, num561, num566, num565, 0f, Main.myPlayer, 0f, 0f); return; } } } } else if (this.aiStyle == 11) { this.defense = this.defDefense; if (this.ai[0] == 0f && Main.netMode != 1) { this.TargetClosest(true); this.ai[0] = 1f; if (this.type != NPCID.DungeonGuardian) { int num567 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)this.position.Y + this.height / 2, 36, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num567].ai[0] = -1f; Main.npc[num567].ai[1] = (float)this.whoAmI; Main.npc[num567].target = this.target; Main.npc[num567].netUpdate = true; num567 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)this.position.Y + this.height / 2, 36, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num567].ai[0] = 1f; Main.npc[num567].ai[1] = (float)this.whoAmI; Main.npc[num567].ai[3] = 150f; Main.npc[num567].target = this.target; Main.npc[num567].netUpdate = true; } } if (this.type == NPCID.DungeonGuardian && this.ai[1] != 3f && this.ai[1] != 2f) { this.ai[1] = 2f; } if (Main.player[this.target].dead || Math.Abs(this.position.X - Main.player[this.target].position.X) > 2000f || Math.Abs(this.position.Y - Main.player[this.target].position.Y) > 2000f) { this.TargetClosest(true); if (Main.player[this.target].dead || Math.Abs(this.position.X - Main.player[this.target].position.X) > 2000f || Math.Abs(this.position.Y - Main.player[this.target].position.Y) > 2000f) { this.ai[1] = 3f; } } if (Main.dayTime && this.ai[1] != 3f && this.ai[1] != 2f) { this.ai[1] = 2f; } int num568 = 0; if (Main.expertMode) { for (int num569 = 0; num569 < 200; num569++) { if (Main.npc[num569].active && Main.npc[num569].type == this.type + 1) { num568++; } } this.defense += num568 * 25; if ((num568 < 2 || (double)this.life < (double)this.lifeMax * 0.75) && this.ai[1] == 0f) { float num570 = 80f; if (num568 == 0) { num570 /= 2f; } if (Main.netMode != 1 && this.ai[2] % num570 == 0f) { Vector2 vector55 = base.Center; float num571 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector55.X; float num572 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector55.Y; Math.Sqrt((double)(num571 * num571 + num572 * num572)); if (Collision.CanHit(vector55, 1, 1, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { float num573 = 3f; if (num568 == 0) { num573 += 2f; } float num574 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector55.X + (float)Main.rand.Next(-20, 21); float num575 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector55.Y + (float)Main.rand.Next(-20, 21); float num576 = (float)Math.Sqrt((double)(num574 * num574 + num575 * num575)); num576 = num573 / num576; num574 *= num576; num575 *= num576; Vector2 value12 = new Vector2(num574 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f, num575 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f); value12.Normalize(); value12 *= num573; value12 += this.velocity; num574 = value12.X; num575 = value12.Y; int num577 = 17; int num578 = 270; vector55 += value12 * 5f; int num579 = Projectile.NewProjectile(vector55.X, vector55.Y, num574, num575, num578, num577, 0f, Main.myPlayer, -1f, 0f); Main.projectile[num579].timeLeft = 300; } } } } if (this.ai[1] == 0f) { this.damage = this.defDamage; this.ai[2] += 1f; if (this.ai[2] >= 800f) { this.ai[2] = 0f; this.ai[1] = 1f; this.TargetClosest(true); this.netUpdate = true; } this.rotation = this.velocity.X / 15f; float num580 = 0.02f; float num581 = 2f; float num582 = 0.05f; float num583 = 8f; if (Main.expertMode) { num580 = 0.03f; num581 = 4f; num582 = 0.07f; num583 = 9.5f; } if (this.position.Y > Main.player[this.target].position.Y - 250f) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.98f; } this.velocity.Y = this.velocity.Y - num580; if (this.velocity.Y > num581) { this.velocity.Y = num581; } } else if (this.position.Y < Main.player[this.target].position.Y - 250f) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.98f; } this.velocity.Y = this.velocity.Y + num580; if (this.velocity.Y < -num581) { this.velocity.Y = -num581; } } if (this.position.X + (float)(this.width / 2) > Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2)) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.98f; } this.velocity.X = this.velocity.X - num582; if (this.velocity.X > num583) { this.velocity.X = num583; } } if (this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2)) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.98f; } this.velocity.X = this.velocity.X + num582; if (this.velocity.X < -num583) { this.velocity.X = -num583; } } } else if (this.ai[1] == 1f) { this.defense -= 10; this.ai[2] += 1f; if (this.ai[2] >= 400f) { this.ai[2] = 0f; this.ai[1] = 0f; } this.rotation += (float)this.direction * 0.3f; Vector2 vector56 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num584 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector56.X; float num585 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector56.Y; float num586 = (float)Math.Sqrt((double)(num584 * num584 + num585 * num585)); float num587 = 1.5f; if (Main.expertMode) { this.damage = (int)((double)this.defDamage * 1.3); num587 = 4f; if (num586 > 150f) { num587 *= 1.05f; } if (num586 > 200f) { num587 *= 1.1f; } if (num586 > 250f) { num587 *= 1.1f; } if (num586 > 300f) { num587 *= 1.1f; } if (num586 > 350f) { num587 *= 1.1f; } if (num586 > 400f) { num587 *= 1.1f; } if (num586 > 450f) { num587 *= 1.1f; } if (num586 > 500f) { num587 *= 1.1f; } if (num586 > 550f) { num587 *= 1.1f; } if (num586 > 600f) { num587 *= 1.1f; } if (num568 == 0) { num587 *= 1.2f; } else if (num568 == 1) { num587 *= 1.1f; } } num586 = num587 / num586; this.velocity.X = num584 * num586; this.velocity.Y = num585 * num586; } else if (this.ai[1] == 2f) { this.damage = 1000; this.defense = 9999; this.rotation += (float)this.direction * 0.3f; Vector2 vector57 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num588 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector57.X; float num589 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector57.Y; float num590 = (float)Math.Sqrt((double)(num588 * num588 + num589 * num589)); num590 = 8f / num590; this.velocity.X = num588 * num590; this.velocity.Y = num589 * num590; } else if (this.ai[1] == 3f) { this.velocity.Y = this.velocity.Y + 0.1f; if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.95f; } this.velocity.X = this.velocity.X * 0.95f; if (this.timeLeft > 50) { this.timeLeft = 50; } } if (this.ai[1] != 2f && this.ai[1] != 3f && this.type != NPCID.DungeonGuardian) { if (num568 == 0 && Main.expertMode) { return; } return; } } else if (this.aiStyle == 12) { this.spriteDirection = -(int)this.ai[0]; if (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].aiStyle != 11) { this.ai[2] += 10f; if (this.ai[2] > 50f || Main.netMode != 2) { this.life = -1; this.HitEffect(0, 10.0); this.active = false; } } if (this.ai[2] == 0f || this.ai[2] == 3f) { if (Main.npc[(int)this.ai[1]].ai[1] == 3f && this.timeLeft > 10) { this.timeLeft = 10; } if (Main.npc[(int)this.ai[1]].ai[1] != 0f) { if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y - 100f) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y - 0.07f; if (this.velocity.Y > 6f) { this.velocity.Y = 6f; } } else if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y - 100f) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y + 0.07f; if (this.velocity.Y < -6f) { this.velocity.Y = -6f; } } if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 120f * this.ai[0]) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > 8f) { this.velocity.X = 8f; } } if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 120f * this.ai[0]) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -8f) { this.velocity.X = -8f; } } } else { this.ai[3] += 1f; if (Main.expertMode) { this.ai[3] += 0.5f; } if (this.ai[3] >= 300f) { this.ai[2] += 1f; this.ai[3] = 0f; this.netUpdate = true; } if (Main.expertMode) { if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y + 230f) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y - 0.04f; if (this.velocity.Y > 3f) { this.velocity.Y = 3f; } } else if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y + 230f) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y + 0.04f; if (this.velocity.Y < -3f) { this.velocity.Y = -3f; } } if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0]) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X - 0.07f; if (this.velocity.X > 8f) { this.velocity.X = 8f; } } if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0]) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X + 0.07f; if (this.velocity.X < -8f) { this.velocity.X = -8f; } } } if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y + 230f) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y - 0.04f; if (this.velocity.Y > 3f) { this.velocity.Y = 3f; } } else if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y + 230f) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y + 0.04f; if (this.velocity.Y < -3f) { this.velocity.Y = -3f; } } if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0]) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X - 0.07f; if (this.velocity.X > 8f) { this.velocity.X = 8f; } } if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0]) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X + 0.07f; if (this.velocity.X < -8f) { this.velocity.X = -8f; } } } Vector2 vector58 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num593 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector58.X; float num594 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector58.Y; Math.Sqrt((double)(num593 * num593 + num594 * num594)); this.rotation = (float)Math.Atan2((double)num594, (double)num593) + 1.57f; return; } if (this.ai[2] == 1f) { Vector2 vector59 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num595 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector59.X; float num596 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector59.Y; float num597 = (float)Math.Sqrt((double)(num595 * num595 + num596 * num596)); this.rotation = (float)Math.Atan2((double)num596, (double)num595) + 1.57f; this.velocity.X = this.velocity.X * 0.95f; this.velocity.Y = this.velocity.Y - 0.1f; if (Main.expertMode) { this.velocity.Y = this.velocity.Y - 0.06f; if (this.velocity.Y < -13f) { this.velocity.Y = -13f; } } else if (this.velocity.Y < -8f) { this.velocity.Y = -8f; } if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y - 200f) { this.TargetClosest(true); this.ai[2] = 2f; vector59 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); num595 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector59.X; num596 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector59.Y; num597 = (float)Math.Sqrt((double)(num595 * num595 + num596 * num596)); if (Main.expertMode) { num597 = 21f / num597; } else { num597 = 18f / num597; } this.velocity.X = num595 * num597; this.velocity.Y = num596 * num597; this.netUpdate = true; return; } } else if (this.ai[2] == 2f) { if (this.position.Y > Main.player[this.target].position.Y || this.velocity.Y < 0f) { this.ai[2] = 3f; return; } } else if (this.ai[2] == 4f) { Vector2 vector60 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num598 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector60.X; float num599 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector60.Y; float num600 = (float)Math.Sqrt((double)(num598 * num598 + num599 * num599)); this.rotation = (float)Math.Atan2((double)num599, (double)num598) + 1.57f; this.velocity.Y = this.velocity.Y * 0.95f; this.velocity.X = this.velocity.X + 0.1f * -this.ai[0]; if (Main.expertMode) { this.velocity.X = this.velocity.X + 0.07f * -this.ai[0]; if (this.velocity.X < -12f) { this.velocity.X = -12f; } else if (this.velocity.X > 12f) { this.velocity.X = 12f; } } else if (this.velocity.X < -8f) { this.velocity.X = -8f; } else if (this.velocity.X > 8f) { this.velocity.X = 8f; } if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 500f || this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) + 500f) { this.TargetClosest(true); this.ai[2] = 5f; vector60 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); num598 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector60.X; num599 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector60.Y; num600 = (float)Math.Sqrt((double)(num598 * num598 + num599 * num599)); if (Main.expertMode) { num600 = 22f / num600; } else { num600 = 17f / num600; } this.velocity.X = num598 * num600; this.velocity.Y = num599 * num600; this.netUpdate = true; return; } } else if (this.ai[2] == 5f && ((this.velocity.X > 0f && this.position.X + (float)(this.width / 2) > Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2)) || (this.velocity.X < 0f && this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2)))) { this.ai[2] = 0f; return; } } else if (this.aiStyle == 13) { if (this.ai[0] < 0f || this.ai[0] >= (float)Main.maxTilesX || this.ai[1] < 0f || this.ai[1] >= (float)Main.maxTilesX) { return; } if (Main.tile[(int)this.ai[0], (int)this.ai[1]] == null) { Main.tile[(int)this.ai[0], (int)this.ai[1]] = new Tile(); } if (!Main.tile[(int)this.ai[0], (int)this.ai[1]].active()) { this.life = -1; this.HitEffect(0, 10.0); this.active = false; return; } this.TargetClosest(true); float num601 = 0.035f; float num602 = 150f; if (this.type == NPCID.ManEater) { num602 = 250f; } if (this.type == NPCID.Clinger) { num602 = 175f; } if (this.type == NPCID.FungiBulb) { num602 = 100f; } if (this.type == NPCID.AngryTrapper) { num602 = 500f; num601 = 0.05f; } if (this.type == NPCID.GiantFungiBulb) { num602 = 350f; num601 = 0.15f; } this.ai[2] += 1f; if (this.ai[2] > 300f) { num602 = (float)((int)((double)num602 * 1.3)); if (this.ai[2] > 450f) { this.ai[2] = 0f; } } Vector2 vector61 = new Vector2(this.ai[0] * 16f + 8f, this.ai[1] * 16f + 8f); float num603 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - (float)(this.width / 2) - vector61.X; float num604 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - (float)(this.height / 2) - vector61.Y; float num605 = (float)Math.Sqrt((double)(num603 * num603 + num604 * num604)); if (num605 > num602) { num605 = num602 / num605; num603 *= num605; num604 *= num605; } if (this.position.X < this.ai[0] * 16f + 8f + num603) { this.velocity.X = this.velocity.X + num601; if (this.velocity.X < 0f && num603 > 0f) { this.velocity.X = this.velocity.X + num601 * 1.5f; } } else if (this.position.X > this.ai[0] * 16f + 8f + num603) { this.velocity.X = this.velocity.X - num601; if (this.velocity.X > 0f && num603 < 0f) { this.velocity.X = this.velocity.X - num601 * 1.5f; } } if (this.position.Y < this.ai[1] * 16f + 8f + num604) { this.velocity.Y = this.velocity.Y + num601; if (this.velocity.Y < 0f && num604 > 0f) { this.velocity.Y = this.velocity.Y + num601 * 1.5f; } } else if (this.position.Y > this.ai[1] * 16f + 8f + num604) { this.velocity.Y = this.velocity.Y - num601; if (this.velocity.Y > 0f && num604 < 0f) { this.velocity.Y = this.velocity.Y - num601 * 1.5f; } } if (this.type == NPCID.ManEater) { if (this.velocity.X > 3f) { this.velocity.X = 3f; } if (this.velocity.X < -3f) { this.velocity.X = -3f; } if (this.velocity.Y > 3f) { this.velocity.Y = 3f; } if (this.velocity.Y < -3f) { this.velocity.Y = -3f; } } else if (this.type == NPCID.AngryTrapper) { if (this.velocity.X > 4f) { this.velocity.X = 4f; } if (this.velocity.X < -4f) { this.velocity.X = -4f; } if (this.velocity.Y > 4f) { this.velocity.Y = 4f; } if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } } else { if (this.velocity.X > 2f) { this.velocity.X = 2f; } if (this.velocity.X < -2f) { this.velocity.X = -2f; } if (this.velocity.Y > 2f) { this.velocity.Y = 2f; } if (this.velocity.Y < -2f) { this.velocity.Y = -2f; } } if (this.type == NPCID.FungiBulb || this.type == NPCID.GiantFungiBulb) { this.rotation = (float)Math.Atan2((double)num604, (double)num603) + 1.57f; } else { if (num603 > 0f) { this.spriteDirection = 1; this.rotation = (float)Math.Atan2((double)num604, (double)num603); } if (num603 < 0f) { this.spriteDirection = -1; this.rotation = (float)Math.Atan2((double)num604, (double)num603) + 3.14f; } } if (this.collideX) { this.netUpdate = true; this.velocity.X = this.oldVelocity.X * -0.7f; if (this.velocity.X > 0f && this.velocity.X < 2f) { this.velocity.X = 2f; } if (this.velocity.X < 0f && this.velocity.X > -2f) { this.velocity.X = -2f; } } if (this.collideY) { this.netUpdate = true; this.velocity.Y = this.oldVelocity.Y * -0.7f; if (this.velocity.Y > 0f && this.velocity.Y < 2f) { this.velocity.Y = 2f; } if (this.velocity.Y < 0f && this.velocity.Y > -2f) { this.velocity.Y = -2f; } } if (Main.netMode != 1) { if (this.type == NPCID.Clinger && !Main.player[this.target].dead) { if (this.justHit) { this.localAI[0] = 0f; } this.localAI[0] += 1f; if (this.localAI[0] >= 120f) { if (!Collision.SolidCollision(this.position, this.width, this.height) && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { float num606 = 10f; vector61 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); num603 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector61.X + (float)Main.rand.Next(-10, 11); num604 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector61.Y + (float)Main.rand.Next(-10, 11); num605 = (float)Math.Sqrt((double)(num603 * num603 + num604 * num604)); num605 = num606 / num605; num603 *= num605; num604 *= num605; int num607 = 22; if (Main.expertMode) { num607 = (int)((double)num607 * 0.8); } int num608 = 96; int num609 = Projectile.NewProjectile(vector61.X, vector61.Y, num603, num604, num608, num607, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num609].timeLeft = 300; this.localAI[0] = 0f; } else { this.localAI[0] = 100f; } } } if (this.type == NPCID.GiantFungiBulb && !Main.player[this.target].dead) { if (this.justHit) { this.localAI[0] = 0f; } this.localAI[0] += 1f; if (this.localAI[0] >= 150f) { if (!Collision.SolidCollision(this.position, this.width, this.height)) { float num610 = 14f; vector61 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); num603 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector61.X + (float)Main.rand.Next(-10, 11); float num611 = Math.Abs(num603 * 0.1f); if (num604 > 0f) { num611 = 0f; } num604 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector61.Y + (float)Main.rand.Next(-10, 11) - num611; num605 = (float)Math.Sqrt((double)(num603 * num603 + num604 * num604)); num605 = num610 / num605; num603 *= num605; num604 *= num605; int num612 = NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 261, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num612].velocity.X = num603; Main.npc[num612].velocity.Y = num604; Main.npc[num612].netUpdate = true; this.localAI[0] = 0f; return; } this.localAI[0] = 250f; return; } } } } else if (this.aiStyle == 14) { this.noGravity = true; if (this.collideX) { this.velocity.X = this.oldVelocity.X * -0.5f; if (this.direction == -1 && this.velocity.X > 0f && this.velocity.X < 2f) { this.velocity.X = 2f; } if (this.direction == 1 && this.velocity.X < 0f && this.velocity.X > -2f) { this.velocity.X = -2f; } } if (this.collideY) { this.velocity.Y = this.oldVelocity.Y * -0.5f; if (this.velocity.Y > 0f && this.velocity.Y < 1f) { this.velocity.Y = 1f; } if (this.velocity.Y < 0f && this.velocity.Y > -1f) { this.velocity.Y = -1f; } } if (this.type == NPCID.FlyingSnake) { int direction4 = 1; int num615 = 1; if (this.velocity.X < 0f) { direction4 = -1; } if (this.velocity.Y < 0f) { num615 = -1; } this.TargetClosest(true); if (!Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.direction = direction4; this.directionY = num615; } } else { this.TargetClosest(true); } if (this.type == NPCID.VampireBat) { if ((double)this.position.Y < Main.worldSurface * 16.0 && Main.dayTime && !Main.eclipse) { this.directionY = -1; this.direction *= -1; } if (this.direction == -1 && this.velocity.X > -7f) { this.velocity.X = this.velocity.X - 0.2f; if (this.velocity.X > 4f) { this.velocity.X = this.velocity.X - 0.1f; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X + 0.05f; } if (this.velocity.X < -7f) { this.velocity.X = -7f; } } else if (this.direction == 1 && this.velocity.X < 7f) { this.velocity.X = this.velocity.X + 0.2f; if (this.velocity.X < -4f) { this.velocity.X = this.velocity.X + 0.1f; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X - 0.05f; } if (this.velocity.X > 7f) { this.velocity.X = 7f; } } if (this.directionY == -1 && this.velocity.Y > -7f) { this.velocity.Y = this.velocity.Y - 0.2f; if (this.velocity.Y > 4f) { this.velocity.Y = this.velocity.Y - 0.1f; } else if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y + 0.05f; } if (this.velocity.Y < -7f) { this.velocity.Y = -7f; } } else if (this.directionY == 1 && this.velocity.Y < 7f) { this.velocity.Y = this.velocity.Y + 0.2f; if (this.velocity.Y < -4f) { this.velocity.Y = this.velocity.Y + 0.1f; } else if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y - 0.05f; } if (this.velocity.Y > 7f) { this.velocity.Y = 7f; } } } else if (this.type == NPCID.FlyingSnake) { if (this.direction == -1 && this.velocity.X > -4f) { this.velocity.X = this.velocity.X - 0.2f; if (this.velocity.X > 4f) { this.velocity.X = this.velocity.X - 0.1f; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X + 0.05f; } if (this.velocity.X < -4f) { this.velocity.X = -4f; } } else if (this.direction == 1 && this.velocity.X < 4f) { this.velocity.X = this.velocity.X + 0.2f; if (this.velocity.X < -4f) { this.velocity.X = this.velocity.X + 0.1f; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X - 0.05f; } if (this.velocity.X > 4f) { this.velocity.X = 4f; } } if (this.directionY == -1 && (double)this.velocity.Y > -2.5) { this.velocity.Y = this.velocity.Y - 0.1f; if ((double)this.velocity.Y > 2.5) { this.velocity.Y = this.velocity.Y - 0.05f; } else if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y + 0.03f; } if ((double)this.velocity.Y < -2.5) { this.velocity.Y = -2.5f; } } else if (this.directionY == 1 && (double)this.velocity.Y < 2.5) { this.velocity.Y = this.velocity.Y + 0.1f; if ((double)this.velocity.Y < -2.5) { this.velocity.Y = this.velocity.Y + 0.05f; } else if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y - 0.03f; } if ((double)this.velocity.Y > 2.5) { this.velocity.Y = 2.5f; } } } else { if (this.direction == -1 && this.velocity.X > -4f) { this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > 4f) { this.velocity.X = this.velocity.X - 0.1f; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X + 0.05f; } if (this.velocity.X < -4f) { this.velocity.X = -4f; } } else if (this.direction == 1 && this.velocity.X < 4f) { this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -4f) { this.velocity.X = this.velocity.X + 0.1f; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X - 0.05f; } if (this.velocity.X > 4f) { this.velocity.X = 4f; } } if (this.directionY == -1 && (double)this.velocity.Y > -1.5) { this.velocity.Y = this.velocity.Y - 0.04f; if ((double)this.velocity.Y > 1.5) { this.velocity.Y = this.velocity.Y - 0.05f; } else if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y + 0.03f; } if ((double)this.velocity.Y < -1.5) { this.velocity.Y = -1.5f; } } else if (this.directionY == 1 && (double)this.velocity.Y < 1.5) { this.velocity.Y = this.velocity.Y + 0.04f; if ((double)this.velocity.Y < -1.5) { this.velocity.Y = this.velocity.Y + 0.05f; } else if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y - 0.03f; } if ((double)this.velocity.Y > 1.5) { this.velocity.Y = 1.5f; } } } if (this.type == NPCID.CaveBat || this.type == NPCID.JungleBat || this.type == NPCID.Hellbat || this.type == NPCID.Demon || this.type == NPCID.VoodooDemon || this.type == NPCID.GiantBat || this.type == NPCID.IlluminantBat || this.type == NPCID.IceBat || this.type == NPCID.Lavabat || this.type == NPCID.GiantFlyingFox) { if (this.wet) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.95f; } this.velocity.Y = this.velocity.Y - 0.5f; if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } this.TargetClosest(true); } if (this.type == NPCID.Hellbat) { if (this.direction == -1 && this.velocity.X > -4f) { this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > 4f) { this.velocity.X = this.velocity.X - 0.07f; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X + 0.03f; } if (this.velocity.X < -4f) { this.velocity.X = -4f; } } else if (this.direction == 1 && this.velocity.X < 4f) { this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -4f) { this.velocity.X = this.velocity.X + 0.07f; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X - 0.03f; } if (this.velocity.X > 4f) { this.velocity.X = 4f; } } if (this.directionY == -1 && (double)this.velocity.Y > -1.5) { this.velocity.Y = this.velocity.Y - 0.04f; if ((double)this.velocity.Y > 1.5) { this.velocity.Y = this.velocity.Y - 0.03f; } else if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y + 0.02f; } if ((double)this.velocity.Y < -1.5) { this.velocity.Y = -1.5f; } } else if (this.directionY == 1 && (double)this.velocity.Y < 1.5) { this.velocity.Y = this.velocity.Y + 0.04f; if ((double)this.velocity.Y < -1.5) { this.velocity.Y = this.velocity.Y + 0.03f; } else if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y - 0.02f; } if ((double)this.velocity.Y > 1.5) { this.velocity.Y = 1.5f; } } } else { if (this.direction == -1 && this.velocity.X > -4f) { this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > 4f) { this.velocity.X = this.velocity.X - 0.1f; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X + 0.05f; } if (this.velocity.X < -4f) { this.velocity.X = -4f; } } else if (this.direction == 1 && this.velocity.X < 4f) { this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -4f) { this.velocity.X = this.velocity.X + 0.1f; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X - 0.05f; } if (this.velocity.X > 4f) { this.velocity.X = 4f; } } if (this.directionY == -1 && (double)this.velocity.Y > -1.5) { this.velocity.Y = this.velocity.Y - 0.04f; if ((double)this.velocity.Y > 1.5) { this.velocity.Y = this.velocity.Y - 0.05f; } else if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y + 0.03f; } if ((double)this.velocity.Y < -1.5) { this.velocity.Y = -1.5f; } } else if (this.directionY == 1 && (double)this.velocity.Y < 1.5) { this.velocity.Y = this.velocity.Y + 0.04f; if ((double)this.velocity.Y < -1.5) { this.velocity.Y = this.velocity.Y + 0.05f; } else if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y - 0.03f; } if ((double)this.velocity.Y > 1.5) { this.velocity.Y = 1.5f; } } } } if (this.type == NPCID.VampireBat && Main.netMode != 1) { Vector2 vector62 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num616 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector62.X; float num617 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector62.Y; float num618 = (float)Math.Sqrt((double)(num616 * num616 + num617 * num617)); if (num618 < 200f && this.position.Y + (float)this.height < Main.player[this.target].position.Y + (float)Main.player[this.target].height && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.Transform(159); } } this.ai[1] += 1f; if (this.type == NPCID.VampireBat) { this.ai[1] += 1f; } if (this.ai[1] > 200f) { if (!Main.player[this.target].wet && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.ai[1] = 0f; } float num619 = 0.2f; float num620 = 0.1f; float num621 = 4f; float num622 = 1.5f; if (this.type == NPCID.Harpy || this.type == NPCID.Demon || this.type == NPCID.VoodooDemon) { num619 = 0.12f; num620 = 0.07f; num621 = 3f; num622 = 1.25f; } if (this.ai[1] > 1000f) { this.ai[1] = 0f; } this.ai[2] += 1f; if (this.ai[2] > 0f) { if (this.velocity.Y < num622) { this.velocity.Y = this.velocity.Y + num620; } } else if (this.velocity.Y > -num622) { this.velocity.Y = this.velocity.Y - num620; } if (this.ai[2] < -150f || this.ai[2] > 150f) { if (this.velocity.X < num621) { this.velocity.X = this.velocity.X + num619; } } else if (this.velocity.X > -num621) { this.velocity.X = this.velocity.X - num619; } if (this.ai[2] > 300f) { this.ai[2] = -300f; } } if (Main.netMode != 1) { if (this.type == NPCID.Harpy) { this.ai[0] += 1f; if (this.ai[0] == 30f || this.ai[0] == 60f || this.ai[0] == 90f) { if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { float num623 = 6f; Vector2 vector63 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num624 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector63.X + (float)Main.rand.Next(-100, 101); float num625 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector63.Y + (float)Main.rand.Next(-100, 101); float num626 = (float)Math.Sqrt((double)(num624 * num624 + num625 * num625)); num626 = num623 / num626; num624 *= num626; num625 *= num626; int num627 = 15; int num628 = 38; int num629 = Projectile.NewProjectile(vector63.X, vector63.Y, num624, num625, num628, num627, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num629].timeLeft = 300; } } else if (this.ai[0] >= (float)(400 + Main.rand.Next(400))) { this.ai[0] = 0f; } } if (this.type == NPCID.Demon || this.type == NPCID.VoodooDemon) { this.ai[0] += 1f; if (this.ai[0] == 20f || this.ai[0] == 40f || this.ai[0] == 60f || this.ai[0] == 80f) { if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { float num630 = 0.2f; Vector2 vector64 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num631 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector64.X + (float)Main.rand.Next(-100, 101); float num632 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector64.Y + (float)Main.rand.Next(-100, 101); float num633 = (float)Math.Sqrt((double)(num631 * num631 + num632 * num632)); num633 = num630 / num633; num631 *= num633; num632 *= num633; int num634 = 21; int num635 = 44; int num636 = Projectile.NewProjectile(vector64.X, vector64.Y, num631, num632, num635, num634, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num636].timeLeft = 300; } } else if (this.ai[0] >= (float)(300 + Main.rand.Next(300))) { this.ai[0] = 0f; } } if (this.type == NPCID.RedDevil) { this.ai[0] += 1f; if (this.ai[0] == 20f || this.ai[0] == 40f || this.ai[0] == 60f || this.ai[0] == 80f || this.ai[0] == 100f) { if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { float num637 = 0.2f; Vector2 value13 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num638 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - value13.X + (float)Main.rand.Next(-50, 51); float num639 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - value13.Y + (float)Main.rand.Next(-50, 51); float num640 = (float)Math.Sqrt((double)(num638 * num638 + num639 * num639)); num640 = num637 / num640; num638 *= num640; num639 *= num640; int num641 = 80; int num642 = 115; value13 += this.velocity * 5f; int num643 = Projectile.NewProjectile(value13.X + num638 * 100f, value13.Y + num639 * 100f, num638, num639, num642, num641, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num643].timeLeft = 300; return; } } else if (this.ai[0] >= (float)(250 + Main.rand.Next(250))) { this.ai[0] = 0f; return; } } } } else if (this.aiStyle == 15) { float num644 = 1f; bool flag65 = false; bool flag66 = false; this.aiAction = 0; if (this.ai[3] == 0f && this.life > 0) { this.ai[3] = (float)this.lifeMax; } if (this.localAI[3] == 0f && Main.netMode != 1) { this.ai[0] = -100f; this.localAI[3] = 1f; this.TargetClosest(true); this.netUpdate = true; } if (Main.player[this.target].dead) { this.TargetClosest(true); if (Main.player[this.target].dead) { this.timeLeft = 0; if (Main.player[this.target].Center.X < base.Center.X) { this.direction = 1; } else { this.direction = -1; } } } if (!Main.player[this.target].dead && this.ai[2] >= 300f && this.ai[1] < 5f && this.velocity.Y == 0f) { this.ai[2] = 0f; this.ai[0] = 0f; this.ai[1] = 5f; if (Main.netMode != 1) { this.TargetClosest(false); Point point5 = base.Center.ToTileCoordinates(); Point point6 = Main.player[this.target].Center.ToTileCoordinates(); Vector2 vector65 = Main.player[this.target].Center - base.Center; int num645 = 10; int num646 = 0; int num647 = 7; int num648 = 0; bool flag67 = false; if (vector65.Length() > 2000f) { flag67 = true; num648 = 100; } while (!flag67 && num648 < 100) { num648++; int num649 = Main.rand.Next(point6.X - num645, point6.X + num645 + 1); int num650 = Main.rand.Next(point6.Y - num645, point6.Y + 1); if ((num650 < point6.Y - num647 || num650 > point6.Y + num647 || num649 < point6.X - num647 || num649 > point6.X + num647) && (num650 < point5.Y - num646 || num650 > point5.Y + num646 || num649 < point5.X - num646 || num649 > point5.X + num646) && !Main.tile[num649, num650].nactive()) { int num651 = num650; int num652 = 0; bool flag68 = Main.tile[num649, num651].nactive() && Main.tileSolid[(int)Main.tile[num649, num651].type] && !Main.tileSolidTop[(int)Main.tile[num649, num651].type]; if (flag68) { num652 = 1; } else { while (num652 < 150 && num651 + num652 < Main.maxTilesY) { int num653 = num651 + num652; bool flag69 = Main.tile[num649, num653].nactive() && Main.tileSolid[(int)Main.tile[num649, num653].type] && !Main.tileSolidTop[(int)Main.tile[num649, num653].type]; if (flag69) { num652--; break; } num652++; } } num650 += num652; bool flag70 = true; if (flag70 && Main.tile[num649, num650].lava()) { flag70 = false; } if (flag70 && !Collision.CanHitLine(base.Center, 0, 0, Main.player[this.target].Center, 0, 0)) { var nearPlayer = new Vector2(num649 * 16, num650 * 16); this.Teleport(nearPlayer, 4, 0); flag70 = false; } if (flag70) { this.localAI[1] = (float)(num649 * 16 + 8); this.localAI[2] = (float)(num650 * 16 + 16); break; } } } if (num648 >= 100) { Vector2 bottom = Main.player[(int)Player.FindClosest(this.position, this.width, this.height)].Bottom; this.localAI[1] = bottom.X; this.localAI[2] = bottom.Y; } } } if (!Collision.CanHitLine(base.Center, 0, 0, Main.player[this.target].Center, 0, 0)) { this.ai[2] += 1f; } if (Math.Abs(base.Top.Y - Main.player[this.target].Bottom.Y) > 320f) { this.ai[2] += 1f; } if (this.ai[1] == 5f) { this.aiAction = 1; this.ai[0] += 1f; num644 = MathHelper.Clamp((60f - this.ai[0]) / 60f, 0f, 1f); num644 = 0.5f + num644 * 0.5f; if (this.ai[0] >= 60f && Main.netMode != 1) { base.Bottom = new Vector2(this.localAI[1], this.localAI[2]); this.ai[1] = 6f; this.ai[0] = 0f; this.netUpdate = true; } if (Main.netMode == 1 && this.ai[0] >= 120f) { this.ai[1] = 6f; this.ai[0] = 0f; } } else if (this.ai[1] == 6f) { flag65 = true; this.aiAction = 0; this.ai[0] += 1f; num644 = MathHelper.Clamp(this.ai[0] / 30f, 0f, 1f); num644 = 0.5f + num644 * 0.5f; if (this.ai[0] >= 30f && Main.netMode != 1) { this.ai[1] = 0f; this.ai[0] = 0f; this.netUpdate = true; this.TargetClosest(true); } if (Main.netMode == 1 && this.ai[0] >= 60f) { this.ai[1] = 0f; this.ai[0] = 0f; this.TargetClosest(true); } } this.dontTakeDamage = (this.hide = flag66); if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.8f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } if (!flag65) { this.ai[0] += 2f; if ((double)this.life < (double)this.lifeMax * 0.8) { this.ai[0] += 1f; } if ((double)this.life < (double)this.lifeMax * 0.6) { this.ai[0] += 1f; } if ((double)this.life < (double)this.lifeMax * 0.4) { this.ai[0] += 2f; } if ((double)this.life < (double)this.lifeMax * 0.2) { this.ai[0] += 3f; } if ((double)this.life < (double)this.lifeMax * 0.1) { this.ai[0] += 4f; } if (this.ai[0] >= 0f) { this.netUpdate = true; this.TargetClosest(true); if (this.ai[1] == 3f) { this.velocity.Y = -13f; this.velocity.X = this.velocity.X + 3.5f * (float)this.direction; this.ai[0] = -200f; this.ai[1] = 0f; } else if (this.ai[1] == 2f) { this.velocity.Y = -6f; this.velocity.X = this.velocity.X + 4.5f * (float)this.direction; this.ai[0] = -120f; this.ai[1] += 1f; } else { this.velocity.Y = -8f; this.velocity.X = this.velocity.X + 4f * (float)this.direction; this.ai[0] = -120f; this.ai[1] += 1f; } } else if (this.ai[0] >= -30f) { this.aiAction = 1; } } } else if (this.target < 255 && ((this.direction == 1 && this.velocity.X < 3f) || (this.direction == -1 && this.velocity.X > -3f))) { if ((this.direction == -1 && (double)this.velocity.X < 0.1) || (this.direction == 1 && (double)this.velocity.X > -0.1)) { this.velocity.X = this.velocity.X + 0.2f * (float)this.direction; } else { this.velocity.X = this.velocity.X * 0.93f; } } if (this.life > 0) { float num659 = (float)this.life / (float)this.lifeMax; num659 = num659 * 0.5f + 0.75f; num659 *= num644; if (num659 != this.scale) { this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)this.height; this.scale = num659; this.width = (int)(98f * this.scale); this.height = (int)(92f * this.scale); this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)this.height; } if (Main.netMode != 1) { int num660 = (int)((double)this.lifeMax * 0.05); if ((float)(this.life + num660) < this.ai[3]) { this.ai[3] = (float)this.life; int num661 = Main.rand.Next(1, 4); for (int num662 = 0; num662 < num661; num662++) { int x = (int)(this.position.X + (float)Main.rand.Next(this.width - 32)); int y = (int)(this.position.Y + (float)Main.rand.Next(this.height - 32)); int num663 = 1; if (Main.expertMode && Main.rand.Next(4) == 0) { num663 = 535; } int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num664].SetDefaults(num663, -1f); Main.npc[num664].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; Main.npc[num664].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; Main.npc[num664].ai[0] = (float)(-1000 * Main.rand.Next(3)); Main.npc[num664].ai[1] = 0f; if (Main.netMode == 2 && num664 < 200) { NetMessage.SendData((int)PacketTypes.NpcUpdate, -1, -1, "", num664, 0f, 0f, 0f, 0, 0, 0); } } return; } } } } else if (this.aiStyle == 16) { if (this.direction == 0) { this.TargetClosest(true); } if (this.wet) { bool flag71 = false; if (this.type != NPCID.Goldfish) { this.TargetClosest(false); if (Main.player[this.target].wet && !Main.player[this.target].dead) { flag71 = true; } } if (!flag71) { if (this.collideX) { this.velocity.X = this.velocity.X * -1f; this.direction *= -1; this.netUpdate = true; } if (this.collideY) { this.netUpdate = true; if (this.velocity.Y > 0f) { this.velocity.Y = Math.Abs(this.velocity.Y) * -1f; this.directionY = -1; this.ai[0] = -1f; } else if (this.velocity.Y < 0f) { this.velocity.Y = Math.Abs(this.velocity.Y); this.directionY = 1; this.ai[0] = 1f; } } } if (flag71) { this.TargetClosest(true); if (this.type == NPCID.Arapaima) { if (this.velocity.X > 0f && this.direction < 0) { this.velocity.X = this.velocity.X * 0.95f; } if (this.velocity.X < 0f && this.direction > 0) { this.velocity.X = this.velocity.X * 0.95f; } this.velocity.X = this.velocity.X + (float)this.direction * 0.25f; this.velocity.Y = this.velocity.Y + (float)this.directionY * 0.2f; if (this.velocity.X > 8f) { this.velocity.X = 7f; } if (this.velocity.X < -8f) { this.velocity.X = -7f; } if (this.velocity.Y > 5f) { this.velocity.Y = 4f; } if (this.velocity.Y < -5f) { this.velocity.Y = -4f; } } else if (this.type == NPCID.Shark || this.type == NPCID.AnglerFish) { this.velocity.X = this.velocity.X + (float)this.direction * 0.15f; this.velocity.Y = this.velocity.Y + (float)this.directionY * 0.15f; if (this.velocity.X > 5f) { this.velocity.X = 5f; } if (this.velocity.X < -5f) { this.velocity.X = -5f; } if (this.velocity.Y > 3f) { this.velocity.Y = 3f; } if (this.velocity.Y < -3f) { this.velocity.Y = -3f; } } else { this.velocity.X = this.velocity.X + (float)this.direction * 0.1f; this.velocity.Y = this.velocity.Y + (float)this.directionY * 0.1f; if (this.velocity.X > 3f) { this.velocity.X = 3f; } if (this.velocity.X < -3f) { this.velocity.X = -3f; } if (this.velocity.Y > 2f) { this.velocity.Y = 2f; } if (this.velocity.Y < -2f) { this.velocity.Y = -2f; } } } else { if (this.type == NPCID.Arapaima) { if (Main.player[this.target].position.Y > this.position.Y) { this.directionY = 1; } else { this.directionY = -1; } this.velocity.X = this.velocity.X + (float)this.direction * 0.2f; if (this.velocity.X < -2f || this.velocity.X > 2f) { this.velocity.X = this.velocity.X * 0.95f; } if (this.ai[0] == -1f) { float num665 = -0.6f; if (this.directionY < 0) { num665 = -1f; } if (this.directionY > 0) { num665 = -0.2f; } this.velocity.Y = this.velocity.Y - 0.02f; if (this.velocity.Y < num665) { this.ai[0] = 1f; } } else { float num666 = 0.6f; if (this.directionY < 0) { num666 = 0.2f; } if (this.directionY > 0) { num666 = 1f; } this.velocity.Y = this.velocity.Y + 0.02f; if (this.velocity.Y > num666) { this.ai[0] = -1f; } } } else { this.velocity.X = this.velocity.X + (float)this.direction * 0.1f; if (this.velocity.X < -1f || this.velocity.X > 1f) { this.velocity.X = this.velocity.X * 0.95f; } if (this.ai[0] == -1f) { this.velocity.Y = this.velocity.Y - 0.01f; if ((double)this.velocity.Y < -0.3) { this.ai[0] = 1f; } } else { this.velocity.Y = this.velocity.Y + 0.01f; if ((double)this.velocity.Y > 0.3) { this.ai[0] = -1f; } } } int num667 = (int)(this.position.X + (float)(this.width / 2)) / 16; int num668 = (int)(this.position.Y + (float)(this.height / 2)) / 16; if (Main.tile[num667, num668 - 1] == null) { Main.tile[num667, num668 - 1] = new Tile(); } if (Main.tile[num667, num668 + 1] == null) { Main.tile[num667, num668 + 1] = new Tile(); } if (Main.tile[num667, num668 + 2] == null) { Main.tile[num667, num668 + 2] = new Tile(); } if (Main.tile[num667, num668 - 1].liquid > 128) { if (Main.tile[num667, num668 + 1].active()) { this.ai[0] = -1f; } else if (Main.tile[num667, num668 + 2].active()) { this.ai[0] = -1f; } } if (this.type != NPCID.Arapaima && ((double)this.velocity.Y > 0.4 || (double)this.velocity.Y < -0.4)) { this.velocity.Y = this.velocity.Y * 0.95f; } } } else { if (this.velocity.Y == 0f) { if (this.type == NPCID.Shark) { this.velocity.X = this.velocity.X * 0.94f; if ((double)this.velocity.X > -0.2 && (double)this.velocity.X < 0.2) { this.velocity.X = 0f; } } else if (Main.netMode != 1) { this.velocity.Y = (float)Main.rand.Next(-50, -20) * 0.1f; this.velocity.X = (float)Main.rand.Next(-20, 20) * 0.1f; this.netUpdate = true; } } this.velocity.Y = this.velocity.Y + 0.3f; if (this.velocity.Y > 10f) { this.velocity.Y = 10f; } this.ai[0] = 1f; } this.rotation = this.velocity.Y * (float)this.direction * 0.1f; if ((double)this.rotation < -0.2) { this.rotation = -0.2f; } if ((double)this.rotation > 0.2) { this.rotation = 0.2f; return; } } else if (this.aiStyle == 17) { this.noGravity = true; if (this.ai[0] == 0f) { this.noGravity = false; this.TargetClosest(true); if (Main.netMode != 1) { if (this.velocity.X != 0f || this.velocity.Y < 0f || (double)this.velocity.Y > 0.3) { this.ai[0] = 1f; this.netUpdate = true; } else { Rectangle rectangle6 = new Rectangle((int)Main.player[this.target].position.X, (int)Main.player[this.target].position.Y, Main.player[this.target].width, Main.player[this.target].height); Rectangle rectangle7 = new Rectangle((int)this.position.X - 100, (int)this.position.Y - 100, this.width + 200, this.height + 200); if (rectangle7.Intersects(rectangle6) || this.life < this.lifeMax) { this.ai[0] = 1f; this.velocity.Y = this.velocity.Y - 6f; this.netUpdate = true; } } } } else if (!Main.player[this.target].dead) { if (this.collideX) { this.velocity.X = this.oldVelocity.X * -0.5f; if (this.direction == -1 && this.velocity.X > 0f && this.velocity.X < 2f) { this.velocity.X = 2f; } if (this.direction == 1 && this.velocity.X < 0f && this.velocity.X > -2f) { this.velocity.X = -2f; } } if (this.collideY) { this.velocity.Y = this.oldVelocity.Y * -0.5f; if (this.velocity.Y > 0f && this.velocity.Y < 1f) { this.velocity.Y = 1f; } if (this.velocity.Y < 0f && this.velocity.Y > -1f) { this.velocity.Y = -1f; } } this.TargetClosest(true); if (this.direction == -1 && this.velocity.X > -3f) { this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > 3f) { this.velocity.X = this.velocity.X - 0.1f; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X - 0.05f; } if (this.velocity.X < -3f) { this.velocity.X = -3f; } } else if (this.direction == 1 && this.velocity.X < 3f) { this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -3f) { this.velocity.X = this.velocity.X + 0.1f; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X + 0.05f; } if (this.velocity.X > 3f) { this.velocity.X = 3f; } } float num669 = Math.Abs(this.position.X + (float)(this.width / 2) - (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2))); float num670 = Main.player[this.target].position.Y - (float)(this.height / 2); if (num669 > 50f) { num670 -= 100f; } if (this.position.Y < num670) { this.velocity.Y = this.velocity.Y + 0.05f; if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y + 0.01f; } } else { this.velocity.Y = this.velocity.Y - 0.05f; if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y - 0.01f; } } if (this.velocity.Y < -3f) { this.velocity.Y = -3f; } if (this.velocity.Y > 3f) { this.velocity.Y = 3f; } } if (this.wet) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.95f; } this.velocity.Y = this.velocity.Y - 0.5f; if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } this.TargetClosest(true); return; } } else if (this.aiStyle == 18) { bool flag72 = false; if (this.wet && this.ai[1] == 1f) { flag72 = true; } else { this.dontTakeDamage = false; } if (Main.expertMode && (this.type == NPCID.BlueJellyfish || this.type == NPCID.PinkJellyfish || this.type == NPCID.GreenJellyfish || this.type == NPCID.BloodJelly)) { if (this.wet) { if (this.target >= 0 && Main.player[this.target].wet && !Main.player[this.target].dead && (Main.player[this.target].Center - base.Center).Length() < 150f) { if (this.ai[1] == 0f) { this.ai[2] += 2f; } else { this.ai[2] -= 0.25f; } } if (flag72) { this.dontTakeDamage = true; this.ai[2] += 1f; if (this.ai[2] >= 120f) { this.ai[1] = 0f; } } else { this.ai[2] += 1f; if (this.ai[2] >= 420f) { this.ai[1] = 1f; this.ai[2] = 0f; } } } else { this.ai[1] = 0f; this.ai[2] = 0f; } } float num671 = 1f; if (flag72) { num671 += 0.5f; } if (this.direction == 0) { this.TargetClosest(true); } if (flag72) { return; } if (!this.wet) { this.rotation += this.velocity.X * 0.1f; if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.98f; if ((double)this.velocity.X > -0.01 && (double)this.velocity.X < 0.01) { this.velocity.X = 0f; } } this.velocity.Y = this.velocity.Y + 0.2f; if (this.velocity.Y > 10f) { this.velocity.Y = 10f; } this.ai[0] = 1f; return; } if (this.collideX) { this.velocity.X = this.velocity.X * -1f; this.direction *= -1; } if (this.collideY) { if (this.velocity.Y > 0f) { this.velocity.Y = Math.Abs(this.velocity.Y) * -1f; this.directionY = -1; this.ai[0] = -1f; } else if (this.velocity.Y < 0f) { this.velocity.Y = Math.Abs(this.velocity.Y); this.directionY = 1; this.ai[0] = 1f; } } bool flag73 = false; if (!this.friendly) { this.TargetClosest(false); if (Main.player[this.target].wet && !Main.player[this.target].dead) { flag73 = true; } } if (flag73) { this.localAI[2] = 1f; this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f; this.velocity *= 0.98f; float num672 = 0.2f; if (this.type == NPCID.GreenJellyfish) { this.velocity *= 0.98f; num672 = 0.6f; } if (this.type == NPCID.Squid) { this.velocity *= 0.99f; num672 = 1f; } if (this.type == NPCID.BloodJelly) { this.velocity *= 0.995f; num672 = 3f; } if (this.velocity.X > -num672 && this.velocity.X < num672 && this.velocity.Y > -num672 && this.velocity.Y < num672) { if (this.type == NPCID.Squid) { this.localAI[0] = 1f; } this.TargetClosest(true); float num673 = 7f; if (this.type == NPCID.GreenJellyfish) { num673 = 9f; } Vector2 vector66 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num674 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector66.X; float num675 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector66.Y; float num676 = (float)Math.Sqrt((double)(num674 * num674 + num675 * num675)); num676 = num673 / num676; num674 *= num676; num675 *= num676; this.velocity.X = num674; this.velocity.Y = num675; return; } } else { this.localAI[2] = 0f; this.velocity.X = this.velocity.X + (float)this.direction * 0.02f; this.rotation = this.velocity.X * 0.4f; if (this.velocity.X < -1f || this.velocity.X > 1f) { this.velocity.X = this.velocity.X * 0.95f; } if (this.ai[0] == -1f) { this.velocity.Y = this.velocity.Y - 0.01f; if (this.velocity.Y < -1f) { this.ai[0] = 1f; } } else { this.velocity.Y = this.velocity.Y + 0.01f; if (this.velocity.Y > 1f) { this.ai[0] = -1f; } } int num677 = (int)(this.position.X + (float)(this.width / 2)) / 16; int num678 = (int)(this.position.Y + (float)(this.height / 2)) / 16; if (Main.tile[num677, num678 - 1] == null) { Main.tile[num677, num678 - 1] = new Tile(); } if (Main.tile[num677, num678 + 1] == null) { Main.tile[num677, num678 + 1] = new Tile(); } if (Main.tile[num677, num678 + 2] == null) { Main.tile[num677, num678 + 2] = new Tile(); } if (Main.tile[num677, num678 - 1].liquid > 128) { if (Main.tile[num677, num678 + 1].active()) { this.ai[0] = -1f; } else if (Main.tile[num677, num678 + 2].active()) { this.ai[0] = -1f; } } else { this.ai[0] = 1f; } if ((double)this.velocity.Y > 1.2 || (double)this.velocity.Y < -1.2) { this.velocity.Y = this.velocity.Y * 0.99f; return; } } } else { if (this.aiStyle == 19) { this.TargetClosest(true); float num679 = 12f; Vector2 vector67 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num680 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector67.X; float num681 = Main.player[this.target].position.Y - vector67.Y; float num682 = (float)Math.Sqrt((double)(num680 * num680 + num681 * num681)); num682 = num679 / num682; num680 *= num682; num681 *= num682; bool flag74 = false; if (this.directionY < 0) { this.rotation = (float)(Math.Atan2((double)num681, (double)num680) + 1.57); flag74 = ((double)this.rotation >= -1.2 && (double)this.rotation <= 1.2); if ((double)this.rotation < -0.8) { this.rotation = -0.8f; } else if ((double)this.rotation > 0.8) { this.rotation = 0.8f; } if (this.velocity.X != 0f) { this.velocity.X = this.velocity.X * 0.9f; if ((double)this.velocity.X > -0.1 || (double)this.velocity.X < 0.1) { this.netUpdate = true; this.velocity.X = 0f; } } } if (this.ai[0] > 0f) { this.ai[0] -= 1f; } if (Main.netMode != 1 && flag74 && this.ai[0] == 0f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.ai[0] = 200f; int num683 = 10; int num684 = 31; int num685 = Projectile.NewProjectile(vector67.X, vector67.Y, num680, num681, num684, num683, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num685].ai[0] = 2f; Main.projectile[num685].timeLeft = 300; Main.projectile[num685].friendly = false; NetMessage.SendData((int)PacketTypes.ProjectileNew, -1, -1, "", num685, 0f, 0f, 0f, 0, 0, 0); this.netUpdate = true; } try { int num686 = (int)this.position.X / 16; int num687 = (int)(this.position.X + (float)(this.width / 2)) / 16; int num688 = (int)(this.position.X + (float)this.width) / 16; int num689 = (int)(this.position.Y + (float)this.height) / 16; bool flag75 = false; if (Main.tile[num686, num689] == null) { Main.tile[num686, num689] = new Tile(); } if (Main.tile[num687, num689] == null) { Main.tile[num686, num689] = new Tile(); } if (Main.tile[num688, num689] == null) { Main.tile[num686, num689] = new Tile(); } if ((Main.tile[num686, num689].nactive() && Main.tileSolid[(int)Main.tile[num686, num689].type]) || (Main.tile[num687, num689].nactive() && Main.tileSolid[(int)Main.tile[num687, num689].type]) || (Main.tile[num688, num689].nactive() && Main.tileSolid[(int)Main.tile[num688, num689].type])) { flag75 = true; } if (flag75) { this.noGravity = true; this.noTileCollide = true; this.velocity.Y = -0.2f; } else { this.noGravity = false; this.noTileCollide = false; } return; } catch { return; } } if (this.aiStyle == 20) { if (this.ai[0] == 0f) { if (Main.netMode != 1) { this.TargetClosest(true); this.direction *= -1; this.directionY *= -1; this.position.Y = this.position.Y + (float)(this.height / 2 + 8); this.ai[1] = this.position.X + (float)(this.width / 2); this.ai[2] = this.position.Y + (float)(this.height / 2); if (this.direction == 0) { this.direction = 1; } if (this.directionY == 0) { this.directionY = 1; } this.ai[3] = 1f + (float)Main.rand.Next(15) * 0.1f; this.velocity.Y = (float)(this.directionY * 6) * this.ai[3]; this.ai[0] += 1f; this.netUpdate = true; return; } this.ai[1] = this.position.X + (float)(this.width / 2); this.ai[2] = this.position.Y + (float)(this.height / 2); return; } else { float num691 = 6f * this.ai[3]; float num692 = 0.2f * this.ai[3]; float num693 = num691 / num692 / 2f; if (this.ai[0] >= 1f && this.ai[0] < (float)((int)num693)) { this.velocity.Y = (float)this.directionY * num691; this.ai[0] += 1f; return; } if (this.ai[0] >= (float)((int)num693)) { this.velocity.Y = 0f; this.directionY *= -1; this.velocity.X = num691 * (float)this.direction; this.ai[0] = -1f; return; } if (this.directionY > 0) { if (this.velocity.Y >= num691) { this.directionY *= -1; this.velocity.Y = num691; } } else if (this.directionY < 0 && this.velocity.Y <= -num691) { this.directionY *= -1; this.velocity.Y = -num691; } if (this.direction > 0) { if (this.velocity.X >= num691) { this.direction *= -1; this.velocity.X = num691; } } else if (this.direction < 0 && this.velocity.X <= -num691) { this.direction *= -1; this.velocity.X = -num691; } this.velocity.X = this.velocity.X + num692 * (float)this.direction; this.velocity.Y = this.velocity.Y + num692 * (float)this.directionY; return; } } else { if (this.aiStyle == 21) { if (this.ai[0] == 0f) { this.TargetClosest(true); this.directionY = 1; this.ai[0] = 1f; } int num694 = 6; if (this.ai[1] == 0f) { this.rotation += (float)(this.direction * this.directionY) * 0.13f; if (this.collideY) { this.ai[0] = 2f; } if (!this.collideY && this.ai[0] == 2f) { this.direction = -this.direction; this.ai[1] = 1f; this.ai[0] = 1f; } if (this.collideX) { this.directionY = -this.directionY; this.ai[1] = 1f; } } else { this.rotation -= (float)(this.direction * this.directionY) * 0.13f; if (this.collideX) { this.ai[0] = 2f; } if (!this.collideX && this.ai[0] == 2f) { this.directionY = -this.directionY; this.ai[1] = 0f; this.ai[0] = 1f; } if (this.collideY) { this.direction = -this.direction; this.ai[1] = 0f; } } this.velocity.X = (float)(num694 * this.direction); this.velocity.Y = (float)(num694 * this.directionY); float num695 = (float)(270 - (int)Main.mouseTextColor) / 400f; return; } if (this.aiStyle == 22) { bool flag76 = false; bool flag77 = this.type == NPCID.Poltergeist && !Main.pumpkinMoon; if (this.type == NPCID.Reaper && !Main.eclipse) { flag77 = true; } if (this.type == NPCID.Drippler && Main.dayTime) { flag77 = true; } if (this.justHit) { this.ai[2] = 0f; } if (!flag77) { if (this.ai[2] >= 0f) { int num696 = 16; bool flag78 = false; bool flag79 = false; if (this.position.X > this.ai[0] - (float)num696 && this.position.X < this.ai[0] + (float)num696) { flag78 = true; } else if ((this.velocity.X < 0f && this.direction > 0) || (this.velocity.X > 0f && this.direction < 0)) { flag78 = true; } num696 += 24; if (this.position.Y > this.ai[1] - (float)num696 && this.position.Y < this.ai[1] + (float)num696) { flag79 = true; } if (flag78 && flag79) { this.ai[2] += 1f; if (this.ai[2] >= 30f && num696 == 16) { flag76 = true; } if (this.ai[2] >= 60f) { this.ai[2] = -200f; this.direction *= -1; this.velocity.X = this.velocity.X * -1f; this.collideX = false; } } else { this.ai[0] = this.position.X; this.ai[1] = this.position.Y; this.ai[2] = 0f; } this.TargetClosest(true); } else if (this.type == NPCID.Reaper) { this.TargetClosest(true); this.ai[2] += 2f; } else { if (this.type == NPCID.Poltergeist) { this.ai[2] += 0.1f; } else { this.ai[2] += 1f; } if (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) > this.position.X + (float)(this.width / 2)) { this.direction = -1; } else { this.direction = 1; } } } int num697 = (int)((this.position.X + (float)(this.width / 2)) / 16f) + this.direction * 2; int num698 = (int)((this.position.Y + (float)this.height) / 16f); bool flag80 = true; bool flag81 = false; int num699 = 3; if (this.type == NPCID.Gastropod) { if (this.justHit) { this.ai[3] = 0f; this.localAI[1] = 0f; } float num700 = 7f; Vector2 vector68 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num701 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector68.X; float num702 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector68.Y; float num703 = (float)Math.Sqrt((double)(num701 * num701 + num702 * num702)); num703 = num700 / num703; num701 *= num703; num702 *= num703; if (Main.netMode != 1 && this.ai[3] == 32f && !Main.player[this.target].npcTypeNoAggro[this.type]) { int num704 = 25; int num705 = 84; Projectile.NewProjectile(vector68.X, vector68.Y, num701, num702, num705, num704, 0f, Main.myPlayer, 0f, 0f); } num699 = 8; if (this.ai[3] > 0f) { this.ai[3] += 1f; if (this.ai[3] >= 64f) { this.ai[3] = 0f; } } if (Main.netMode != 1 && this.ai[3] == 0f) { this.localAI[1] += 1f; if (this.localAI[1] > 120f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height) && !Main.player[this.target].npcTypeNoAggro[this.type]) { this.localAI[1] = 0f; this.ai[3] = 1f; this.netUpdate = true; } } } else if (this.type == NPCID.Pixie) { num699 = 4; } else if (this.type == NPCID.IceElemental) { this.alpha = 30; if (this.justHit) { this.ai[3] = 0f; this.localAI[1] = 0f; } float num708 = 5f; Vector2 vector69 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num709 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector69.X; float num710 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector69.Y; float num711 = (float)Math.Sqrt((double)(num709 * num709 + num710 * num710)); num711 = num708 / num711; num709 *= num711; num710 *= num711; if (num709 > 0f) { this.direction = 1; } else { this.direction = -1; } this.spriteDirection = this.direction; if (this.direction < 0) { this.rotation = (float)Math.Atan2((double)(-(double)num710), (double)(-(double)num709)); } else { this.rotation = (float)Math.Atan2((double)num710, (double)num709); } if (Main.netMode != 1 && this.ai[3] == 16f) { int num712 = 45; int num713 = 128; Projectile.NewProjectile(vector69.X, vector69.Y, num709, num710, num713, num712, 0f, Main.myPlayer, 0f, 0f); } num699 = 10; if (this.ai[3] > 0f) { this.ai[3] += 1f; if (this.ai[3] >= 64f) { this.ai[3] = 0f; } } if (Main.netMode != 1 && this.ai[3] == 0f) { this.localAI[1] += 1f; if (this.localAI[1] > 120f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.localAI[1] = 0f; this.ai[3] = 1f; this.netUpdate = true; } } } else if (this.type == NPCID.IchorSticker) { this.rotation = this.velocity.X * 0.1f; if (Main.player[this.target].Center.Y < base.Center.Y) { num699 = 12; } else { num699 = 6; } if (Main.netMode != 1 && !this.confused) { this.ai[3] += 1f; if (this.justHit) { this.ai[3] = -45f; this.localAI[1] = 0f; } if (Main.netMode != 1 && this.ai[3] >= (float)(60 + Main.rand.Next(60))) { this.ai[3] = 0f; if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].head)) { float num714 = 10f; Vector2 vector70 = new Vector2(this.position.X + (float)this.width * 0.5f - 4f, this.position.Y + (float)this.height * 0.7f); float num715 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector70.X; float num716 = Math.Abs(num715) * 0.1f; float num717 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector70.Y - num716; num715 += (float)Main.rand.Next(-10, 11); num717 += (float)Main.rand.Next(-30, 21); float num718 = (float)Math.Sqrt((double)(num715 * num715 + num717 * num717)); num718 = num714 / num718; num715 *= num718; num717 *= num718; int num719 = 40; int num720 = 288; Projectile.NewProjectile(vector70.X, vector70.Y, num715, num717, num720, num719, 0f, Main.myPlayer, 0f, 0f); } } } } if (this.type == NPCID.Drippler) { num699 = 4; if (this.target >= 0) { float num721 = (Main.player[this.target].Center - base.Center).Length(); num721 /= 70f; if (num721 > 8f) { num721 = 8f; } num699 += (int)num721; } } for (int num722 = num698; num722 < num698 + num699; num722++) { if (Main.tile[num697, num722] == null) { Main.tile[num697, num722] = new Tile(); } if ((Main.tile[num697, num722].nactive() && Main.tileSolid[(int)Main.tile[num697, num722].type]) || Main.tile[num697, num722].liquid > 0) { if (num722 <= num698 + 1) { flag81 = true; } flag80 = false; break; } } if (Main.player[this.target].npcTypeNoAggro[this.type]) { bool flag82 = false; for (int num723 = num698; num723 < num698 + num699 - 2; num723++) { if (Main.tile[num697, num723] == null) { Main.tile[num697, num723] = new Tile(); } if ((Main.tile[num697, num723].nactive() && Main.tileSolid[(int)Main.tile[num697, num723].type]) || Main.tile[num697, num723].liquid > 0) { flag82 = true; break; } } this.directionY = (!flag82).ToDirectionInt(); } if (this.type == NPCID.IceElemental || this.type == NPCID.IchorSticker) { for (int num724 = num698 - 3; num724 < num698; num724++) { if (Main.tile[num697, num724] == null) { Main.tile[num697, num724] = new Tile(); } if ((Main.tile[num697, num724].nactive() && Main.tileSolid[(int)Main.tile[num697, num724].type]) || Main.tile[num697, num724].liquid > 0) { flag81 = false; flag76 = true; break; } } } if (flag76) { flag81 = false; flag80 = true; if (this.type == NPCID.IchorSticker) { this.velocity.Y = this.velocity.Y + 2f; } } if (flag80) { if (this.type == NPCID.Pixie || this.type == NPCID.IceElemental) { this.velocity.Y = this.velocity.Y + 0.2f; if (this.velocity.Y > 2f) { this.velocity.Y = 2f; } } else if (this.type == NPCID.Drippler) { this.velocity.Y = this.velocity.Y + 0.03f; if ((double)this.velocity.Y > 0.75) { this.velocity.Y = 0.75f; } } else { this.velocity.Y = this.velocity.Y + 0.1f; if (this.velocity.Y > 3f) { this.velocity.Y = 3f; } } } else { if (this.type == NPCID.Pixie || this.type == NPCID.IceElemental) { if ((this.directionY < 0 && this.velocity.Y > 0f) || flag81) { this.velocity.Y = this.velocity.Y - 0.2f; } } else if (this.type == NPCID.Drippler) { if ((this.directionY < 0 && this.velocity.Y > 0f) || flag81) { this.velocity.Y = this.velocity.Y - 0.075f; } if (this.velocity.Y < -0.75f) { this.velocity.Y = -0.75f; } } else if (this.directionY < 0 && this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y - 0.1f; } if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } } if (this.type == NPCID.Pixie && this.wet) { this.velocity.Y = this.velocity.Y - 0.2f; if (this.velocity.Y < -2f) { this.velocity.Y = -2f; } } if (this.collideX) { this.velocity.X = this.oldVelocity.X * -0.4f; if (this.direction == -1 && this.velocity.X > 0f && this.velocity.X < 1f) { this.velocity.X = 1f; } if (this.direction == 1 && this.velocity.X < 0f && this.velocity.X > -1f) { this.velocity.X = -1f; } } if (this.collideY) { this.velocity.Y = this.oldVelocity.Y * -0.25f; if (this.velocity.Y > 0f && this.velocity.Y < 1f) { this.velocity.Y = 1f; } if (this.velocity.Y < 0f && this.velocity.Y > -1f) { this.velocity.Y = -1f; } } float num725 = 2f; if (this.type == NPCID.Pixie) { num725 = 3f; } if (this.type == NPCID.Reaper) { num725 = 4f; } if (this.type == NPCID.Drippler) { num725 = 1.5f; } if (this.type == NPCID.Poltergeist) { this.alpha = 0; num725 = 4f; if (!flag77) { this.TargetClosest(true); } else if (this.timeLeft > 10) { this.timeLeft = 10; } if (this.direction < 0 && this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.9f; } if (this.direction > 0 && this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.9f; } } if (this.direction == -1 && this.velocity.X > -num725) { this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > num725) { this.velocity.X = this.velocity.X - 0.1f; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X + 0.05f; } if (this.velocity.X < -num725) { this.velocity.X = -num725; } } else if (this.direction == 1 && this.velocity.X < num725) { this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -num725) { this.velocity.X = this.velocity.X + 0.1f; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X - 0.05f; } if (this.velocity.X > num725) { this.velocity.X = num725; } } if (this.type == NPCID.Drippler) { num725 = 1f; } else { num725 = 1.5f; } if (this.directionY == -1 && this.velocity.Y > -num725) { this.velocity.Y = this.velocity.Y - 0.04f; if (this.velocity.Y > num725) { this.velocity.Y = this.velocity.Y - 0.05f; } else if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y + 0.03f; } if (this.velocity.Y < -num725) { this.velocity.Y = -num725; } } else if (this.directionY == 1 && this.velocity.Y < num725) { this.velocity.Y = this.velocity.Y + 0.04f; if (this.velocity.Y < -num725) { this.velocity.Y = this.velocity.Y + 0.05f; } else if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y - 0.03f; } if (this.velocity.Y > num725) { this.velocity.Y = num725; } } if (this.type == NPCID.Gastropod) { return; } } else if (this.aiStyle == 23) { this.noGravity = true; this.noTileCollide = true; if (this.target < 0 || this.target == 255 || Main.player[this.target].dead) { this.TargetClosest(true); } if (this.ai[0] == 0f) { float num726 = 9f; Vector2 vector71 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num727 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector71.X; float num728 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector71.Y; float num729 = (float)Math.Sqrt((double)(num727 * num727 + num728 * num728)); num729 = num726 / num729; num727 *= num729; num728 *= num729; this.velocity.X = num727; this.velocity.Y = num728; this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 0.785f; this.ai[0] = 1f; this.ai[1] = 0f; this.netUpdate = true; return; } if (this.ai[0] == 1f) { if (this.justHit) { this.ai[0] = 2f; this.ai[1] = 0f; } this.velocity *= 0.99f; this.ai[1] += 1f; if (this.ai[1] >= 100f) { this.netUpdate = true; this.ai[0] = 2f; this.ai[1] = 0f; this.velocity.X = 0f; this.velocity.Y = 0f; return; } } else { if (this.justHit) { this.ai[0] = 2f; this.ai[1] = 0f; } this.velocity *= 0.96f; this.ai[1] += 1f; float num730 = this.ai[1] / 120f; num730 = 0.1f + num730 * 0.4f; this.rotation += num730 * (float)this.direction; if (this.ai[1] >= 120f) { this.netUpdate = true; this.ai[0] = 0f; this.ai[1] = 0f; return; } } } else if (this.aiStyle == 24) { this.noGravity = true; if (this.ai[0] == 0f) { this.noGravity = false; this.TargetClosest(true); if (Main.netMode != 1) { if (this.velocity.X != 0f || this.velocity.Y < 0f || (double)this.velocity.Y > 0.3) { this.ai[0] = 1f; this.netUpdate = true; this.direction = -this.direction; } else { Rectangle rectangle8 = new Rectangle((int)Main.player[this.target].position.X, (int)Main.player[this.target].position.Y, Main.player[this.target].width, Main.player[this.target].height); Rectangle rectangle9 = new Rectangle((int)this.position.X - 100, (int)this.position.Y - 100, this.width + 200, this.height + 200); if (rectangle9.Intersects(rectangle8) || this.life < this.lifeMax) { this.ai[0] = 1f; this.velocity.Y = this.velocity.Y - 6f; this.netUpdate = true; this.direction = -this.direction; } } } } else if (!Main.player[this.target].dead) { if (this.collideX) { this.direction *= -1; this.velocity.X = this.oldVelocity.X * -0.5f; if (this.direction == -1 && this.velocity.X > 0f && this.velocity.X < 2f) { this.velocity.X = 2f; } if (this.direction == 1 && this.velocity.X < 0f && this.velocity.X > -2f) { this.velocity.X = -2f; } } if (this.collideY) { this.velocity.Y = this.oldVelocity.Y * -0.5f; if (this.velocity.Y > 0f && this.velocity.Y < 1f) { this.velocity.Y = 1f; } if (this.velocity.Y < 0f && this.velocity.Y > -1f) { this.velocity.Y = -1f; } } if (this.direction == -1 && this.velocity.X > -3f) { this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > 3f) { this.velocity.X = this.velocity.X - 0.1f; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X - 0.05f; } if (this.velocity.X < -3f) { this.velocity.X = -3f; } } else if (this.direction == 1 && this.velocity.X < 3f) { this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -3f) { this.velocity.X = this.velocity.X + 0.1f; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X + 0.05f; } if (this.velocity.X > 3f) { this.velocity.X = 3f; } } int num731 = (int)((this.position.X + (float)(this.width / 2)) / 16f) + this.direction; int num732 = (int)((this.position.Y + (float)this.height) / 16f); bool flag83 = true; int num733 = 15; bool flag84 = false; for (int num734 = num732; num734 < num732 + num733; num734++) { if (Main.tile[num731, num734] == null) { Main.tile[num731, num734] = new Tile(); } if ((Main.tile[num731, num734].nactive() && Main.tileSolid[(int)Main.tile[num731, num734].type]) || Main.tile[num731, num734].liquid > 0) { if (num734 < num732 + 5) { flag84 = true; } flag83 = false; break; } } if (flag83) { this.velocity.Y = this.velocity.Y + 0.05f; } else { this.velocity.Y = this.velocity.Y - 0.1f; } if (flag84) { this.velocity.Y = this.velocity.Y - 0.2f; } if (this.velocity.Y > 2f) { this.velocity.Y = 2f; } if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } } if (this.wet) { this.ai[1] = 0f; if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.95f; } this.velocity.Y = this.velocity.Y - 0.5f; if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } this.TargetClosest(true); return; } } else if (this.aiStyle == 25) { bool flag85 = this.type == NPCID.PresentMimic && !Main.snowMoon; if (this.ai[3] == 0f) { this.position.X = this.position.X + 8f; if (this.position.Y / 16f > (float)(Main.maxTilesY - 200)) { this.ai[3] = 3f; } else if ((double)(this.position.Y / 16f) > Main.worldSurface) { this.TargetClosest(true); if (Main.player[this.target].ZoneSnow) { this.ai[3] = 4f; } else { this.ai[3] = 2f; } } else { this.ai[3] = 1f; } } if (this.type == NPCID.PresentMimic) { this.ai[3] = 1f; } if (this.ai[0] == 0f) { if (!flag85) { this.TargetClosest(true); } if (Main.netMode != 1) { if (this.velocity.X != 0f || this.velocity.Y < 0f || (double)this.velocity.Y > 0.3) { this.ai[0] = 1f; this.netUpdate = true; return; } Rectangle rectangle10 = new Rectangle((int)Main.player[this.target].position.X, (int)Main.player[this.target].position.Y, Main.player[this.target].width, Main.player[this.target].height); Rectangle rectangle11 = new Rectangle((int)this.position.X - 100, (int)this.position.Y - 100, this.width + 200, this.height + 200); if (rectangle11.Intersects(rectangle10) || this.life < this.lifeMax) { this.ai[0] = 1f; this.netUpdate = true; return; } } } else if (this.velocity.Y == 0f) { this.ai[2] += 1f; int num735 = 20; if (this.ai[1] == 0f) { num735 = 12; } if (this.ai[2] < (float)num735) { this.velocity.X = this.velocity.X * 0.9f; return; } this.ai[2] = 0f; if (!flag85) { this.TargetClosest(true); } if (this.direction == 0) { this.direction = -1; } this.spriteDirection = this.direction; this.ai[1] += 1f; if (this.ai[1] == 2f) { this.velocity.X = (float)this.direction * 2.5f; this.velocity.Y = -8f; this.ai[1] = 0f; } else { this.velocity.X = (float)this.direction * 3.5f; this.velocity.Y = -4f; } this.netUpdate = true; return; } else { if (this.direction == 1 && this.velocity.X < 1f) { this.velocity.X = this.velocity.X + 0.1f; return; } if (this.direction == -1 && this.velocity.X > -1f) { this.velocity.X = this.velocity.X - 0.1f; return; } } } else if (this.aiStyle == 26) { int num736 = 30; int num737 = 10; bool flag86 = false; bool flag87 = false; bool flag88 = false; if (this.velocity.Y == 0f && ((this.velocity.X > 0f && this.direction < 0) || (this.velocity.X < 0f && this.direction > 0))) { flag87 = true; this.ai[3] += 1f; } if (this.position.X == this.oldPosition.X || this.ai[3] >= (float)num736 || flag87) { this.ai[3] += 1f; flag88 = true; } else if (this.ai[3] > 0f) { this.ai[3] -= 1f; } if (this.ai[3] > (float)(num736 * num737)) { this.ai[3] = 0f; } if (this.justHit) { this.ai[3] = 0f; } if (this.ai[3] == (float)num736) { this.netUpdate = true; } Vector2 vector72 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num738 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector72.X; float num739 = Main.player[this.target].position.Y - vector72.Y; float num740 = (float)Math.Sqrt((double)(num738 * num738 + num739 * num739)); if (num740 < 200f && !flag88) { this.ai[3] = 0f; } if (this.type == NPCID.StardustSpiderSmall) { this.ai[1] += 1f; bool flag89 = this.ai[1] >= 240f; if (!flag89 && this.velocity.Y == 0f) { for (int num741 = 0; num741 < 255; num741++) { if (Main.player[num741].active && !Main.player[num741].dead && Main.player[num741].Distance(base.Center) < 800f && Main.player[num741].Center.Y < base.Center.Y && Math.Abs(Main.player[num741].Center.X - base.Center.X) < 20f) { flag89 = true; break; } } } if (flag89 && Main.netMode != 1) { for (int num742 = 0; num742 < 3; num742++) { Projectile.NewProjectile(base.Center.X, base.Center.Y, (Main.rand.NextFloat() - 0.5f) * 2f, -4f - 10f * Main.rand.NextFloat(), 538, 50, 0f, Main.myPlayer, 0f, 0f); } this.HitEffect(9999, 10.0); this.active = false; return; } } else if (this.type == NPCID.NebulaBeast) { if (this.ai[2] == 1f) { this.ai[1] += 1f; this.velocity.X = this.velocity.X * 0.7f; if (this.velocity.X > -0.5f && this.velocity.X < 0.5f) { this.velocity.X = 0f; } if (this.ai[1] == 30f && Main.netMode != 1) { int num744 = Main.expertMode ? 35 : 50; Projectile.NewProjectile(base.Center.X + (float)(this.spriteDirection * -20), base.Center.Y, (float)(this.spriteDirection * -7), 0f, 575, num744, 0f, Main.myPlayer, (float)this.target, 0f); } if (this.ai[1] >= 60f) { this.ai[1] = (float)(-(float)Main.rand.Next(320, 601)); this.ai[2] = 0f; } } else { this.ai[1] += 1f; if (this.ai[1] >= 180f && num740 < 500f && this.velocity.Y == 0f) { flag86 = true; this.ai[1] = 0f; this.ai[2] = 1f; this.netUpdate = true; } else if (this.velocity.Y == 0f && num740 < 100f && Math.Abs(this.velocity.X) > 3f && ((base.Center.X < Main.player[this.target].Center.X && this.velocity.X > 0f) || (base.Center.X > Main.player[this.target].Center.X && this.velocity.X < 0f))) { this.velocity.Y = this.velocity.Y - 4f; } } } else if ((this.type == NPCID.Wolf || this.type == NPCID.Hellhound) && this.velocity.Y == 0f && num740 < 100f && Math.Abs(this.velocity.X) > 3f && ((this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) && this.velocity.X > 0f) || (this.position.X + (float)(this.width / 2) > Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) && this.velocity.X < 0f))) { this.velocity.Y = this.velocity.Y - 4f; } if (this.ai[3] < (float)num736) { if ((this.type == NPCID.Hellhound || this.type == NPCID.HeadlessHorseman) && !Main.pumpkinMoon) { if (this.timeLeft > 10) { this.timeLeft = 10; } } else { this.TargetClosest(true); } } else { if (this.velocity.X == 0f) { if (this.velocity.Y == 0f) { this.ai[0] += 1f; if (this.ai[0] >= 2f) { this.direction *= -1; this.spriteDirection = this.direction; this.ai[0] = 0f; } } } else { this.ai[0] = 0f; } this.directionY = -1; if (this.direction == 0) { this.direction = 1; } } float num745 = 6f; float num746 = 0.07f; if (!flag86 && (this.velocity.Y == 0f || this.wet || (this.velocity.X <= 0f && this.direction < 0) || (this.velocity.X >= 0f && this.direction > 0))) { if (this.type == NPCID.Wolf) { if (this.velocity.X > 0f && this.direction < 0) { this.velocity.X = this.velocity.X * 0.95f; } if (this.velocity.X < 0f && this.direction > 0) { this.velocity.X = this.velocity.X * 0.95f; } } else if (this.type == NPCID.Hellhound) { if (this.velocity.X > 0f && this.direction < 0) { this.velocity.X = this.velocity.X * 0.9f; } if (this.velocity.X < 0f && this.direction > 0) { this.velocity.X = this.velocity.X * 0.9f; } if (this.direction > 0 && this.velocity.X < 3f) { this.velocity.X = this.velocity.X + 0.1f; } if (this.direction < 0 && this.velocity.X > -3f) { this.velocity.X = this.velocity.X - 0.1f; } } else if (this.type == NPCID.HeadlessHorseman) { if (this.velocity.X > 0f && this.direction < 0) { this.velocity.X = this.velocity.X * 0.95f; } if (this.velocity.X < 0f && this.direction > 0) { this.velocity.X = this.velocity.X * 0.95f; } if (this.velocity.X < -num745 || this.velocity.X > num745) { if (this.velocity.Y == 0f) { this.velocity *= 0.8f; } } else if (this.velocity.X < num745 && this.direction == 1) { this.velocity.X = this.velocity.X + 0.07f; if (this.velocity.X > num745) { this.velocity.X = num745; } } else if (this.velocity.X > -num745 && this.direction == -1) { this.velocity.X = this.velocity.X - 0.07f; if (this.velocity.X < -num745) { this.velocity.X = -num745; } } } else if (this.type == NPCID.StardustSpiderSmall) { if (Math.Sign(this.velocity.X) != this.direction) { this.velocity.X = this.velocity.X * 0.9f; } num745 = 6f; num746 = 0.2f; } else if (this.type == NPCID.NebulaBeast) { if (Math.Sign(this.velocity.X) != this.direction) { this.velocity.X = this.velocity.X * 0.85f; } num745 = 10f; num746 = 0.2f; } if (this.velocity.X < -num745 || this.velocity.X > num745) { if (this.velocity.Y == 0f) { this.velocity *= 0.8f; } } else if (this.velocity.X < num745 && this.direction == 1) { this.velocity.X = this.velocity.X + num746; if (this.velocity.X > num745) { this.velocity.X = num745; } } else if (this.velocity.X > -num745 && this.direction == -1) { this.velocity.X = this.velocity.X - num746; if (this.velocity.X < -num745) { this.velocity.X = -num745; } } } if (this.velocity.Y >= 0f) { int num747 = 0; if (this.velocity.X < 0f) { num747 = -1; } if (this.velocity.X > 0f) { num747 = 1; } Vector2 position5 = this.position; position5.X += this.velocity.X; int num748 = (int)((position5.X + (float)(this.width / 2) + (float)((this.width / 2 + 1) * num747)) / 16f); int num749 = (int)((position5.Y + (float)this.height - 1f) / 16f); if (Main.tile[num748, num749] == null) { Main.tile[num748, num749] = new Tile(); } if (Main.tile[num748, num749 - 1] == null) { Main.tile[num748, num749 - 1] = new Tile(); } if (Main.tile[num748, num749 - 2] == null) { Main.tile[num748, num749 - 2] = new Tile(); } if (Main.tile[num748, num749 - 3] == null) { Main.tile[num748, num749 - 3] = new Tile(); } if (Main.tile[num748, num749 + 1] == null) { Main.tile[num748, num749 + 1] = new Tile(); } if ((float)(num748 * 16) < position5.X + (float)this.width && (float)(num748 * 16 + 16) > position5.X && ((Main.tile[num748, num749].nactive() && !Main.tile[num748, num749].topSlope() && !Main.tile[num748, num749 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num748, num749].type] && !Main.tileSolidTop[(int)Main.tile[num748, num749].type]) || (Main.tile[num748, num749 - 1].halfBrick() && Main.tile[num748, num749 - 1].nactive())) && (!Main.tile[num748, num749 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num748, num749 - 1].type] || Main.tileSolidTop[(int)Main.tile[num748, num749 - 1].type] || (Main.tile[num748, num749 - 1].halfBrick() && (!Main.tile[num748, num749 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num748, num749 - 4].type] || Main.tileSolidTop[(int)Main.tile[num748, num749 - 4].type]))) && (!Main.tile[num748, num749 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num748, num749 - 2].type] || Main.tileSolidTop[(int)Main.tile[num748, num749 - 2].type]) && (!Main.tile[num748, num749 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num748, num749 - 3].type] || Main.tileSolidTop[(int)Main.tile[num748, num749 - 3].type]) && (!Main.tile[num748 - num747, num749 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num748 - num747, num749 - 3].type])) { float num750 = (float)(num749 * 16); if (Main.tile[num748, num749].halfBrick()) { num750 += 8f; } if (Main.tile[num748, num749 - 1].halfBrick()) { num750 -= 8f; } if (num750 < position5.Y + (float)this.height) { float num751 = position5.Y + (float)this.height - num750; if ((double)num751 <= 16.1) { this.gfxOffY += this.position.Y + (float)this.height - num750; this.position.Y = num750 - (float)this.height; if (num751 < 9f) { this.stepSpeed = 1f; } else { this.stepSpeed = 2f; } } } } } if (this.velocity.Y == 0f) { int num752 = (int)((this.position.X + (float)(this.width / 2) + (float)((this.width / 2 + 2) * this.direction) + this.velocity.X * 5f) / 16f); int num753 = (int)((this.position.Y + (float)this.height - 15f) / 16f); if (Main.tile[num752, num753] == null) { Main.tile[num752, num753] = new Tile(); } if (Main.tile[num752, num753 - 1] == null) { Main.tile[num752, num753 - 1] = new Tile(); } if (Main.tile[num752, num753 - 2] == null) { Main.tile[num752, num753 - 2] = new Tile(); } if (Main.tile[num752, num753 - 3] == null) { Main.tile[num752, num753 - 3] = new Tile(); } if (Main.tile[num752, num753 + 1] == null) { Main.tile[num752, num753 + 1] = new Tile(); } if (Main.tile[num752 + this.direction, num753 - 1] == null) { Main.tile[num752 + this.direction, num753 - 1] = new Tile(); } if (Main.tile[num752 + this.direction, num753 + 1] == null) { Main.tile[num752 + this.direction, num753 + 1] = new Tile(); } if (Main.tile[num752 - this.direction, num753 + 1] == null) { Main.tile[num752 - this.direction, num753 + 1] = new Tile(); } int num754 = this.spriteDirection; if (this.type == NPCID.NebulaBeast || this.type == NPCID.StardustSpiderSmall) { num754 *= -1; } if ((this.velocity.X < 0f && num754 == -1) || (this.velocity.X > 0f && num754 == 1)) { bool flag90 = this.type == NPCID.StardustSpiderSmall || this.type == NPCID.NebulaBeast; float num755 = 3f; if (Main.tile[num752, num753 - 2].nactive() && Main.tileSolid[(int)Main.tile[num752, num753 - 2].type]) { if (Main.tile[num752, num753 - 3].nactive() && Main.tileSolid[(int)Main.tile[num752, num753 - 3].type]) { this.velocity.Y = -8.5f; this.netUpdate = true; } else { this.velocity.Y = -7.5f; this.netUpdate = true; } } else if (Main.tile[num752, num753 - 1].nactive() && !Main.tile[num752, num753 - 1].topSlope() && Main.tileSolid[(int)Main.tile[num752, num753 - 1].type]) { this.velocity.Y = -7f; this.netUpdate = true; } else if (this.position.Y + (float)this.height - (float)(num753 * 16) > 20f && Main.tile[num752, num753].nactive() && !Main.tile[num752, num753].topSlope() && Main.tileSolid[(int)Main.tile[num752, num753].type]) { this.velocity.Y = -6f; this.netUpdate = true; } else if ((this.directionY < 0 || Math.Abs(this.velocity.X) > num755) && (!flag90 || !Main.tile[num752, num753 + 1].nactive() || !Main.tileSolid[(int)Main.tile[num752, num753 + 1].type]) && (!Main.tile[num752, num753 + 2].nactive() || !Main.tileSolid[(int)Main.tile[num752, num753 + 2].type]) && (!Main.tile[num752 + this.direction, num753 + 3].nactive() || !Main.tileSolid[(int)Main.tile[num752 + this.direction, num753 + 3].type])) { this.velocity.Y = -8f; this.netUpdate = true; } } } if (this.type == NPCID.NebulaBeast && Math.Abs(this.velocity.X) >= num745 * 0.95f) { return; } } else if (this.aiStyle == 27) { if (this.position.X < 160f || this.position.X > (float)((Main.maxTilesX - 10) * 16)) { this.active = false; } if (this.localAI[0] == 0f) { this.localAI[0] = 1f; Main.wofB = -1; Main.wofT = -1; } this.ai[1] += 1f; if (this.ai[2] == 0f) { if ((double)this.life < (double)this.lifeMax * 0.5) { this.ai[1] += 1f; } if ((double)this.life < (double)this.lifeMax * 0.2) { this.ai[1] += 1f; } if (this.ai[1] > 2700f) { this.ai[2] = 1f; } } if (this.ai[2] > 0f && this.ai[1] > 60f) { int num757 = 3; if ((double)this.life < (double)this.lifeMax * 0.3) { num757++; } this.ai[2] += 1f; this.ai[1] = 0f; if (this.ai[2] > (float)num757) { this.ai[2] = 0f; } if (Main.netMode != 1) { int num758 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)(this.height / 2) + 20f), 117, 1, 0f, 0f, 0f, 0f, 255); Main.npc[num758].velocity.X = (float)(this.direction * 8); } } this.localAI[3] += 1f; if (this.localAI[3] >= (float)(600 + Main.rand.Next(1000))) { this.localAI[3] = (float)(-(float)Main.rand.Next(200)); } Main.wof = this.whoAmI; int num759 = (int)(this.position.X / 16f); int num760 = (int)((this.position.X + (float)this.width) / 16f); int num761 = (int)((this.position.Y + (float)(this.height / 2)) / 16f); int num762 = 0; int num763 = num761 + 7; while (num762 < 15 && num763 > Main.maxTilesY - 200) { num763++; for (int num764 = num759; num764 <= num760; num764++) { try { if (WorldGen.SolidTile(num764, num763) || Main.tile[num764, num763].liquid > 0) { num762++; } } catch { num762 += 15; } } } num763 += 4; if (Main.wofB == -1) { Main.wofB = num763 * 16; } else if (Main.wofB > num763 * 16) { Main.wofB--; if (Main.wofB < num763 * 16) { Main.wofB = num763 * 16; } } else if (Main.wofB < num763 * 16) { Main.wofB++; if (Main.wofB > num763 * 16) { Main.wofB = num763 * 16; } } num762 = 0; num763 = num761 - 7; while (num762 < 15 && num763 < Main.maxTilesY - 10) { num763--; for (int num765 = num759; num765 <= num760; num765++) { try { if (WorldGen.SolidTile(num765, num763) || Main.tile[num765, num763].liquid > 0) { num762++; } } catch { num762 += 15; } } } num763 -= 4; if (Main.wofT == -1) { Main.wofT = num763 * 16; } else if (Main.wofT > num763 * 16) { Main.wofT--; if (Main.wofT < num763 * 16) { Main.wofT = num763 * 16; } } else if (Main.wofT < num763 * 16) { Main.wofT++; if (Main.wofT > num763 * 16) { Main.wofT = num763 * 16; } } float num766 = (float)((Main.wofB + Main.wofT) / 2 - this.height / 2); if (this.position.Y > num766 + 1f) { this.velocity.Y = -1f; } else if (this.position.Y < num766 - 1f) { this.velocity.Y = 1f; } this.velocity.Y = 0f; this.position.Y = num766; float num767 = 1.5f; if ((double)this.life < (double)this.lifeMax * 0.75) { num767 += 0.25f; } if ((double)this.life < (double)this.lifeMax * 0.5) { num767 += 0.4f; } if ((double)this.life < (double)this.lifeMax * 0.25) { num767 += 0.5f; } if ((double)this.life < (double)this.lifeMax * 0.1) { num767 += 0.6f; } if ((double)this.life < (double)this.lifeMax * 0.66 && Main.expertMode) { num767 += 0.3f; } if ((double)this.life < (double)this.lifeMax * 0.33 && Main.expertMode) { num767 += 0.3f; } if ((double)this.life < (double)this.lifeMax * 0.05 && Main.expertMode) { num767 += 0.6f; } if ((double)this.life < (double)this.lifeMax * 0.035 && Main.expertMode) { num767 += 0.6f; } if ((double)this.life < (double)this.lifeMax * 0.025 && Main.expertMode) { num767 += 0.6f; } if (Main.expertMode) { num767 *= 1.35f; num767 += 0.35f; } if (this.velocity.X == 0f) { this.TargetClosest(true); this.velocity.X = (float)this.direction; } if (this.velocity.X < 0f) { this.velocity.X = -num767; this.direction = -1; } else { this.velocity.X = num767; this.direction = 1; } this.spriteDirection = this.direction; Vector2 vector77 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num768 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector77.X; float num769 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector77.Y; float num770 = (float)Math.Sqrt((double)(num768 * num768 + num769 * num769)); num768 *= num770; num769 *= num770; if (this.direction > 0) { if (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) > this.position.X + (float)(this.width / 2)) { this.rotation = (float)Math.Atan2((double)(-(double)num769), (double)(-(double)num768)) + 3.14f; } else { this.rotation = 0f; } } else if (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) < this.position.X + (float)(this.width / 2)) { this.rotation = (float)Math.Atan2((double)num769, (double)num768) + 3.14f; } else { this.rotation = 0f; } if (Main.expertMode && Main.netMode != 1) { int num771 = (int)(1f + (float)this.life / (float)this.lifeMax * 10f); num771 *= num771; if (num771 < 400) { num771 = (num771 * 19 + 400) / 20; } if (num771 < 60) { num771 = (num771 * 3 + 60) / 4; } if (num771 < 20) { num771 = (num771 + 20) / 2; } num771 = (int)((double)num771 * 0.7); if (Main.rand.Next(num771) == 0) { int num772 = 0; float[] array2 = new float[10]; for (int num773 = 0; num773 < 200; num773++) { if (num772 < 10 && Main.npc[num773].active && Main.npc[num773].type == NPCID.TheHungry) { array2[num772] = Main.npc[num773].ai[0]; num772++; } } int maxValue7 = 1 + num772 * 2; if (num772 < 10 && Main.rand.Next(maxValue7) <= 1) { int num774 = -1; for (int num775 = 0; num775 < 1000; num775++) { int num776 = Main.rand.Next(10); float num777 = (float)num776 * 0.1f - 0.05f; bool flag91 = true; for (int num778 = 0; num778 < num772; num778++) { if (num777 == array2[num778]) { flag91 = false; break; } } if (flag91) { num774 = num776; break; } } if (num774 >= 0) { int num779 = NPC.NewNPC((int)this.position.X, (int)num766, 115, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num779].ai[0] = (float)num774 * 0.1f - 0.05f; } } } } if (this.localAI[0] == 1f && Main.netMode != 1) { this.localAI[0] = 2f; num766 = (float)((Main.wofB + Main.wofT) / 2); num766 = (num766 + (float)Main.wofT) / 2f; int num780 = NPC.NewNPC((int)this.position.X, (int)num766, 114, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num780].ai[0] = 1f; num766 = (float)((Main.wofB + Main.wofT) / 2); num766 = (num766 + (float)Main.wofB) / 2f; num780 = NPC.NewNPC((int)this.position.X, (int)num766, 114, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num780].ai[0] = -1f; num766 = (float)((Main.wofB + Main.wofT) / 2); num766 = (num766 + (float)Main.wofB) / 2f; for (int num781 = 0; num781 < 11; num781++) { num780 = NPC.NewNPC((int)this.position.X, (int)num766, 115, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num780].ai[0] = (float)num781 * 0.1f - 0.05f; } return; } } else if (this.aiStyle == 28) { if (Main.wof < 0) { this.active = false; return; } this.realLife = Main.wof; if (Main.npc[Main.wof].life > 0) { this.life = Main.npc[Main.wof].life; } this.TargetClosest(true); this.position.X = Main.npc[Main.wof].position.X; this.direction = Main.npc[Main.wof].direction; this.spriteDirection = this.direction; float num782 = (float)((Main.wofB + Main.wofT) / 2); if (this.ai[0] > 0f) { num782 = (num782 + (float)Main.wofT) / 2f; } else { num782 = (num782 + (float)Main.wofB) / 2f; } num782 -= (float)(this.height / 2); if (this.position.Y > num782 + 1f) { this.velocity.Y = -1f; } else if (this.position.Y < num782 - 1f) { this.velocity.Y = 1f; } else { this.velocity.Y = 0f; this.position.Y = num782; } if (this.velocity.Y > 5f) { this.velocity.Y = 5f; } if (this.velocity.Y < -5f) { this.velocity.Y = -5f; } Vector2 vector78 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num783 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector78.X; float num784 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector78.Y; float num785 = (float)Math.Sqrt((double)(num783 * num783 + num784 * num784)); num783 *= num785; num784 *= num785; bool flag92 = true; if (this.direction > 0) { if (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) > this.position.X + (float)(this.width / 2)) { this.rotation = (float)Math.Atan2((double)(-(double)num784), (double)(-(double)num783)) + 3.14f; } else { this.rotation = 0f; flag92 = false; } } else if (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) < this.position.X + (float)(this.width / 2)) { this.rotation = (float)Math.Atan2((double)num784, (double)num783) + 3.14f; } else { this.rotation = 0f; flag92 = false; } if (Main.netMode != 1) { int num786 = 4; this.localAI[1] += 1f; if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.75) { this.localAI[1] += 1f; num786++; } if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.5) { this.localAI[1] += 1f; num786++; } if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.25) { this.localAI[1] += 1f; num786 += 2; } if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.1) { this.localAI[1] += 2f; num786 += 3; } if (Main.expertMode) { this.localAI[1] += 0.5f; num786++; if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.1) { this.localAI[1] += 2f; num786 += 3; } } if (this.localAI[2] == 0f) { if (this.localAI[1] > 600f) { this.localAI[2] = 1f; this.localAI[1] = 0f; return; } } else if (this.localAI[1] > 45f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.localAI[1] = 0f; this.localAI[2] += 1f; if (this.localAI[2] >= (float)num786) { this.localAI[2] = 0f; } if (flag92) { float num787 = 9f; int num788 = 11; int num789 = 83; if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.5) { num788++; num787 += 1f; } if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.25) { num788++; num787 += 1f; } if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.1) { num788 += 2; num787 += 2f; } vector78 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); num783 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector78.X; num784 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector78.Y; num785 = (float)Math.Sqrt((double)(num783 * num783 + num784 * num784)); num785 = num787 / num785; num783 *= num785; num784 *= num785; vector78.X += num783; vector78.Y += num784; Projectile.NewProjectile(vector78.X, vector78.Y, num783, num784, num789, num788, 0f, Main.myPlayer, 0f, 0f); return; } } } } else if (this.aiStyle == 29) { if (this.justHit) { this.ai[1] = 10f; } if (Main.wof < 0) { this.active = false; return; } this.TargetClosest(true); float num790 = 0.1f; float num791 = 300f; if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.25) { this.damage = (int)(75f * Main.damageMultiplier); this.defense = 40; if (!Main.expertMode) { num791 = 900f; } else { num790 += 0.1f; } } else if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.5) { this.damage = (int)(60f * Main.damageMultiplier); this.defense = 30; if (!Main.expertMode) { num791 = 700f; } else { num790 += 0.066f; } } else if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.75) { this.damage = (int)(45f * Main.damageMultiplier); this.defense = 20; if (!Main.expertMode) { num791 = 500f; } else { num790 += 0.033f; } } if (Main.expertMode) { this.defense = this.defDefense; if (this.whoAmI % 4 == 0) { num791 *= 1.75f; } if (this.whoAmI % 4 == 1) { num791 *= 1.5f; } if (this.whoAmI % 4 == 2) { num791 *= 1.25f; } if (this.whoAmI % 3 == 0) { num791 *= 1.5f; } if (this.whoAmI % 3 == 1) { num791 *= 1.25f; } num791 *= 0.75f; } float num792 = Main.npc[Main.wof].position.X + (float)(Main.npc[Main.wof].width / 2); float num793 = Main.npc[Main.wof].position.Y; float num794 = (float)(Main.wofB - Main.wofT); num793 = (float)Main.wofT + num794 * this.ai[0]; this.ai[2] += 1f; if (this.ai[2] > 100f) { num791 = (float)((int)(num791 * 1.3f)); if (this.ai[2] > 200f) { this.ai[2] = 0f; } } Vector2 vector79 = new Vector2(num792, num793); float num795 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - (float)(this.width / 2) - vector79.X; float num796 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - (float)(this.height / 2) - vector79.Y; float num797 = (float)Math.Sqrt((double)(num795 * num795 + num796 * num796)); if (this.ai[1] == 0f) { if (num797 > num791) { num797 = num791 / num797; num795 *= num797; num796 *= num797; } if (this.position.X < num792 + num795) { this.velocity.X = this.velocity.X + num790; if (this.velocity.X < 0f && num795 > 0f) { this.velocity.X = this.velocity.X + num790 * 2.5f; } } else if (this.position.X > num792 + num795) { this.velocity.X = this.velocity.X - num790; if (this.velocity.X > 0f && num795 < 0f) { this.velocity.X = this.velocity.X - num790 * 2.5f; } } if (this.position.Y < num793 + num796) { this.velocity.Y = this.velocity.Y + num790; if (this.velocity.Y < 0f && num796 > 0f) { this.velocity.Y = this.velocity.Y + num790 * 2.5f; } } else if (this.position.Y > num793 + num796) { this.velocity.Y = this.velocity.Y - num790; if (this.velocity.Y > 0f && num796 < 0f) { this.velocity.Y = this.velocity.Y - num790 * 2.5f; } } float num798 = 4f; if (Main.expertMode && Main.wof >= 0) { float num799 = 1.5f; float num800 = (float)(Main.npc[Main.wof].life / Main.npc[Main.wof].lifeMax); if ((double)num800 < 0.75) { num799 += 0.7f; } if ((double)num800 < 0.5) { num799 += 0.7f; } if ((double)num800 < 0.25) { num799 += 0.9f; } if ((double)num800 < 0.1) { num799 += 0.9f; } num799 *= 1.25f; num799 += 0.3f; num798 += num799 * 0.35f; if (base.Center.X < Main.npc[Main.wof].Center.X && Main.npc[Main.wof].velocity.X > 0f) { num798 += 6f; } if (base.Center.X > Main.npc[Main.wof].Center.X && Main.npc[Main.wof].velocity.X < 0f) { num798 += 6f; } } if (this.velocity.X > num798) { this.velocity.X = num798; } if (this.velocity.X < -num798) { this.velocity.X = -num798; } if (this.velocity.Y > num798) { this.velocity.Y = num798; } if (this.velocity.Y < -num798) { this.velocity.Y = -num798; } } else if (this.ai[1] > 0f) { this.ai[1] -= 1f; } else { this.ai[1] = 0f; } if (num795 > 0f) { this.spriteDirection = 1; this.rotation = (float)Math.Atan2((double)num796, (double)num795); } if (num795 < 0f) { this.spriteDirection = -1; this.rotation = (float)Math.Atan2((double)num796, (double)num795) + 3.14f; } return; } else if (this.aiStyle == 30) { if (this.target < 0 || this.target == 255 || Main.player[this.target].dead || !Main.player[this.target].active) { this.TargetClosest(true); } bool dead2 = Main.player[this.target].dead; float num801 = this.position.X + (float)(this.width / 2) - Main.player[this.target].position.X - (float)(Main.player[this.target].width / 2); float num802 = this.position.Y + (float)this.height - 59f - Main.player[this.target].position.Y - (float)(Main.player[this.target].height / 2); float num803 = (float)Math.Atan2((double)num802, (double)num801) + 1.57f; if (num803 < 0f) { num803 += 6.283f; } else if ((double)num803 > 6.283) { num803 -= 6.283f; } float num804 = 0.1f; if (this.rotation < num803) { if ((double)(num803 - this.rotation) > 3.1415) { this.rotation -= num804; } else { this.rotation += num804; } } else if (this.rotation > num803) { if ((double)(this.rotation - num803) > 3.1415) { this.rotation += num804; } else { this.rotation -= num804; } } if (this.rotation > num803 - num804 && this.rotation < num803 + num804) { this.rotation = num803; } if (this.rotation < 0f) { this.rotation += 6.283f; } else if ((double)this.rotation > 6.283) { this.rotation -= 6.283f; } if (this.rotation > num803 - num804 && this.rotation < num803 + num804) { this.rotation = num803; } if (Main.netMode != 1 && !Main.dayTime && !dead2 && this.timeLeft < 10) { for (int num806 = 0; num806 < 200; num806++) { if (num806 != this.whoAmI && Main.npc[num806].active && (Main.npc[num806].type == NPCID.Retinazer || Main.npc[num806].type == NPCID.Spazmatism) && Main.npc[num806].timeLeft - 1 > this.timeLeft) { this.timeLeft = Main.npc[num806].timeLeft - 1; } } } if (Main.dayTime || dead2) { this.velocity.Y = this.velocity.Y - 0.04f; if (this.timeLeft > 10) { this.timeLeft = 10; return; } } else if (this.ai[0] == 0f) { if (this.ai[1] == 0f) { float num807 = 7f; float num808 = 0.1f; if (Main.expertMode) { num807 = 8.25f; num808 = 0.115f; } int num809 = 1; if (this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)Main.player[this.target].width) { num809 = -1; } Vector2 vector80 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num810 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) + (float)(num809 * 300) - vector80.X; float num811 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - 300f - vector80.Y; float num812 = (float)Math.Sqrt((double)(num810 * num810 + num811 * num811)); float num813 = num812; num812 = num807 / num812; num810 *= num812; num811 *= num812; if (this.velocity.X < num810) { this.velocity.X = this.velocity.X + num808; if (this.velocity.X < 0f && num810 > 0f) { this.velocity.X = this.velocity.X + num808; } } else if (this.velocity.X > num810) { this.velocity.X = this.velocity.X - num808; if (this.velocity.X > 0f && num810 < 0f) { this.velocity.X = this.velocity.X - num808; } } if (this.velocity.Y < num811) { this.velocity.Y = this.velocity.Y + num808; if (this.velocity.Y < 0f && num811 > 0f) { this.velocity.Y = this.velocity.Y + num808; } } else if (this.velocity.Y > num811) { this.velocity.Y = this.velocity.Y - num808; if (this.velocity.Y > 0f && num811 < 0f) { this.velocity.Y = this.velocity.Y - num808; } } this.ai[2] += 1f; if (this.ai[2] >= 600f) { this.ai[1] = 1f; this.ai[2] = 0f; this.ai[3] = 0f; this.target = 255; this.netUpdate = true; } else if (this.position.Y + (float)this.height < Main.player[this.target].position.Y && num813 < 400f) { if (!Main.player[this.target].dead) { this.ai[3] += 1f; if (Main.expertMode && (double)this.life < (double)this.lifeMax * 0.9) { this.ai[3] += 0.3f; } if (Main.expertMode && (double)this.life < (double)this.lifeMax * 0.8) { this.ai[3] += 0.3f; } if (Main.expertMode && (double)this.life < (double)this.lifeMax * 0.7) { this.ai[3] += 0.3f; } if (Main.expertMode && (double)this.life < (double)this.lifeMax * 0.6) { this.ai[3] += 0.3f; } } if (this.ai[3] >= 60f) { this.ai[3] = 0f; vector80 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); num810 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector80.X; num811 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector80.Y; if (Main.netMode != 1) { float num814 = 9f; int num815 = 20; int num816 = 83; if (Main.expertMode) { num814 = 10.5f; num815 = 19; } num812 = (float)Math.Sqrt((double)(num810 * num810 + num811 * num811)); num812 = num814 / num812; num810 *= num812; num811 *= num812; num810 += (float)Main.rand.Next(-40, 41) * 0.08f; num811 += (float)Main.rand.Next(-40, 41) * 0.08f; vector80.X += num810 * 15f; vector80.Y += num811 * 15f; Projectile.NewProjectile(vector80.X, vector80.Y, num810, num811, num816, num815, 0f, Main.myPlayer, 0f, 0f); } } } } else if (this.ai[1] == 1f) { this.rotation = num803; float num817 = 12f; if (Main.expertMode) { num817 = 15f; } Vector2 vector81 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num818 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector81.X; float num819 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector81.Y; float num820 = (float)Math.Sqrt((double)(num818 * num818 + num819 * num819)); num820 = num817 / num820; this.velocity.X = num818 * num820; this.velocity.Y = num819 * num820; this.ai[1] = 2f; } else if (this.ai[1] == 2f) { this.ai[2] += 1f; if (this.ai[2] >= 25f) { this.velocity.X = this.velocity.X * 0.96f; this.velocity.Y = this.velocity.Y * 0.96f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1) { this.velocity.Y = 0f; } } else { this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 1.57f; } if (this.ai[2] >= 70f) { this.ai[3] += 1f; this.ai[2] = 0f; this.target = 255; this.rotation = num803; if (this.ai[3] >= 4f) { this.ai[1] = 0f; this.ai[3] = 0f; } else { this.ai[1] = 1f; } } } if ((double)this.life < (double)this.lifeMax * 0.4) { this.ai[0] = 1f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; return; } } else if (this.ai[0] == 1f || this.ai[0] == 2f) { if (this.ai[0] == 1f) { this.ai[2] += 0.005f; if ((double)this.ai[2] > 0.5) { this.ai[2] = 0.5f; } } else { this.ai[2] -= 0.005f; if (this.ai[2] < 0f) { this.ai[2] = 0f; } } this.rotation += this.ai[2]; this.ai[1] += 1f; if (this.ai[1] == 100f) { this.ai[0] += 1f; this.ai[1] = 0f; if (this.ai[0] == 3f) { this.ai[2] = 0f; } } this.velocity.X *= 0.98f; this.velocity.Y *= 0.98f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1) { this.velocity.Y = 0f; return; } } else { this.damage = (int)((double)this.defDamage * 1.5); this.defense = this.defDefense + 10; this.soundHit = 4; if (this.ai[1] == 0f) { float num823 = 8f; float num824 = 0.15f; if (Main.expertMode) { num823 = 9.5f; num824 = 0.175f; } Vector2 vector82 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num825 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector82.X; float num826 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - 300f - vector82.Y; float num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); num827 = num823 / num827; num825 *= num827; num826 *= num827; if (this.velocity.X < num825) { this.velocity.X = this.velocity.X + num824; if (this.velocity.X < 0f && num825 > 0f) { this.velocity.X = this.velocity.X + num824; } } else if (this.velocity.X > num825) { this.velocity.X = this.velocity.X - num824; if (this.velocity.X > 0f && num825 < 0f) { this.velocity.X = this.velocity.X - num824; } } if (this.velocity.Y < num826) { this.velocity.Y = this.velocity.Y + num824; if (this.velocity.Y < 0f && num826 > 0f) { this.velocity.Y = this.velocity.Y + num824; } } else if (this.velocity.Y > num826) { this.velocity.Y = this.velocity.Y - num824; if (this.velocity.Y > 0f && num826 < 0f) { this.velocity.Y = this.velocity.Y - num824; } } this.ai[2] += 1f; if (this.ai[2] >= 300f) { this.ai[1] = 1f; this.ai[2] = 0f; this.ai[3] = 0f; this.TargetClosest(true); this.netUpdate = true; } vector82 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); num825 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector82.X; num826 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector82.Y; this.rotation = (float)Math.Atan2((double)num826, (double)num825) - 1.57f; if (Main.netMode != 1) { this.localAI[1] += 1f; if ((double)this.life < (double)this.lifeMax * 0.75) { this.localAI[1] += 1f; } if ((double)this.life < (double)this.lifeMax * 0.5) { this.localAI[1] += 1f; } if ((double)this.life < (double)this.lifeMax * 0.25) { this.localAI[1] += 1f; } if ((double)this.life < (double)this.lifeMax * 0.1) { this.localAI[1] += 2f; } if (this.localAI[1] > 180f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.localAI[1] = 0f; float num828 = 8.5f; int num829 = 25; int num830 = 100; if (Main.expertMode) { num828 = 10f; num829 = 23; } num827 = (float)Math.Sqrt((double)(num825 * num825 + num826 * num826)); num827 = num828 / num827; num825 *= num827; num826 *= num827; vector82.X += num825 * 15f; vector82.Y += num826 * 15f; Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, num830, num829, 0f, Main.myPlayer, 0f, 0f); return; } } } else { int num831 = 1; if (this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)Main.player[this.target].width) { num831 = -1; } float num832 = 8f; float num833 = 0.2f; if (Main.expertMode) { num832 = 9.5f; num833 = 0.25f; } Vector2 vector83 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num834 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) + (float)(num831 * 340) - vector83.X; float num835 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector83.Y; float num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); num836 = num832 / num836; num834 *= num836; num835 *= num836; if (this.velocity.X < num834) { this.velocity.X = this.velocity.X + num833; if (this.velocity.X < 0f && num834 > 0f) { this.velocity.X = this.velocity.X + num833; } } else if (this.velocity.X > num834) { this.velocity.X = this.velocity.X - num833; if (this.velocity.X > 0f && num834 < 0f) { this.velocity.X = this.velocity.X - num833; } } if (this.velocity.Y < num835) { this.velocity.Y = this.velocity.Y + num833; if (this.velocity.Y < 0f && num835 > 0f) { this.velocity.Y = this.velocity.Y + num833; } } else if (this.velocity.Y > num835) { this.velocity.Y = this.velocity.Y - num833; if (this.velocity.Y > 0f && num835 < 0f) { this.velocity.Y = this.velocity.Y - num833; } } vector83 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); num834 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector83.X; num835 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector83.Y; this.rotation = (float)Math.Atan2((double)num835, (double)num834) - 1.57f; if (Main.netMode != 1) { this.localAI[1] += 1f; if ((double)this.life < (double)this.lifeMax * 0.75) { this.localAI[1] += 0.5f; } if ((double)this.life < (double)this.lifeMax * 0.5) { this.localAI[1] += 0.75f; } if ((double)this.life < (double)this.lifeMax * 0.25) { this.localAI[1] += 1f; } if ((double)this.life < (double)this.lifeMax * 0.1) { this.localAI[1] += 1.5f; } if (Main.expertMode) { this.localAI[1] += 1.5f; } if (this.localAI[1] > 60f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.localAI[1] = 0f; float num837 = 9f; int num838 = 18; int num839 = 100; if (Main.expertMode) { num838 = 17; } num836 = (float)Math.Sqrt((double)(num834 * num834 + num835 * num835)); num836 = num837 / num836; num834 *= num836; num835 *= num836; vector83.X += num834 * 15f; vector83.Y += num835 * 15f; Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, num839, num838, 0f, Main.myPlayer, 0f, 0f); } } this.ai[2] += 1f; if (this.ai[2] >= 180f) { this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; this.TargetClosest(true); this.netUpdate = true; return; } } } } else if (this.aiStyle == 31) { if (this.target < 0 || this.target == 255 || Main.player[this.target].dead || !Main.player[this.target].active) { this.TargetClosest(true); } bool dead3 = Main.player[this.target].dead; float num840 = this.position.X + (float)(this.width / 2) - Main.player[this.target].position.X - (float)(Main.player[this.target].width / 2); float num841 = this.position.Y + (float)this.height - 59f - Main.player[this.target].position.Y - (float)(Main.player[this.target].height / 2); float num842 = (float)Math.Atan2((double)num841, (double)num840) + 1.57f; if (num842 < 0f) { num842 += 6.283f; } else if ((double)num842 > 6.283) { num842 -= 6.283f; } float num843 = 0.15f; if (this.rotation < num842) { if ((double)(num842 - this.rotation) > 3.1415) { this.rotation -= num843; } else { this.rotation += num843; } } else if (this.rotation > num842) { if ((double)(this.rotation - num842) > 3.1415) { this.rotation += num843; } else { this.rotation -= num843; } } if (this.rotation > num842 - num843 && this.rotation < num842 + num843) { this.rotation = num842; } if (this.rotation < 0f) { this.rotation += 6.283f; } else if ((double)this.rotation > 6.283) { this.rotation -= 6.283f; } if (this.rotation > num842 - num843 && this.rotation < num842 + num843) { this.rotation = num842; } if (Main.netMode != 1 && !Main.dayTime && !dead3 && this.timeLeft < 10) { for (int num845 = 0; num845 < 200; num845++) { if (num845 != this.whoAmI && Main.npc[num845].active && (Main.npc[num845].type == NPCID.Retinazer || Main.npc[num845].type == NPCID.Spazmatism) && Main.npc[num845].timeLeft - 1 > this.timeLeft) { this.timeLeft = Main.npc[num845].timeLeft - 1; } } } if (Main.dayTime || dead3) { this.velocity.Y = this.velocity.Y - 0.04f; if (this.timeLeft > 10) { this.timeLeft = 10; return; } } else if (this.ai[0] == 0f) { if (this.ai[1] == 0f) { this.TargetClosest(true); float num846 = 12f; float num847 = 0.4f; int num848 = 1; if (this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)Main.player[this.target].width) { num848 = -1; } Vector2 vector84 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num849 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) + (float)(num848 * 400) - vector84.X; float num850 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector84.Y; float num851 = (float)Math.Sqrt((double)(num849 * num849 + num850 * num850)); num851 = num846 / num851; num849 *= num851; num850 *= num851; if (this.velocity.X < num849) { this.velocity.X = this.velocity.X + num847; if (this.velocity.X < 0f && num849 > 0f) { this.velocity.X = this.velocity.X + num847; } } else if (this.velocity.X > num849) { this.velocity.X = this.velocity.X - num847; if (this.velocity.X > 0f && num849 < 0f) { this.velocity.X = this.velocity.X - num847; } } if (this.velocity.Y < num850) { this.velocity.Y = this.velocity.Y + num847; if (this.velocity.Y < 0f && num850 > 0f) { this.velocity.Y = this.velocity.Y + num847; } } else if (this.velocity.Y > num850) { this.velocity.Y = this.velocity.Y - num847; if (this.velocity.Y > 0f && num850 < 0f) { this.velocity.Y = this.velocity.Y - num847; } } this.ai[2] += 1f; if (this.ai[2] >= 600f) { this.ai[1] = 1f; this.ai[2] = 0f; this.ai[3] = 0f; this.target = 255; this.netUpdate = true; } else { if (!Main.player[this.target].dead) { this.ai[3] += 1f; if (Main.expertMode && (double)this.life < (double)this.lifeMax * 0.8) { this.ai[3] += 0.6f; } } if (this.ai[3] >= 60f) { this.ai[3] = 0f; vector84 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); num849 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector84.X; num850 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector84.Y; if (Main.netMode != 1) { float num852 = 12f; int num853 = 25; int num854 = 96; if (Main.expertMode) { num852 = 14f; num853 = 22; } num851 = (float)Math.Sqrt((double)(num849 * num849 + num850 * num850)); num851 = num852 / num851; num849 *= num851; num850 *= num851; num849 += (float)Main.rand.Next(-40, 41) * 0.05f; num850 += (float)Main.rand.Next(-40, 41) * 0.05f; vector84.X += num849 * 4f; vector84.Y += num850 * 4f; Projectile.NewProjectile(vector84.X, vector84.Y, num849, num850, num854, num853, 0f, Main.myPlayer, 0f, 0f); } } } } else if (this.ai[1] == 1f) { this.rotation = num842; float num855 = 13f; if (Main.expertMode) { if ((double)this.life < (double)this.lifeMax * 0.9) { num855 += 0.5f; } if ((double)this.life < (double)this.lifeMax * 0.8) { num855 += 0.5f; } if ((double)this.life < (double)this.lifeMax * 0.7) { num855 += 0.55f; } if ((double)this.life < (double)this.lifeMax * 0.6) { num855 += 0.6f; } if ((double)this.life < (double)this.lifeMax * 0.5) { num855 += 0.65f; } } Vector2 vector85 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num856 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector85.X; float num857 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector85.Y; float num858 = (float)Math.Sqrt((double)(num856 * num856 + num857 * num857)); num858 = num855 / num858; this.velocity.X = num856 * num858; this.velocity.Y = num857 * num858; this.ai[1] = 2f; } else if (this.ai[1] == 2f) { this.ai[2] += 1f; if (this.ai[2] >= 8f) { this.velocity.X = this.velocity.X * 0.9f; this.velocity.Y = this.velocity.Y * 0.9f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1) { this.velocity.Y = 0f; } } else { this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 1.57f; } if (this.ai[2] >= 42f) { this.ai[3] += 1f; this.ai[2] = 0f; this.target = 255; this.rotation = num842; if (this.ai[3] >= 10f) { this.ai[1] = 0f; this.ai[3] = 0f; } else { this.ai[1] = 1f; } } } if ((double)this.life < (double)this.lifeMax * 0.4) { this.ai[0] = 1f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; return; } } else if (this.ai[0] == 1f || this.ai[0] == 2f) { if (this.ai[0] == 1f) { this.ai[2] += 0.005f; if ((double)this.ai[2] > 0.5) { this.ai[2] = 0.5f; } } else { this.ai[2] -= 0.005f; if (this.ai[2] < 0f) { this.ai[2] = 0f; } } this.rotation += this.ai[2]; this.ai[1] += 1f; if (this.ai[1] == 100f) { this.ai[0] += 1f; this.ai[1] = 0f; if (this.ai[0] == 3f) { this.ai[2] = 0f; } } this.velocity.X = this.velocity.X * 0.98f; this.velocity.Y = this.velocity.Y * 0.98f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1) { this.velocity.Y = 0f; return; } } else { this.soundHit = 4; this.damage = (int)((double)this.defDamage * 1.5); this.defense = this.defDefense + 18; if (this.ai[1] == 0f) { float num861 = 4f; float num862 = 0.1f; int num863 = 1; if (this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)Main.player[this.target].width) { num863 = -1; } Vector2 vector86 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num864 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) + (float)(num863 * 180) - vector86.X; float num865 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector86.Y; float num866 = (float)Math.Sqrt((double)(num864 * num864 + num865 * num865)); if (Main.expertMode) { if (num866 > 300f) { num861 += 0.5f; } if (num866 > 400f) { num861 += 0.5f; } if (num866 > 500f) { num861 += 0.55f; } if (num866 > 600f) { num861 += 0.55f; } if (num866 > 700f) { num861 += 0.6f; } if (num866 > 800f) { num861 += 0.6f; } } num866 = num861 / num866; num864 *= num866; num865 *= num866; if (this.velocity.X < num864) { this.velocity.X = this.velocity.X + num862; if (this.velocity.X < 0f && num864 > 0f) { this.velocity.X = this.velocity.X + num862; } } else if (this.velocity.X > num864) { this.velocity.X = this.velocity.X - num862; if (this.velocity.X > 0f && num864 < 0f) { this.velocity.X = this.velocity.X - num862; } } if (this.velocity.Y < num865) { this.velocity.Y = this.velocity.Y + num862; if (this.velocity.Y < 0f && num865 > 0f) { this.velocity.Y = this.velocity.Y + num862; } } else if (this.velocity.Y > num865) { this.velocity.Y = this.velocity.Y - num862; if (this.velocity.Y > 0f && num865 < 0f) { this.velocity.Y = this.velocity.Y - num862; } } this.ai[2] += 1f; if (this.ai[2] >= 400f) { this.ai[1] = 1f; this.ai[2] = 0f; this.ai[3] = 0f; this.target = 255; this.netUpdate = true; } if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.localAI[2] += 1f; if (this.localAI[2] > 22f) { this.localAI[2] = 0f; } if (Main.netMode != 1) { this.localAI[1] += 1f; if ((double)this.life < (double)this.lifeMax * 0.75) { this.localAI[1] += 1f; } if ((double)this.life < (double)this.lifeMax * 0.5) { this.localAI[1] += 1f; } if ((double)this.life < (double)this.lifeMax * 0.25) { this.localAI[1] += 1f; } if ((double)this.life < (double)this.lifeMax * 0.1) { this.localAI[1] += 2f; } if (this.localAI[1] > 8f) { this.localAI[1] = 0f; float num867 = 6f; int num868 = 30; if (Main.expertMode) { num868 = 27; } int num869 = 101; vector86 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); num864 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector86.X; num865 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector86.Y; num866 = (float)Math.Sqrt((double)(num864 * num864 + num865 * num865)); num866 = num867 / num866; num864 *= num866; num865 *= num866; num865 += (float)Main.rand.Next(-40, 41) * 0.01f; num864 += (float)Main.rand.Next(-40, 41) * 0.01f; num865 += this.velocity.Y * 0.5f; num864 += this.velocity.X * 0.5f; vector86.X -= num864 * 1f; vector86.Y -= num865 * 1f; Projectile.NewProjectile(vector86.X, vector86.Y, num864, num865, num869, num868, 0f, Main.myPlayer, 0f, 0f); return; } } } } else { if (this.ai[1] == 1f) { this.rotation = num842; float num870 = 14f; if (Main.expertMode) { num870 += 2.5f; } Vector2 vector87 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num871 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector87.X; float num872 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector87.Y; float num873 = (float)Math.Sqrt((double)(num871 * num871 + num872 * num872)); num873 = num870 / num873; this.velocity.X = num871 * num873; this.velocity.Y = num872 * num873; this.ai[1] = 2f; return; } if (this.ai[1] == 2f) { this.ai[2] += 1f; if (Main.expertMode) { this.ai[2] += 0.5f; } if (this.ai[2] >= 50f) { this.velocity.X = this.velocity.X * 0.93f; this.velocity.Y = this.velocity.Y * 0.93f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1) { this.velocity.Y = 0f; } } else { this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 1.57f; } if (this.ai[2] >= 80f) { this.ai[3] += 1f; this.ai[2] = 0f; this.target = 255; this.rotation = num842; if (this.ai[3] >= 6f) { this.ai[1] = 0f; this.ai[3] = 0f; return; } this.ai[1] = 1f; return; } } } } } else if (this.aiStyle == 32) { this.damage = this.defDamage; this.defense = this.defDefense; if (this.ai[0] == 0f && Main.netMode != 1) { this.TargetClosest(true); this.ai[0] = 1f; int num874 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)this.position.Y + this.height / 2, 128, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num874].ai[0] = -1f; Main.npc[num874].ai[1] = (float)this.whoAmI; Main.npc[num874].target = this.target; Main.npc[num874].netUpdate = true; num874 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)this.position.Y + this.height / 2, 129, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num874].ai[0] = 1f; Main.npc[num874].ai[1] = (float)this.whoAmI; Main.npc[num874].target = this.target; Main.npc[num874].netUpdate = true; num874 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)this.position.Y + this.height / 2, 130, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num874].ai[0] = -1f; Main.npc[num874].ai[1] = (float)this.whoAmI; Main.npc[num874].target = this.target; Main.npc[num874].ai[3] = 150f; Main.npc[num874].netUpdate = true; num874 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)this.position.Y + this.height / 2, 131, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num874].ai[0] = 1f; Main.npc[num874].ai[1] = (float)this.whoAmI; Main.npc[num874].target = this.target; Main.npc[num874].netUpdate = true; Main.npc[num874].ai[3] = 150f; } if (Main.player[this.target].dead || Math.Abs(this.position.X - Main.player[this.target].position.X) > 6000f || Math.Abs(this.position.Y - Main.player[this.target].position.Y) > 6000f) { this.TargetClosest(true); if (Main.player[this.target].dead || Math.Abs(this.position.X - Main.player[this.target].position.X) > 6000f || Math.Abs(this.position.Y - Main.player[this.target].position.Y) > 6000f) { this.ai[1] = 3f; } } if (Main.dayTime && this.ai[1] != 3f && this.ai[1] != 2f) { this.ai[1] = 2f; } if (this.ai[1] == 0f) { this.ai[2] += 1f; if (this.ai[2] >= 600f) { this.ai[2] = 0f; this.ai[1] = 1f; this.TargetClosest(true); this.netUpdate = true; } this.rotation = this.velocity.X / 15f; if (this.position.Y > Main.player[this.target].position.Y - 200f) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.98f; } this.velocity.Y = this.velocity.Y - 0.1f; if (this.velocity.Y > 2f) { this.velocity.Y = 2f; } } else if (this.position.Y < Main.player[this.target].position.Y - 500f) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.98f; } this.velocity.Y = this.velocity.Y + 0.1f; if (this.velocity.Y < -2f) { this.velocity.Y = -2f; } } if (this.position.X + (float)(this.width / 2) > Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) + 100f) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.98f; } this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > 8f) { this.velocity.X = 8f; } } if (this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - 100f) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.98f; } this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -8f) { this.velocity.X = -8f; return; } } } else { if (this.ai[1] == 1f) { this.defense *= 2; this.damage *= 2; this.ai[2] += 1f; if (this.ai[2] >= 400f) { this.ai[2] = 0f; this.ai[1] = 0f; } this.rotation += (float)this.direction * 0.3f; Vector2 vector88 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num875 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector88.X; float num876 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector88.Y; float num877 = (float)Math.Sqrt((double)(num875 * num875 + num876 * num876)); num877 = 2f / num877; this.velocity.X = num875 * num877; this.velocity.Y = num876 * num877; return; } if (this.ai[1] == 2f) { this.damage = 1000; this.defense = 9999; this.rotation += (float)this.direction * 0.3f; Vector2 vector89 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num878 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector89.X; float num879 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector89.Y; float num880 = (float)Math.Sqrt((double)(num878 * num878 + num879 * num879)); float num881 = 10f; num881 += num880 / 100f; if (num881 < 8f) { num881 = 8f; } if (num881 > 32f) { num881 = 32f; } num880 = num881 / num880; this.velocity.X = num878 * num880; this.velocity.Y = num879 * num880; return; } if (this.ai[1] == 3f) { this.velocity.Y = this.velocity.Y + 0.1f; if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.95f; } this.velocity.X = this.velocity.X * 0.95f; if (this.timeLeft > 500) { this.timeLeft = 500; return; } } } } else if (this.aiStyle == 33) { Vector2 vector90 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num882 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector90.X; float num883 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector90.Y; float num884 = (float)Math.Sqrt((double)(num882 * num882 + num883 * num883)); if (this.ai[2] != 99f) { if (num884 > 800f) { this.ai[2] = 99f; } } else if (num884 < 400f) { this.ai[2] = 0f; } this.spriteDirection = -(int)this.ai[0]; if (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].aiStyle != 32) { this.ai[2] += 10f; if (this.ai[2] > 50f || Main.netMode != 2) { this.life = -1; this.HitEffect(0, 10.0); this.active = false; } } if (this.ai[2] == 99f) { if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y - 0.1f; if (this.velocity.Y > 8f) { this.velocity.Y = 8f; } } else if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y + 0.1f; if (this.velocity.Y < -8f) { this.velocity.Y = -8f; } } if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2)) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X - 0.5f; if (this.velocity.X > 12f) { this.velocity.X = 12f; } } if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2)) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X + 0.5f; if (this.velocity.X < -12f) { this.velocity.X = -12f; return; } } } else { if (this.ai[2] == 0f || this.ai[2] == 3f) { if (Main.npc[(int)this.ai[1]].ai[1] == 3f && this.timeLeft > 10) { this.timeLeft = 10; } if (Main.npc[(int)this.ai[1]].ai[1] != 0f) { this.TargetClosest(true); if (Main.player[this.target].dead) { this.velocity.Y = this.velocity.Y + 0.1f; if (this.velocity.Y > 16f) { this.velocity.Y = 16f; } } else { Vector2 vector91 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num885 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector91.X; float num886 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector91.Y; float num887 = (float)Math.Sqrt((double)(num885 * num885 + num886 * num886)); num887 = 7f / num887; num885 *= num887; num886 *= num887; this.rotation = (float)Math.Atan2((double)num886, (double)num885) - 1.57f; if (this.velocity.X > num885) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.97f; } this.velocity.X = this.velocity.X - 0.05f; } if (this.velocity.X < num885) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.97f; } this.velocity.X = this.velocity.X + 0.05f; } if (this.velocity.Y > num886) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.97f; } this.velocity.Y = this.velocity.Y - 0.05f; } if (this.velocity.Y < num886) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.97f; } this.velocity.Y = this.velocity.Y + 0.05f; } } this.ai[3] += 1f; if (this.ai[3] >= 600f) { this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; } } else { this.ai[3] += 1f; if (this.ai[3] >= 300f) { this.ai[2] += 1f; this.ai[3] = 0f; this.netUpdate = true; } if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y + 320f) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y - 0.04f; if (this.velocity.Y > 3f) { this.velocity.Y = 3f; } } else if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y + 260f) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y + 0.04f; if (this.velocity.Y < -3f) { this.velocity.Y = -3f; } } if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2)) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X - 0.3f; if (this.velocity.X > 12f) { this.velocity.X = 12f; } } if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 250f) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X + 0.3f; if (this.velocity.X < -12f) { this.velocity.X = -12f; } } } Vector2 vector92 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num888 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector92.X; float num889 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector92.Y; Math.Sqrt((double)(num888 * num888 + num889 * num889)); this.rotation = (float)Math.Atan2((double)num889, (double)num888) + 1.57f; return; } if (this.ai[2] == 1f) { Vector2 vector93 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num890 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector93.X; float num891 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector93.Y; float num892 = (float)Math.Sqrt((double)(num890 * num890 + num891 * num891)); this.rotation = (float)Math.Atan2((double)num891, (double)num890) + 1.57f; this.velocity.X = this.velocity.X * 0.95f; this.velocity.Y = this.velocity.Y - 0.1f; if (this.velocity.Y < -8f) { this.velocity.Y = -8f; } if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y - 200f) { this.TargetClosest(true); this.ai[2] = 2f; vector93 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); num890 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector93.X; num891 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector93.Y; num892 = (float)Math.Sqrt((double)(num890 * num890 + num891 * num891)); num892 = 22f / num892; this.velocity.X = num890 * num892; this.velocity.Y = num891 * num892; this.netUpdate = true; return; } } else if (this.ai[2] == 2f) { if (this.position.Y > Main.player[this.target].position.Y || this.velocity.Y < 0f) { this.ai[2] = 3f; return; } } else { if (this.ai[2] == 4f) { this.TargetClosest(true); Vector2 vector94 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num893 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector94.X; float num894 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector94.Y; float num895 = (float)Math.Sqrt((double)(num893 * num893 + num894 * num894)); num895 = 7f / num895; num893 *= num895; num894 *= num895; if (this.velocity.X > num893) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.97f; } this.velocity.X = this.velocity.X - 0.05f; } if (this.velocity.X < num893) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.97f; } this.velocity.X = this.velocity.X + 0.05f; } if (this.velocity.Y > num894) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.97f; } this.velocity.Y = this.velocity.Y - 0.05f; } if (this.velocity.Y < num894) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.97f; } this.velocity.Y = this.velocity.Y + 0.05f; } this.ai[3] += 1f; if (this.ai[3] >= 600f) { this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; } vector94 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); num893 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector94.X; num894 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector94.Y; num895 = (float)Math.Sqrt((double)(num893 * num893 + num894 * num894)); this.rotation = (float)Math.Atan2((double)num894, (double)num893) + 1.57f; return; } if (this.ai[2] == 5f && ((this.velocity.X > 0f && this.position.X + (float)(this.width / 2) > Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2)) || (this.velocity.X < 0f && this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2)))) { this.ai[2] = 0f; return; } } } } else if (this.aiStyle == 34) { this.spriteDirection = -(int)this.ai[0]; Vector2 vector95 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num896 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector95.X; float num897 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector95.Y; float num898 = (float)Math.Sqrt((double)(num896 * num896 + num897 * num897)); if (this.ai[2] != 99f) { if (num898 > 800f) { this.ai[2] = 99f; } } else if (num898 < 400f) { this.ai[2] = 0f; } if (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].aiStyle != 32) { this.ai[2] += 10f; if (this.ai[2] > 50f || Main.netMode != 2) { this.life = -1; this.HitEffect(0, 10.0); this.active = false; } } if (this.ai[2] == 99f) { if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y - 0.1f; if (this.velocity.Y > 8f) { this.velocity.Y = 8f; } } else if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y + 0.1f; if (this.velocity.Y < -8f) { this.velocity.Y = -8f; } } if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2)) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X - 0.5f; if (this.velocity.X > 12f) { this.velocity.X = 12f; } } if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2)) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X + 0.5f; if (this.velocity.X < -12f) { this.velocity.X = -12f; return; } } } else { if (this.ai[2] == 0f || this.ai[2] == 3f) { if (Main.npc[(int)this.ai[1]].ai[1] == 3f && this.timeLeft > 10) { this.timeLeft = 10; } if (Main.npc[(int)this.ai[1]].ai[1] != 0f) { this.TargetClosest(true); this.TargetClosest(true); if (Main.player[this.target].dead) { this.velocity.Y = this.velocity.Y + 0.1f; if (this.velocity.Y > 16f) { this.velocity.Y = 16f; } } else { Vector2 vector96 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num899 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector96.X; float num900 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector96.Y; float num901 = (float)Math.Sqrt((double)(num899 * num899 + num900 * num900)); num901 = 12f / num901; num899 *= num901; num900 *= num901; this.rotation = (float)Math.Atan2((double)num900, (double)num899) - 1.57f; if (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) < 2f) { this.rotation = (float)Math.Atan2((double)num900, (double)num899) - 1.57f; this.velocity.X = num899; this.velocity.Y = num900; this.netUpdate = true; } else { this.velocity *= 0.97f; } this.ai[3] += 1f; if (this.ai[3] >= 600f) { this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; } } } else { this.ai[3] += 1f; if (this.ai[3] >= 600f) { this.ai[2] += 1f; this.ai[3] = 0f; this.netUpdate = true; } if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y + 300f) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y - 0.1f; if (this.velocity.Y > 3f) { this.velocity.Y = 3f; } } else if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y + 230f) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y + 0.1f; if (this.velocity.Y < -3f) { this.velocity.Y = -3f; } } if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) + 250f) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.94f; } this.velocity.X = this.velocity.X - 0.3f; if (this.velocity.X > 9f) { this.velocity.X = 9f; } } if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2)) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.94f; } this.velocity.X = this.velocity.X + 0.2f; if (this.velocity.X < -8f) { this.velocity.X = -8f; } } } Vector2 vector97 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num902 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector97.X; float num903 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector97.Y; Math.Sqrt((double)(num902 * num902 + num903 * num903)); this.rotation = (float)Math.Atan2((double)num903, (double)num902) + 1.57f; return; } if (this.ai[2] == 1f) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.9f; } Vector2 vector98 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num904 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 280f * this.ai[0] - vector98.X; float num905 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector98.Y; float num906 = (float)Math.Sqrt((double)(num904 * num904 + num905 * num905)); this.rotation = (float)Math.Atan2((double)num905, (double)num904) + 1.57f; this.velocity.X = (this.velocity.X * 5f + Main.npc[(int)this.ai[1]].velocity.X) / 6f; this.velocity.X = this.velocity.X + 0.5f; this.velocity.Y = this.velocity.Y - 0.5f; if (this.velocity.Y < -9f) { this.velocity.Y = -9f; } if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y - 280f) { this.TargetClosest(true); this.ai[2] = 2f; vector98 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); num904 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector98.X; num905 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector98.Y; num906 = (float)Math.Sqrt((double)(num904 * num904 + num905 * num905)); num906 = 20f / num906; this.velocity.X = num904 * num906; this.velocity.Y = num905 * num906; this.netUpdate = true; return; } } else if (this.ai[2] == 2f) { if (this.position.Y > Main.player[this.target].position.Y || this.velocity.Y < 0f) { if (this.ai[3] >= 4f) { this.ai[2] = 3f; this.ai[3] = 0f; return; } this.ai[2] = 1f; this.ai[3] += 1f; return; } } else if (this.ai[2] == 4f) { Vector2 vector99 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num907 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector99.X; float num908 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector99.Y; float num909 = (float)Math.Sqrt((double)(num907 * num907 + num908 * num908)); this.rotation = (float)Math.Atan2((double)num908, (double)num907) + 1.57f; this.velocity.Y = (this.velocity.Y * 5f + Main.npc[(int)this.ai[1]].velocity.Y) / 6f; this.velocity.X = this.velocity.X + 0.5f; if (this.velocity.X > 12f) { this.velocity.X = 12f; } if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 500f || this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) + 500f) { this.TargetClosest(true); this.ai[2] = 5f; vector99 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); num907 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector99.X; num908 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector99.Y; num909 = (float)Math.Sqrt((double)(num907 * num907 + num908 * num908)); num909 = 17f / num909; this.velocity.X = num907 * num909; this.velocity.Y = num908 * num909; this.netUpdate = true; return; } } else if (this.ai[2] == 5f && this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - 100f) { if (this.ai[3] >= 4f) { this.ai[2] = 0f; this.ai[3] = 0f; return; } this.ai[2] = 4f; this.ai[3] += 1f; return; } } } else if (this.aiStyle == 35) { this.spriteDirection = -(int)this.ai[0]; if (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].aiStyle != 32) { this.ai[2] += 10f; if (this.ai[2] > 50f || Main.netMode != 2) { this.life = -1; this.HitEffect(0, 10.0); this.active = false; } } if (this.ai[2] == 0f) { if (Main.npc[(int)this.ai[1]].ai[1] == 3f && this.timeLeft > 10) { this.timeLeft = 10; } if (Main.npc[(int)this.ai[1]].ai[1] != 0f) { this.localAI[0] += 2f; if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y - 100f) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y - 0.07f; if (this.velocity.Y > 6f) { this.velocity.Y = 6f; } } else if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y - 100f) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y + 0.07f; if (this.velocity.Y < -6f) { this.velocity.Y = -6f; } } if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 120f * this.ai[0]) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > 8f) { this.velocity.X = 8f; } } if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 120f * this.ai[0]) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -8f) { this.velocity.X = -8f; } } } else { this.ai[3] += 1f; if (this.ai[3] >= 1100f) { this.localAI[0] = 0f; this.ai[2] = 1f; this.ai[3] = 0f; this.netUpdate = true; } if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y - 150f) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y - 0.04f; if (this.velocity.Y > 3f) { this.velocity.Y = 3f; } } else if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y - 150f) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y + 0.04f; if (this.velocity.Y < -3f) { this.velocity.Y = -3f; } } if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) + 200f) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X - 0.2f; if (this.velocity.X > 8f) { this.velocity.X = 8f; } } if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) + 160f) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X + 0.2f; if (this.velocity.X < -8f) { this.velocity.X = -8f; } } } Vector2 vector100 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num910 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector100.X; float num911 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector100.Y; float num912 = (float)Math.Sqrt((double)(num910 * num910 + num911 * num911)); this.rotation = (float)Math.Atan2((double)num911, (double)num910) + 1.57f; if (Main.netMode != 1) { this.localAI[0] += 1f; if (this.localAI[0] > 140f) { this.localAI[0] = 0f; float num913 = 12f; int num914 = 0; int num915 = 102; num912 = num913 / num912; num910 = -num910 * num912; num911 = -num911 * num912; num910 += (float)Main.rand.Next(-40, 41) * 0.01f; num911 += (float)Main.rand.Next(-40, 41) * 0.01f; vector100.X += num910 * 4f; vector100.Y += num911 * 4f; Projectile.NewProjectile(vector100.X, vector100.Y, num910, num911, num915, num914, 0f, Main.myPlayer, 0f, 0f); return; } } } else if (this.ai[2] == 1f) { this.ai[3] += 1f; if (this.ai[3] >= 300f) { this.localAI[0] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; } Vector2 vector101 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num916 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - vector101.X; float num917 = Main.npc[(int)this.ai[1]].position.Y - vector101.Y; num917 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - 80f - vector101.Y; float num918 = (float)Math.Sqrt((double)(num916 * num916 + num917 * num917)); num918 = 6f / num918; num916 *= num918; num917 *= num918; if (this.velocity.X > num916) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.9f; } this.velocity.X = this.velocity.X - 0.04f; } if (this.velocity.X < num916) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.9f; } this.velocity.X = this.velocity.X + 0.04f; } if (this.velocity.Y > num917) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.9f; } this.velocity.Y = this.velocity.Y - 0.08f; } if (this.velocity.Y < num917) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.9f; } this.velocity.Y = this.velocity.Y + 0.08f; } this.TargetClosest(true); vector101 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); num916 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector101.X; num917 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector101.Y; num918 = (float)Math.Sqrt((double)(num916 * num916 + num917 * num917)); this.rotation = (float)Math.Atan2((double)num917, (double)num916) - 1.57f; if (Main.netMode != 1) { this.localAI[0] += 1f; if (this.localAI[0] > 40f) { this.localAI[0] = 0f; float num919 = 10f; int num920 = 0; int num921 = 102; num918 = num919 / num918; num916 *= num918; num917 *= num918; num916 += (float)Main.rand.Next(-40, 41) * 0.01f; num917 += (float)Main.rand.Next(-40, 41) * 0.01f; vector101.X += num916 * 4f; vector101.Y += num917 * 4f; Projectile.NewProjectile(vector101.X, vector101.Y, num916, num917, num921, num920, 0f, Main.myPlayer, 0f, 0f); return; } } } } else if (this.aiStyle == 36) { this.spriteDirection = -(int)this.ai[0]; if (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].aiStyle != 32) { this.ai[2] += 10f; if (this.ai[2] > 50f || Main.netMode != 2) { this.life = -1; this.HitEffect(0, 10.0); this.active = false; } } if (this.ai[2] == 0f || this.ai[2] == 3f) { if (Main.npc[(int)this.ai[1]].ai[1] == 3f && this.timeLeft > 10) { this.timeLeft = 10; } if (Main.npc[(int)this.ai[1]].ai[1] != 0f) { this.localAI[0] += 3f; if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y - 100f) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y - 0.07f; if (this.velocity.Y > 6f) { this.velocity.Y = 6f; } } else if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y - 100f) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y + 0.07f; if (this.velocity.Y < -6f) { this.velocity.Y = -6f; } } if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 120f * this.ai[0]) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > 8f) { this.velocity.X = 8f; } } if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 120f * this.ai[0]) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -8f) { this.velocity.X = -8f; } } } else { this.ai[3] += 1f; if (this.ai[3] >= 800f) { this.ai[2] += 1f; this.ai[3] = 0f; this.netUpdate = true; } if (this.position.Y > Main.npc[(int)this.ai[1]].position.Y - 100f) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y - 0.1f; if (this.velocity.Y > 3f) { this.velocity.Y = 3f; } } else if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y - 100f) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.96f; } this.velocity.Y = this.velocity.Y + 0.1f; if (this.velocity.Y < -3f) { this.velocity.Y = -3f; } } if (this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 180f * this.ai[0]) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X - 0.14f; if (this.velocity.X > 8f) { this.velocity.X = 8f; } } if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 180f * this.ai[0]) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.96f; } this.velocity.X = this.velocity.X + 0.14f; if (this.velocity.X < -8f) { this.velocity.X = -8f; } } } this.TargetClosest(true); Vector2 vector102 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num922 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector102.X; float num923 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector102.Y; float num924 = (float)Math.Sqrt((double)(num922 * num922 + num923 * num923)); this.rotation = (float)Math.Atan2((double)num923, (double)num922) - 1.57f; if (Main.netMode != 1) { this.localAI[0] += 1f; if (this.localAI[0] > 200f) { this.localAI[0] = 0f; float num925 = 8f; int num926 = 25; int num927 = 100; num924 = num925 / num924; num922 *= num924; num923 *= num924; num922 += (float)Main.rand.Next(-40, 41) * 0.05f; num923 += (float)Main.rand.Next(-40, 41) * 0.05f; vector102.X += num922 * 8f; vector102.Y += num923 * 8f; Projectile.NewProjectile(vector102.X, vector102.Y, num922, num923, num927, num926, 0f, Main.myPlayer, 0f, 0f); return; } } } else if (this.ai[2] == 1f) { this.ai[3] += 1f; if (this.ai[3] >= 200f) { this.localAI[0] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; } Vector2 vector103 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num928 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - 350f - vector103.X; float num929 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - 20f - vector103.Y; float num930 = (float)Math.Sqrt((double)(num928 * num928 + num929 * num929)); num930 = 7f / num930; num928 *= num930; num929 *= num930; if (this.velocity.X > num928) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.9f; } this.velocity.X = this.velocity.X - 0.1f; } if (this.velocity.X < num928) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.9f; } this.velocity.X = this.velocity.X + 0.1f; } if (this.velocity.Y > num929) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.9f; } this.velocity.Y = this.velocity.Y - 0.03f; } if (this.velocity.Y < num929) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.9f; } this.velocity.Y = this.velocity.Y + 0.03f; } this.TargetClosest(true); vector103 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); num928 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector103.X; num929 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector103.Y; num930 = (float)Math.Sqrt((double)(num928 * num928 + num929 * num929)); this.rotation = (float)Math.Atan2((double)num929, (double)num928) - 1.57f; if (Main.netMode == 1) { this.localAI[0] += 1f; if (this.localAI[0] > 80f) { this.localAI[0] = 0f; float num931 = 10f; int num932 = 25; int num933 = 100; num930 = num931 / num930; num928 *= num930; num929 *= num930; num928 += (float)Main.rand.Next(-40, 41) * 0.05f; num929 += (float)Main.rand.Next(-40, 41) * 0.05f; vector103.X += num928 * 8f; vector103.Y += num929 * 8f; Projectile.NewProjectile(vector103.X, vector103.Y, num928, num929, num933, num932, 0f, Main.myPlayer, 0f, 0f); return; } } } } else if (this.aiStyle == 37) { if (this.ai[3] > 0f) { this.realLife = (int)this.ai[3]; } if (this.target < 0 || this.target == 255 || Main.player[this.target].dead) { this.TargetClosest(true); } if (this.type >= NPCID.TheDestroyer && this.type <= NPCID.TheDestroyerTail) { this.velocity.Length(); if (this.type == NPCID.TheDestroyer || (this.type != NPCID.TheDestroyer && Main.npc[(int)this.ai[1]].alpha < 128)) { this.alpha -= 42; if (this.alpha < 0) { this.alpha = 0; } } } if (this.type > 134) { bool flag93 = false; if (this.ai[1] <= 0f) { flag93 = true; } else if (Main.npc[(int)this.ai[1]].life <= 0) { flag93 = true; } if (flag93) { this.life = 0; this.HitEffect(0, 10.0); this.checkDead(); } } if (Main.netMode != 1) { if (this.ai[0] == 0f && this.type == NPCID.TheDestroyer) { this.ai[3] = (float)this.whoAmI; this.realLife = this.whoAmI; int num936 = this.whoAmI; int num937 = 80; for (int num938 = 0; num938 <= num937; num938++) { int num939 = 135; if (num938 == num937) { num939 = 136; } int num940 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)(this.position.Y + (float)this.height), num939, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num940].ai[3] = (float)this.whoAmI; Main.npc[num940].realLife = this.whoAmI; Main.npc[num940].ai[1] = (float)num936; Main.npc[num936].ai[0] = (float)num940; NetMessage.SendData((int)PacketTypes.NpcUpdate, -1, -1, "", num940, 0f, 0f, 0f, 0, 0, 0); num936 = num940; } } if (this.type == NPCID.TheDestroyerBody) { this.localAI[0] += (float)Main.rand.Next(4); if (this.localAI[0] >= (float)Main.rand.Next(1400, 26000)) { this.localAI[0] = 0f; this.TargetClosest(true); if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { float num941 = 8f; Vector2 vector104 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)(this.height / 2)); float num942 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector104.X + (float)Main.rand.Next(-20, 21); float num943 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector104.Y + (float)Main.rand.Next(-20, 21); float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); num944 = num941 / num944; num942 *= num944; num943 *= num944; num942 += (float)Main.rand.Next(-20, 21) * 0.05f; num943 += (float)Main.rand.Next(-20, 21) * 0.05f; int num945 = 22; if (Main.expertMode) { num945 = 18; } int num946 = 100; vector104.X += num942 * 5f; vector104.Y += num943 * 5f; int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num947].timeLeft = 300; this.netUpdate = true; } } } } int num948 = (int)(this.position.X / 16f) - 1; int num949 = (int)((this.position.X + (float)this.width) / 16f) + 2; int num950 = (int)(this.position.Y / 16f) - 1; int num951 = (int)((this.position.Y + (float)this.height) / 16f) + 2; if (num948 < 0) { num948 = 0; } if (num949 > Main.maxTilesX) { num949 = Main.maxTilesX; } if (num950 < 0) { num950 = 0; } if (num951 > Main.maxTilesY) { num951 = Main.maxTilesY; } bool flag94 = false; if (!flag94) { for (int num952 = num948; num952 < num949; num952++) { for (int num953 = num950; num953 < num951; num953++) { if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) { Vector2 vector105; vector105.X = (float)(num952 * 16); vector105.Y = (float)(num953 * 16); if (this.position.X + (float)this.width > vector105.X && this.position.X < vector105.X + 16f && this.position.Y + (float)this.height > vector105.Y && this.position.Y < vector105.Y + 16f) { flag94 = true; break; } } } } } if (!flag94) { this.localAI[1] = 1f; if (this.type == NPCID.TheDestroyer) { Rectangle rectangle12 = new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height); int num954 = 1000; bool flag95 = true; if (this.position.Y > Main.player[this.target].position.Y) { for (int num955 = 0; num955 < 255; num955++) { if (Main.player[num955].active) { Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); if (rectangle12.Intersects(rectangle13)) { flag95 = false; break; } } } if (flag95) { flag94 = true; } } } } else { this.localAI[1] = 0f; } float num956 = 16f; if (Main.dayTime || Main.player[this.target].dead) { flag94 = false; this.velocity.Y = this.velocity.Y + 1f; if ((double)this.position.Y > Main.worldSurface * 16.0) { this.velocity.Y = this.velocity.Y + 1f; num956 = 32f; } if ((double)this.position.Y > Main.rockLayer * 16.0) { for (int num957 = 0; num957 < 200; num957++) { if (Main.npc[num957].aiStyle == this.aiStyle) { Main.npc[num957].active = false; } } } } float num958 = 0.1f; float num959 = 0.15f; Vector2 vector106 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num960 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2); float num961 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2); num960 = (float)((int)(num960 / 16f) * 16); num961 = (float)((int)(num961 / 16f) * 16); vector106.X = (float)((int)(vector106.X / 16f) * 16); vector106.Y = (float)((int)(vector106.Y / 16f) * 16); num960 -= vector106.X; num961 -= vector106.Y; float num962 = (float)Math.Sqrt((double)(num960 * num960 + num961 * num961)); if (this.ai[1] > 0f && this.ai[1] < (float)Main.npc.Length) { try { vector106 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); num960 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - vector106.X; num961 = Main.npc[(int)this.ai[1]].position.Y + (float)(Main.npc[(int)this.ai[1]].height / 2) - vector106.Y; } catch { } this.rotation = (float)Math.Atan2((double)num961, (double)num960) + 1.57f; num962 = (float)Math.Sqrt((double)(num960 * num960 + num961 * num961)); int num963 = (int)(44f * this.scale); num962 = (num962 - (float)num963) / num962; num960 *= num962; num961 *= num962; this.velocity = Vector2.Zero; this.position.X = this.position.X + num960; this.position.Y = this.position.Y + num961; return; } if (!flag94) { this.TargetClosest(true); this.velocity.Y = this.velocity.Y + 0.15f; if (this.velocity.Y > num956) { this.velocity.Y = num956; } if ((double)(Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) < (double)num956 * 0.4) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X - num958 * 1.1f; } else { this.velocity.X = this.velocity.X + num958 * 1.1f; } } else if (this.velocity.Y == num956) { if (this.velocity.X < num960) { this.velocity.X = this.velocity.X + num958; } else if (this.velocity.X > num960) { this.velocity.X = this.velocity.X - num958; } } else if (this.velocity.Y > 4f) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X + num958 * 0.9f; } else { this.velocity.X = this.velocity.X - num958 * 0.9f; } } } else { if (this.soundDelay == 0) { float num964 = num962 / 40f; if (num964 < 10f) { num964 = 10f; } if (num964 > 20f) { num964 = 20f; } this.soundDelay = (int)num964; } num962 = (float)Math.Sqrt((double)(num960 * num960 + num961 * num961)); float num965 = Math.Abs(num960); float num966 = Math.Abs(num961); float num967 = num956 / num962; num960 *= num967; num961 *= num967; if (((this.velocity.X > 0f && num960 > 0f) || (this.velocity.X < 0f && num960 < 0f)) && ((this.velocity.Y > 0f && num961 > 0f) || (this.velocity.Y < 0f && num961 < 0f))) { if (this.velocity.X < num960) { this.velocity.X = this.velocity.X + num959; } else if (this.velocity.X > num960) { this.velocity.X = this.velocity.X - num959; } if (this.velocity.Y < num961) { this.velocity.Y = this.velocity.Y + num959; } else if (this.velocity.Y > num961) { this.velocity.Y = this.velocity.Y - num959; } } if ((this.velocity.X > 0f && num960 > 0f) || (this.velocity.X < 0f && num960 < 0f) || (this.velocity.Y > 0f && num961 > 0f) || (this.velocity.Y < 0f && num961 < 0f)) { if (this.velocity.X < num960) { this.velocity.X = this.velocity.X + num958; } else if (this.velocity.X > num960) { this.velocity.X = this.velocity.X - num958; } if (this.velocity.Y < num961) { this.velocity.Y = this.velocity.Y + num958; } else if (this.velocity.Y > num961) { this.velocity.Y = this.velocity.Y - num958; } if ((double)Math.Abs(num961) < (double)num956 * 0.2 && ((this.velocity.X > 0f && num960 < 0f) || (this.velocity.X < 0f && num960 > 0f))) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y + num958 * 2f; } else { this.velocity.Y = this.velocity.Y - num958 * 2f; } } if ((double)Math.Abs(num960) < (double)num956 * 0.2 && ((this.velocity.Y > 0f && num961 < 0f) || (this.velocity.Y < 0f && num961 > 0f))) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X + num958 * 2f; } else { this.velocity.X = this.velocity.X - num958 * 2f; } } } else if (num965 > num966) { if (this.velocity.X < num960) { this.velocity.X = this.velocity.X + num958 * 1.1f; } else if (this.velocity.X > num960) { this.velocity.X = this.velocity.X - num958 * 1.1f; } if ((double)(Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) < (double)num956 * 0.5) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y + num958; } else { this.velocity.Y = this.velocity.Y - num958; } } } else { if (this.velocity.Y < num961) { this.velocity.Y = this.velocity.Y + num958 * 1.1f; } else if (this.velocity.Y > num961) { this.velocity.Y = this.velocity.Y - num958 * 1.1f; } if ((double)(Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) < (double)num956 * 0.5) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X + num958; } else { this.velocity.X = this.velocity.X - num958; } } } } this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f; if (this.type == NPCID.TheDestroyer) { if (flag94) { if (this.localAI[0] != 1f) { this.netUpdate = true; } this.localAI[0] = 1f; } else { if (this.localAI[0] != 0f) { this.netUpdate = true; } this.localAI[0] = 0f; } if (((this.velocity.X > 0f && this.oldVelocity.X < 0f) || (this.velocity.X < 0f && this.oldVelocity.X > 0f) || (this.velocity.Y > 0f && this.oldVelocity.Y < 0f) || (this.velocity.Y < 0f && this.oldVelocity.Y > 0f)) && !this.justHit) { this.netUpdate = true; return; } } } else if (this.aiStyle == 38) { float num968 = 4f; float num969 = 1f; if (this.type == NPCID.SnowmanGangsta) { num968 = 3f; num969 = 0.7f; } if (this.type == NPCID.SnowBalla) { num968 = 3.5f; num969 = 0.8f; } if (this.type == NPCID.SnowmanGangsta) { this.ai[2] += 1f; if (this.ai[2] >= 120f) { this.ai[2] = 0f; if (Main.netMode != 1) { Vector2 vector107 = new Vector2(this.position.X + (float)this.width * 0.5f - (float)(this.direction * 12), this.position.Y + (float)this.height * 0.5f); float speedX = (float)(12 * this.spriteDirection); float speedY = 0f; if (Main.netMode != 1) { int num970 = 25; int num971 = 110; int num972 = Projectile.NewProjectile(vector107.X, vector107.Y, speedX, speedY, num971, num970, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num972].ai[0] = 2f; Main.projectile[num972].timeLeft = 300; Main.projectile[num972].friendly = false; NetMessage.SendData((int)PacketTypes.ProjectileNew, -1, -1, "", num972, 0f, 0f, 0f, 0, 0, 0); this.netUpdate = true; } } } } if (this.type == NPCID.MisterStabby && this.ai[1] >= 3f) { this.TargetClosest(true); this.spriteDirection = this.direction; if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.9f; this.ai[2] += 1f; if ((double)this.velocity.X > -0.3 && (double)this.velocity.X < 0.3) { this.velocity.X = 0f; } if (this.ai[2] >= 200f) { this.ai[2] = 0f; this.ai[1] = 0f; } } } else if (this.type == NPCID.SnowBalla && this.ai[1] >= 3f) { this.TargetClosest(true); if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.9f; this.ai[2] += 1f; if ((double)this.velocity.X > -0.3 && (double)this.velocity.X < 0.3) { this.velocity.X = 0f; } if (this.ai[2] >= 16f) { this.ai[2] = 0f; this.ai[1] = 0f; } } if (this.velocity.X == 0f && this.velocity.Y == 0f && this.ai[2] == 8f) { float num973 = 10f; Vector2 vector108 = new Vector2(this.position.X + (float)this.width * 0.5f - (float)(this.direction * 12), this.position.Y + (float)this.height * 0.25f); float num974 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector108.X; float num975 = Main.player[this.target].position.Y - vector108.Y; float num976 = (float)Math.Sqrt((double)(num974 * num974 + num975 * num975)); num976 = num973 / num976; num974 *= num976; num975 *= num976; if (Main.netMode != 1) { int num977 = 35; int num978 = 109; int num979 = Projectile.NewProjectile(vector108.X, vector108.Y, num974, num975, num978, num977, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num979].ai[0] = 2f; Main.projectile[num979].timeLeft = 300; Main.projectile[num979].friendly = false; NetMessage.SendData((int)PacketTypes.ProjectileNew, -1, -1, "", num979, 0f, 0f, 0f, 0, 0, 0); this.netUpdate = true; } } } else { if (this.velocity.Y == 0f) { if (this.localAI[2] == this.position.X) { this.direction *= -1; this.ai[3] = 60f; } this.localAI[2] = this.position.X; if (this.ai[3] == 0f) { this.TargetClosest(true); } this.ai[0] += 1f; if (this.ai[0] > 2f) { this.ai[0] = 0f; this.ai[1] += 1f; this.velocity.Y = -8.2f; this.velocity.X = this.velocity.X + (float)this.direction * num969 * 1.1f; } else { this.velocity.Y = -6f; this.velocity.X = this.velocity.X + (float)this.direction * num969 * 0.9f; } this.spriteDirection = this.direction; } this.velocity.X = this.velocity.X + (float)this.direction * num969 * 0.01f; } if (this.ai[3] > 0f) { this.ai[3] -= 1f; } if (this.velocity.X > num968 && this.direction > 0) { this.velocity.X = 4f; } if (this.velocity.X < -num968 && this.direction < 0) { this.velocity.X = -4f; return; } } else if (this.aiStyle == 39) { if (this.target < 0 || Main.player[this.target].dead || this.direction == 0) { this.TargetClosest(true); } bool flag96 = true; int num980 = 0; if (this.velocity.X < 0f) { num980 = -1; } if (this.velocity.X > 0f) { num980 = 1; } Vector2 position6 = this.position; position6.X += this.velocity.X; int num981 = (int)((position6.X + (float)(this.width / 2) + (float)((this.width / 2 + 1) * num980)) / 16f); int num982 = (int)((position6.Y + (float)this.height - 1f) / 16f); if ((float)(num981 * 16) < position6.X + (float)this.width && (float)(num981 * 16 + 16) > position6.X && ((Main.tile[num981, num982].nactive() && !Main.tile[num981, num982].topSlope() && !Main.tile[num981, num982 - 1].topSlope() && ((Main.tileSolid[(int)Main.tile[num981, num982].type] && !Main.tileSolidTop[(int)Main.tile[num981, num982].type]) || (flag96 && Main.tileSolidTop[(int)Main.tile[num981, num982].type] && (!Main.tileSolid[(int)Main.tile[num981, num982 - 1].type] || !Main.tile[num981, num982 - 1].nactive()) && Main.tile[num981, num982].type != TileID.Anvils && Main.tile[num981, num982].type != TileID.WorkBenches && Main.tile[num981, num982].type != TileID.MythrilAnvil))) || (Main.tile[num981, num982 - 1].halfBrick() && Main.tile[num981, num982 - 1].nactive())) && (!Main.tile[num981, num982 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num981, num982 - 1].type] || Main.tileSolidTop[(int)Main.tile[num981, num982 - 1].type] || (Main.tile[num981, num982 - 1].halfBrick() && (!Main.tile[num981, num982 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num981, num982 - 4].type] || Main.tileSolidTop[(int)Main.tile[num981, num982 - 4].type]))) && (!Main.tile[num981, num982 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num981, num982 - 2].type] || Main.tileSolidTop[(int)Main.tile[num981, num982 - 2].type]) && (!Main.tile[num981, num982 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num981, num982 - 3].type] || Main.tileSolidTop[(int)Main.tile[num981, num982 - 3].type]) && (!Main.tile[num981 - num980, num982 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num981 - num980, num982 - 3].type] || Main.tileSolidTop[(int)Main.tile[num981 - num980, num982 - 3].type])) { float num983 = (float)(num982 * 16); if (Main.tile[num981, num982].halfBrick()) { num983 += 8f; } if (Main.tile[num981, num982 - 1].halfBrick()) { num983 -= 8f; } if (num983 < position6.Y + (float)this.height) { float num984 = position6.Y + (float)this.height - num983; if ((double)num984 <= 16.1) { this.gfxOffY += this.position.Y + (float)this.height - num983; this.position.Y = num983 - (float)this.height; if (num984 < 9f) { this.stepSpeed = 0.75f; } else { this.stepSpeed = 1.5f; } } } } if (this.justHit && this.type != NPCID.SolarSroller) { this.ai[0] = 0f; this.ai[1] = 0f; this.TargetClosest(true); } if (this.ai[0] == 0f) { if (this.velocity.X < 0f) { this.direction = -1; } else if (this.velocity.X > 0f) { this.direction = 1; } this.spriteDirection = this.direction; Vector2 vector109 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num986 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector109.X; float num987 = Main.player[this.target].position.Y - vector109.Y; float num988 = (float)Math.Sqrt((double)(num986 * num986 + num987 * num987)); bool flag97 = Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height); if (this.type >= NPCID.GiantShelly && this.type <= NPCID.GiantShelly2) { if (num988 > 200f && flag97) { this.ai[1] += 2f; } if (num988 > 600f && (flag97 || this.position.Y + (float)this.height > Main.player[this.target].position.Y - 200f)) { this.ai[1] += 4f; } } else { if (num988 > 200f && flag97) { this.ai[1] += 4f; } if (num988 > 600f && (flag97 || this.position.Y + (float)this.height > Main.player[this.target].position.Y - 200f)) { this.ai[1] += 10f; } if (this.wet) { this.ai[1] = 1000f; } } this.defense = this.defDefense; this.damage = this.defDamage; if (this.type >= NPCID.GiantShelly && this.type <= NPCID.GiantShelly2) { this.knockBackResist = 0.75f * Main.knockBackMultiplier; } else { this.knockBackResist = 0.3f * Main.knockBackMultiplier; } this.ai[1] += 1f; if (this.ai[1] >= 400f) { this.ai[1] = 0f; this.ai[0] = 1f; } if (!this.justHit && this.velocity.X != this.oldVelocity.X) { this.direction *= -1; } if (this.velocity.Y == 0f && Main.player[this.target].position.Y < this.position.Y + (float)this.height) { int num989; int num990; if (this.direction > 0) { num989 = (int)(((double)this.position.X + (double)this.width * 0.5) / 16.0); num990 = num989 + 3; } else { num990 = (int)(((double)this.position.X + (double)this.width * 0.5) / 16.0); num989 = num990 - 3; } int num991 = (int)((this.position.Y + (float)this.height + 2f) / 16f) - 1; int num992 = num991 + 4; bool flag98 = false; for (int num993 = num989; num993 <= num990; num993++) { for (int num994 = num991; num994 <= num992; num994++) { if (Main.tile[num993, num994] != null && Main.tile[num993, num994].nactive() && Main.tileSolid[(int)Main.tile[num993, num994].type]) { flag98 = true; } } } if (!flag98) { this.direction *= -1; this.velocity.X = 0.1f * (float)this.direction; } } if (this.type >= NPCID.GiantShelly && this.type <= NPCID.GiantShelly2) { float num995 = 0.5f; if (this.velocity.X < -num995 || this.velocity.X > num995) { if (this.velocity.Y == 0f) { this.velocity *= 0.8f; return; } } else if (this.velocity.X < num995 && this.direction == 1) { this.velocity.X = this.velocity.X + 0.07f; if (this.velocity.X > num995) { this.velocity.X = num995; return; } } else if (this.velocity.X > -num995 && this.direction == -1) { this.velocity.X = this.velocity.X - 0.07f; if (this.velocity.X < -num995) { this.velocity.X = -num995; return; } } } else { float num996 = 1f; if (num988 < 400f) { if (this.velocity.X < -num996 || this.velocity.X > num996) { if (this.velocity.Y == 0f) { this.velocity *= 0.8f; return; } } else if (this.velocity.X < num996 && this.direction == 1) { this.velocity.X = this.velocity.X + 0.07f; if (this.velocity.X > num996) { this.velocity.X = num996; return; } } else if (this.velocity.X > -num996 && this.direction == -1) { this.velocity.X = this.velocity.X - 0.07f; if (this.velocity.X < -num996) { this.velocity.X = -num996; return; } } } else if (this.velocity.X < -1.5f || this.velocity.X > 1.5f) { if (this.velocity.Y == 0f) { this.velocity *= 0.8f; return; } } else if (this.velocity.X < 1.5f && this.direction == 1) { this.velocity.X = this.velocity.X + 0.07f; if (this.velocity.X > 1.5f) { this.velocity.X = 1.5f; return; } } else if (this.velocity.X > -1.5f && this.direction == -1) { this.velocity.X = this.velocity.X - 0.07f; if (this.velocity.X < -1.5f) { this.velocity.X = -1.5f; return; } } } } else if (this.ai[0] == 1f) { this.velocity.X = this.velocity.X * 0.5f; if (this.type >= NPCID.GiantShelly && this.type <= NPCID.GiantShelly2) { this.ai[1] += 0.5f; } else { this.ai[1] += 1f; } if (this.ai[1] >= 30f) { this.netUpdate = true; this.TargetClosest(true); this.ai[1] = 0f; this.ai[2] = 0f; this.ai[0] = 3f; if (this.type == NPCID.SolarSroller) { this.ai[0] = 6f; this.ai[2] = (float)Main.rand.Next(2, 5); return; } } } else { if (this.ai[0] == 3f) { if (Main.expertMode) { if (this.type >= NPCID.GiantShelly && this.type <= NPCID.GiantShelly2) { this.damage = (int)((double)this.defDamage * 1.5 * 0.9); } else { this.damage = (int)((double)(this.defDamage * 2) * 0.9); } } else if (this.type >= NPCID.GiantShelly && this.type <= NPCID.GiantShelly2) { this.damage = (int)((double)this.defDamage * 1.5); } else { this.damage = this.defDamage * 2; } this.defense = this.defDefense * 2; this.ai[1] += 1f; if (this.ai[1] == 1f) { this.netUpdate = true; this.TargetClosest(true); this.ai[2] += 0.3f; this.rotation += this.ai[2] * (float)this.direction; this.ai[1] += 1f; bool flag99 = Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height); float num998 = 10f; if (!flag99) { num998 = 6f; } if (this.type >= NPCID.GiantShelly && this.type <= NPCID.GiantShelly2) { num998 *= 0.75f; } Vector2 vector110 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num999 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector110.X; float num1000 = Math.Abs(num999) * 0.2f; if (this.directionY > 0) { num1000 = 0f; } float num1001 = Main.player[this.target].position.Y - vector110.Y - num1000; float num1002 = (float)Math.Sqrt((double)(num999 * num999 + num1001 * num1001)); this.netUpdate = true; num1002 = num998 / num1002; num999 *= num1002; num1001 *= num1002; if (!flag99) { num1001 = -10f; } this.velocity.X = num999; this.velocity.Y = num1001; this.ai[3] = this.velocity.X; } else { if (this.position.X + (float)this.width > Main.player[this.target].position.X && this.position.X < Main.player[this.target].position.X + (float)Main.player[this.target].width && this.position.Y < Main.player[this.target].position.Y + (float)Main.player[this.target].height) { this.velocity.X = this.velocity.X * 0.8f; this.ai[3] = 0f; if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y + 0.2f; } } if (this.ai[3] != 0f) { this.velocity.X = this.ai[3]; this.velocity.Y = this.velocity.Y - 0.22f; } if (this.ai[1] >= 90f) { this.noGravity = false; this.ai[1] = 0f; this.ai[0] = 4f; } } if (this.wet && this.directionY < 0) { this.velocity.Y = this.velocity.Y - 0.3f; } this.rotation += this.ai[2] * (float)this.direction; return; } if (this.ai[0] == 4f) { if (this.wet && this.directionY < 0) { this.velocity.Y = this.velocity.Y - 0.3f; } this.velocity.X = this.velocity.X * 0.96f; if (this.ai[2] > 0f) { this.ai[2] -= 0.01f; this.rotation += this.ai[2] * (float)this.direction; } else if (this.velocity.Y >= 0f) { this.rotation = 0f; } if (this.ai[2] <= 0f && (this.velocity.Y == 0f || this.wet)) { this.netUpdate = true; this.rotation = 0f; this.ai[2] = 0f; this.ai[1] = 0f; this.ai[0] = 5f; return; } } else { if (this.ai[0] == 6f) { this.damage = (int)((float)this.defDamage * (Main.expertMode ? 1.4f : 1.8f)); this.defense = this.defDefense * 2; this.knockBackResist = 0f; this.ai[1] += 1f; if (this.ai[3] > 0f) { this.ai[3] += 1f; if (this.ai[3] >= 10f) { this.ai[3] = 0f; } } if (this.ai[1] == 1f) { this.netUpdate = true; this.TargetClosest(true); bool flag100 = Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height); float num1010 = 16f; if (!flag100) { num1010 = 10f; } Vector2 vector112 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num1011 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector112.X; float num1012 = Math.Abs(num1011) * 0.2f; if (this.directionY > 0) { num1012 = 0f; } float num1013 = Main.player[this.target].position.Y - vector112.Y - num1012; float num1014 = (float)Math.Sqrt((double)(num1011 * num1011 + num1013 * num1013)); this.netUpdate = true; num1014 = num1010 / num1014; num1011 *= num1014; num1013 *= num1014; if (!flag100) { num1013 = -12f; } this.velocity.X = num1011; this.velocity.Y = num1013; } else { if (this.position.X + (float)this.width > Main.player[this.target].position.X && this.position.X < Main.player[this.target].position.X + (float)Main.player[this.target].width && this.position.Y < Main.player[this.target].position.Y + (float)Main.player[this.target].height) { this.velocity.X = this.velocity.X * 0.9f; if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y + 0.2f; } } if (this.ai[2] == 0f || this.ai[1] >= 1200f) { this.ai[1] = 0f; this.ai[0] = 5f; } } if (this.wet && this.directionY < 0) { this.velocity.Y = this.velocity.Y - 0.3f; } this.rotation += MathHelper.Clamp(this.velocity.X / 10f * (float)this.direction, -0.314159274f, 0.314159274f); return; } if (this.ai[0] == 5f) { this.rotation = 0f; this.velocity.X = 0f; if (this.type >= NPCID.GiantShelly && this.type <= NPCID.GiantShelly2) { this.ai[1] += 0.5f; } else { this.ai[1] += 1f; } if (this.ai[1] >= 30f) { this.TargetClosest(true); this.netUpdate = true; this.ai[1] = 0f; this.ai[0] = 0f; } if (this.wet) { this.ai[0] = 3f; this.ai[1] = 0f; return; } } } } } else if (this.aiStyle == 40) { if (this.target < 0 || this.target == 255 || Main.player[this.target].dead) { this.TargetClosest(true); } float num1015 = 2f; float num1016 = 0.08f; if (this.type == NPCID.DesertScorpionWall) { num1015 = 4f; num1016 = 0.16f; } Vector2 vector113 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num1017 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2); float num1018 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2); num1017 = (float)((int)(num1017 / 8f) * 8); num1018 = (float)((int)(num1018 / 8f) * 8); vector113.X = (float)((int)(vector113.X / 8f) * 8); vector113.Y = (float)((int)(vector113.Y / 8f) * 8); num1017 -= vector113.X; num1018 -= vector113.Y; float num1019 = (float)Math.Sqrt((double)(num1017 * num1017 + num1018 * num1018)); if (num1019 == 0f) { num1017 = this.velocity.X; num1018 = this.velocity.Y; } else { num1019 = num1015 / num1019; num1017 *= num1019; num1018 *= num1019; } if (Main.player[this.target].dead) { num1017 = (float)this.direction * num1015 / 2f; num1018 = -num1015 / 2f; } this.spriteDirection = -1; if (!Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.ai[0] += 1f; if (this.ai[0] > 0f) { this.velocity.Y = this.velocity.Y + 0.023f; } else { this.velocity.Y = this.velocity.Y - 0.023f; } if (this.ai[0] < -100f || this.ai[0] > 100f) { this.velocity.X = this.velocity.X + 0.023f; } else { this.velocity.X = this.velocity.X - 0.023f; } if (this.ai[0] > 200f) { this.ai[0] = -200f; } this.velocity.X = this.velocity.X + num1017 * 0.007f; this.velocity.Y = this.velocity.Y + num1018 * 0.007f; this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X); if ((double)this.velocity.X > 1.5) { this.velocity.X = this.velocity.X * 0.9f; } if ((double)this.velocity.X < -1.5) { this.velocity.X = this.velocity.X * 0.9f; } if ((double)this.velocity.Y > 1.5) { this.velocity.Y = this.velocity.Y * 0.9f; } if ((double)this.velocity.Y < -1.5) { this.velocity.Y = this.velocity.Y * 0.9f; } if (this.velocity.X > 3f) { this.velocity.X = 3f; } if (this.velocity.X < -3f) { this.velocity.X = -3f; } if (this.velocity.Y > 3f) { this.velocity.Y = 3f; } if (this.velocity.Y < -3f) { this.velocity.Y = -3f; } } else { if (this.velocity.X < num1017) { this.velocity.X = this.velocity.X + num1016; if (this.velocity.X < 0f && num1017 > 0f) { this.velocity.X = this.velocity.X + num1016; } } else if (this.velocity.X > num1017) { this.velocity.X = this.velocity.X - num1016; if (this.velocity.X > 0f && num1017 < 0f) { this.velocity.X = this.velocity.X - num1016; } } if (this.velocity.Y < num1018) { this.velocity.Y = this.velocity.Y + num1016; if (this.velocity.Y < 0f && num1018 > 0f) { this.velocity.Y = this.velocity.Y + num1016; } } else if (this.velocity.Y > num1018) { this.velocity.Y = this.velocity.Y - num1016; if (this.velocity.Y > 0f && num1018 < 0f) { this.velocity.Y = this.velocity.Y - num1016; } } this.rotation = (float)Math.Atan2((double)num1018, (double)num1017); } if (this.type == NPCID.DesertScorpionWall) { this.rotation += 1.57079637f; } float num1020 = 0.5f; if (this.collideX) { this.netUpdate = true; this.velocity.X = this.oldVelocity.X * -num1020; if (this.direction == -1 && this.velocity.X > 0f && this.velocity.X < 2f) { this.velocity.X = 2f; } if (this.direction == 1 && this.velocity.X < 0f && this.velocity.X > -2f) { this.velocity.X = -2f; } } if (this.collideY) { this.netUpdate = true; this.velocity.Y = this.oldVelocity.Y * -num1020; if (this.velocity.Y > 0f && (double)this.velocity.Y < 1.5) { this.velocity.Y = 2f; } if (this.velocity.Y < 0f && (double)this.velocity.Y > -1.5) { this.velocity.Y = -2f; } } if (((this.velocity.X > 0f && this.oldVelocity.X < 0f) || (this.velocity.X < 0f && this.oldVelocity.X > 0f) || (this.velocity.Y > 0f && this.oldVelocity.Y < 0f) || (this.velocity.Y < 0f && this.oldVelocity.Y > 0f)) && !this.justHit) { this.netUpdate = true; } if (Main.netMode != 1) { if (Main.netMode != 1 && Main.expertMode && this.target >= 0 && (this.type == NPCID.BlackRecluse || this.type == NPCID.BlackRecluseWall) && Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.localAI[0] += 1f; if (this.justHit) { this.localAI[0] -= (float)Main.rand.Next(20, 60); if (this.localAI[0] < 0f) { this.localAI[0] = 0f; } } if (this.localAI[0] > (float)Main.rand.Next(180, 900)) { this.localAI[0] = 0f; Vector2 vector114 = Main.player[this.target].Center - base.Center; vector114.Normalize(); vector114 *= 8f; Projectile.NewProjectile(base.Center.X, base.Center.Y, vector114.X, vector114.Y, 472, 18, 0f, Main.myPlayer, 0f, 0f); } } int num1021 = (int)base.Center.X / 16; int num1022 = (int)base.Center.Y / 16; bool flag101 = false; for (int num1023 = num1021 - 1; num1023 <= num1021 + 1; num1023++) { for (int num1024 = num1022 - 1; num1024 <= num1022 + 1; num1024++) { if (Main.tile[num1023, num1024] == null) { return; } if (Main.tile[num1023, num1024].wall > 0) { flag101 = true; } } } if (!flag101) { if (this.type == NPCID.JungleCreeperWall) { this.Transform(236); return; } if (this.type == NPCID.BlackRecluseWall) { this.Transform(163); return; } if (this.type == NPCID.BloodCrawlerWall) { this.Transform(239); return; } if (this.type == NPCID.DesertScorpionWall) { this.Transform(530); return; } this.Transform(164); return; } } } else if (this.aiStyle == 41) { if (this.ai[2] > 1f) { this.ai[2] -= 1f; } if (this.ai[2] == 0f) { this.ai[0] = -100f; this.ai[2] = 1f; this.TargetClosest(true); this.spriteDirection = this.direction; } if (this.type == NPCID.ChatteringTeethBomb) { Vector2 value14 = new Vector2(-6f, -10f); value14.X *= (float)this.spriteDirection; if (this.ai[1] == 5f) { this.velocity = Vector2.Zero; this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 160; this.height = 160; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.dontTakeDamage = true; if (this.ai[2] == 1f) { this.life = -1; this.HitEffect(0, 10.0); this.active = false; } return; } } if (this.type == NPCID.ChatteringTeethBomb && this.ai[1] != 5f) { if (this.wet || Vector2.Distance(base.Center, Main.player[this.target].Center) < 64f) { this.ai[1] = 5f; this.ai[2] = 3f; this.netUpdate = true; return; } } else if (this.wet && this.type != NPCID.Derpling) { if (this.collideX) { this.direction *= -this.direction; this.spriteDirection = this.direction; } if (this.collideY) { this.TargetClosest(true); if (this.oldVelocity.Y < 0f) { this.velocity.Y = 5f; } else { this.velocity.Y = this.velocity.Y - 2f; } this.spriteDirection = this.direction; } if (this.velocity.Y > 4f) { this.velocity.Y = this.velocity.Y * 0.95f; } this.velocity.Y = this.velocity.Y - 0.3f; if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } } if (this.velocity.Y == 0f) { if (this.ai[3] == this.position.X) { this.direction *= -1; this.ai[2] = 300f; } this.ai[3] = 0f; this.velocity.X = this.velocity.X * 0.8f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } if (this.type == NPCID.Derpling) { this.ai[0] += 2f; } else { this.ai[0] += 5f; } Vector2 vector115 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num1031 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector115.X; float num1032 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector115.Y; float num1033 = (float)Math.Sqrt((double)(num1031 * num1031 + num1032 * num1032)); float num1034 = 400f / num1033; if (this.type == NPCID.Derpling) { num1034 *= 5f; } else { num1034 *= 10f; } if (num1034 > 30f) { num1034 = 30f; } this.ai[0] += (float)((int)num1034); if (this.ai[0] >= 0f) { this.netUpdate = true; if (this.ai[2] == 1f) { this.TargetClosest(true); } if (this.type == NPCID.Derpling) { if (this.ai[1] == 2f) { this.velocity.Y = -11.5f; this.velocity.X = this.velocity.X + 2f * (float)this.direction; if (num1033 < 350f && num1033 > 200f) { this.velocity.X = this.velocity.X + (float)this.direction; } this.ai[0] = -200f; this.ai[1] = 0f; this.ai[3] = this.position.X; } else { this.velocity.Y = -7.5f; this.velocity.X = this.velocity.X + (float)(4 * this.direction); if (num1033 < 350f && num1033 > 200f) { this.velocity.X = this.velocity.X + (float)this.direction; } this.ai[0] = -120f; this.ai[1] += 1f; } } else if (this.ai[1] == 3f) { this.velocity.Y = -9f; this.velocity.X = this.velocity.X + (float)(3 * this.direction); if (num1033 < 350f && num1033 > 200f) { this.velocity.X = this.velocity.X + (float)this.direction; } this.ai[0] = -200f; this.ai[1] = 0f; this.ai[3] = this.position.X; } else { this.velocity.Y = -5f; this.velocity.X = this.velocity.X + (float)(5 * this.direction); if (num1033 < 350f && num1033 > 200f) { this.velocity.X = this.velocity.X + (float)this.direction; } this.ai[0] = -120f; this.ai[1] += 1f; } } else if (this.ai[0] >= -30f) { this.aiAction = 1; } this.spriteDirection = this.direction; return; } if (this.target < 255) { if (this.type == NPCID.Derpling) { bool flag102 = false; if (this.position.Y + (float)this.height < Main.player[this.target].position.Y && this.position.X + (float)this.width > Main.player[this.target].position.X && this.position.X < Main.player[this.target].position.X + (float)Main.player[this.target].width) { flag102 = true; this.velocity.X = this.velocity.X * 0.92f; if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.9f; this.velocity.Y = this.velocity.Y + 0.1f; } } if (!flag102 && ((this.direction == 1 && this.velocity.X < 4f) || (this.direction == -1 && this.velocity.X > -4f))) { if ((this.direction == -1 && (double)this.velocity.X < 0.1) || (this.direction == 1 && (double)this.velocity.X > -0.1)) { this.velocity.X = this.velocity.X + 0.2f * (float)this.direction; return; } this.velocity.X = this.velocity.X * 0.93f; return; } } else if ((this.direction == 1 && this.velocity.X < 3f) || (this.direction == -1 && this.velocity.X > -3f)) { if ((this.direction == -1 && (double)this.velocity.X < 0.1) || (this.direction == 1 && (double)this.velocity.X > -0.1)) { this.velocity.X = this.velocity.X + 0.2f * (float)this.direction; return; } this.velocity.X = this.velocity.X * 0.93f; return; } } } else if (this.aiStyle == 42) { this.TargetClosest(true); if (this.ai[0] == 0f) { if (this.target >= 0) { Vector2 vector116 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num1035 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector116.X; float num1036 = Main.player[this.target].position.Y - vector116.Y; float num1037 = (float)Math.Sqrt((double)(num1035 * num1035 + num1036 * num1036)); if (num1037 < 200f && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { this.ai[0] = 1f; } } if (this.velocity.X != 0f || this.velocity.Y < 0f || this.velocity.Y > 2f || this.life != this.lifeMax) { this.ai[0] = 1f; return; } } else { this.ai[0] += 1f; if (this.ai[0] >= 21f) { this.ai[0] = 21f; this.Transform(196); return; } } } else if (this.aiStyle == 43) { int num1038 = 0; for (int num1039 = 0; num1039 < 255; num1039++) { if (Main.player[num1039].active && !Main.player[num1039].dead && (base.Center - Main.player[num1039].Center).Length() < 1000f) { num1038++; } } if (Main.expertMode) { int num1040 = (int)(20f * (1f - (float)this.life / (float)this.lifeMax)); this.defense = this.defDefense + num1040; } if (this.target < 0 || this.target == 255 || Main.player[this.target].dead || !Main.player[this.target].active) { this.TargetClosest(true); } bool dead4 = Main.player[this.target].dead; if (dead4 && Main.expertMode) { if ((double)this.position.Y < Main.worldSurface * 16.0 + 2000.0) { this.velocity.Y = this.velocity.Y + 0.04f; } if (this.position.X < (float)(Main.maxTilesX * 8)) { this.velocity.X = this.velocity.X - 0.04f; } else { this.velocity.X = this.velocity.X + 0.04f; } if (this.timeLeft > 10) { this.timeLeft = 10; return; } } else if (this.ai[0] == -1f) { if (Main.netMode != 1) { float num1041 = this.ai[1]; int num1042; do { num1042 = Main.rand.Next(3); if (num1042 == 1) { num1042 = 2; } else if (num1042 == 2) { num1042 = 3; } } while ((float)num1042 == num1041); this.ai[0] = (float)num1042; this.ai[1] = 0f; this.ai[2] = 0f; return; } } else if (this.ai[0] == 0f) { int num1043 = 2; if (Main.expertMode) { if (this.life < this.lifeMax / 2) { num1043++; } if (this.life < this.lifeMax / 3) { num1043++; } if (this.life < this.lifeMax / 5) { num1043++; } } if (this.ai[1] > (float)(2 * num1043) && this.ai[1] % 2f == 0f) { this.ai[0] = -1f; this.ai[1] = 0f; this.ai[2] = 0f; this.netUpdate = true; return; } if (this.ai[1] % 2f == 0f) { this.TargetClosest(true); if (Math.Abs(this.position.Y + (float)(this.height / 2) - (Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2))) < 20f) { this.localAI[0] = 1f; this.ai[1] += 1f; this.ai[2] = 0f; float num1044 = 12f; if (Main.expertMode) { num1044 = 16f; if ((double)this.life < (double)this.lifeMax * 0.75) { num1044 += 2f; } if ((double)this.life < (double)this.lifeMax * 0.5) { num1044 += 2f; } if ((double)this.life < (double)this.lifeMax * 0.25) { num1044 += 2f; } if ((double)this.life < (double)this.lifeMax * 0.1) { num1044 += 2f; } } Vector2 vector117 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num1045 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector117.X; float num1046 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector117.Y; float num1047 = (float)Math.Sqrt((double)(num1045 * num1045 + num1046 * num1046)); num1047 = num1044 / num1047; this.velocity.X = num1045 * num1047; this.velocity.Y = num1046 * num1047; this.spriteDirection = this.direction; return; } this.localAI[0] = 0f; float num1048 = 12f; float num1049 = 0.15f; if (Main.expertMode) { if ((double)this.life < (double)this.lifeMax * 0.75) { num1048 += 1f; num1049 += 0.05f; } if ((double)this.life < (double)this.lifeMax * 0.5) { num1048 += 1f; num1049 += 0.05f; } if ((double)this.life < (double)this.lifeMax * 0.25) { num1048 += 2f; num1049 += 0.05f; } if ((double)this.life < (double)this.lifeMax * 0.1) { num1048 += 2f; num1049 += 0.1f; } } if (this.position.Y + (float)(this.height / 2) < Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2)) { this.velocity.Y = this.velocity.Y + num1049; } else { this.velocity.Y = this.velocity.Y - num1049; } if (this.velocity.Y < -12f) { this.velocity.Y = -num1048; } if (this.velocity.Y > 12f) { this.velocity.Y = num1048; } if (Math.Abs(this.position.X + (float)(this.width / 2) - (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2))) > 600f) { this.velocity.X = this.velocity.X + 0.15f * (float)this.direction; } else if (Math.Abs(this.position.X + (float)(this.width / 2) - (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2))) < 300f) { this.velocity.X = this.velocity.X - 0.15f * (float)this.direction; } else { this.velocity.X = this.velocity.X * 0.8f; } if (this.velocity.X < -16f) { this.velocity.X = -16f; } if (this.velocity.X > 16f) { this.velocity.X = 16f; } this.spriteDirection = this.direction; return; } else { if (this.velocity.X < 0f) { this.direction = -1; } else { this.direction = 1; } this.spriteDirection = this.direction; int num1050 = 600; if (Main.expertMode) { if ((double)this.life < (double)this.lifeMax * 0.1) { num1050 = 300; } else if ((double)this.life < (double)this.lifeMax * 0.25) { num1050 = 450; } else if ((double)this.life < (double)this.lifeMax * 0.5) { num1050 = 500; } else if ((double)this.life < (double)this.lifeMax * 0.75) { num1050 = 550; } } int num1051 = 1; if (this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2)) { num1051 = -1; } if (this.direction == num1051 && Math.Abs(this.position.X + (float)(this.width / 2) - (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2))) > (float)num1050) { this.ai[2] = 1f; } if (this.ai[2] != 1f) { this.localAI[0] = 1f; return; } this.TargetClosest(true); this.spriteDirection = this.direction; this.localAI[0] = 0f; this.velocity *= 0.9f; float num1052 = 0.1f; if (Main.expertMode) { if (this.life < this.lifeMax / 2) { this.velocity *= 0.9f; num1052 += 0.05f; } if (this.life < this.lifeMax / 3) { this.velocity *= 0.9f; num1052 += 0.05f; } if (this.life < this.lifeMax / 5) { this.velocity *= 0.9f; num1052 += 0.05f; } } if (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) < num1052) { this.ai[2] = 0f; this.ai[1] += 1f; return; } } } else if (this.ai[0] == 2f) { this.TargetClosest(true); this.spriteDirection = this.direction; float num1053 = 12f; float num1054 = 0.07f; if (Main.expertMode) { num1054 = 0.1f; } Vector2 vector118 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num1055 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector118.X; float num1056 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - 200f - vector118.Y; float num1057 = (float)Math.Sqrt((double)(num1055 * num1055 + num1056 * num1056)); if (num1057 < 200f) { this.ai[0] = 1f; this.ai[1] = 0f; this.netUpdate = true; return; } num1057 = num1053 / num1057; if (this.velocity.X < num1055) { this.velocity.X = this.velocity.X + num1054; if (this.velocity.X < 0f && num1055 > 0f) { this.velocity.X = this.velocity.X + num1054; } } else if (this.velocity.X > num1055) { this.velocity.X = this.velocity.X - num1054; if (this.velocity.X > 0f && num1055 < 0f) { this.velocity.X = this.velocity.X - num1054; } } if (this.velocity.Y < num1056) { this.velocity.Y = this.velocity.Y + num1054; if (this.velocity.Y < 0f && num1056 > 0f) { this.velocity.Y = this.velocity.Y + num1054; return; } } else if (this.velocity.Y > num1056) { this.velocity.Y = this.velocity.Y - num1054; if (this.velocity.Y > 0f && num1056 < 0f) { this.velocity.Y = this.velocity.Y - num1054; return; } } } else if (this.ai[0] == 1f) { this.localAI[0] = 0f; this.TargetClosest(true); Vector2 vector119 = new Vector2(this.position.X + (float)(this.width / 2) + (float)(Main.rand.Next(20) * this.direction), this.position.Y + (float)this.height * 0.8f); Vector2 vector120 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num1058 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector120.X; float num1059 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector120.Y; float num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); this.ai[1] += 1f; if (Main.expertMode) { this.ai[1] += (float)(num1038 / 2); if ((double)this.life < (double)this.lifeMax * 0.75) { this.ai[1] += 0.25f; } if ((double)this.life < (double)this.lifeMax * 0.5) { this.ai[1] += 0.25f; } if ((double)this.life < (double)this.lifeMax * 0.25) { this.ai[1] += 0.25f; } if ((double)this.life < (double)this.lifeMax * 0.1) { this.ai[1] += 0.25f; } } bool flag103 = false; if (this.ai[1] > 40f) { this.ai[1] = 0f; this.ai[2] += 1f; flag103 = true; } if (Collision.CanHit(vector119, 1, 1, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height) && flag103) { if (Main.netMode != 1) { int num1061 = Main.rand.Next(210, 212); int num1062 = NPC.NewNPC((int)vector119.X, (int)vector119.Y, num1061, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num1062].velocity.X = (float)Main.rand.Next(-200, 201) * 0.002f; Main.npc[num1062].velocity.Y = (float)Main.rand.Next(-200, 201) * 0.002f; Main.npc[num1062].localAI[0] = 60f; Main.npc[num1062].netUpdate = true; } } if (num1060 > 400f || !Collision.CanHit(new Vector2(vector119.X, vector119.Y - 30f), 1, 1, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { float num1063 = 14f; float num1064 = 0.1f; vector120 = vector119; num1058 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector120.X; num1059 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector120.Y; num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); num1060 = num1063 / num1060; if (this.velocity.X < num1058) { this.velocity.X = this.velocity.X + num1064; if (this.velocity.X < 0f && num1058 > 0f) { this.velocity.X = this.velocity.X + num1064; } } else if (this.velocity.X > num1058) { this.velocity.X = this.velocity.X - num1064; if (this.velocity.X > 0f && num1058 < 0f) { this.velocity.X = this.velocity.X - num1064; } } if (this.velocity.Y < num1059) { this.velocity.Y = this.velocity.Y + num1064; if (this.velocity.Y < 0f && num1059 > 0f) { this.velocity.Y = this.velocity.Y + num1064; } } else if (this.velocity.Y > num1059) { this.velocity.Y = this.velocity.Y - num1064; if (this.velocity.Y > 0f && num1059 < 0f) { this.velocity.Y = this.velocity.Y - num1064; } } } else { this.velocity *= 0.9f; } this.spriteDirection = this.direction; if (this.ai[2] > 5f) { this.ai[0] = -1f; this.ai[1] = 1f; this.netUpdate = true; return; } } else if (this.ai[0] == 3f) { float num1065 = 4f; float num1066 = 0.05f; if (Main.expertMode) { num1066 = 0.075f; num1065 = 6f; } Vector2 vector121 = new Vector2(this.position.X + (float)(this.width / 2) + (float)(Main.rand.Next(20) * this.direction), this.position.Y + (float)this.height * 0.8f); Vector2 vector122 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num1067 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector122.X; float num1068 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - 300f - vector122.Y; float num1069 = (float)Math.Sqrt((double)(num1067 * num1067 + num1068 * num1068)); this.ai[1] += 1f; bool flag104 = false; if (Main.expertMode) { if ((double)this.life < (double)this.lifeMax * 0.1) { if (this.ai[1] % 15f == 14f) { flag104 = true; } } else if (this.life < this.lifeMax / 3) { if (this.ai[1] % 25f == 24f) { flag104 = true; } } else if (this.life < this.lifeMax / 2) { if (this.ai[1] % 30f == 29f) { flag104 = true; } } else if (this.ai[1] % 35f == 34f) { flag104 = true; } } else if (this.ai[1] % 40f == 39f) { flag104 = true; } if (flag104 && this.position.Y + (float)this.height < Main.player[this.target].position.Y && Collision.CanHit(vector121, 1, 1, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { if (Main.netMode != 1) { float num1070 = 8f; if (Main.expertMode) { num1070 += 2f; } if (Main.expertMode && (double)this.life < (double)this.lifeMax * 0.1) { num1070 += 3f; } float num1071 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector121.X + (float)Main.rand.Next(-80, 81); float num1072 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector121.Y + (float)Main.rand.Next(-40, 41); float num1073 = (float)Math.Sqrt((double)(num1071 * num1071 + num1072 * num1072)); num1073 = num1070 / num1073; num1071 *= num1073; num1072 *= num1073; int num1074 = 11; int num1075 = 55; int num1076 = Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, num1075, num1074, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num1076].timeLeft = 300; } } if (!Collision.CanHit(new Vector2(vector121.X, vector121.Y - 30f), 1, 1, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { num1065 = 14f; num1066 = 0.1f; vector122 = vector121; num1067 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector122.X; num1068 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector122.Y; num1069 = (float)Math.Sqrt((double)(num1067 * num1067 + num1068 * num1068)); num1069 = num1065 / num1069; if (this.velocity.X < num1067) { this.velocity.X = this.velocity.X + num1066; if (this.velocity.X < 0f && num1067 > 0f) { this.velocity.X = this.velocity.X + num1066; } } else if (this.velocity.X > num1067) { this.velocity.X = this.velocity.X - num1066; if (this.velocity.X > 0f && num1067 < 0f) { this.velocity.X = this.velocity.X - num1066; } } if (this.velocity.Y < num1068) { this.velocity.Y = this.velocity.Y + num1066; if (this.velocity.Y < 0f && num1068 > 0f) { this.velocity.Y = this.velocity.Y + num1066; } } else if (this.velocity.Y > num1068) { this.velocity.Y = this.velocity.Y - num1066; if (this.velocity.Y > 0f && num1068 < 0f) { this.velocity.Y = this.velocity.Y - num1066; } } } else if (num1069 > 100f) { this.TargetClosest(true); this.spriteDirection = this.direction; num1069 = num1065 / num1069; if (this.velocity.X < num1067) { this.velocity.X = this.velocity.X + num1066; if (this.velocity.X < 0f && num1067 > 0f) { this.velocity.X = this.velocity.X + num1066 * 2f; } } else if (this.velocity.X > num1067) { this.velocity.X = this.velocity.X - num1066; if (this.velocity.X > 0f && num1067 < 0f) { this.velocity.X = this.velocity.X - num1066 * 2f; } } if (this.velocity.Y < num1068) { this.velocity.Y = this.velocity.Y + num1066; if (this.velocity.Y < 0f && num1068 > 0f) { this.velocity.Y = this.velocity.Y + num1066 * 2f; } } else if (this.velocity.Y > num1068) { this.velocity.Y = this.velocity.Y - num1066; if (this.velocity.Y > 0f && num1068 < 0f) { this.velocity.Y = this.velocity.Y - num1066 * 2f; } } } if (this.ai[1] > 800f) { this.ai[0] = -1f; this.ai[1] = 3f; this.netUpdate = true; return; } } } else if (this.aiStyle == 44) { this.noGravity = true; if (this.collideX) { if (this.oldVelocity.X > 0f) { this.direction = -1; } else { this.direction = 1; } this.velocity.X = (float)this.direction; } if (this.collideY) { if (this.oldVelocity.Y > 0f) { this.directionY = -1; } else { this.directionY = 1; } this.velocity.Y = (float)this.directionY; } int num1077 = this.target; int direction5 = this.direction; if (this.target == 255 || Main.player[this.target].dead || Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[0] = 90f; this.TargetClosest(true); } else if (this.ai[0] > 0f) { this.ai[0] -= 1f; this.TargetClosest(true); } if (this.netUpdate && num1077 == this.target && direction5 == this.direction) { this.netUpdate = false; } float num1078 = 0.05f; float num1079 = 0.01f; float num1080 = 3f; float num1081 = 1f; float num1082 = 30f; float num1083 = 100f; float num1084 = Math.Abs(this.position.X + (float)(this.width / 2) - (Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2))); float num1085 = Main.player[this.target].position.Y - (float)(this.height / 2); if (this.type == NPCID.FlyingAntlion) { num1078 = 0.09f; num1079 = 0.03f; num1080 = 5f; num1081 = 2f; num1082 = 40f; num1083 = 150f; num1085 = Main.player[this.target].Center.Y - (float)(this.height / 2); this.rotation = this.velocity.X * 0.1f; for (int num1086 = 0; num1086 < 200; num1086++) { if (num1086 != this.whoAmI && Main.npc[num1086].active && Main.npc[num1086].type == this.type && Math.Abs(this.position.X - Main.npc[num1086].position.X) + Math.Abs(this.position.Y - Main.npc[num1086].position.Y) < (float)this.width) { if (this.position.X < Main.npc[num1086].position.X) { this.velocity.X = this.velocity.X - 0.05f; } else { this.velocity.X = this.velocity.X + 0.05f; } if (this.position.Y < Main.npc[num1086].position.Y) { this.velocity.Y = this.velocity.Y - 0.05f; } else { this.velocity.Y = this.velocity.Y + 0.05f; } } } } if (this.ai[0] <= 0f) { num1080 *= 0.8f; num1078 *= 0.7f; num1085 = base.Center.Y + (float)(this.directionY * 1000); if (this.velocity.X < 0f) { this.direction = -1; } else if (this.velocity.X > 0f || this.direction == 0) { this.direction = 1; } } if (num1084 > num1082) { if (this.direction == -1 && this.velocity.X > -num1080) { this.velocity.X = this.velocity.X - num1078; if (this.velocity.X > num1080) { this.velocity.X = this.velocity.X - num1078; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X - num1078 / 2f; } if (this.velocity.X < -num1080) { this.velocity.X = -num1080; } } else if (this.direction == 1 && this.velocity.X < num1080) { this.velocity.X = this.velocity.X + num1078; if (this.velocity.X < -num1080) { this.velocity.X = this.velocity.X + num1078; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X + num1078 / 2f; } if (this.velocity.X > num1080) { this.velocity.X = num1080; } } } if (num1084 > num1083) { num1085 -= num1083 / 2f; } if (this.position.Y < num1085) { this.velocity.Y = this.velocity.Y + num1079; if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y + num1079; } } else { this.velocity.Y = this.velocity.Y - num1079; if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y - num1079; } } if (this.velocity.Y < -num1081) { this.velocity.Y = -num1081; } if (this.velocity.Y > num1081) { this.velocity.Y = num1081; return; } } else if (this.aiStyle == 45) { NPC.golemBoss = this.whoAmI; if (this.localAI[0] == 0f && Main.netMode != 1) { this.localAI[0] = 1f; NPC.NewNPC((int)base.Center.X - 84, (int)base.Center.Y - 9, 247, 0, 0f, 0f, 0f, 0f, 255); NPC.NewNPC((int)base.Center.X + 78, (int)base.Center.Y - 9, 248, 0, 0f, 0f, 0f, 0f, 255); NPC.NewNPC((int)base.Center.X - 3, (int)base.Center.Y - 57, 246, 0, 0f, 0f, 0f, 0f, 255); } if (this.target >= 0 && Main.player[this.target].dead) { this.TargetClosest(true); if (Main.player[this.target].dead) { this.noTileCollide = true; } } if (this.alpha > 0) { this.alpha -= 10; if (this.alpha < 0) { this.alpha = 0; } this.ai[1] = 0f; } bool flag105 = false; bool flag106 = false; bool flag107 = false; this.dontTakeDamage = false; for (int num1087 = 0; num1087 < 200; num1087++) { if (Main.npc[num1087].active && Main.npc[num1087].type == NPCID.GolemHead) { flag105 = true; } if (Main.npc[num1087].active && Main.npc[num1087].type == NPCID.GolemFistLeft) { flag106 = true; } if (Main.npc[num1087].active && Main.npc[num1087].type == NPCID.GolemFistRight) { flag107 = true; } } this.dontTakeDamage = flag105; if (this.ai[0] == 0f) { this.noTileCollide = false; if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.8f; this.ai[1] += 1f; if (this.ai[1] > 0f) { if (!flag106) { this.ai[1] += 2f; } if (!flag107) { this.ai[1] += 2f; } if (!flag105) { this.ai[1] += 2f; } if (this.life < this.lifeMax) { this.ai[1] += 1f; } if (this.life < this.lifeMax / 2) { this.ai[1] += 4f; } if (this.life < this.lifeMax / 3) { this.ai[1] += 8f; } } if (this.ai[1] >= 300f) { this.ai[1] = -20f; this.frameCounter = 0.0; } else if (this.ai[1] == -1f) { this.TargetClosest(true); this.velocity.X = (float)(4 * this.direction); this.velocity.Y = -12.1f; this.ai[0] = 1f; this.ai[1] = 0f; } } } else if (this.ai[0] == 1f) { if (this.velocity.Y == 0f) { this.ai[0] = 0f; } else { this.TargetClosest(true); if (this.position.X < Main.player[this.target].position.X && this.position.X + (float)this.width > Main.player[this.target].position.X + (float)Main.player[this.target].width) { this.velocity.X = this.velocity.X * 0.9f; this.velocity.Y = this.velocity.Y + 0.2f; } else { if (this.direction < 0) { this.velocity.X = this.velocity.X - 0.2f; } else if (this.direction > 0) { this.velocity.X = this.velocity.X + 0.2f; } float num1094 = 3f; if (this.life < this.lifeMax) { num1094 += 1f; } if (this.life < this.lifeMax / 2) { num1094 += 1f; } if (this.life < this.lifeMax / 4) { num1094 += 1f; } if (this.velocity.X < -num1094) { this.velocity.X = -num1094; } if (this.velocity.X > num1094) { this.velocity.X = num1094; } } } } if (this.target <= 0 || this.target == 255 || Main.player[this.target].dead) { this.TargetClosest(true); } int num1095 = 3000; if (Math.Abs(base.Center.X - Main.player[this.target].Center.X) + Math.Abs(base.Center.Y - Main.player[this.target].Center.Y) > (float)num1095) { this.TargetClosest(true); if (Math.Abs(base.Center.X - Main.player[this.target].Center.X) + Math.Abs(base.Center.Y - Main.player[this.target].Center.Y) > (float)num1095) { this.active = false; return; } } } else if (this.aiStyle == 46) { this.noTileCollide = true; if (NPC.golemBoss < 0) { this.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); return; } float num1096 = 12f; Vector2 vector123 = new Vector2(base.Center.X, base.Center.Y); float num1097 = Main.npc[NPC.golemBoss].Center.X - vector123.X; float num1098 = Main.npc[NPC.golemBoss].Center.Y - vector123.Y; num1098 -= 57f; num1097 -= 3f; float num1099 = (float)Math.Sqrt((double)(num1097 * num1097 + num1098 * num1098)); if (num1099 < 20f) { this.rotation = 0f; this.velocity.X = num1097; this.velocity.Y = num1098; } else { num1099 = num1096 / num1099; this.velocity.X = num1097 * num1099; this.velocity.Y = num1098 * num1099; this.rotation = this.velocity.X * 0.1f; } if (this.alpha > 0) { this.alpha -= 10; if (this.alpha < 0) { this.alpha = 0; } this.ai[1] = 30f; } if (this.ai[0] == 0f) { this.ai[1] += 1f; int num1100 = 300; if (this.ai[1] < 20f || this.ai[1] > (float)(num1100 - 20)) { this.localAI[0] = 1f; } else { this.localAI[0] = 0f; } if (this.ai[1] >= (float)num1100) { this.TargetClosest(true); this.ai[1] = 0f; Vector2 vector124 = new Vector2(base.Center.X, base.Center.Y + 10f); float num1101 = 8f; float num1102 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector124.X; float num1103 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector124.Y; float num1104 = (float)Math.Sqrt((double)(num1102 * num1102 + num1103 * num1103)); num1104 = num1101 / num1104; num1102 *= num1104; num1103 *= num1104; int num1105 = 18; int num1106 = 258; if (Main.netMode != 1) { Projectile.NewProjectile(vector124.X, vector124.Y, num1102, num1103, num1106, num1105, 0f, Main.myPlayer, 0f, 0f); } } } else if (this.ai[0] == 1f) { this.TargetClosest(true); Vector2 vector125 = new Vector2(base.Center.X, base.Center.Y + 10f); if (Main.player[this.target].Center.X < base.Center.X - (float)this.width) { this.localAI[1] = -1f; vector125.X -= 40f; } else if (Main.player[this.target].Center.X > base.Center.X + (float)this.width) { this.localAI[1] = 1f; vector125.X += 40f; } else { this.localAI[1] = 0f; } this.ai[1] += 1f; if ((double)this.life < (double)this.lifeMax * 0.4) { this.ai[1] += 1f; } if ((double)this.life < (double)this.lifeMax * 0.2) { this.ai[1] += 1f; } int num1107 = 300; if (this.ai[1] < 20f || this.ai[1] > (float)(num1107 - 20)) { this.localAI[0] = 1f; } else { this.localAI[0] = 0f; } if (this.ai[1] >= (float)num1107) { this.TargetClosest(true); this.ai[1] = 0f; float num1108 = 8f; float num1109 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector125.X; float num1110 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector125.Y; float num1111 = (float)Math.Sqrt((double)(num1109 * num1109 + num1110 * num1110)); num1111 = num1108 / num1111; num1109 *= num1111; num1110 *= num1111; int num1112 = 24; int num1113 = 258; if (Main.netMode != 1) { Projectile.NewProjectile(vector125.X, vector125.Y, num1109, num1110, num1113, num1112, 0f, Main.myPlayer, 0f, 0f); } } this.ai[2] += 1f; if (this.life < this.lifeMax / 3) { this.ai[2] += 1f; } if (this.life < this.lifeMax / 4) { this.ai[2] += 1f; } if (this.life < this.lifeMax / 5) { this.ai[2] += 1f; } if (!Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[2] += 4f; } if (this.ai[2] > (float)(60 + Main.rand.Next(600))) { this.ai[2] = 0f; int num1114 = 28; int num1115 = 259; if (this.localAI[1] == 0f) { for (int num1116 = 0; num1116 < 2; num1116++) { vector125 = new Vector2(base.Center.X, base.Center.Y - 22f); if (num1116 == 0) { vector125.X -= 18f; } else { vector125.X += 18f; } float num1117 = 11f; float num1118 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector125.X; float num1119 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector125.Y; float num1120 = (float)Math.Sqrt((double)(num1118 * num1118 + num1119 * num1119)); num1120 = num1117 / num1120; num1118 *= num1120; num1119 *= num1120; vector125.X += num1118 * 3f; vector125.Y += num1119 * 3f; if (Main.netMode != 1) { int num1121 = Projectile.NewProjectile(vector125.X, vector125.Y, num1118, num1119, num1115, num1114, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num1121].timeLeft = 300; } } } else if (this.localAI[1] != 0f) { vector125 = new Vector2(base.Center.X, base.Center.Y - 22f); if (this.localAI[1] == -1f) { vector125.X -= 30f; } else if (this.localAI[1] == 1f) { vector125.X += 30f; } float num1122 = 12f; float num1123 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector125.X; float num1124 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector125.Y; float num1125 = (float)Math.Sqrt((double)(num1123 * num1123 + num1124 * num1124)); num1125 = num1122 / num1125; num1123 *= num1125; num1124 *= num1125; vector125.X += num1123 * 3f; vector125.Y += num1124 * 3f; if (Main.netMode != 1) { int num1126 = Projectile.NewProjectile(vector125.X, vector125.Y, num1123, num1124, num1115, num1114, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num1126].timeLeft = 300; } } } } if (this.life < this.lifeMax / 2) { this.ai[0] = 1f; return; } this.ai[0] = 0f; return; } else if (this.aiStyle == 47) { if (NPC.golemBoss < 0) { this.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); return; } if (this.alpha > 0) { this.alpha -= 10; if (this.alpha < 0) { this.alpha = 0; } this.ai[1] = 0f; } if (this.ai[0] == 0f) { this.noTileCollide = true; float num1127 = 14f; if (this.life < this.lifeMax / 2) { num1127 += 3f; } if (this.life < this.lifeMax / 4) { num1127 += 3f; } if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax) { num1127 += 8f; } Vector2 vector126 = new Vector2(base.Center.X, base.Center.Y); float num1128 = Main.npc[NPC.golemBoss].Center.X - vector126.X; float num1129 = Main.npc[NPC.golemBoss].Center.Y - vector126.Y; num1129 -= 9f; if (this.type == NPCID.GolemFistLeft) { num1128 -= 84f; } else { num1128 += 78f; } float num1130 = (float)Math.Sqrt((double)(num1128 * num1128 + num1129 * num1129)); if (num1130 < 12f + num1127) { this.rotation = 0f; this.velocity.X = num1128; this.velocity.Y = num1129; this.ai[1] += 1f; if (this.life < this.lifeMax / 2) { this.ai[1] += 1f; } if (this.life < this.lifeMax / 4) { this.ai[1] += 1f; } if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax) { this.ai[1] += 10f; } if (this.ai[1] >= 60f) { this.TargetClosest(true); if ((this.type == NPCID.GolemFistLeft && base.Center.X + 100f > Main.player[this.target].Center.X) || (this.type == NPCID.GolemFistRight && base.Center.X - 100f < Main.player[this.target].Center.X)) { this.ai[1] = 0f; this.ai[0] = 1f; return; } this.ai[1] = 0f; return; } } else { num1130 = num1127 / num1130; this.velocity.X = num1128 * num1130; this.velocity.Y = num1129 * num1130; this.rotation = (float)Math.Atan2((double)(-(double)this.velocity.Y), (double)(-(double)this.velocity.X)); if (this.type == NPCID.GolemFistLeft) { this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X); return; } } } else if (this.ai[0] == 1f) { this.noTileCollide = true; this.collideX = false; this.collideY = false; float num1131 = 12f; if (this.life < this.lifeMax / 2) { num1131 += 4f; } if (this.life < this.lifeMax / 4) { num1131 += 4f; } if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax) { num1131 += 10f; } Vector2 vector127 = new Vector2(base.Center.X, base.Center.Y); float num1132 = Main.player[this.target].Center.X - vector127.X; float num1133 = Main.player[this.target].Center.Y - vector127.Y; float num1134 = (float)Math.Sqrt((double)(num1132 * num1132 + num1133 * num1133)); num1134 = num1131 / num1134; this.velocity.X = num1132 * num1134; this.velocity.Y = num1133 * num1134; this.ai[0] = 2f; this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X); if (this.type == NPCID.GolemFistLeft) { this.rotation = (float)Math.Atan2((double)(-(double)this.velocity.Y), (double)(-(double)this.velocity.X)); return; } } else if (this.ai[0] == 2f) { if (Math.Abs(this.velocity.X) > Math.Abs(this.velocity.Y)) { if (this.velocity.X > 0f && base.Center.X > Main.player[this.target].Center.X) { this.noTileCollide = false; } if (this.velocity.X < 0f && base.Center.X < Main.player[this.target].Center.X) { this.noTileCollide = false; } } else { if (this.velocity.Y > 0f && base.Center.Y > Main.player[this.target].Center.Y) { this.noTileCollide = false; } if (this.velocity.Y < 0f && base.Center.Y < Main.player[this.target].Center.Y) { this.noTileCollide = false; } } Vector2 vector128 = new Vector2(base.Center.X, base.Center.Y); float num1135 = Main.npc[NPC.golemBoss].Center.X - vector128.X; float num1136 = Main.npc[NPC.golemBoss].Center.Y - vector128.Y; num1135 += Main.npc[NPC.golemBoss].velocity.X; num1136 += Main.npc[NPC.golemBoss].velocity.Y; num1136 -= 9f; if (this.type == NPCID.GolemFistLeft) { num1135 -= 84f; } else { num1135 += 78f; } float num1137 = (float)Math.Sqrt((double)(num1135 * num1135 + num1136 * num1136)); if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax) { this.knockBackResist = 0f; if (num1137 > 700f || this.collideX || this.collideY) { this.noTileCollide = true; this.ai[0] = 0f; return; } } else { bool flag108 = this.justHit; if (flag108) { int num1138 = 0; while (num1138 < 200) { if (Main.npc[num1138].active && Main.npc[num1138].type == NPCID.GolemHead) { if (Main.npc[num1138].life < Main.npc[num1138].lifeMax / 2) { if (this.knockBackResist == 0f) { flag108 = false; } this.knockBackResist = 0f; break; } break; } else { num1138++; } } } if (num1137 > 600f || this.collideX || this.collideY || flag108) { this.noTileCollide = true; this.ai[0] = 0f; return; } } } else if (this.ai[0] == 3f) { this.noTileCollide = true; float num1139 = 12f; float num1140 = 0.4f; Vector2 vector129 = new Vector2(base.Center.X, base.Center.Y); float num1141 = Main.player[this.target].Center.X - vector129.X; float num1142 = Main.player[this.target].Center.Y - vector129.Y; float num1143 = (float)Math.Sqrt((double)(num1141 * num1141 + num1142 * num1142)); num1143 = num1139 / num1143; num1141 *= num1143; num1142 *= num1143; if (this.velocity.X < num1141) { this.velocity.X = this.velocity.X + num1140; if (this.velocity.X < 0f && num1141 > 0f) { this.velocity.X = this.velocity.X + num1140 * 2f; } } else if (this.velocity.X > num1141) { this.velocity.X = this.velocity.X - num1140; if (this.velocity.X > 0f && num1141 < 0f) { this.velocity.X = this.velocity.X - num1140 * 2f; } } if (this.velocity.Y < num1142) { this.velocity.Y = this.velocity.Y + num1140; if (this.velocity.Y < 0f && num1142 > 0f) { this.velocity.Y = this.velocity.Y + num1140 * 2f; } } else if (this.velocity.Y > num1142) { this.velocity.Y = this.velocity.Y - num1140; if (this.velocity.Y > 0f && num1142 < 0f) { this.velocity.Y = this.velocity.Y - num1140 * 2f; } } this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X); if (this.type == NPCID.GolemFistLeft) { this.rotation = (float)Math.Atan2((double)(-(double)this.velocity.Y), (double)(-(double)this.velocity.X)); return; } } } else if (this.aiStyle == 48) { bool flag109 = false; if (!Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.noTileCollide = true; flag109 = true; } else { this.noTileCollide = false; } if (NPC.golemBoss < 0) { this.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); return; } this.TargetClosest(true); float num1144 = 7f; float num1145 = 0.05f; Vector2 vector130 = new Vector2(base.Center.X, base.Center.Y); float num1146 = Main.player[this.target].Center.X - vector130.X; float num1147 = Main.player[this.target].Center.Y - vector130.Y - 300f; float num1148 = (float)Math.Sqrt((double)(num1146 * num1146 + num1147 * num1147)); num1148 = num1144 / num1148; num1146 *= num1148; num1147 *= num1148; if (this.velocity.X < num1146) { this.velocity.X = this.velocity.X + num1145; if (this.velocity.X < 0f && num1146 > 0f) { this.velocity.X = this.velocity.X + num1145; } } else if (this.velocity.X > num1146) { this.velocity.X = this.velocity.X - num1145; if (this.velocity.X > 0f && num1146 < 0f) { this.velocity.X = this.velocity.X - num1145; } } if (this.velocity.Y < num1147) { this.velocity.Y = this.velocity.Y + num1145; if (this.velocity.Y < 0f && num1147 > 0f) { this.velocity.Y = this.velocity.Y + num1145; } } else if (this.velocity.Y > num1147) { this.velocity.Y = this.velocity.Y - num1145; if (this.velocity.Y > 0f && num1147 < 0f) { this.velocity.Y = this.velocity.Y - num1145; } } this.ai[1] += 1f; if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.8) { this.ai[1] += 1f; } if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.6) { this.ai[1] += 1f; } if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.2) { this.ai[1] += 1f; } if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.1) { this.ai[1] += 1f; } int num1149 = 360; if (this.ai[1] < 20f || this.ai[1] > (float)(num1149 - 20)) { this.localAI[0] = 1f; } else { this.localAI[0] = 0f; } if (flag109) { this.ai[1] = 20f; } if (this.ai[1] >= (float)num1149) { this.TargetClosest(true); this.ai[1] = 0f; Vector2 vector131 = new Vector2(base.Center.X, base.Center.Y - 10f); float num1150 = 8f; int num1151 = 20; int num1152 = 258; float num1153 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector131.X; float num1154 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector131.Y; float num1155 = (float)Math.Sqrt((double)(num1153 * num1153 + num1154 * num1154)); num1155 = num1150 / num1155; num1153 *= num1155; num1154 *= num1155; if (Main.netMode != 1) { Projectile.NewProjectile(vector131.X, vector131.Y, num1153, num1154, num1152, num1151, 0f, Main.myPlayer, 0f, 0f); } } this.ai[2] += 1f; if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax / 1.25) { this.ai[2] += 1f; } if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax / 1.5) { this.ai[2] += 1f; } if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 2) { this.ai[2] += 1f; } if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 3) { this.ai[2] += 1f; } if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 4) { this.ai[2] += 1f; } if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 5) { this.ai[2] += 1f; } if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 6) { this.ai[2] += 1f; } if (!Collision.CanHit(Main.npc[NPC.golemBoss].Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[2] += 4f; } if (this.ai[2] > (float)(100 + Main.rand.Next(4800))) { this.ai[2] = 0f; for (int num1156 = 0; num1156 < 2; num1156++) { Vector2 vector132 = new Vector2(base.Center.X, base.Center.Y - 50f); if (num1156 == 0) { vector132.X -= 14f; } else if (num1156 == 1) { vector132.X += 14f; } float num1157 = 11f; int num1158 = 24; int num1159 = 259; if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.5) { num1158++; num1157 += 0.25f; } if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.4) { num1158++; num1157 += 0.25f; } if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.3) { num1158++; num1157 += 0.25f; } if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.2) { num1158++; num1157 += 0.25f; } if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.1) { num1158++; num1157 += 0.25f; } float num1160 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector132.X; float num1161 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector132.Y; float num1162 = (float)Math.Sqrt((double)(num1160 * num1160 + num1161 * num1161)); num1162 = num1157 / num1162; num1160 *= num1162; num1161 *= num1162; vector132.X += num1160 * 3f; vector132.Y += num1161 * 3f; if (Main.netMode != 1) { int num1163 = Projectile.NewProjectile(vector132.X, vector132.Y, num1160, num1161, num1159, num1158, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num1163].timeLeft = 300; } } return; } } else if (this.aiStyle == 49) { this.noGravity = true; this.TargetClosest(true); float num1164 = 4f; float num1165 = 0.25f; Vector2 vector133 = new Vector2(base.Center.X, base.Center.Y); float num1166 = Main.player[this.target].Center.X - vector133.X; float num1167 = Main.player[this.target].Center.Y - vector133.Y - 200f; float num1168 = (float)Math.Sqrt((double)(num1166 * num1166 + num1167 * num1167)); if (num1168 < 20f) { num1166 = this.velocity.X; num1167 = this.velocity.Y; } else { num1168 = num1164 / num1168; num1166 *= num1168; num1167 *= num1168; } if (this.velocity.X < num1166) { this.velocity.X = this.velocity.X + num1165; if (this.velocity.X < 0f && num1166 > 0f) { this.velocity.X = this.velocity.X + num1165 * 2f; } } else if (this.velocity.X > num1166) { this.velocity.X = this.velocity.X - num1165; if (this.velocity.X > 0f && num1166 < 0f) { this.velocity.X = this.velocity.X - num1165 * 2f; } } if (this.velocity.Y < num1167) { this.velocity.Y = this.velocity.Y + num1165; if (this.velocity.Y < 0f && num1167 > 0f) { this.velocity.Y = this.velocity.Y + num1165 * 2f; } } else if (this.velocity.Y > num1167) { this.velocity.Y = this.velocity.Y - num1165; if (this.velocity.Y > 0f && num1167 < 0f) { this.velocity.Y = this.velocity.Y - num1165 * 2f; } } if (this.position.X + (float)this.width > Main.player[this.target].position.X && this.position.X < Main.player[this.target].position.X + (float)Main.player[this.target].width && this.position.Y + (float)this.height < Main.player[this.target].position.Y && Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height) && Main.netMode != 1) { this.ai[0] += 1f; if (this.ai[0] > 8f) { this.ai[0] = 0f; int num1169 = (int)(this.position.X + 10f + (float)Main.rand.Next(this.width - 20)); int num1170 = (int)(this.position.Y + (float)this.height + 4f); Projectile.NewProjectile((float)num1169, (float)num1170, 0f, 5f, 264, 20, 0f, Main.myPlayer, 0f, 0f); return; } } } else { if (this.aiStyle == 50) { if (this.timeLeft > 5) { this.timeLeft = 5; } this.noTileCollide = true; this.velocity.Y = this.velocity.Y + 0.02f; if (this.velocity.Y < 0f && !Main.expertMode) { this.velocity.Y = this.velocity.Y * 0.99f; } if (this.velocity.Y > 1f) { this.velocity.Y = 1f; } this.TargetClosest(true); if (this.position.X + (float)this.width < Main.player[this.target].position.X) { if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.98f; } if (Main.expertMode && this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.98f; } this.velocity.X = this.velocity.X + 0.1f; if (Main.expertMode) { this.velocity.X = this.velocity.X + 0.1f; } } else if (this.position.X > Main.player[this.target].position.X + (float)Main.player[this.target].width) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.98f; } if (Main.expertMode && this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.98f; } this.velocity.X = this.velocity.X - 0.1f; if (Main.expertMode) { this.velocity.X = this.velocity.X + 0.1f; } } if (this.velocity.X > 5f || this.velocity.X < -5f) { this.velocity.X = this.velocity.X * 0.97f; } this.rotation = this.velocity.X * 0.2f; return; } if (this.aiStyle == 51) { bool flag110 = false; bool flag111 = false; this.TargetClosest(true); if (Main.player[this.target].dead) { flag111 = true; flag110 = true; } if (Main.netMode != 1) { int num1171 = 6000; if (Math.Abs(base.Center.X - Main.player[this.target].Center.X) + Math.Abs(base.Center.Y - Main.player[this.target].Center.Y) > (float)num1171) { this.active = false; this.life = 0; if (Main.netMode == 2) { NetMessage.SendData((int)PacketTypes.NpcUpdate, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } } NPC.plantBoss = this.whoAmI; if (this.localAI[0] == 0f && Main.netMode != 1) { this.localAI[0] = 1f; NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 263, this.whoAmI, 0f, 0f, 0f, 0f, 255); NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 263, this.whoAmI, 0f, 0f, 0f, 0f, 255); NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 263, this.whoAmI, 0f, 0f, 0f, 0f, 255); } int[] array3 = new int[3]; float num1172 = 0f; float num1173 = 0f; int num1174 = 0; for (int num1175 = 0; num1175 < 200; num1175++) { if (Main.npc[num1175].active && Main.npc[num1175].aiStyle == 52) { num1172 += Main.npc[num1175].Center.X; num1173 += Main.npc[num1175].Center.Y; array3[num1174] = num1175; num1174++; if (num1174 > 2) { break; } } } num1172 /= (float)num1174; num1173 /= (float)num1174; float num1176 = 2.5f; float num1177 = 0.025f; if (this.life < this.lifeMax / 2) { num1176 = 5f; num1177 = 0.05f; } if (this.life < this.lifeMax / 4) { num1176 = 7f; } if (!Main.player[this.target].ZoneJungle || (double)Main.player[this.target].position.Y < Main.worldSurface * 16.0 || Main.player[this.target].position.Y > (float)((Main.maxTilesY - 200) * 16)) { flag110 = true; num1176 += 8f; num1177 = 0.15f; } if (Main.expertMode) { num1176 += 1f; num1176 *= 1.1f; num1177 += 0.01f; num1177 *= 1.1f; } Vector2 vector134 = new Vector2(num1172, num1173); float num1178 = Main.player[this.target].Center.X - vector134.X; float num1179 = Main.player[this.target].Center.Y - vector134.Y; if (flag111) { num1179 *= -1f; num1178 *= -1f; num1176 += 8f; } float num1180 = (float)Math.Sqrt((double)(num1178 * num1178 + num1179 * num1179)); int num1181 = 500; if (flag110) { num1181 += 350; } if (Main.expertMode) { num1181 += 150; } if (num1180 >= (float)num1181) { num1180 = (float)num1181 / num1180; num1178 *= num1180; num1179 *= num1180; } num1172 += num1178; num1173 += num1179; vector134 = new Vector2(base.Center.X, base.Center.Y); num1178 = num1172 - vector134.X; num1179 = num1173 - vector134.Y; num1180 = (float)Math.Sqrt((double)(num1178 * num1178 + num1179 * num1179)); if (num1180 < num1176) { num1178 = this.velocity.X; num1179 = this.velocity.Y; } else { num1180 = num1176 / num1180; num1178 *= num1180; num1179 *= num1180; } if (this.velocity.X < num1178) { this.velocity.X = this.velocity.X + num1177; if (this.velocity.X < 0f && num1178 > 0f) { this.velocity.X = this.velocity.X + num1177 * 2f; } } else if (this.velocity.X > num1178) { this.velocity.X = this.velocity.X - num1177; if (this.velocity.X > 0f && num1178 < 0f) { this.velocity.X = this.velocity.X - num1177 * 2f; } } if (this.velocity.Y < num1179) { this.velocity.Y = this.velocity.Y + num1177; if (this.velocity.Y < 0f && num1179 > 0f) { this.velocity.Y = this.velocity.Y + num1177 * 2f; } } else if (this.velocity.Y > num1179) { this.velocity.Y = this.velocity.Y - num1177; if (this.velocity.Y > 0f && num1179 < 0f) { this.velocity.Y = this.velocity.Y - num1177 * 2f; } } Vector2 vector135 = new Vector2(base.Center.X, base.Center.Y); float num1182 = Main.player[this.target].Center.X - vector135.X; float num1183 = Main.player[this.target].Center.Y - vector135.Y; this.rotation = (float)Math.Atan2((double)num1183, (double)num1182) + 1.57f; if (this.life > this.lifeMax / 2) { this.defense = 36; this.damage = (int)(50f * Main.damageMultiplier); if (flag110) { this.defense *= 2; this.damage *= 2; } if (Main.netMode != 1) { this.localAI[1] += 1f; if ((double)this.life < (double)this.lifeMax * 0.9) { this.localAI[1] += 1f; } if ((double)this.life < (double)this.lifeMax * 0.8) { this.localAI[1] += 1f; } if ((double)this.life < (double)this.lifeMax * 0.7) { this.localAI[1] += 1f; } if ((double)this.life < (double)this.lifeMax * 0.6) { this.localAI[1] += 1f; } if (flag110) { this.localAI[1] += 3f; } if (Main.expertMode) { this.localAI[1] += 1f; } if (Main.expertMode && this.justHit && Main.rand.Next(2) == 0) { this.localAI[3] = 1f; } if (this.localAI[1] > 80f) { this.localAI[1] = 0f; bool flag112 = Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height); if (this.localAI[3] > 0f) { flag112 = true; this.localAI[3] = 0f; } if (flag112) { Vector2 vector136 = new Vector2(base.Center.X, base.Center.Y); float num1184 = 15f; if (Main.expertMode) { num1184 = 17f; } float num1185 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector136.X; float num1186 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector136.Y; float num1187 = (float)Math.Sqrt((double)(num1185 * num1185 + num1186 * num1186)); num1187 = num1184 / num1187; num1185 *= num1187; num1186 *= num1187; int num1188 = 22; int num1189 = 275; int maxValue8 = 4; int maxValue9 = 8; if (Main.expertMode) { maxValue8 = 2; maxValue9 = 6; } if ((double)this.life < (double)this.lifeMax * 0.8 && Main.rand.Next(maxValue8) == 0) { num1188 = 27; this.localAI[1] = -30f; num1189 = 276; } else if ((double)this.life < (double)this.lifeMax * 0.8 && Main.rand.Next(maxValue9) == 0) { num1188 = 31; this.localAI[1] = -120f; num1189 = 277; } if (flag110) { num1188 *= 2; } if (Main.expertMode) { num1188 = (int)((double)num1188 * 0.9); } vector136.X += num1185 * 3f; vector136.Y += num1186 * 3f; int num1190 = Projectile.NewProjectile(vector136.X, vector136.Y, num1185, num1186, num1189, num1188, 0f, Main.myPlayer, 0f, 0f); if (num1189 != 277) { Main.projectile[num1190].timeLeft = 300; return; } } } } } else { this.defense = 10; this.damage = (int)(70f * Main.damageMultiplier); if (flag110) { this.defense *= 4; this.damage *= 2; } if (Main.netMode != 1) { if (this.localAI[0] == 1f) { this.localAI[0] = 2f; for (int num1191 = 0; num1191 < 8; num1191++) { NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 264, this.whoAmI, 0f, 0f, 0f, 0f, 255); } if (Main.expertMode) { for (int num1192 = 0; num1192 < 200; num1192++) { if (Main.npc[num1192].active && Main.npc[num1192].aiStyle == 52) { for (int num1193 = 0; num1193 < 3; num1193++) { int num1194 = NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 264, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num1194].ai[3] = (float)(num1192 + 1); } } } } } else if (Main.expertMode && Main.rand.Next(60) == 0) { int num1195 = 0; for (int num1196 = 0; num1196 < 200; num1196++) { if (Main.npc[num1196].active && Main.npc[num1196].type == NPCID.PlanterasTentacle && Main.npc[num1196].ai[3] == 0f) { num1195++; } } if (num1195 < 8 && Main.rand.Next((num1195 + 1) * 10) <= 1) { NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 264, this.whoAmI, 0f, 0f, 0f, 0f, 255); } } } if (this.localAI[2] == 0f) { this.localAI[2] = 1f; } this.localAI[1] += 1f; if ((double)this.life < (double)this.lifeMax * 0.4) { this.localAI[1] += 1f; } if ((double)this.life < (double)this.lifeMax * 0.3) { this.localAI[1] += 1f; } if ((double)this.life < (double)this.lifeMax * 0.2) { this.localAI[1] += 1f; } if ((double)this.life < (double)this.lifeMax * 0.1) { this.localAI[1] += 1f; } if (this.localAI[1] >= 350f) { float num1197 = 8f; Vector2 vector137 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num1198 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector137.X + (float)Main.rand.Next(-10, 11); float num1199 = Math.Abs(num1198 * 0.2f); float num1200 = Main.player[this.target].position.Y + (float)Main.player[this.target].height * 0.5f - vector137.Y + (float)Main.rand.Next(-10, 11); if (num1200 > 0f) { num1199 = 0f; } num1200 -= num1199; float num1201 = (float)Math.Sqrt((double)(num1198 * num1198 + num1200 * num1200)); num1201 = num1197 / num1201; num1198 *= num1201; num1200 *= num1201; int num1202 = NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 265, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num1202].velocity.X = num1198; Main.npc[num1202].velocity.Y = num1200; Main.npc[num1202].netUpdate = true; this.localAI[1] = 0f; return; } } } else if (this.aiStyle == 52) { bool flag113 = false; bool flag114 = false; if (NPC.plantBoss < 0) { this.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); this.netUpdate = true; return; } if (Main.player[Main.npc[NPC.plantBoss].target].dead) { flag114 = true; } if ((NPC.plantBoss != -1 && !Main.player[Main.npc[NPC.plantBoss].target].ZoneJungle) || (double)Main.player[Main.npc[NPC.plantBoss].target].position.Y < Main.worldSurface * 16.0 || Main.player[Main.npc[NPC.plantBoss].target].position.Y > (float)((Main.maxTilesY - 200) * 16) || flag114) { this.localAI[0] -= 4f; flag113 = true; } if (Main.netMode == 1) { if (this.ai[0] == 0f) { this.ai[0] = (float)((int)(base.Center.X / 16f)); } if (this.ai[1] == 0f) { this.ai[1] = (float)((int)(base.Center.X / 16f)); } } if (Main.netMode != 1) { if (this.ai[0] == 0f || this.ai[1] == 0f) { this.localAI[0] = 0f; } this.localAI[0] -= 1f; if (Main.npc[NPC.plantBoss].life < Main.npc[NPC.plantBoss].lifeMax / 2) { this.localAI[0] -= 2f; } if (Main.npc[NPC.plantBoss].life < Main.npc[NPC.plantBoss].lifeMax / 4) { this.localAI[0] -= 2f; } if (flag113) { this.localAI[0] -= 6f; } if (!flag114 && this.localAI[0] <= 0f && this.ai[0] != 0f) { for (int num1203 = 0; num1203 < 200; num1203++) { if (num1203 != this.whoAmI && Main.npc[num1203].active && Main.npc[num1203].type == this.type && (Main.npc[num1203].velocity.X != 0f || Main.npc[num1203].velocity.Y != 0f)) { this.localAI[0] = (float)Main.rand.Next(60, 300); } } } if (this.localAI[0] <= 0f) { this.localAI[0] = (float)Main.rand.Next(300, 600); bool flag115 = false; int num1204 = 0; while (!flag115 && num1204 <= 1000) { num1204++; int num1205 = (int)(Main.player[Main.npc[NPC.plantBoss].target].Center.X / 16f); int num1206 = (int)(Main.player[Main.npc[NPC.plantBoss].target].Center.Y / 16f); if (this.ai[0] == 0f) { num1205 = (int)((Main.player[Main.npc[NPC.plantBoss].target].Center.X + Main.npc[NPC.plantBoss].Center.X) / 32f); num1206 = (int)((Main.player[Main.npc[NPC.plantBoss].target].Center.Y + Main.npc[NPC.plantBoss].Center.Y) / 32f); } if (flag114) { num1205 = (int)Main.npc[NPC.plantBoss].position.X / 16; num1206 = (int)(Main.npc[NPC.plantBoss].position.Y + 400f) / 16; } int num1207 = 20; num1207 += (int)(100f * ((float)num1204 / 1000f)); int num1208 = num1205 + Main.rand.Next(-num1207, num1207 + 1); int num1209 = num1206 + Main.rand.Next(-num1207, num1207 + 1); if (Main.npc[NPC.plantBoss].life < Main.npc[NPC.plantBoss].lifeMax / 2 && Main.rand.Next(6) == 0) { this.TargetClosest(true); int num1210 = (int)(Main.player[this.target].Center.X / 16f); int num1211 = (int)(Main.player[this.target].Center.Y / 16f); if (Main.tile[num1210, num1211].wall > 0) { num1208 = num1210; num1209 = num1211; } } try { if (WorldGen.SolidTile(num1208, num1209) || (Main.tile[num1208, num1209].wall > 0 && (num1204 > 500 || Main.npc[NPC.plantBoss].life < Main.npc[NPC.plantBoss].lifeMax / 2))) { flag115 = true; this.ai[0] = (float)num1208; this.ai[1] = (float)num1209; this.netUpdate = true; } } catch { } } } } if (this.ai[0] > 0f && this.ai[1] > 0f) { float num1212 = 6f; if (Main.npc[NPC.plantBoss].life < Main.npc[NPC.plantBoss].lifeMax / 2) { num1212 = 8f; } if (Main.npc[NPC.plantBoss].life < Main.npc[NPC.plantBoss].lifeMax / 4) { num1212 = 10f; } if (Main.expertMode) { num1212 += 1f; } if (Main.expertMode && Main.npc[NPC.plantBoss].life < Main.npc[NPC.plantBoss].lifeMax / 2) { num1212 += 1f; } if (flag113) { num1212 *= 2f; } if (flag114) { num1212 *= 2f; } Vector2 vector138 = new Vector2(base.Center.X, base.Center.Y); float num1213 = this.ai[0] * 16f - 8f - vector138.X; float num1214 = this.ai[1] * 16f - 8f - vector138.Y; float num1215 = (float)Math.Sqrt((double)(num1213 * num1213 + num1214 * num1214)); if (num1215 < 12f + num1212) { this.velocity.X = num1213; this.velocity.Y = num1214; } else { num1215 = num1212 / num1215; this.velocity.X = num1213 * num1215; this.velocity.Y = num1214 * num1215; } Vector2 vector139 = new Vector2(base.Center.X, base.Center.Y); float num1216 = Main.npc[NPC.plantBoss].Center.X - vector139.X; float num1217 = Main.npc[NPC.plantBoss].Center.Y - vector139.Y; this.rotation = (float)Math.Atan2((double)num1217, (double)num1216) - 1.57f; return; } } else if (this.aiStyle == 53) { if (NPC.plantBoss < 0) { this.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); this.netUpdate = true; return; } int num1218 = NPC.plantBoss; if (this.ai[3] > 0f) { num1218 = (int)this.ai[3] - 1; } if (Main.netMode != 1) { this.localAI[0] -= 1f; if (this.localAI[0] <= 0f) { this.localAI[0] = (float)Main.rand.Next(120, 480); this.ai[0] = (float)Main.rand.Next(-100, 101); this.ai[1] = (float)Main.rand.Next(-100, 101); this.netUpdate = true; } } this.TargetClosest(true); float num1219 = 0.2f; float num1220 = 200f; if ((double)Main.npc[NPC.plantBoss].life < (double)Main.npc[NPC.plantBoss].lifeMax * 0.25) { num1220 += 100f; } if ((double)Main.npc[NPC.plantBoss].life < (double)Main.npc[NPC.plantBoss].lifeMax * 0.1) { num1220 += 100f; } if (Main.expertMode) { float num1221 = 1f - (float)this.life / (float)this.lifeMax; num1220 += num1221 * 300f; num1219 += 0.3f; } if (!Main.npc[num1218].active || NPC.plantBoss < 0) { this.active = false; return; } float num1222 = Main.npc[num1218].position.X + (float)(Main.npc[num1218].width / 2); float num1223 = Main.npc[num1218].position.Y + (float)(Main.npc[num1218].height / 2); Vector2 vector140 = new Vector2(num1222, num1223); float num1224 = num1222 + this.ai[0]; float num1225 = num1223 + this.ai[1]; float num1226 = num1224 - vector140.X; float num1227 = num1225 - vector140.Y; float num1228 = (float)Math.Sqrt((double)(num1226 * num1226 + num1227 * num1227)); num1228 = num1220 / num1228; num1226 *= num1228; num1227 *= num1228; if (this.position.X < num1222 + num1226) { this.velocity.X = this.velocity.X + num1219; if (this.velocity.X < 0f && num1226 > 0f) { this.velocity.X = this.velocity.X * 0.9f; } } else if (this.position.X > num1222 + num1226) { this.velocity.X = this.velocity.X - num1219; if (this.velocity.X > 0f && num1226 < 0f) { this.velocity.X = this.velocity.X * 0.9f; } } if (this.position.Y < num1223 + num1227) { this.velocity.Y = this.velocity.Y + num1219; if (this.velocity.Y < 0f && num1227 > 0f) { this.velocity.Y = this.velocity.Y * 0.9f; } } else if (this.position.Y > num1223 + num1227) { this.velocity.Y = this.velocity.Y - num1219; if (this.velocity.Y > 0f && num1227 < 0f) { this.velocity.Y = this.velocity.Y * 0.9f; } } if (this.velocity.X > 8f) { this.velocity.X = 8f; } if (this.velocity.X < -8f) { this.velocity.X = -8f; } if (this.velocity.Y > 8f) { this.velocity.Y = 8f; } if (this.velocity.Y < -8f) { this.velocity.Y = -8f; } if (num1226 > 0f) { this.spriteDirection = 1; this.rotation = (float)Math.Atan2((double)num1227, (double)num1226); } if (num1226 < 0f) { this.spriteDirection = -1; this.rotation = (float)Math.Atan2((double)num1227, (double)num1226) + 3.14f; return; } } else if (this.aiStyle == 54) { NPC.crimsonBoss = this.whoAmI; if (Main.netMode != 1 && this.localAI[0] == 0f) { this.localAI[0] = 1f; for (int num1229 = 0; num1229 < 20; num1229++) { float num1230 = base.Center.X; float num1231 = base.Center.Y; num1230 += (float)Main.rand.Next(-this.width, this.width); num1231 += (float)Main.rand.Next(-this.height, this.height); int num1232 = NPC.NewNPC((int)num1230, (int)num1231, 267, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num1232].velocity = new Vector2((float)Main.rand.Next(-30, 31) * 0.1f, (float)Main.rand.Next(-30, 31) * 0.1f); Main.npc[num1232].netUpdate = true; } } if (Main.netMode != 1) { this.TargetClosest(true); int num1233 = 6000; if (Math.Abs(base.Center.X - Main.player[this.target].Center.X) + Math.Abs(base.Center.Y - Main.player[this.target].Center.Y) > (float)num1233) { this.active = false; this.life = 0; if (Main.netMode == 2) { NetMessage.SendData((int)PacketTypes.NpcUpdate, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } } if (this.ai[0] < 0f) { if (this.localAI[2] == 0f) { this.localAI[2] = 1f; } this.dontTakeDamage = false; this.knockBackResist = 0.5f; if (Main.expertMode) { this.knockBackResist *= Main.expertKnockBack; } this.TargetClosest(true); Vector2 vector141 = new Vector2(base.Center.X, base.Center.Y); float num1235 = Main.player[this.target].Center.X - vector141.X; float num1236 = Main.player[this.target].Center.Y - vector141.Y; float num1237 = (float)Math.Sqrt((double)(num1235 * num1235 + num1236 * num1236)); float num1238 = 8f; num1237 = num1238 / num1237; num1235 *= num1237; num1236 *= num1237; this.velocity.X = (this.velocity.X * 50f + num1235) / 51f; this.velocity.Y = (this.velocity.Y * 50f + num1236) / 51f; if (this.ai[0] == -1f) { if (Main.netMode != 1) { this.localAI[1] += 1f; if (this.justHit) { this.localAI[1] -= (float)Main.rand.Next(5); } int num1239 = 60 + Main.rand.Next(120); if (Main.netMode != 0) { num1239 += Main.rand.Next(30, 90); } if (this.localAI[1] >= (float)num1239) { this.localAI[1] = 0f; this.TargetClosest(true); int num1240 = 0; int num1241; int num1242; while (true) { num1240++; num1241 = (int)Main.player[this.target].Center.X / 16; num1242 = (int)Main.player[this.target].Center.Y / 16; if (Main.rand.Next(2) == 0) { num1241 += Main.rand.Next(7, 13); } else { num1241 -= Main.rand.Next(7, 13); } if (Main.rand.Next(2) == 0) { num1242 += Main.rand.Next(7, 13); } else { num1242 -= Main.rand.Next(7, 13); } if (!WorldGen.SolidTile(num1241, num1242)) { break; } if (num1240 > 100) { return; } } this.ai[3] = 0f; this.ai[0] = -2f; this.ai[1] = (float)num1241; this.ai[2] = (float)num1242; this.netUpdate = true; this.netSpam = 0; return; } } } else { if (this.ai[0] == -2f) { this.velocity *= 0.9f; if (Main.netMode != 0) { this.ai[3] += 15f; } else { this.ai[3] += 25f; } if (this.ai[3] >= 255f) { this.ai[3] = 255f; this.position.X = this.ai[1] * 16f - (float)(this.width / 2); this.position.Y = this.ai[2] * 16f - (float)(this.height / 2); this.ai[0] = -3f; this.netUpdate = true; this.netSpam = 0; } this.alpha = (int)this.ai[3]; return; } if (this.ai[0] == -3f) { if (Main.netMode != 0) { this.ai[3] -= 15f; } else { this.ai[3] -= 25f; } if (this.ai[3] <= 0f) { this.ai[3] = 0f; this.ai[0] = -1f; this.netUpdate = true; this.netSpam = 0; } this.alpha = (int)this.ai[3]; return; } } } else { this.TargetClosest(true); Vector2 vector142 = new Vector2(base.Center.X, base.Center.Y); float num1243 = Main.player[this.target].Center.X - vector142.X; float num1244 = Main.player[this.target].Center.Y - vector142.Y; float num1245 = (float)Math.Sqrt((double)(num1243 * num1243 + num1244 * num1244)); float num1246 = 1f; if (num1245 < num1246) { this.velocity.X = num1243; this.velocity.Y = num1244; } else { num1245 = num1246 / num1245; this.velocity.X = num1243 * num1245; this.velocity.Y = num1244 * num1245; } if (this.ai[0] == 0f) { if (Main.netMode != 1) { int num1247 = 0; for (int num1248 = 0; num1248 < 200; num1248++) { if (Main.npc[num1248].active && Main.npc[num1248].type == NPCID.Creeper) { num1247++; } } if (num1247 == 0) { this.ai[0] = -1f; this.localAI[1] = 0f; this.alpha = 0; this.netUpdate = true; } this.localAI[1] += 1f; if (this.localAI[1] >= (float)(120 + Main.rand.Next(300))) { this.localAI[1] = 0f; this.TargetClosest(true); int num1249 = 0; int num1250; int num1251; while (true) { num1249++; num1250 = (int)Main.player[this.target].Center.X / 16; num1251 = (int)Main.player[this.target].Center.Y / 16; num1250 += Main.rand.Next(-50, 51); num1251 += Main.rand.Next(-50, 51); if (!WorldGen.SolidTile(num1250, num1251) && Collision.CanHit(new Vector2((float)(num1250 * 16), (float)(num1251 * 16)), 1, 1, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { break; } if (num1249 > 100) { return; } } this.ai[0] = 1f; this.ai[1] = (float)num1250; this.ai[2] = (float)num1251; this.netUpdate = true; return; } } } else if (this.ai[0] == 1f) { this.alpha += 5; if (this.alpha >= 255) { this.alpha = 255; this.position.X = this.ai[1] * 16f - (float)(this.width / 2); this.position.Y = this.ai[2] * 16f - (float)(this.height / 2); this.ai[0] = 2f; return; } } else if (this.ai[0] == 2f) { this.alpha -= 5; if (this.alpha <= 0) { this.alpha = 0; this.ai[0] = 0f; return; } } } } else if (this.aiStyle == 55) { if (NPC.crimsonBoss < 0) { this.active = false; this.netUpdate = true; return; } if (this.ai[0] == 0f) { Vector2 vector143 = new Vector2(base.Center.X, base.Center.Y); float num1252 = Main.npc[NPC.crimsonBoss].Center.X - vector143.X; float num1253 = Main.npc[NPC.crimsonBoss].Center.Y - vector143.Y; float num1254 = (float)Math.Sqrt((double)(num1252 * num1252 + num1253 * num1253)); if (num1254 > 90f) { num1254 = 8f / num1254; num1252 *= num1254; num1253 *= num1254; this.velocity.X = (this.velocity.X * 15f + num1252) / 16f; this.velocity.Y = (this.velocity.Y * 15f + num1253) / 16f; return; } if (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) < 8f) { this.velocity.Y = this.velocity.Y * 1.05f; this.velocity.X = this.velocity.X * 1.05f; } if (Main.netMode != 1 && ((Main.expertMode && Main.rand.Next(100) == 0) || Main.rand.Next(200) == 0)) { this.TargetClosest(true); vector143 = new Vector2(base.Center.X, base.Center.Y); num1252 = Main.player[this.target].Center.X - vector143.X; num1253 = Main.player[this.target].Center.Y - vector143.Y; num1254 = (float)Math.Sqrt((double)(num1252 * num1252 + num1253 * num1253)); num1254 = 8f / num1254; this.velocity.X = num1252 * num1254; this.velocity.Y = num1253 * num1254; this.ai[0] = 1f; this.netUpdate = true; return; } } else { if (Main.expertMode) { Vector2 value15 = Main.player[this.target].Center - base.Center; value15.Normalize(); value15 *= 9f; this.velocity = (this.velocity * 99f + value15) / 100f; } Vector2 vector144 = new Vector2(base.Center.X, base.Center.Y); float num1255 = Main.npc[NPC.crimsonBoss].Center.X - vector144.X; float num1256 = Main.npc[NPC.crimsonBoss].Center.Y - vector144.Y; float num1257 = (float)Math.Sqrt((double)(num1255 * num1255 + num1256 * num1256)); if (num1257 > 700f || this.justHit) { this.ai[0] = 0f; return; } } } else { if (this.aiStyle == 56) { this.TargetClosest(true); Vector2 vector145 = new Vector2(base.Center.X, base.Center.Y); float num1258 = Main.player[this.target].Center.X - vector145.X; float num1259 = Main.player[this.target].Center.Y - vector145.Y; float num1260 = (float)Math.Sqrt((double)(num1258 * num1258 + num1259 * num1259)); float num1261 = 12f; num1260 = num1261 / num1260; num1258 *= num1260; num1259 *= num1260; this.velocity.X = (this.velocity.X * 100f + num1258) / 101f; this.velocity.Y = (this.velocity.Y * 100f + num1259) / 101f; this.rotation = (float)Math.Atan2((double)num1259, (double)num1258) - 1.57f; return; } if (this.aiStyle == 57) { float num1263 = 2f; this.noGravity = true; this.noTileCollide = true; if (!Main.dayTime) { this.TargetClosest(true); } bool flag116 = false; if ((double)this.life < (double)this.lifeMax * 0.75) { num1263 = 3f; } if ((double)this.life < (double)this.lifeMax * 0.5) { num1263 = 4f; } if (Main.dayTime) { if (this.timeLeft > 10) { this.timeLeft = 10; } num1263 = 8f; } else if (this.ai[0] == 0f) { this.ai[1] += 1f; if ((double)this.life < (double)this.lifeMax * 0.5) { this.ai[1] += 1f; } if ((double)this.life < (double)this.lifeMax * 0.25) { this.ai[1] += 1f; } if (this.ai[1] >= 300f && Main.netMode != 1) { this.ai[1] = 0f; if ((double)this.life < (double)this.lifeMax * 0.25 && this.type != NPCID.Everscream) { this.ai[0] = (float)Main.rand.Next(3, 5); } else { this.ai[0] = (float)Main.rand.Next(1, 3); } this.netUpdate = true; } } else if (this.ai[0] == 1f) { if (this.type == NPCID.Everscream) { flag116 = true; this.ai[1] += 1f; if (this.ai[1] % 5f == 0f) { Vector2 vector146 = new Vector2(this.position.X + 20f + (float)Main.rand.Next(this.width - 40), this.position.Y + 20f + (float)Main.rand.Next(this.height - 40)); float num1264 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector146.X; float num1265 = Main.player[this.target].position.Y - vector146.Y; num1264 += (float)Main.rand.Next(-50, 51); num1265 += (float)Main.rand.Next(-50, 51); num1265 -= Math.Abs(num1264) * ((float)Main.rand.Next(0, 21) * 0.01f); float num1266 = (float)Math.Sqrt((double)(num1264 * num1264 + num1265 * num1265)); float num1267 = 12.5f; num1266 = num1267 / num1266; num1264 *= num1266; num1265 *= num1266; num1264 *= 1f + (float)Main.rand.Next(-20, 21) * 0.02f; num1265 *= 1f + (float)Main.rand.Next(-20, 21) * 0.02f; Projectile.NewProjectile(vector146.X, vector146.Y, num1264, num1265, 345, 43, 0f, Main.myPlayer, (float)Main.rand.Next(0, 31), 0f); } if (this.ai[1] >= 180f) { this.ai[1] = 0f; this.ai[0] = 0f; } } else { flag116 = true; this.ai[1] += 1f; if (this.ai[1] % 15f == 0f) { Vector2 vector147 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f + 30f); float num1268 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector147.X; float num1269 = Main.player[this.target].position.Y - vector147.Y; float num1270 = (float)Math.Sqrt((double)(num1268 * num1268 + num1269 * num1269)); float num1271 = 10f; num1270 = num1271 / num1270; num1268 *= num1270; num1269 *= num1270; num1268 *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f; num1269 *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f; Projectile.NewProjectile(vector147.X, vector147.Y, num1268, num1269, 325, 50, 0f, Main.myPlayer, 0f, 0f); } if (this.ai[1] >= 120f) { this.ai[1] = 0f; this.ai[0] = 0f; } } } else if (this.ai[0] == 2f) { if (this.type == NPCID.Everscream) { flag116 = true; this.ai[1] += 1f; if (this.ai[1] > 60f && this.ai[1] < 240f && this.ai[1] % 15f == 0f) { float num1272 = 4.5f; Vector2 vector148 = new Vector2(this.position.X + 20f + (float)Main.rand.Next(this.width - 40), this.position.Y + 60f + (float)Main.rand.Next(this.height - 80)); float num1273 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector148.X; float num1274 = Main.player[this.target].position.Y - vector148.Y; num1274 -= Math.Abs(num1273) * 0.3f; num1272 += Math.Abs(num1273) * 0.004f; num1273 += (float)Main.rand.Next(-50, 51); num1274 -= (float)Main.rand.Next(50, 201); float num1275 = (float)Math.Sqrt((double)(num1273 * num1273 + num1274 * num1274)); num1275 = num1272 / num1275; num1273 *= num1275; num1274 *= num1275; num1273 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; num1274 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; Projectile.NewProjectile(vector148.X, vector148.Y, num1273, num1274, 346, 57, 0f, Main.myPlayer, 0f, (float)Main.rand.Next(2)); } if (this.ai[1] >= 300f) { this.ai[1] = 0f; this.ai[0] = 0f; } } else { flag116 = true; this.ai[1] += 1f; if (this.ai[1] > 60f && this.ai[1] < 240f && this.ai[1] % 8f == 0f) { float num1276 = 10f; Vector2 vector149 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f + 30f); float num1277 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector149.X; float num1278 = Main.player[this.target].position.Y - vector149.Y; num1278 -= Math.Abs(num1277) * 0.3f; num1276 += Math.Abs(num1277) * 0.004f; if (num1276 > 14f) { num1276 = 14f; } num1277 += (float)Main.rand.Next(-50, 51); num1278 -= (float)Main.rand.Next(50, 201); float num1279 = (float)Math.Sqrt((double)(num1277 * num1277 + num1278 * num1278)); num1279 = num1276 / num1279; num1277 *= num1279; num1278 *= num1279; num1277 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; num1278 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; Projectile.NewProjectile(vector149.X, vector149.Y, num1277, num1278, Main.rand.Next(326, 329), 40, 0f, Main.myPlayer, 0f, 0f); } if (this.ai[1] >= 300f) { this.ai[1] = 0f; this.ai[0] = 0f; } } } else if (this.ai[0] == 3f) { num1263 = 4f; this.ai[1] += 1f; if (this.ai[1] % 30f == 0f) { Vector2 vector150 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f + 30f); float num1280 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector150.X; float num1281 = Main.player[this.target].position.Y - vector150.Y; float num1282 = (float)Math.Sqrt((double)(num1280 * num1280 + num1281 * num1281)); float num1283 = 16f; num1282 = num1283 / num1282; num1280 *= num1282; num1281 *= num1282; num1280 *= 1f + (float)Main.rand.Next(-20, 21) * 0.001f; num1281 *= 1f + (float)Main.rand.Next(-20, 21) * 0.001f; Projectile.NewProjectile(vector150.X, vector150.Y, num1280, num1281, 325, 75, 0f, Main.myPlayer, 0f, 0f); } if (this.ai[1] >= 120f) { this.ai[1] = 0f; this.ai[0] = 0f; } } else if (this.ai[0] == 4f) { num1263 = 4f; this.ai[1] += 1f; if (this.ai[1] % 10f == 0f) { float num1284 = 12f; Vector2 vector151 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f + 30f); float num1285 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector151.X; float num1286 = Main.player[this.target].position.Y - vector151.Y; num1286 -= Math.Abs(num1285) * 0.2f; num1284 += Math.Abs(num1285) * 0.002f; if (num1284 > 16f) { num1284 = 16f; } num1285 += (float)Main.rand.Next(-50, 51); num1286 -= (float)Main.rand.Next(50, 201); float num1287 = (float)Math.Sqrt((double)(num1285 * num1285 + num1286 * num1286)); num1287 = num1284 / num1287; num1285 *= num1287; num1286 *= num1287; num1285 *= 1f + (float)Main.rand.Next(-30, 31) * 0.005f; num1286 *= 1f + (float)Main.rand.Next(-30, 31) * 0.005f; Projectile.NewProjectile(vector151.X, vector151.Y, num1285, num1286, Main.rand.Next(326, 329), 50, 0f, Main.myPlayer, 0f, 0f); } if (this.ai[1] >= 240f) { this.ai[1] = 0f; this.ai[0] = 0f; } } if (Math.Abs(base.Center.X - Main.player[this.target].Center.X) < 50f) { flag116 = true; } if (flag116) { this.velocity.X = this.velocity.X * 0.9f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } } else { if (this.direction > 0) { this.velocity.X = (this.velocity.X * 20f + num1263) / 21f; } if (this.direction < 0) { this.velocity.X = (this.velocity.X * 20f - num1263) / 21f; } } int num1288 = 80; int num1289 = 20; Vector2 position7 = new Vector2(base.Center.X - (float)(num1288 / 2), this.position.Y + (float)this.height - (float)num1289); bool flag117 = false; if (this.position.X < Main.player[this.target].position.X && this.position.X + (float)this.width > Main.player[this.target].position.X + (float)Main.player[this.target].width && this.position.Y + (float)this.height < Main.player[this.target].position.Y + (float)Main.player[this.target].height - 16f) { flag117 = true; } if (flag117) { this.velocity.Y = this.velocity.Y + 0.5f; } else if (Collision.SolidCollision(position7, num1288, num1289)) { if (this.velocity.Y > 0f) { this.velocity.Y = 0f; } if ((double)this.velocity.Y > -0.2) { this.velocity.Y = this.velocity.Y - 0.025f; } else { this.velocity.Y = this.velocity.Y - 0.2f; } if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } } else { if (this.velocity.Y < 0f) { this.velocity.Y = 0f; } if ((double)this.velocity.Y < 0.1) { this.velocity.Y = this.velocity.Y + 0.025f; } else { this.velocity.Y = this.velocity.Y + 0.5f; } } if (this.velocity.Y > 10f) { this.velocity.Y = 10f; return; } } else { if (this.aiStyle == 58) { this.localAI[0] += 1f; if (this.localAI[0] > 6f) { this.localAI[0] = 0f; this.localAI[1] += 1f; if (this.localAI[1] > 4f) { this.localAI[1] = 0f; } } if (Main.netMode != 1) { this.localAI[2] += 1f; if (this.localAI[2] > 300f) { this.ai[3] = (float)Main.rand.Next(3); this.localAI[2] = 0f; } else if (this.ai[3] == 0f && this.localAI[2] % 30f == 0f && this.localAI[2] > 30f) { float num1290 = 5f; Vector2 vector152 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f + 30f); if (!WorldGen.SolidTile((int)vector152.X / 16, (int)vector152.Y / 16)) { float num1291 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector152.X; float num1292 = Main.player[this.target].position.Y - vector152.Y; num1291 += (float)Main.rand.Next(-50, 51); num1292 += (float)Main.rand.Next(50, 201); num1292 *= 0.2f; float num1293 = (float)Math.Sqrt((double)(num1291 * num1291 + num1292 * num1292)); num1293 = num1290 / num1293; num1291 *= num1293; num1292 *= num1293; num1291 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; num1292 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; Projectile.NewProjectile(vector152.X, vector152.Y, num1291, num1292, Main.rand.Next(326, 329), 40, 0f, Main.myPlayer, 0f, 0f); } } } if (this.ai[0] == 0f && Main.netMode != 1) { this.TargetClosest(true); this.ai[0] = 1f; int num1294 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)this.position.Y + this.height / 2, 328, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num1294].ai[0] = -1f; Main.npc[num1294].ai[1] = (float)this.whoAmI; Main.npc[num1294].target = this.target; Main.npc[num1294].netUpdate = true; num1294 = NPC.NewNPC((int)(this.position.X + (float)(this.width / 2)), (int)this.position.Y + this.height / 2, 328, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num1294].ai[0] = 1f; Main.npc[num1294].ai[1] = (float)this.whoAmI; Main.npc[num1294].ai[3] = 150f; Main.npc[num1294].target = this.target; Main.npc[num1294].netUpdate = true; } if (Main.player[this.target].dead || Math.Abs(this.position.X - Main.player[this.target].position.X) > 2000f || Math.Abs(this.position.Y - Main.player[this.target].position.Y) > 2000f) { this.TargetClosest(true); if (Main.player[this.target].dead || Math.Abs(this.position.X - Main.player[this.target].position.X) > 2000f || Math.Abs(this.position.Y - Main.player[this.target].position.Y) > 2000f) { this.ai[1] = 2f; } } if (Main.dayTime) { this.velocity.Y = this.velocity.Y + 0.3f; this.velocity.X = this.velocity.X * 0.9f; } else if (this.ai[1] == 0f) { this.ai[2] += 1f; if (this.ai[2] >= 300f) { if (this.ai[3] != 1f) { this.ai[1] = 0f; this.ai[2] = 0f; } else { this.ai[2] = 0f; this.ai[1] = 1f; this.TargetClosest(true); this.netUpdate = true; } } Vector2 vector153 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num1295 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector153.X; float num1296 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - 200f - vector153.Y; float num1297 = (float)Math.Sqrt((double)(num1295 * num1295 + num1296 * num1296)); float num1298 = 6f; if (this.ai[3] == 1f) { if (num1297 > 900f) { num1298 = 12f; } else if (num1297 > 600f) { num1298 = 10f; } else if (num1297 > 300f) { num1298 = 8f; } } if (num1297 > 50f) { num1297 = num1298 / num1297; this.velocity.X = (this.velocity.X * 14f + num1295 * num1297) / 15f; this.velocity.Y = (this.velocity.Y * 14f + num1296 * num1297) / 15f; } } else if (this.ai[1] == 1f) { this.ai[2] += 1f; if (this.ai[2] >= 600f || this.ai[3] != 1f) { this.ai[2] = 0f; this.ai[1] = 0f; } Vector2 vector154 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num1299 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector154.X; float num1300 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector154.Y; float num1301 = (float)Math.Sqrt((double)(num1299 * num1299 + num1300 * num1300)); num1301 = 16f / num1301; this.velocity.X = (this.velocity.X * 49f + num1299 * num1301) / 50f; this.velocity.Y = (this.velocity.Y * 49f + num1300 * num1301) / 50f; } else if (this.ai[1] == 2f) { this.ai[1] = 3f; this.velocity.Y = this.velocity.Y + 0.1f; if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.95f; } this.velocity.X = this.velocity.X * 0.95f; if (this.timeLeft > 500) { this.timeLeft = 500; } } this.rotation = this.velocity.X * -0.02f; return; } if (this.aiStyle == 59) { this.spriteDirection = -(int)this.ai[0]; if (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].aiStyle != 58) { this.ai[2] += 10f; if (this.ai[2] > 50f || Main.netMode != 2) { this.life = -1; this.HitEffect(0, 10.0); this.active = false; } } if (Main.netMode != 1 && Main.npc[(int)this.ai[1]].ai[3] == 2f) { this.localAI[1] += 1f; if (this.localAI[1] > 90f) { this.localAI[1] = 0f; float num1302 = 0.01f; Vector2 vector155 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f + 30f); float num1303 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector155.X; float num1304 = Main.player[this.target].position.Y - vector155.Y; float num1305 = (float)Math.Sqrt((double)(num1303 * num1303 + num1304 * num1304)); num1305 = num1302 / num1305; num1303 *= num1305; num1304 *= num1305; Projectile.NewProjectile(base.Center.X, base.Center.Y, num1303, num1304, 329, 60, 0f, Main.myPlayer, this.rotation, (float)this.spriteDirection); } } if (Main.dayTime) { this.velocity.Y = this.velocity.Y + 0.3f; this.velocity.X = this.velocity.X * 0.9f; return; } if (this.ai[2] == 0f || this.ai[2] == 3f) { if (Main.npc[(int)this.ai[1]].ai[1] == 3f && this.timeLeft > 10) { this.timeLeft = 10; } this.ai[3] += 1f; if (this.ai[3] >= 180f) { this.ai[2] += 1f; this.ai[3] = 0f; this.netUpdate = true; } Vector2 vector156 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num1306 = (Main.player[this.target].Center.X + Main.npc[(int)this.ai[1]].Center.X) / 2f; float num1307 = (Main.player[this.target].Center.Y + Main.npc[(int)this.ai[1]].Center.Y) / 2f; num1306 += -170f * this.ai[0] - vector156.X; num1307 += 90f - vector156.Y; float num1308 = Math.Abs(Main.player[this.target].Center.X - Main.npc[(int)this.ai[1]].Center.X) + Math.Abs(Main.player[this.target].Center.Y - Main.npc[(int)this.ai[1]].Center.Y); if (num1308 > 700f) { num1306 = Main.npc[(int)this.ai[1]].Center.X - 170f * this.ai[0] - vector156.X; num1307 = Main.npc[(int)this.ai[1]].Center.Y + 90f - vector156.Y; } float num1309 = (float)Math.Sqrt((double)(num1306 * num1306 + num1307 * num1307)); float num1310 = 6f; if (num1309 > 1000f) { num1310 = 21f; } else if (num1309 > 800f) { num1310 = 18f; } else if (num1309 > 600f) { num1310 = 15f; } else if (num1309 > 400f) { num1310 = 12f; } else if (num1309 > 200f) { num1310 = 9f; } if (this.ai[0] < 0f && base.Center.X > Main.npc[(int)this.ai[1]].Center.X) { num1306 -= 4f; } if (this.ai[0] > 0f && base.Center.X < Main.npc[(int)this.ai[1]].Center.X) { num1306 += 4f; } num1309 = num1310 / num1309; this.velocity.X = (this.velocity.X * 14f + num1306 * num1309) / 15f; this.velocity.Y = (this.velocity.Y * 14f + num1307 * num1309) / 15f; num1309 = (float)Math.Sqrt((double)(num1306 * num1306 + num1307 * num1307)); if (num1309 > 20f) { this.rotation = (float)Math.Atan2((double)num1307, (double)num1306) + 1.57f; return; } } else if (this.ai[2] == 1f) { Vector2 vector157 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num1311 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector157.X; float num1312 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector157.Y; float num1313 = (float)Math.Sqrt((double)(num1311 * num1311 + num1312 * num1312)); this.rotation = (float)Math.Atan2((double)num1312, (double)num1311) + 1.57f; this.velocity.X = this.velocity.X * 0.95f; this.velocity.Y = this.velocity.Y - 0.3f; if (this.velocity.Y < -14f) { this.velocity.Y = -14f; } if (this.position.Y < Main.npc[(int)this.ai[1]].position.Y - 200f) { this.TargetClosest(true); this.ai[2] = 2f; vector157 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); num1311 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector157.X; num1312 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector157.Y; num1313 = (float)Math.Sqrt((double)(num1311 * num1311 + num1312 * num1312)); num1313 = 18f / num1313; this.velocity.X = num1311 * num1313; this.velocity.Y = num1312 * num1313; this.netUpdate = true; return; } } else if (this.ai[2] == 2f) { float num1314 = Math.Abs(base.Center.X - Main.npc[(int)this.ai[1]].Center.X) + Math.Abs(base.Center.Y - Main.npc[(int)this.ai[1]].Center.Y); if (this.position.Y > Main.player[this.target].position.Y || this.velocity.Y < 0f || num1314 > 800f) { this.ai[2] = 3f; return; } } else if (this.ai[2] == 4f) { Vector2 vector158 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num1315 = Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 200f * this.ai[0] - vector158.X; float num1316 = Main.npc[(int)this.ai[1]].position.Y + 230f - vector158.Y; float num1317 = (float)Math.Sqrt((double)(num1315 * num1315 + num1316 * num1316)); this.rotation = (float)Math.Atan2((double)num1316, (double)num1315) + 1.57f; this.velocity.Y = this.velocity.Y * 0.95f; this.velocity.X = this.velocity.X + 0.3f * -this.ai[0]; if (this.velocity.X < -14f) { this.velocity.X = -14f; } if (this.velocity.X > 14f) { this.velocity.X = 14f; } if (this.position.X + (float)(this.width / 2) < Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) - 500f || this.position.X + (float)(this.width / 2) > Main.npc[(int)this.ai[1]].position.X + (float)(Main.npc[(int)this.ai[1]].width / 2) + 500f) { this.TargetClosest(true); this.ai[2] = 5f; vector158 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); num1315 = Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2) - vector158.X; num1316 = Main.player[this.target].position.Y + (float)(Main.player[this.target].height / 2) - vector158.Y; num1317 = (float)Math.Sqrt((double)(num1315 * num1315 + num1316 * num1316)); num1317 = 17f / num1317; this.velocity.X = num1315 * num1317; this.velocity.Y = num1316 * num1317; this.netUpdate = true; return; } } else if (this.ai[2] == 5f) { float num1318 = Math.Abs(base.Center.X - Main.npc[(int)this.ai[1]].Center.X) + Math.Abs(base.Center.Y - Main.npc[(int)this.ai[1]].Center.Y); if ((this.velocity.X > 0f && this.position.X + (float)(this.width / 2) > Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2)) || (this.velocity.X < 0f && this.position.X + (float)(this.width / 2) < Main.player[this.target].position.X + (float)(Main.player[this.target].width / 2)) || num1318 > 800f) { this.ai[2] = 0f; return; } } } else if (this.aiStyle == 60) { if (Main.dayTime) { if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X + 0.25f; } else { this.velocity.X = this.velocity.X - 0.25f; } this.velocity.Y = this.velocity.Y - 0.1f; this.rotation = this.velocity.X * 0.05f; } else if (this.ai[0] == 0f) { if (this.ai[2] == 0f) { this.TargetClosest(true); if (base.Center.X < Main.player[this.target].Center.X) { this.ai[2] = 1f; } else { this.ai[2] = -1f; } } this.TargetClosest(true); int num1319 = 800; float num1320 = Math.Abs(base.Center.X - Main.player[this.target].Center.X); if (base.Center.X < Main.player[this.target].Center.X && this.ai[2] < 0f && num1320 > (float)num1319) { this.ai[2] = 0f; } if (base.Center.X > Main.player[this.target].Center.X && this.ai[2] > 0f && num1320 > (float)num1319) { this.ai[2] = 0f; } float num1321 = 0.45f; float num1322 = 7f; if ((double)this.life < (double)this.lifeMax * 0.75) { num1321 = 0.55f; num1322 = 8f; } if ((double)this.life < (double)this.lifeMax * 0.5) { num1321 = 0.7f; num1322 = 10f; } if ((double)this.life < (double)this.lifeMax * 0.25) { num1321 = 0.8f; num1322 = 11f; } this.velocity.X = this.velocity.X + this.ai[2] * num1321; if (this.velocity.X > num1322) { this.velocity.X = num1322; } if (this.velocity.X < -num1322) { this.velocity.X = -num1322; } float num1323 = Main.player[this.target].position.Y - (this.position.Y + (float)this.height); if (num1323 < 150f) { this.velocity.Y = this.velocity.Y - 0.2f; } if (num1323 > 200f) { this.velocity.Y = this.velocity.Y + 0.2f; } if (this.velocity.Y > 8f) { this.velocity.Y = 8f; } if (this.velocity.Y < -8f) { this.velocity.Y = -8f; } this.rotation = this.velocity.X * 0.05f; if ((num1320 < 500f || this.ai[3] < 0f) && this.position.Y < Main.player[this.target].position.Y) { this.ai[3] += 1f; int num1324 = 13; if ((double)this.life < (double)this.lifeMax * 0.75) { num1324 = 12; } if ((double)this.life < (double)this.lifeMax * 0.5) { num1324 = 11; } if ((double)this.life < (double)this.lifeMax * 0.25) { num1324 = 10; } num1324++; if (this.ai[3] > (float)num1324) { this.ai[3] = (float)(-(float)num1324); } if (this.ai[3] == 0f && Main.netMode != 1) { Vector2 vector159 = new Vector2(base.Center.X, base.Center.Y); vector159.X += this.velocity.X * 7f; float num1325 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector159.X; float num1326 = Main.player[this.target].Center.Y - vector159.Y; float num1327 = (float)Math.Sqrt((double)(num1325 * num1325 + num1326 * num1326)); float num1328 = 6f; if ((double)this.life < (double)this.lifeMax * 0.75) { num1328 = 7f; } if ((double)this.life < (double)this.lifeMax * 0.5) { num1328 = 8f; } if ((double)this.life < (double)this.lifeMax * 0.25) { num1328 = 9f; } num1327 = num1328 / num1327; num1325 *= num1327; num1326 *= num1327; Projectile.NewProjectile(vector159.X, vector159.Y, num1325, num1326, 348, 42, 0f, Main.myPlayer, 0f, 0f); } } else if (this.ai[3] < 0f) { this.ai[3] += 1f; } if (Main.netMode != 1) { this.ai[1] += (float)Main.rand.Next(1, 4); if (this.ai[1] > 800f && num1320 < 600f) { this.ai[0] = -1f; } } } else if (this.ai[0] == 1f) { this.TargetClosest(true); float num1329 = 0.15f; float num1330 = 7f; if ((double)this.life < (double)this.lifeMax * 0.75) { num1329 = 0.17f; num1330 = 8f; } if ((double)this.life < (double)this.lifeMax * 0.5) { num1329 = 0.2f; num1330 = 9f; } if ((double)this.life < (double)this.lifeMax * 0.25) { num1329 = 0.25f; num1330 = 10f; } num1329 -= 0.05f; num1330 -= 1f; if (base.Center.X < Main.player[this.target].Center.X) { this.velocity.X = this.velocity.X + num1329; if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X * 0.98f; } } if (base.Center.X > Main.player[this.target].Center.X) { this.velocity.X = this.velocity.X - num1329; if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X * 0.98f; } } if (this.velocity.X > num1330 || this.velocity.X < -num1330) { this.velocity.X = this.velocity.X * 0.95f; } float num1331 = Main.player[this.target].position.Y - (this.position.Y + (float)this.height); if (num1331 < 180f) { this.velocity.Y = this.velocity.Y - 0.1f; } if (num1331 > 200f) { this.velocity.Y = this.velocity.Y + 0.1f; } if (this.velocity.Y > 6f) { this.velocity.Y = 6f; } if (this.velocity.Y < -6f) { this.velocity.Y = -6f; } this.rotation = this.velocity.X * 0.01f; if (Main.netMode != 1) { this.ai[3] += 1f; int num1332 = 15; if ((double)this.life < (double)this.lifeMax * 0.75) { num1332 = 14; } if ((double)this.life < (double)this.lifeMax * 0.5) { num1332 = 12; } if ((double)this.life < (double)this.lifeMax * 0.25) { num1332 = 10; } if ((double)this.life < (double)this.lifeMax * 0.1) { num1332 = 8; } num1332 += 3; if (this.ai[3] >= (float)num1332) { this.ai[3] = 0f; Vector2 vector160 = new Vector2(base.Center.X, this.position.Y + (float)this.height - 14f); int i2 = (int)(vector160.X / 16f); int j2 = (int)(vector160.Y / 16f); if (!WorldGen.SolidTile(i2, j2)) { float num1333 = this.velocity.Y; if (num1333 < 0f) { num1333 = 0f; } num1333 += 3f; float speedX2 = this.velocity.X * 0.25f; Projectile.NewProjectile(vector160.X, vector160.Y, speedX2, num1333, 349, 37, 0f, Main.myPlayer, (float)Main.rand.Next(5), 0f); } } } if (Main.netMode != 1) { this.ai[1] += (float)Main.rand.Next(1, 4); if (this.ai[1] > 600f) { this.ai[0] = -1f; } } } else if (this.ai[0] == 2f) { this.TargetClosest(true); Vector2 vector161 = new Vector2(base.Center.X, base.Center.Y - 20f); float num1334 = (float)Main.rand.Next(-1000, 1001); float num1335 = (float)Main.rand.Next(-1000, 1001); float num1336 = (float)Math.Sqrt((double)(num1334 * num1334 + num1335 * num1335)); float num1337 = 15f; this.velocity *= 0.95f; num1336 = num1337 / num1336; num1334 *= num1336; num1335 *= num1336; this.rotation += 0.2f; vector161.X += num1334 * 4f; vector161.Y += num1335 * 4f; this.ai[3] += 1f; int num1338 = 7; if ((double)this.life < (double)this.lifeMax * 0.75) { num1338--; } if ((double)this.life < (double)this.lifeMax * 0.5) { num1338 -= 2; } if ((double)this.life < (double)this.lifeMax * 0.25) { num1338 -= 3; } if ((double)this.life < (double)this.lifeMax * 0.1) { num1338 -= 4; } if (this.ai[3] > (float)num1338) { this.ai[3] = 0f; Projectile.NewProjectile(vector161.X, vector161.Y, num1334, num1335, 349, 35, 0f, Main.myPlayer, 0f, 0f); } if (Main.netMode != 1) { this.ai[1] += (float)Main.rand.Next(1, 4); if (this.ai[1] > 500f) { this.ai[0] = -1f; } } } if (this.ai[0] == -1f) { int num1339 = Main.rand.Next(3); this.TargetClosest(true); if (Math.Abs(base.Center.X - Main.player[this.target].Center.X) > 1000f) { num1339 = 0; } this.ai[0] = (float)num1339; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; return; } } else if (this.aiStyle == 61) { float num1340 = 2f; this.noGravity = true; this.noTileCollide = true; if (!Main.dayTime) { this.TargetClosest(true); } bool flag118 = false; if ((double)this.life < (double)this.lifeMax * 0.75) { num1340 = 3f; } if ((double)this.life < (double)this.lifeMax * 0.5) { num1340 = 4f; } if ((double)this.life < (double)this.lifeMax * 0.25) { num1340 = 5f; } if (Main.dayTime) { if (this.timeLeft > 10) { this.timeLeft = 10; } num1340 = 8f; if (this.velocity.X == 0f) { this.velocity.X = 0.1f; } } else if (this.ai[0] == 0f) { this.ai[1] += 1f; if (this.ai[1] >= 300f && Main.netMode != 1) { this.TargetClosest(true); this.ai[1] = 0f; this.ai[0] = 1f; this.netUpdate = true; } } else if (this.ai[0] == 1f) { this.ai[1] += 1f; flag118 = true; int num1341 = 16; if ((double)this.life < (double)this.lifeMax * 0.25) { num1341 = 8; } else if ((double)this.life < (double)this.lifeMax * 0.5) { num1341 = 11; } else if ((double)this.life < (double)this.lifeMax * 0.75) { num1341 = 14; } if (this.ai[1] % (float)num1341 == 0f) { Vector2 vector162 = new Vector2(base.Center.X + (float)(this.direction * 50), base.Center.Y + (float)Main.rand.Next(15, 36)); float num1342 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector162.X; float num1343 = Main.player[this.target].Center.Y - vector162.Y; num1342 += (float)Main.rand.Next(-40, 41); num1343 += (float)Main.rand.Next(-40, 41); float num1344 = (float)Math.Sqrt((double)(num1342 * num1342 + num1343 * num1343)); float num1345 = 15f; num1344 = num1345 / num1344; num1342 *= num1344; num1343 *= num1344; num1342 *= 1f + (float)Main.rand.Next(-20, 21) * 0.015f; num1343 *= 1f + (float)Main.rand.Next(-20, 21) * 0.015f; Projectile.NewProjectile(vector162.X, vector162.Y, num1342, num1343, 180, 36, 0f, Main.myPlayer, 0f, 0f); } if (this.ai[1] > 240f) { this.ai[0] = 0f; this.ai[1] = 0f; } } if (Main.netMode != 1) { int num1346 = 600; int num1347 = 1200; int num1348 = 2700; if ((double)this.life < (double)this.lifeMax * 0.25) { num1346 = (int)((double)num1346 * 0.5); num1347 = (int)((double)num1347 * 0.5); num1348 = (int)((double)num1348 * 0.5); } else if ((double)this.life < (double)this.lifeMax * 0.5) { num1346 = (int)((double)num1346 * 0.75); num1347 = (int)((double)num1347 * 0.75); num1348 = (int)((double)num1348 * 0.75); } else if ((double)this.life < (double)this.lifeMax * 0.75) { num1346 = (int)((double)num1346 * 0.9); num1347 = (int)((double)num1347 * 0.9); num1348 = (int)((double)num1348 * 0.9); } if (Main.rand.Next(num1346) == 0) { Vector2 vector163 = new Vector2(base.Center.X - (float)(this.direction * 24), base.Center.Y - 64f); float num1349 = (float)(Main.rand.Next(1, 100) * this.direction); float num1350 = 1f; float num1351 = (float)Math.Sqrt((double)(num1349 * num1349 + num1350 * num1350)); float num1352 = 1f; num1351 = num1352 / num1351; num1349 *= num1351; num1350 *= num1351; Projectile.NewProjectile(vector163.X, vector163.Y, num1349, num1350, 352, 80, 0f, Main.myPlayer, 0f, 0f); } if (Main.rand.Next(num1347) == 0) { this.localAI[1] = 1f; } if (this.localAI[1] >= 1f) { this.localAI[1] += 1f; int num1353 = 12; if (this.localAI[1] % (float)num1353 == 0f) { Vector2 vector164 = new Vector2(base.Center.X - (float)(this.direction * 24), base.Center.Y - 64f); float num1354 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector164.X; float num1355 = Main.player[this.target].Center.Y - vector164.Y; num1354 += (float)Main.rand.Next(-50, 51); num1355 += (float)Main.rand.Next(-50, 51); float num1356 = (float)Math.Sqrt((double)(num1354 * num1354 + num1355 * num1355)); float num1357 = 12.5f; num1356 = num1357 / num1356; num1354 *= num1356; num1355 *= num1356; num1354 *= 1f + (float)Main.rand.Next(-20, 21) * 0.015f; num1355 *= 1f + (float)Main.rand.Next(-20, 21) * 0.015f; Projectile.NewProjectile(vector164.X, vector164.Y, num1354, num1355, 350, 42, 0f, Main.myPlayer, 0f, 0f); } if (this.localAI[1] >= 100f) { this.localAI[1] = 0f; } } if (Main.rand.Next(num1348) == 0) { this.localAI[2] = 2f; } if (this.localAI[2] > 0f) { this.localAI[2] += 1f; int num1358 = 9; if (this.localAI[2] % (float)num1358 == 0f) { Vector2 vector165 = new Vector2(base.Center.X - (float)(this.direction * 24), base.Center.Y - 64f); float num1359 = (float)Main.rand.Next(-100, 101); float num1360 = -300f; float num1361 = (float)Math.Sqrt((double)(num1359 * num1359 + num1360 * num1360)); float num1362 = 11f; num1361 = num1362 / num1361; num1359 *= num1361; num1360 *= num1361; num1359 *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f; num1360 *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f; Projectile.NewProjectile(vector165.X, vector165.Y, num1359, num1360, 351, 50, 0f, Main.myPlayer, 0f, 0f); } if (this.localAI[2] >= 100f) { this.localAI[2] = 0f; } } } if (Math.Abs(base.Center.X - Main.player[this.target].Center.X) < 50f) { flag118 = true; } if (flag118) { this.velocity.X = this.velocity.X * 0.9f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } } else { if (this.direction > 0) { this.velocity.X = (this.velocity.X * 20f + num1340) / 21f; } if (this.direction < 0) { this.velocity.X = (this.velocity.X * 20f - num1340) / 21f; } } int num1363 = 80; int num1364 = 20; Vector2 position8 = new Vector2(base.Center.X - (float)(num1363 / 2), this.position.Y + (float)this.height - (float)num1364); bool flag119 = false; if (this.position.X < Main.player[this.target].position.X && this.position.X + (float)this.width > Main.player[this.target].position.X + (float)Main.player[this.target].width && this.position.Y + (float)this.height < Main.player[this.target].position.Y + (float)Main.player[this.target].height - 16f) { flag119 = true; } if (flag119) { this.velocity.Y = this.velocity.Y + 0.5f; } else if (Collision.SolidCollision(position8, num1363, num1364)) { if (this.velocity.Y > 0f) { this.velocity.Y = 0f; } if ((double)this.velocity.Y > -0.2) { this.velocity.Y = this.velocity.Y - 0.025f; } else { this.velocity.Y = this.velocity.Y - 0.2f; } if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } } else { if (this.velocity.Y < 0f) { this.velocity.Y = 0f; } if ((double)this.velocity.Y < 0.1) { this.velocity.Y = this.velocity.Y + 0.025f; } else { this.velocity.Y = this.velocity.Y + 0.5f; } } if (this.velocity.Y > 10f) { this.velocity.Y = 10f; return; } } else if (this.aiStyle == 62) { this.TargetClosest(true); this.rotation = Math.Abs(this.velocity.X) * (float)this.direction * 0.1f; this.spriteDirection = this.direction; float num1365 = 7f; Vector2 vector166 = new Vector2(base.Center.X + (float)(this.direction * 20), base.Center.Y + 6f); float num1366 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector166.X; float num1367 = Main.player[this.target].position.Y - vector166.Y; float num1368 = (float)Math.Sqrt((double)(num1366 * num1366 + num1367 * num1367)); float num1369 = num1365 / num1368; num1366 *= num1369; num1367 *= num1369; bool flag120 = Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1); if (Main.dayTime) { int num1370 = 60; this.velocity.X = (this.velocity.X * (float)(num1370 - 1) - num1366) / (float)num1370; this.velocity.Y = (this.velocity.Y * (float)(num1370 - 1) - num1367) / (float)num1370; if (this.timeLeft > 10) { this.timeLeft = 10; return; } } else { if (num1368 > 600f || !flag120) { int num1371 = 60; this.velocity.X = (this.velocity.X * (float)(num1371 - 1) + num1366) / (float)num1371; this.velocity.Y = (this.velocity.Y * (float)(num1371 - 1) + num1367) / (float)num1371; return; } this.velocity *= 0.98f; if (Math.Abs(this.velocity.X) < 1f && Math.Abs(this.velocity.Y) < 1f && Main.netMode != 1) { this.localAI[0] += 1f; if (this.localAI[0] >= 15f) { this.localAI[0] = 0f; num1366 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector166.X; num1367 = Main.player[this.target].Center.Y - vector166.Y; num1366 += (float)Main.rand.Next(-35, 36); num1367 += (float)Main.rand.Next(-35, 36); num1366 *= 1f + (float)Main.rand.Next(-20, 21) * 0.015f; num1367 *= 1f + (float)Main.rand.Next(-20, 21) * 0.015f; num1368 = (float)Math.Sqrt((double)(num1366 * num1366 + num1367 * num1367)); num1365 = 10f; num1369 = num1365 / num1368; num1366 *= num1369; num1367 *= num1369; num1366 *= 1f + (float)Main.rand.Next(-20, 21) * 0.0125f; num1367 *= 1f + (float)Main.rand.Next(-20, 21) * 0.0125f; Projectile.NewProjectile(vector166.X, vector166.Y, num1366, num1367, 180, 32, 0f, Main.myPlayer, 0f, 0f); return; } } } } else if (this.aiStyle == 63) { this.TargetClosest(true); float num1372 = 11f; Vector2 vector167 = new Vector2(base.Center.X + (float)(this.direction * 20), base.Center.Y + 6f); float num1373 = Main.player[this.target].position.X + (float)Main.player[this.target].width * 0.5f - vector167.X; float num1374 = Main.player[this.target].Center.Y - vector167.Y; float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); float num1376 = num1372 / num1375; num1373 *= num1376; num1374 *= num1376; if (Main.dayTime) { num1373 = -num1373; num1374 = -num1374; } this.ai[0] -= 1f; if (num1375 < 200f || this.ai[0] > 0f) { if (num1375 < 200f) { this.ai[0] = 20f; } if (this.velocity.X < 0f) { this.direction = -1; } else { this.direction = 1; } this.rotation += (float)this.direction * 0.3f; return; } this.velocity.X = (this.velocity.X * 50f + num1373) / 51f; this.velocity.Y = (this.velocity.Y * 50f + num1374) / 51f; if (num1375 < 350f) { this.velocity.X = (this.velocity.X * 10f + num1373) / 11f; this.velocity.Y = (this.velocity.Y * 10f + num1374) / 11f; } if (num1375 < 300f) { this.velocity.X = (this.velocity.X * 7f + num1373) / 8f; this.velocity.Y = (this.velocity.Y * 7f + num1374) / 8f; } this.rotation = this.velocity.X * 0.15f; return; } else { if (this.aiStyle == 64) { float num1377 = this.ai[0]; float num1378 = this.ai[1]; if (Main.netMode != 1) { this.localAI[0] -= 1f; if (this.ai[3] == 0f) { this.ai[3] = (float)Main.rand.Next(75, 111) * 0.01f; } if (this.localAI[0] <= 0f) { this.TargetClosest(true); this.localAI[0] = (float)Main.rand.Next(60, 180); float num1379 = Math.Abs(base.Center.X - Main.player[this.target].Center.X); if (num1379 > 700f && this.localAI[3] == 0f) { float num1380 = (float)Main.rand.Next(50, 151) * 0.01f; if (num1379 > 1000f) { num1380 = (float)Main.rand.Next(150, 201) * 0.01f; } else if (num1379 > 850f) { num1380 = (float)Main.rand.Next(100, 151) * 0.01f; } int num1381 = this.direction * Main.rand.Next(100, 251); int num1382 = Main.rand.Next(-50, 51); if (this.position.Y > Main.player[this.target].position.Y - 100f) { num1382 -= Main.rand.Next(100, 251); } float num1383 = num1380 / (float)Math.Sqrt((double)(num1381 * num1381 + num1382 * num1382)); num1377 = (float)num1381 * num1383; num1378 = (float)num1382 * num1383; } else { this.localAI[3] = 1f; float num1384 = (float)Main.rand.Next(5, 151) * 0.01f; int num1385 = Main.rand.Next(-100, 101); int num1386 = Main.rand.Next(-100, 101); float num1387 = num1384 / (float)Math.Sqrt((double)(num1385 * num1385 + num1386 * num1386)); num1377 = (float)num1385 * num1387; num1378 = (float)num1386 * num1387; } this.netUpdate = true; } } this.scale = this.ai[3]; if (this.localAI[2] > 0f) { int i3 = (int)base.Center.X / 16; int j3 = (int)base.Center.Y / 16; this.localAI[2] -= 1f; } else if (this.localAI[1] > 0f) { this.localAI[1] -= 1f; } else { this.localAI[1] = (float)Main.rand.Next(30, 180); if (!Main.dayTime || (double)(this.position.Y / 16f) > Main.worldSurface + 10.0) { this.localAI[2] = (float)Main.rand.Next(10, 30); } } int num1388 = 80; this.velocity.X = (this.velocity.X * (float)(num1388 - 1) + num1377) / (float)num1388; this.velocity.Y = (this.velocity.Y * (float)(num1388 - 1) + num1378) / (float)num1388; if (this.velocity.Y > 0f) { int num1389 = 4; int num1390 = (int)base.Center.X / 16; int num1391 = (int)base.Center.Y / 16; for (int num1392 = num1391; num1392 < num1391 + num1389; num1392++) { if (Main.tile[num1390, num1392] != null && ((Main.tile[num1390, num1392].nactive() && Main.tileSolid[(int)Main.tile[num1390, num1392].type]) || Main.tile[num1390, num1392].liquid > 0)) { num1378 *= -1f; if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.9f; } } } } if (this.velocity.Y < 0f) { int num1393 = 30; bool flag121 = false; int num1394 = (int)base.Center.X / 16; int num1395 = (int)base.Center.Y / 16; for (int num1396 = num1395; num1396 < num1395 + num1393; num1396++) { if (Main.tile[num1394, num1396] != null && Main.tile[num1394, num1396].nactive() && Main.tileSolid[(int)Main.tile[num1394, num1396].type]) { flag121 = true; } } if (!flag121) { num1378 *= -1f; if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.9f; } } } if (this.collideX) { if (this.velocity.X < 0f) { num1377 = Math.Abs(num1377); } else { num1377 = -Math.Abs(num1377); } this.velocity.X = this.velocity.X * -0.2f; } if (this.velocity.X < 0f) { this.direction = -1; } if (this.velocity.X > 0f) { this.direction = 1; } this.ai[0] = num1377; this.ai[1] = num1378; return; } if (this.aiStyle == 65) { float num1397 = this.ai[0]; float num1398 = this.ai[1]; if (Main.netMode != 1) { if (this.ai[2] == 0f) { int num1399 = 0; int num1400 = 4; int num1401 = 6; int num1402 = 3; int num1403 = 7; int num1404 = 2; int num1405 = 1; int num1406 = 5; int num1407 = Main.rand.Next(100); if (num1407 == 0) { num1407 = num1406; } else if (num1407 < 3) { num1407 = num1405; } else if (num1407 < 9) { num1407 = num1404; } else if (num1407 < 19) { num1407 = num1403; } else if (num1407 < 34) { num1407 = num1402; } else if (num1407 < 53) { num1407 = num1401; } else if (num1407 < 75) { num1407 = num1400; } else { num1407 = num1399; } this.ai[2] = (float)(1 + num1407); } if (this.ai[3] == 0f) { this.ai[3] = (float)Main.rand.Next(75, 111) * 0.01f; } this.localAI[0] -= 1f; if (this.localAI[0] <= 0f) { this.TargetClosest(true); this.localAI[0] = (float)Main.rand.Next(90, 240); float num1408 = Math.Abs(base.Center.X - Main.player[this.target].Center.X); if (num1408 > 700f && this.localAI[3] == 0f) { float num1409 = (float)Main.rand.Next(50, 151) * 0.01f; if (num1408 > 1000f) { num1409 = (float)Main.rand.Next(150, 201) * 0.01f; } else if (num1408 > 850f) { num1409 = (float)Main.rand.Next(100, 151) * 0.01f; } int num1410 = this.direction * Main.rand.Next(100, 251); int num1411 = Main.rand.Next(-50, 51); if (this.position.Y > Main.player[this.target].position.Y - 100f) { num1411 -= Main.rand.Next(100, 251); } float num1412 = num1409 / (float)Math.Sqrt((double)(num1410 * num1410 + num1411 * num1411)); num1397 = (float)num1410 * num1412; num1398 = (float)num1411 * num1412; } else { this.localAI[3] = 1f; float num1413 = (float)Main.rand.Next(26, 301) * 0.01f; int num1414 = Main.rand.Next(-100, 101); int num1415 = Main.rand.Next(-100, 101); float num1416 = num1413 / (float)Math.Sqrt((double)(num1414 * num1414 + num1415 * num1415)); num1397 = (float)num1414 * num1416; num1398 = (float)num1415 * num1416; } this.netUpdate = true; } } this.scale = this.ai[3]; int num1417 = 60; this.velocity.X = (this.velocity.X * (float)(num1417 - 1) + num1397) / (float)num1417; this.velocity.Y = (this.velocity.Y * (float)(num1417 - 1) + num1398) / (float)num1417; if (this.velocity.Y > 0f) { int num1418 = 3; int num1419 = (int)base.Center.X / 16; int num1420 = (int)base.Center.Y / 16; for (int num1421 = num1420; num1421 < num1420 + num1418; num1421++) { if (Main.tile[num1419, num1421] != null && ((Main.tile[num1419, num1421].nactive() && Main.tileSolid[(int)Main.tile[num1419, num1421].type]) || Main.tile[num1419, num1421].liquid > 0)) { num1398 *= -1f; if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.9f; } } } } if (this.velocity.Y < 0f) { int num1422 = 30; bool flag122 = false; int num1423 = (int)base.Center.X / 16; int num1424 = (int)base.Center.Y / 16; for (int num1425 = num1424; num1425 < num1424 + num1422; num1425++) { if (Main.tile[num1423, num1425] != null && Main.tile[num1423, num1425].nactive() && Main.tileSolid[(int)Main.tile[num1423, num1425].type]) { flag122 = true; } } if (!flag122) { num1398 *= -1f; if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.9f; } } } if (this.collideX) { if (this.velocity.X < 0f) { num1397 = Math.Abs(num1397); } else { num1397 = -Math.Abs(num1397); } this.velocity.X = this.velocity.X * -0.2f; } if (this.velocity.X < 0f) { this.direction = -1; } if (this.velocity.X > 0f) { this.direction = 1; } this.ai[0] = num1397; this.ai[1] = num1398; if (this.type == NPCID.Butterfly) { this.catchItem = (short)(1994f + this.ai[2] - 1f); return; } } else if (this.aiStyle == 66) { if (this.type == NPCID.EnchantedNightcrawler) { float num1426 = (float)Main.rand.Next(90, 111) * 0.01f; num1426 *= (Main.essScale + 0.5f) / 2f; } if (this.type == NPCID.Worm || this.type == NPCID.GoldWorm || (this.type >= NPCID.EnchantedNightcrawler && this.type <= NPCID.Buggy)) { if (this.localAI[2] < 90f) { this.localAI[2] += 1f; } else { this.friendly = false; } } if (this.velocity.Y == 0f) { if (this.ai[0] == 1f) { if (this.direction == 0) { this.TargetClosest(true); } if (this.collideX) { this.direction *= -1; } float num1427 = 0.2f; if (this.type == NPCID.Grubby) { num1427 = 0.25f; } if (this.type == NPCID.Sluggy) { num1427 = 0.325f; } if (this.type == NPCID.Buggy) { num1427 = 0.4f; } this.velocity.X = num1427 * (float)this.direction; if (this.type == NPCID.TruffleWorm) { this.velocity.X = this.velocity.X * 3f; } } else { this.velocity.X = 0f; } if (Main.netMode != 1) { this.localAI[1] -= 1f; if (this.localAI[1] <= 0f) { if (this.ai[0] == 1f) { this.ai[0] = 0f; this.localAI[1] = (float)Main.rand.Next(300, 900); } else { this.ai[0] = 1f; this.localAI[1] = (float)Main.rand.Next(600, 1800); } this.netUpdate = true; } } } if (this.type == NPCID.TruffleWorm) { this.spriteDirection = this.direction; bool flag123 = false; for (int num1428 = 0; num1428 < 255; num1428++) { Player player4 = Main.player[num1428]; if (player4.active && !player4.dead && Vector2.Distance(player4.Center, base.Center) <= 160f) { flag123 = true; break; } } int num1429 = 90; if (flag123 && this.ai[1] < (float)num1429) { this.ai[1] += 1f; } if (this.ai[1] == (float)num1429 && Main.netMode != 1) { this.position.Y = this.position.Y + 16f; this.Transform(375); this.netUpdate = true; return; } } } else if (this.aiStyle == 67) { if (this.type == NPCID.Snail) { if (this.ai[3] != 0f) { this.scale = this.ai[3]; int num1430 = (int)(12f * this.scale); int num1431 = (int)(12f * this.scale); if (num1430 != this.width) { this.position.X = this.position.X + (float)(this.width / 2) - (float)num1430 - 2f; this.width = num1430; } if (num1431 != this.height) { this.position.Y = this.position.Y + (float)this.height - (float)num1431; this.height = num1431; } } if (this.ai[3] == 0f && Main.netMode != 1) { this.ai[3] = (float)Main.rand.Next(80, 111) * 0.01f; this.netUpdate = true; } } float num1432 = 0.3f; if (this.type == NPCID.GlowingSnail) { num1432 = 0.6f; } if (this.ai[0] == 0f) { this.TargetClosest(true); this.directionY = 1; this.ai[0] = 1f; if (this.direction > 0) { this.spriteDirection = 1; } } bool flag124 = false; if (Main.netMode != 1) { if (this.ai[2] == 0f && Main.rand.Next(7200) == 0) { this.ai[2] = 2f; this.netUpdate = true; } if (!this.collideX && !this.collideY) { this.localAI[3] += 1f; if (this.localAI[3] > 5f) { this.ai[2] = 2f; this.netUpdate = true; } } else { this.localAI[3] = 0f; } } if (this.ai[2] > 0f) { this.ai[1] = 0f; this.ai[0] = 1f; this.directionY = 1; if (this.velocity.Y > num1432) { this.rotation += (float)this.direction * 0.1f; } else { this.rotation = 0f; } this.spriteDirection = this.direction; this.velocity.X = num1432 * (float)this.direction; this.noGravity = false; int num1433 = (int)(base.Center.X + (float)(this.width / 2 * -(float)this.direction)) / 16; int num1434 = (int)(this.position.Y + (float)this.height + 8f) / 16; if (Main.tile[num1433, num1434] != null && !Main.tile[num1433, num1434].topSlope() && this.collideY) { this.ai[2] -= 1f; } num1434 = (int)(this.position.Y + (float)this.height - 4f) / 16; num1433 = (int)(base.Center.X + (float)(this.width / 2 * this.direction)) / 16; if (Main.tile[num1433, num1434] != null && Main.tile[num1433, num1434].bottomSlope()) { this.direction *= -1; } if (this.collideX && this.velocity.Y == 0f) { flag124 = true; this.ai[2] = 0f; this.directionY = -1; this.ai[1] = 1f; } if (this.velocity.Y == 0f) { if (this.localAI[1] == this.position.X) { this.localAI[2] += 1f; if (this.localAI[2] > 10f) { this.direction = 1; this.velocity.X = (float)this.direction * num1432; this.localAI[2] = 0f; } } else { this.localAI[2] = 0f; this.localAI[1] = this.position.X; } } } if (this.ai[2] == 0f) { this.noGravity = true; if (this.ai[1] == 0f) { if (this.collideY) { this.ai[0] = 2f; } if (!this.collideY && this.ai[0] == 2f) { this.direction = -this.direction; this.ai[1] = 1f; this.ai[0] = 1f; } if (this.collideX) { this.directionY = -this.directionY; this.ai[1] = 1f; } } else { if (this.collideX) { this.ai[0] = 2f; } if (!this.collideX && this.ai[0] == 2f) { this.directionY = -this.directionY; this.ai[1] = 0f; this.ai[0] = 1f; } if (this.collideY) { this.direction = -this.direction; this.ai[1] = 0f; } } if (!flag124) { float num1435 = this.rotation; if (this.directionY < 0) { if (this.direction < 0) { if (this.collideX) { this.rotation = 1.57f; this.spriteDirection = -1; } else if (this.collideY) { this.rotation = 3.14f; this.spriteDirection = 1; } } else if (this.collideY) { this.rotation = 3.14f; this.spriteDirection = -1; } else if (this.collideX) { this.rotation = 4.71f; this.spriteDirection = 1; } } else if (this.direction < 0) { if (this.collideY) { this.rotation = 0f; this.spriteDirection = -1; } else if (this.collideX) { this.rotation = 1.57f; this.spriteDirection = 1; } } else if (this.collideX) { this.rotation = 4.71f; this.spriteDirection = -1; } else if (this.collideY) { this.rotation = 0f; this.spriteDirection = 1; } float num1436 = this.rotation; this.rotation = num1435; if ((double)this.rotation > 6.28) { this.rotation -= 6.28f; } if (this.rotation < 0f) { this.rotation += 6.28f; } float num1437 = Math.Abs(this.rotation - num1436); float num1438 = 0.1f; if (this.rotation > num1436) { if ((double)num1437 > 3.14) { this.rotation += num1438; } else { this.rotation -= num1438; if (this.rotation < num1436) { this.rotation = num1436; } } } if (this.rotation < num1436) { if ((double)num1437 > 3.14) { this.rotation -= num1438; } else { this.rotation += num1438; if (this.rotation > num1436) { this.rotation = num1436; } } } } this.velocity.X = num1432 * (float)this.direction; this.velocity.Y = num1432 * (float)this.directionY; return; } } else if (this.aiStyle == 68) { this.noGravity = true; if (this.ai[0] == 0f) { this.noGravity = false; int direction6 = this.direction; int num1439 = this.target; this.TargetClosest(true); if (num1439 >= 0 && direction6 != 0) { this.direction = direction6; } if (this.wet) { float num1440 = 2f; this.velocity.X = (this.velocity.X * 19f + num1440 * (float)this.direction) / 20f; int num1441 = (int)(base.Center.X + (float)((this.width / 2 + 8) * this.direction)) / 16; int num1442 = (int)(base.Center.Y / 16f); int j4 = (int)(this.position.Y / 16f); int num1443 = (int)((this.position.Y + (float)this.height) / 16f); if (Main.tile[num1441, num1442] == null) { Main.tile[num1441, num1442] = new Tile(); } if (Main.tile[num1441, num1443] == null) { Main.tile[num1441, num1443] = new Tile(); } if (WorldGen.SolidTile(num1441, num1442) || WorldGen.SolidTile(num1441, j4) || WorldGen.SolidTile(num1441, num1443) || Main.tile[num1441, num1443].liquid == 0) { this.direction *= -1; } this.spriteDirection = this.direction; if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.5f; } this.noGravity = true; num1441 = (int)(base.Center.X / 16f); num1442 = (int)(base.Center.Y / 16f); float num1444 = this.position.Y + (float)this.height; if (Main.tile[num1441, num1442 - 1] == null) { Main.tile[num1441, num1442 - 1] = new Tile(); } if (Main.tile[num1441, num1442] == null) { Main.tile[num1441, num1442] = new Tile(); } if (Main.tile[num1441, num1442 + 1] == null) { Main.tile[num1441, num1442 + 1] = new Tile(); } if (Main.tile[num1441, num1442 - 1].liquid > 0) { num1444 = (float)(num1442 * 16); num1444 -= (float)(Main.tile[num1441, num1442 - 1].liquid / 16); } else if (Main.tile[num1441, num1442].liquid > 0) { num1444 = (float)((num1442 + 1) * 16); num1444 -= (float)(Main.tile[num1441, num1442].liquid / 16); } else if (Main.tile[num1441, num1442 + 1].liquid > 0) { num1444 = (float)((num1442 + 2) * 16); num1444 -= (float)(Main.tile[num1441, num1442 + 1].liquid / 16); } num1444 -= 6f; if (base.Center.Y > num1444) { this.velocity.Y = this.velocity.Y - 0.1f; if (this.velocity.Y < -8f) { this.velocity.Y = -8f; } if (base.Center.Y + this.velocity.Y < num1444) { this.velocity.Y = num1444 - base.Center.Y; } } else { this.velocity.Y = num1444 - base.Center.Y; } } if (Main.netMode != 1) { if (!this.wet) { this.ai[0] = 1f; this.netUpdate = true; this.direction = -this.direction; return; } Rectangle rectangle14 = new Rectangle((int)Main.player[this.target].position.X, (int)Main.player[this.target].position.Y, Main.player[this.target].width, Main.player[this.target].height); Rectangle rectangle15 = new Rectangle((int)this.position.X - 100, (int)this.position.Y - 100, this.width + 200, this.height + 200); if (rectangle15.Intersects(rectangle14) || this.life < this.lifeMax) { this.ai[0] = 1f; this.velocity.Y = this.velocity.Y - 6f; this.netUpdate = true; this.direction = -this.direction; return; } } } else if (!Main.player[this.target].dead) { bool flag125 = false; this.ai[1] += 1f; if (this.ai[1] >= 300f) { flag125 = true; } if (flag125) { if (this.velocity.Y == 0f || this.collideY || this.wet) { this.velocity.X = 0f; this.velocity.Y = 0f; this.ai[0] = 0f; this.ai[1] = 0f; if (Main.netMode != 1) { if ((this.type == NPCID.Duck2 || this.type == NPCID.DuckWhite2) && !this.wet) { int direction7 = this.direction; this.Transform(this.type - 1); this.TargetClosest(true); this.direction = direction7; this.ai[0] = 0f; this.ai[1] = (float)(200 + Main.rand.Next(200)); } this.netUpdate = true; return; } } else { this.velocity.X = this.velocity.X * 0.98f; this.velocity.Y = this.velocity.Y + 0.1f; if (this.velocity.Y > 2f) { this.velocity.Y = 2f; return; } } } else { if (this.collideX) { this.direction *= -1; this.velocity.X = this.oldVelocity.X * -0.5f; if (this.direction == -1 && this.velocity.X > 0f && this.velocity.X < 2f) { this.velocity.X = 2f; } if (this.direction == 1 && this.velocity.X < 0f && this.velocity.X > -2f) { this.velocity.X = -2f; } } if (this.collideY) { this.velocity.Y = this.oldVelocity.Y * -0.5f; if (this.velocity.Y > 0f && this.velocity.Y < 1f) { this.velocity.Y = 1f; } if (this.velocity.Y < 0f && this.velocity.Y > -1f) { this.velocity.Y = -1f; } } if (this.direction == -1 && this.velocity.X > -3f) { this.velocity.X = this.velocity.X - 0.1f; if (this.velocity.X > 3f) { this.velocity.X = this.velocity.X - 0.1f; } else if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X - 0.05f; } if (this.velocity.X < -3f) { this.velocity.X = -3f; } } else if (this.direction == 1 && this.velocity.X < 3f) { this.velocity.X = this.velocity.X + 0.1f; if (this.velocity.X < -3f) { this.velocity.X = this.velocity.X + 0.1f; } else if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X + 0.05f; } if (this.velocity.X > 3f) { this.velocity.X = 3f; } } int num1445 = (int)((this.position.X + (float)(this.width / 2)) / 16f) + this.direction; int num1446 = (int)((this.position.Y + (float)this.height) / 16f); bool flag126 = true; int num1447 = 15; bool flag127 = false; for (int num1448 = num1446; num1448 < num1446 + num1447; num1448++) { if (Main.tile[num1445, num1448] == null) { Main.tile[num1445, num1448] = new Tile(); } if ((Main.tile[num1445, num1448].nactive() && Main.tileSolid[(int)Main.tile[num1445, num1448].type]) || Main.tile[num1445, num1448].liquid > 0) { if (num1448 < num1446 + 5) { flag127 = true; } flag126 = false; break; } } if (flag126) { this.velocity.Y = this.velocity.Y + 0.1f; } else { this.velocity.Y = this.velocity.Y - 0.1f; } if (flag127) { this.velocity.Y = this.velocity.Y - 0.2f; } if (this.velocity.Y > 3f) { this.velocity.Y = 3f; } if (this.velocity.Y < -4f) { this.velocity.Y = -4f; return; } } } } else if (this.aiStyle == 69) { bool expertMode = Main.expertMode; float num1449 = expertMode ? (0.6f * Main.damageMultiplier) : 1f; bool flag128 = (double)this.life <= (double)this.lifeMax * 0.5; bool flag129 = expertMode && (double)this.life <= (double)this.lifeMax * 0.15; bool flag130 = this.ai[0] > 4f; bool flag131 = this.ai[0] > 9f; bool flag132 = this.ai[3] < 10f; if (flag131) { this.damage = (int)((float)this.defDamage * 1.1f * num1449); this.defense = 0; } else if (flag130) { this.damage = (int)((float)this.defDamage * 1.2f * num1449); this.defense = (int)((float)this.defDefense * 0.8f); } else { this.damage = this.defDamage; this.defense = this.defDefense; } int num1450 = expertMode ? 40 : 60; float num1451 = expertMode ? 0.55f : 0.45f; float scaleFactor10 = expertMode ? 8.5f : 7.5f; if (flag131) { num1451 = 0.7f; scaleFactor10 = 12f; num1450 = 30; } else if (flag130 && flag132) { num1451 = (expertMode ? 0.6f : 0.5f); scaleFactor10 = (expertMode ? 10f : 8f); num1450 = (expertMode ? 40 : 20); } else if (flag132 && !flag130 && !flag131) { num1450 = 30; } int num1452 = expertMode ? 28 : 30; float num1453 = expertMode ? 17f : 16f; if (flag131) { num1452 = 25; num1453 = 27f; } else if (flag132 && flag130) { num1452 = (expertMode ? 27 : 30); if (expertMode) { num1453 = 21f; } } int num1454 = 80; int num1455 = 4; float num1456 = 0.3f; float scaleFactor11 = 5f; int num1457 = 90; int num1458 = 180; int num1459 = 180; int num1460 = 30; int num1461 = 120; int num1462 = 4; float scaleFactor12 = 6f; float scaleFactor13 = 20f; float num1463 = 6.28318548f / (float)(num1461 / 2); int num1464 = 75; Vector2 vector168 = base.Center; Player player5 = Main.player[this.target]; if (this.target < 0 || this.target == 255 || player5.dead || !player5.active) { this.TargetClosest(true); player5 = Main.player[this.target]; this.netUpdate = true; } if (player5.dead || Vector2.Distance(player5.Center, vector168) > 2400f) { this.velocity.Y = this.velocity.Y - 0.4f; if (this.timeLeft > 10) { this.timeLeft = 10; } if (this.ai[0] > 4f) { this.ai[0] = 5f; } else { this.ai[0] = 0f; } this.ai[2] = 0f; } bool flag133 = player5.position.Y < 800f || (double)player5.position.Y > Main.worldSurface * 16.0 || (player5.position.X > 6400f && player5.position.X < (float)(Main.maxTilesX * 16 - 6400)); if (flag133) { num1450 = 20; this.damage = this.defDamage * 2; this.defense = this.defDefense * 2; this.ai[3] = 0f; num1453 += 6f; } if (this.localAI[0] == 0f) { this.localAI[0] = 1f; this.alpha = 255; this.rotation = 0f; if (Main.netMode != 1) { this.ai[0] = -1f; this.netUpdate = true; } } float num1465 = (float)Math.Atan2((double)(player5.Center.Y - vector168.Y), (double)(player5.Center.X - vector168.X)); if (this.spriteDirection == 1) { num1465 += 3.14159274f; } if (num1465 < 0f) { num1465 += 6.28318548f; } if (num1465 > 6.28318548f) { num1465 -= 6.28318548f; } if (this.ai[0] == -1f) { num1465 = 0f; } if (this.ai[0] == 3f) { num1465 = 0f; } if (this.ai[0] == 4f) { num1465 = 0f; } if (this.ai[0] == 8f) { num1465 = 0f; } float num1466 = 0.04f; if (this.ai[0] == 1f || this.ai[0] == 6f) { num1466 = 0f; } if (this.ai[0] == 7f) { num1466 = 0f; } if (this.ai[0] == 3f) { num1466 = 0.01f; } if (this.ai[0] == 4f) { num1466 = 0.01f; } if (this.ai[0] == 8f) { num1466 = 0.01f; } if (this.rotation < num1465) { if ((double)(num1465 - this.rotation) > 3.1415926535897931) { this.rotation -= num1466; } else { this.rotation += num1466; } } if (this.rotation > num1465) { if ((double)(this.rotation - num1465) > 3.1415926535897931) { this.rotation += num1466; } else { this.rotation -= num1466; } } if (this.rotation > num1465 - num1466 && this.rotation < num1465 + num1466) { this.rotation = num1465; } if (this.rotation < 0f) { this.rotation += 6.28318548f; } if (this.rotation > 6.28318548f) { this.rotation -= 6.28318548f; } if (this.rotation > num1465 - num1466 && this.rotation < num1465 + num1466) { this.rotation = num1465; } if (this.ai[0] != -1f && this.ai[0] < 9f) { bool flag134 = Collision.SolidCollision(this.position, this.width, this.height); if (flag134) { this.alpha += 15; } else { this.alpha -= 15; } if (this.alpha < 0) { this.alpha = 0; } if (this.alpha > 150) { this.alpha = 150; } } if (this.ai[0] == -1f) { this.velocity *= 0.98f; int num1467 = Math.Sign(player5.Center.X - vector168.X); if (num1467 != 0) { this.direction = num1467; this.spriteDirection = -this.direction; } if (this.ai[2] > 20f) { this.velocity.Y = -2f; this.alpha -= 5; bool flag135 = Collision.SolidCollision(this.position, this.width, this.height); if (flag135) { this.alpha += 15; } if (this.alpha < 0) { this.alpha = 0; } if (this.alpha > 150) { this.alpha = 150; } } this.ai[2] += 1f; if (this.ai[2] >= (float)num1464) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[2] = 0f; this.netUpdate = true; return; } } else if (this.ai[0] == 0f && !player5.dead) { if (this.ai[1] == 0f) { this.ai[1] = (float)(300 * Math.Sign((vector168 - player5.Center).X)); } Vector2 value17 = player5.Center + new Vector2(this.ai[1], -200f) - vector168; Vector2 vector170 = Vector2.Normalize(value17 - this.velocity) * scaleFactor10; if (this.velocity.X < vector170.X) { this.velocity.X = this.velocity.X + num1451; if (this.velocity.X < 0f && vector170.X > 0f) { this.velocity.X = this.velocity.X + num1451; } } else if (this.velocity.X > vector170.X) { this.velocity.X = this.velocity.X - num1451; if (this.velocity.X > 0f && vector170.X < 0f) { this.velocity.X = this.velocity.X - num1451; } } if (this.velocity.Y < vector170.Y) { this.velocity.Y = this.velocity.Y + num1451; if (this.velocity.Y < 0f && vector170.Y > 0f) { this.velocity.Y = this.velocity.Y + num1451; } } else if (this.velocity.Y > vector170.Y) { this.velocity.Y = this.velocity.Y - num1451; if (this.velocity.Y > 0f && vector170.Y < 0f) { this.velocity.Y = this.velocity.Y - num1451; } } int num1471 = Math.Sign(player5.Center.X - vector168.X); if (num1471 != 0) { if (this.ai[2] == 0f && num1471 != this.direction) { this.rotation += 3.14159274f; } this.direction = num1471; if (this.spriteDirection != -this.direction) { this.rotation += 3.14159274f; } this.spriteDirection = -this.direction; } this.ai[2] += 1f; if (this.ai[2] >= (float)num1450) { int num1472 = 0; switch ((int)this.ai[3]) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: num1472 = 1; break; case 10: this.ai[3] = 1f; num1472 = 2; break; case 11: this.ai[3] = 0f; num1472 = 3; break; } if (flag128) { num1472 = 4; } if (num1472 == 1) { this.ai[0] = 1f; this.ai[1] = 0f; this.ai[2] = 0f; this.velocity = Vector2.Normalize(player5.Center - vector168) * num1453; this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X); if (num1471 != 0) { this.direction = num1471; if (this.spriteDirection == 1) { this.rotation += 3.14159274f; } this.spriteDirection = -this.direction; } } else if (num1472 == 2) { this.ai[0] = 2f; this.ai[1] = 0f; this.ai[2] = 0f; } else if (num1472 == 3) { this.ai[0] = 3f; this.ai[1] = 0f; this.ai[2] = 0f; } else if (num1472 == 4) { this.ai[0] = 4f; this.ai[1] = 0f; this.ai[2] = 0f; } this.netUpdate = true; return; } } else if (this.ai[0] == 1f) { this.ai[2] += 1f; if (this.ai[2] >= (float)num1452) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] += 2f; this.netUpdate = true; return; } } else if (this.ai[0] == 2f) { if (this.ai[1] == 0f) { this.ai[1] = (float)(300 * Math.Sign((vector168 - player5.Center).X)); } Vector2 value19 = player5.Center + new Vector2(this.ai[1], -200f) - vector168; Vector2 vector172 = Vector2.Normalize(value19 - this.velocity) * scaleFactor11; if (this.velocity.X < vector172.X) { this.velocity.X = this.velocity.X + num1456; if (this.velocity.X < 0f && vector172.X > 0f) { this.velocity.X = this.velocity.X + num1456; } } else if (this.velocity.X > vector172.X) { this.velocity.X = this.velocity.X - num1456; if (this.velocity.X > 0f && vector172.X < 0f) { this.velocity.X = this.velocity.X - num1456; } } if (this.velocity.Y < vector172.Y) { this.velocity.Y = this.velocity.Y + num1456; if (this.velocity.Y < 0f && vector172.Y > 0f) { this.velocity.Y = this.velocity.Y + num1456; } } else if (this.velocity.Y > vector172.Y) { this.velocity.Y = this.velocity.Y - num1456; if (this.velocity.Y > 0f && vector172.Y < 0f) { this.velocity.Y = this.velocity.Y - num1456; } } if (this.ai[2] % (float)num1455 == 0f) { if (Main.netMode != 1) { Vector2 vector173 = Vector2.Normalize(player5.Center - vector168) * (float)(this.width + 20) / 2f + vector168; NPC.NewNPC((int)vector173.X, (int)vector173.Y + 45, 371, 0, 0f, 0f, 0f, 0f, 255); } } int num1476 = Math.Sign(player5.Center.X - vector168.X); if (num1476 != 0) { this.direction = num1476; if (this.spriteDirection != -this.direction) { this.rotation += 3.14159274f; } this.spriteDirection = -this.direction; } this.ai[2] += 1f; if (this.ai[2] >= (float)num1454) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[2] = 0f; this.netUpdate = true; return; } } else if (this.ai[0] == 3f) { this.velocity *= 0.98f; this.velocity.Y = MathHelper.Lerp(this.velocity.Y, 0f, 0.02f); if (Main.netMode != 1 && this.ai[2] == (float)(num1457 - 30)) { Vector2 vector174 = this.rotation.ToRotationVector2() * (Vector2.UnitX * (float)this.direction) * (float)(this.width + 20) / 2f + vector168; Projectile.NewProjectile(vector174.X, vector174.Y, (float)(this.direction * 2), 8f, 385, 0, 0f, Main.myPlayer, 0f, 0f); Projectile.NewProjectile(vector174.X, vector174.Y, (float)(-(float)this.direction * 2), 8f, 385, 0, 0f, Main.myPlayer, 0f, 0f); } this.ai[2] += 1f; if (this.ai[2] >= (float)num1457) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[2] = 0f; this.netUpdate = true; return; } } else if (this.ai[0] == 4f) { this.velocity *= 0.98f; this.velocity.Y = MathHelper.Lerp(this.velocity.Y, 0f, 0.02f); this.ai[2] += 1f; if (this.ai[2] >= (float)num1458) { this.ai[0] = 5f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; return; } } else if (this.ai[0] == 5f && !player5.dead) { if (this.ai[1] == 0f) { this.ai[1] = (float)(300 * Math.Sign((vector168 - player5.Center).X)); } Vector2 value20 = player5.Center + new Vector2(this.ai[1], -200f) - vector168; Vector2 vector175 = Vector2.Normalize(value20 - this.velocity) * scaleFactor10; if (this.velocity.X < vector175.X) { this.velocity.X = this.velocity.X + num1451; if (this.velocity.X < 0f && vector175.X > 0f) { this.velocity.X = this.velocity.X + num1451; } } else if (this.velocity.X > vector175.X) { this.velocity.X = this.velocity.X - num1451; if (this.velocity.X > 0f && vector175.X < 0f) { this.velocity.X = this.velocity.X - num1451; } } if (this.velocity.Y < vector175.Y) { this.velocity.Y = this.velocity.Y + num1451; if (this.velocity.Y < 0f && vector175.Y > 0f) { this.velocity.Y = this.velocity.Y + num1451; } } else if (this.velocity.Y > vector175.Y) { this.velocity.Y = this.velocity.Y - num1451; if (this.velocity.Y > 0f && vector175.Y < 0f) { this.velocity.Y = this.velocity.Y - num1451; } } int num1477 = Math.Sign(player5.Center.X - vector168.X); if (num1477 != 0) { if (this.ai[2] == 0f && num1477 != this.direction) { this.rotation += 3.14159274f; } this.direction = num1477; if (this.spriteDirection != -this.direction) { this.rotation += 3.14159274f; } this.spriteDirection = -this.direction; } this.ai[2] += 1f; if (this.ai[2] >= (float)num1450) { int num1478 = 0; switch ((int)this.ai[3]) { case 0: case 1: case 2: case 3: case 4: case 5: num1478 = 1; break; case 6: this.ai[3] = 1f; num1478 = 2; break; case 7: this.ai[3] = 0f; num1478 = 3; break; } if (flag129) { num1478 = 4; } if (num1478 == 1) { this.ai[0] = 6f; this.ai[1] = 0f; this.ai[2] = 0f; this.velocity = Vector2.Normalize(player5.Center - vector168) * num1453; this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X); if (num1477 != 0) { this.direction = num1477; if (this.spriteDirection == 1) { this.rotation += 3.14159274f; } this.spriteDirection = -this.direction; } } else if (num1478 == 2) { this.velocity = Vector2.Normalize(player5.Center - vector168) * scaleFactor13; this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X); if (num1477 != 0) { this.direction = num1477; if (this.spriteDirection == 1) { this.rotation += 3.14159274f; } this.spriteDirection = -this.direction; } this.ai[0] = 7f; this.ai[1] = 0f; this.ai[2] = 0f; } else if (num1478 == 3) { this.ai[0] = 8f; this.ai[1] = 0f; this.ai[2] = 0f; } else if (num1478 == 4) { this.ai[0] = 9f; this.ai[1] = 0f; this.ai[2] = 0f; } this.netUpdate = true; return; } } else if (this.ai[0] == 6f) { this.ai[2] += 1f; if (this.ai[2] >= (float)num1452) { this.ai[0] = 5f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] += 2f; this.netUpdate = true; return; } } else if (this.ai[0] == 7f) { if (this.ai[2] % (float)num1462 == 0f) { if (Main.netMode != 1) { Vector2 vector177 = Vector2.Normalize(this.velocity) * (float)(this.width + 20) / 2f + vector168; int num1482 = NPC.NewNPC((int)vector177.X, (int)vector177.Y + 45, 371, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num1482].target = this.target; Main.npc[num1482].velocity = Vector2.Normalize(this.velocity).RotatedBy((double)(1.57079637f * (float)this.direction), default(Vector2)) * scaleFactor12; Main.npc[num1482].netUpdate = true; Main.npc[num1482].ai[3] = (float)Main.rand.Next(80, 121) / 100f; } } this.velocity = this.velocity.RotatedBy((double)(-(double)num1463 * (float)this.direction), default(Vector2)); this.rotation -= num1463 * (float)this.direction; this.ai[2] += 1f; if (this.ai[2] >= (float)num1461) { this.ai[0] = 5f; this.ai[1] = 0f; this.ai[2] = 0f; this.netUpdate = true; return; } } else if (this.ai[0] == 8f) { this.velocity *= 0.98f; this.velocity.Y = MathHelper.Lerp(this.velocity.Y, 0f, 0.02f); if (Main.netMode != 1 && this.ai[2] == (float)(num1457 - 30)) { Projectile.NewProjectile(vector168.X, vector168.Y, 0f, 0f, 385, 0, 0f, Main.myPlayer, 1f, (float)(this.target + 1)); } this.ai[2] += 1f; if (this.ai[2] >= (float)num1457) { this.ai[0] = 5f; this.ai[1] = 0f; this.ai[2] = 0f; this.netUpdate = true; return; } } else if (this.ai[0] == 9f) { if (this.ai[2] < (float)(num1459 - 90)) { bool flag136 = Collision.SolidCollision(this.position, this.width, this.height); if (flag136) { this.alpha += 15; } else { this.alpha -= 15; } if (this.alpha < 0) { this.alpha = 0; } if (this.alpha > 150) { this.alpha = 150; } } else if (this.alpha < 255) { this.alpha += 4; if (this.alpha > 255) { this.alpha = 255; } } this.velocity *= 0.98f; this.velocity.Y = MathHelper.Lerp(this.velocity.Y, 0f, 0.02f); this.ai[2] += 1f; if (this.ai[2] >= (float)num1459) { this.ai[0] = 10f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; return; } } else if (this.ai[0] == 10f && !player5.dead) { this.dontTakeDamage = false; this.chaseable = false; if (this.alpha < 255) { this.alpha += 25; if (this.alpha > 255) { this.alpha = 255; } } if (this.ai[1] == 0f) { this.ai[1] = (float)(360 * Math.Sign((vector168 - player5.Center).X)); } Vector2 value22 = player5.Center + new Vector2(this.ai[1], -200f) - vector168; Vector2 desiredVelocity = Vector2.Normalize(value22 - this.velocity) * scaleFactor10; this.SimpleFlyMovement(desiredVelocity, num1451); int num1483 = Math.Sign(player5.Center.X - vector168.X); if (num1483 != 0) { if (this.ai[2] == 0f && num1483 != this.direction) { this.rotation += 3.14159274f; for (int num1484 = 0; num1484 < this.oldPos.Length; num1484++) { this.oldPos[num1484] = Vector2.Zero; } } this.direction = num1483; if (this.spriteDirection != -this.direction) { this.rotation += 3.14159274f; } this.spriteDirection = -this.direction; } this.ai[2] += 1f; if (this.ai[2] >= (float)num1450) { int num1485 = 0; switch ((int)this.ai[3]) { case 0: case 2: case 3: case 5: case 6: case 7: num1485 = 1; break; case 1: case 4: case 8: num1485 = 2; break; } if (num1485 == 1) { this.ai[0] = 11f; this.ai[1] = 0f; this.ai[2] = 0f; this.velocity = Vector2.Normalize(player5.Center - vector168) * num1453; this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X); if (num1483 != 0) { this.direction = num1483; if (this.spriteDirection == 1) { this.rotation += 3.14159274f; } this.spriteDirection = -this.direction; } } else if (num1485 == 2) { this.ai[0] = 12f; this.ai[1] = 0f; this.ai[2] = 0f; } else if (num1485 == 3) { this.ai[0] = 13f; this.ai[1] = 0f; this.ai[2] = 0f; } this.netUpdate = true; return; } } else if (this.ai[0] == 11f) { this.dontTakeDamage = false; this.chaseable = true; this.alpha -= 25; if (this.alpha < 0) { this.alpha = 0; } this.ai[2] += 1f; if (this.ai[2] >= (float)num1452) { this.ai[0] = 10f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] += 1f; this.netUpdate = true; return; } } else if (this.ai[0] == 12f) { this.dontTakeDamage = true; this.chaseable = false; if (this.alpha < 255) { this.alpha += 17; if (this.alpha > 255) { this.alpha = 255; } } this.velocity *= 0.98f; this.velocity.Y = MathHelper.Lerp(this.velocity.Y, 0f, 0.02f); if (Main.netMode != 1 && this.ai[2] == (float)(num1460 / 2)) { if (this.ai[1] == 0f) { this.ai[1] = (float)(300 * Math.Sign((vector168 - player5.Center).X)); } Vector2 center6 = player5.Center + new Vector2(-this.ai[1], -200f); vector168 = (base.Center = center6); int num1489 = Math.Sign(player5.Center.X - vector168.X); if (num1489 != 0) { if (this.ai[2] == 0f && num1489 != this.direction) { this.rotation += 3.14159274f; for (int num1490 = 0; num1490 < this.oldPos.Length; num1490++) { this.oldPos[num1490] = Vector2.Zero; } } this.direction = num1489; if (this.spriteDirection != -this.direction) { this.rotation += 3.14159274f; } this.spriteDirection = -this.direction; } } this.ai[2] += 1f; if (this.ai[2] >= (float)num1460) { this.ai[0] = 10f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] += 1f; if (this.ai[3] >= 9f) { this.ai[3] = 0f; } this.netUpdate = true; return; } } else if (this.ai[0] == 13f) { this.velocity = this.velocity.RotatedBy((double)(-(double)num1463 * (float)this.direction), default(Vector2)); this.rotation -= num1463 * (float)this.direction; this.ai[2] += 1f; if (this.ai[2] >= (float)num1461) { this.ai[0] = 10f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] += 1f; this.netUpdate = true; return; } } } else if (this.aiStyle == 70) { if (this.target == 255) { this.TargetClosest(true); this.ai[3] = (float)Main.rand.Next(80, 121) / 100f; float scaleFactor14 = (float)Main.rand.Next(165, 265) / 15f; this.velocity = Vector2.Normalize(Main.player[this.target].Center - base.Center + new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101))) * scaleFactor14; this.netUpdate = true; } Vector2 vector179 = Vector2.Normalize(Main.player[this.target].Center - base.Center); this.velocity = (this.velocity * 40f + vector179 * 20f) / 41f; this.scale = this.ai[3]; this.alpha -= 30; if (this.alpha < 50) { this.alpha = 50; } this.alpha = 50; this.velocity.X = (this.velocity.X * 50f + Main.windSpeed * 2f + (float)Main.rand.Next(-10, 11) * 0.1f) / 51f; this.velocity.Y = (this.velocity.Y * 50f + -0.25f + (float)Main.rand.Next(-10, 11) * 0.2f) / 51f; if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y - 0.04f; } if (this.ai[0] == 0f) { int num1491 = 40; Rectangle rect = this.getRect(); rect.X -= num1491 + this.width / 2; rect.Y -= num1491 + this.height / 2; rect.Width += num1491 * 2; rect.Height += num1491 * 2; for (int num1492 = 0; num1492 < 255; num1492++) { Player player6 = Main.player[num1492]; if (player6.active && !player6.dead && rect.Intersects(player6.getRect())) { this.ai[0] = 1f; this.ai[1] = 4f; this.netUpdate = true; break; } } } if (this.ai[0] == 0f) { this.ai[1] += 1f; if (this.ai[1] >= 150f) { this.ai[0] = 1f; this.ai[1] = 4f; } } if (this.ai[0] == 1f) { this.ai[1] -= 1f; if (this.ai[1] <= 0f) { this.life = 0; this.HitEffect(0, 10.0); this.active = false; return; } } if (this.justHit || this.ai[0] == 1f) { this.dontTakeDamage = true; this.position = base.Center; this.width = (this.height = 100); this.position = new Vector2(this.position.X - (float)(this.width / 2), this.position.Y - (float)(this.height / 2)); if (this.timeLeft > 3) { this.timeLeft = 3; return; } } } else if (this.aiStyle == 71) { this.noTileCollide = true; int num1493 = 90; if (this.target < 0 || this.target == 255 || Main.player[this.target].dead) { this.TargetClosest(false); this.direction = 1; this.netUpdate = true; } if (this.ai[0] == 0f) { this.ai[1] += 1f; int arg_5028C_0 = this.type; this.noGravity = true; this.dontTakeDamage = true; this.velocity.Y = this.ai[3]; if (this.type == NPCID.Sharkron2) { float num1494 = 0.104719758f; float num1495 = this.ai[2]; float num1496 = (float)(Math.Cos((double)(num1494 * this.localAI[1])) - 0.5) * num1495; this.position.X = this.position.X - num1496 * (float)(-(float)this.direction); this.localAI[1] += 1f; num1496 = (float)(Math.Cos((double)(num1494 * this.localAI[1])) - 0.5) * num1495; this.position.X = this.position.X + num1496 * (float)(-(float)this.direction); if (Math.Abs(Math.Cos((double)(num1494 * this.localAI[1])) - 0.5) > 0.25) { this.spriteDirection = ((Math.Cos((double)(num1494 * this.localAI[1])) - 0.5 >= 0.0) ? -1 : 1); } this.rotation = this.velocity.Y * (float)this.spriteDirection * 0.1f; if ((double)this.rotation < -0.2) { this.rotation = -0.2f; } if ((double)this.rotation > 0.2) { this.rotation = 0.2f; } this.alpha -= 6; if (this.alpha < 0) { this.alpha = 0; } } if (this.ai[1] >= (float)num1493) { this.ai[0] = 1f; this.ai[1] = 0f; if (!Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[1] = 1f; } this.TargetClosest(true); this.spriteDirection = this.direction; Vector2 vector180 = Main.player[this.target].Center - base.Center; vector180.Normalize(); this.velocity = vector180 * 16f; this.rotation = this.velocity.ToRotation(); if (this.direction == -1) { this.rotation += 3.14159274f; } this.netUpdate = true; return; } } else if (this.ai[0] == 1f) { this.noGravity = true; if (!Collision.SolidCollision(this.position, this.width, this.height)) { if (this.ai[1] < 1f) { this.ai[1] = 1f; } } else { this.alpha -= 15; if (this.alpha < 150) { this.alpha = 150; } } if (this.ai[1] >= 1f) { this.alpha -= 60; if (this.alpha < 0) { this.alpha = 0; } this.dontTakeDamage = false; this.ai[1] += 1f; if (Collision.SolidCollision(this.position, this.width, this.height)) { this.life = 0; this.HitEffect(0, 10.0); this.active = false; return; } } if (this.ai[1] >= 60f) { this.noGravity = false; } this.rotation = this.velocity.ToRotation(); if (this.direction == -1) { this.rotation += 3.14159274f; return; } } } else if (this.aiStyle == 72) { if (this.type == NPCID.ForceBubble) { int num1497 = (int)this.ai[0]; if (Main.npc[num1497].active && Main.npc[num1497].type == NPCID.MartianOfficer) { this.velocity = Vector2.Zero; this.position = Main.npc[num1497].Center; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.gfxOffY = Main.npc[num1497].gfxOffY; return; } this.life = 0; this.HitEffect(0, 10.0); this.active = false; return; } } else if (this.aiStyle == 73) { this.TargetClosest(false); this.spriteDirection = this.direction; this.velocity.X = this.velocity.X * 0.93f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } if (this.type == NPCID.MartianTurret) { float num1498 = 120f; float num1499 = 60f; if (this.ai[1] < num1498) { this.ai[1] += 1f; if (this.ai[1] > 60f) { float num1500 = (this.ai[1] - num1499) / (num1498 - num1499); this.alpha = (int)((1f - num1500) * 255f); } else { this.alpha = 255; } this.dontTakeDamage = true; this.frameCounter = 0.0; this.frame.Y = 0; float num1501 = this.ai[1] / num1499; return; } this.dontTakeDamage = false; } if (this.ai[0] < 60f) { this.ai[0] += 1f; } if (this.justHit) { this.ai[0] = -30f; } if (this.ai[0] == 60f) { this.ai[0] = -120f; Vector2 center7 = Main.player[this.target].Center; Vector2 value25 = base.Center - Vector2.UnitY * 10f; Vector2 vector181 = center7 - value25; vector181.X += (float)Main.rand.Next(-100, 101); vector181.Y += (float)Main.rand.Next(-100, 101); vector181.X *= (float)Main.rand.Next(70, 131) * 0.01f; vector181.Y *= (float)Main.rand.Next(70, 131) * 0.01f; vector181.Normalize(); if (float.IsNaN(vector181.X) || float.IsNaN(vector181.Y)) { vector181 = -Vector2.UnitY; } vector181 *= 14f; int num1504 = 35; if (Main.expertMode && this.type >= NPCID.BrainScrambler && this.type <= NPCID.MartianSaucer) { num1504 = (int)((double)num1504 * 0.8); } Projectile.NewProjectile(value25.X, value25.Y, vector181.X, vector181.Y, 435, num1504, 0f, Main.myPlayer, 0f, 0f); return; } } else if (this.aiStyle == 74) { this.TargetClosest(false); this.rotation = this.velocity.ToRotation(); if (Math.Sign(this.velocity.X) != 0) { this.spriteDirection = -Math.Sign(this.velocity.X); } if (this.rotation < -1.57079637f) { this.rotation += 3.14159274f; } if (this.rotation > 1.57079637f) { this.rotation -= 3.14159274f; } if (this.type == NPCID.SolarCorite) { this.spriteDirection = Math.Sign(this.velocity.X); } float num1505 = 0.4f; float num1506 = 10f; float scaleFactor16 = 200f; float num1507 = 750f; float num1508 = 30f; float num1509 = 30f; float scaleFactor17 = 0.95f; int num1510 = 50; float scaleFactor18 = 14f; float num1511 = 30f; float num1512 = 100f; float num1513 = 20f; float num1514 = 0f; float num1515 = 7f; bool flag137 = true; if (this.type == NPCID.SolarCorite) { num1505 = 0.3f; num1506 = 8f; scaleFactor16 = 300f; num1507 = 800f; num1508 = 60f; num1509 = 5f; scaleFactor17 = 0.8f; num1510 = 0; scaleFactor18 = 10f; num1511 = 30f; num1512 = 150f; num1513 = 60f; num1514 = 0.333333343f; num1515 = 8f; flag137 = false; } num1514 *= num1513; if (Main.expertMode) { num1505 *= Main.expertKnockBack; } if (this.ai[0] == 0f) { this.knockBackResist = num1505; float scaleFactor19 = num1506; Vector2 center8 = base.Center; Vector2 center9 = Main.player[this.target].Center; Vector2 vector183 = center9 - center8; Vector2 vector184 = vector183 - Vector2.UnitY * scaleFactor16; float num1521 = vector183.Length(); vector183 = Vector2.Normalize(vector183) * scaleFactor19; vector184 = Vector2.Normalize(vector184) * scaleFactor19; bool flag138 = Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1); if (this.ai[3] >= 120f) { flag138 = true; } float num1522 = 8f; flag138 = (flag138 && vector183.ToRotation() > 3.14159274f / num1522 && vector183.ToRotation() < 3.14159274f - 3.14159274f / num1522); if (num1521 > num1507 || !flag138) { this.velocity.X = (this.velocity.X * (num1508 - 1f) + vector184.X) / num1508; this.velocity.Y = (this.velocity.Y * (num1508 - 1f) + vector184.Y) / num1508; if (!flag138) { this.ai[3] += 1f; if (this.ai[3] == 120f) { this.netUpdate = true; } } else { this.ai[3] = 0f; } } else { this.ai[0] = 1f; this.ai[2] = vector183.X; this.ai[3] = vector183.Y; this.netUpdate = true; } } else if (this.ai[0] == 1f) { this.knockBackResist = 0f; this.velocity *= scaleFactor17; this.ai[1] += 1f; if (this.ai[1] >= num1509) { this.ai[0] = 2f; this.ai[1] = 0f; this.netUpdate = true; Vector2 velocity2 = new Vector2(this.ai[2], this.ai[3]) + new Vector2((float)Main.rand.Next(-num1510, num1510 + 1), (float)Main.rand.Next(-num1510, num1510 + 1)) * 0.04f; velocity2.Normalize(); velocity2 *= scaleFactor18; this.velocity = velocity2; } } else if (this.ai[0] == 2f) { this.knockBackResist = 0f; float num1524 = num1511; this.ai[1] += 1f; bool flag139 = Vector2.Distance(base.Center, Main.player[this.target].Center) > num1512 && base.Center.Y > Main.player[this.target].Center.Y; if ((this.ai[1] >= num1524 && flag139) || this.velocity.Length() < num1515) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; this.velocity /= 2f; this.netUpdate = true; if (this.type == NPCID.SolarCorite) { this.ai[1] = 45f; this.ai[0] = 4f; } } else { Vector2 center10 = base.Center; Vector2 center11 = Main.player[this.target].Center; Vector2 vec4 = center11 - center10; vec4.Normalize(); if (vec4.HasNaNs()) { vec4 = new Vector2((float)this.direction, 0f); } this.velocity = (this.velocity * (num1513 - 1f) + vec4 * (this.velocity.Length() + num1514)) / num1513; } if (flag137 && Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[0] = 3f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; } } else if (this.ai[0] == 4f) { this.ai[1] -= 3f; if (this.ai[1] <= 0f) { this.ai[0] = 0f; this.ai[1] = 0f; this.netUpdate = true; } this.velocity *= 0.95f; } if (flag137 && this.ai[0] != 3f && Vector2.Distance(base.Center, Main.player[this.target].Center) < 64f) { this.ai[0] = 3f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; } if (this.ai[0] == 3f) { this.position = base.Center; this.width = (this.height = 192); this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.velocity = Vector2.Zero; this.damage = (int)(80f * Main.damageMultiplier); this.alpha = 255; this.ai[1] += 1f; if (this.ai[1] >= 3f) { this.life = 0; this.HitEffect(0, 10.0); this.active = false; return; } } } else if (this.aiStyle == 75) { int num1529 = -1; Vector2 vector185 = Vector2.Zero; int num1530 = 0; if (this.type == NPCID.ScutlixRider) { if (this.localAI[0] == 0f && Main.netMode != 1) { this.localAI[0] = 1f; int num1531 = NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 391, this.whoAmI, 0f, 0f, 0f, 0f, 255); this.ai[0] = (float)num1531; this.netUpdate = true; } int num1532 = (int)this.ai[0]; if (Main.npc[num1532].active && Main.npc[num1532].type == NPCID.Scutlix) { if (this.timeLeft < 60) { this.timeLeft = 60; } num1529 = num1532; vector185 = Vector2.UnitY * -14f; } } if (this.type == NPCID.SolarDrakomireRider) { if (this.localAI[0] == 0f && Main.netMode != 1) { this.localAI[0] = 1f; int num1533 = NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 415, this.whoAmI, 0f, 0f, 0f, 0f, 255); this.ai[0] = (float)num1533; this.netUpdate = true; } int num1534 = (int)this.ai[0]; if (Main.npc[num1534].active && Main.npc[num1534].type == NPCID.SolarDrakomire) { if (this.timeLeft < 60) { this.timeLeft = 60; } num1529 = num1534; vector185 = new Vector2((float)(-(float)Main.npc[num1534].spriteDirection * 10), -30f); } } else if (this.type == NPCID.MartianSaucer) { int num1535 = (int)this.ai[0]; if (Main.npc[num1535].active && Main.npc[num1535].type == NPCID.MartianSaucerCore) { if (this.timeLeft < 60) { this.timeLeft = 60; } num1529 = num1535; vector185 = Vector2.UnitY * 2f; vector185 *= Main.npc[num1535].scale; float num1536 = Main.npc[num1535].rotation; vector185 = vector185.RotatedBy((double)num1536, default(Vector2)); this.rotation = num1536; if (Main.netMode != 1) { bool flag140 = true; if (Main.npc[num1535].ai[0] >= 1f || Main.npc[num1535].ai[0] < 0f) { flag140 = false; } if (flag140) { for (int num1537 = 0; num1537 < 2; num1537++) { if (Main.npc[(int)this.localAI[num1537]].active && Main.npc[(int)this.localAI[num1537]].type == 393) { flag140 = false; } } for (int num1538 = 2; num1538 < 4; num1538++) { if (Main.npc[(int)this.localAI[num1538]].active && Main.npc[(int)this.localAI[num1538]].type == 394) { flag140 = false; } } } if (flag140) { Main.npc[num1535].ai[0] = 1f; Main.npc[num1535].ai[1] = 0f; Main.npc[num1535].ai[2] = 0f; Main.npc[num1535].ai[3] = 0f; Main.npc[num1535].netUpdate = true; } } } } else if (this.type == NPCID.MartianSaucerTurret) { int num1539 = (int)this.ai[0]; if (Main.npc[num1539].active && Main.npc[num1539].type == NPCID.MartianSaucerCore) { if (this.timeLeft < 60) { this.timeLeft = 60; } num1529 = num1539; vector185 = Vector2.UnitY * 29f + ((this.ai[1] == 1f) ? Vector2.UnitX : (-Vector2.UnitX)) * 60f; vector185 *= Main.npc[num1539].scale; float num1540 = Main.npc[num1539].rotation; vector185 = vector185.RotatedBy((double)num1540, default(Vector2)); this.rotation = num1540; } } else if (this.type == NPCID.MartianSaucerCannon) { int num1541 = (int)this.ai[0]; if (Main.npc[num1541].active && Main.npc[num1541].type == NPCID.MartianSaucerCore) { if (this.timeLeft < 60) { this.timeLeft = 60; } num1529 = num1541; vector185 = Vector2.UnitY * -13f + ((this.ai[1] == 1f) ? Vector2.UnitX : (-Vector2.UnitX)) * 49f; vector185 *= Main.npc[num1541].scale; float num1542 = Main.npc[num1541].rotation; vector185 = vector185.RotatedBy((double)num1542, default(Vector2)); this.rotation = num1542; num1530 = ((this.ai[1] == 1f) ? 1 : -1); } } else if (this.type == NPCID.PirateShipCannon) { int num1543 = (int)this.ai[0]; if (Main.npc[num1543].active && Main.npc[num1543].type == NPCID.PirateShip) { if (this.timeLeft < 60) { this.timeLeft = 60; } num1529 = num1543; vector185 = new Vector2((-122f + 68f * this.ai[1]) * (float)((Main.npc[num1543].spriteDirection == 1) ? -1 : 1), -6f); vector185 *= Main.npc[num1543].scale; float num1544 = Main.npc[num1543].rotation; vector185 = vector185.RotatedBy((double)num1544, default(Vector2)); this.rotation = num1544; } } if (num1529 != -1) { NPC nPC7 = Main.npc[num1529]; this.velocity = Vector2.Zero; this.position = nPC7.Center; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.position += vector185; this.gfxOffY = nPC7.gfxOffY; this.direction = nPC7.direction; if (num1530 == 0) { this.spriteDirection = nPC7.spriteDirection; } else { this.spriteDirection = num1530; } if (this.type == NPCID.ScutlixRider) { this.timeLeft = nPC7.timeLeft; this.velocity = nPC7.velocity; this.target = nPC7.target; if (this.ai[1] < 60f) { this.ai[1] += 1f; } if (this.justHit) { this.ai[1] = -30f; } int num1545 = 438; int num1546 = 30; float scaleFactor20 = 7f; if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { Vector2 vector186 = Main.player[this.target].Center - base.Center; Vector2 vector187 = Vector2.Normalize(vector186); float num1547 = vector186.Length(); float num1548 = 700f; if (this.type == NPCID.PirateDeadeye) { num1548 = 550f; } if (this.type == NPCID.PirateCrossbower) { num1548 = 800f; } if (num1547 < num1548) { if (this.ai[1] == 60f && Math.Sign(vector186.X) == this.direction) { this.ai[1] = -60f; Vector2 center12 = Main.player[this.target].Center; Vector2 value26 = base.Center - Vector2.UnitY * 4f; Vector2 vector188 = center12 - value26; vector188.X += (float)Main.rand.Next(-50, 51); vector188.Y += (float)Main.rand.Next(-50, 51); vector188.X *= (float)Main.rand.Next(80, 121) * 0.01f; vector188.Y *= (float)Main.rand.Next(80, 121) * 0.01f; vector188.Normalize(); if (float.IsNaN(vector188.X) || float.IsNaN(vector188.Y)) { vector188 = -Vector2.UnitY; } vector188 *= scaleFactor20; Projectile.NewProjectile(value26.X, value26.Y, vector188.X, vector188.Y, num1545, num1546, 0f, Main.myPlayer, 0f, 0f); this.netUpdate = true; } else { float num1549 = this.ai[2]; this.velocity.X = this.velocity.X * 0.5f; this.ai[2] = 3f; if (Math.Abs(vector187.Y) > Math.Abs(vector187.X) * 2f) { if (vector187.Y > 0f) { this.ai[2] = 1f; } else { this.ai[2] = 5f; } } else if (Math.Abs(vector187.X) > Math.Abs(vector187.Y) * 2f) { this.ai[2] = 3f; } else if (vector187.Y > 0f) { this.ai[2] = 2f; } else { this.ai[2] = 4f; } if (this.ai[2] != num1549) { this.netUpdate = true; } } } } } if (this.type == NPCID.PirateShipCannon) { this.timeLeft = nPC7.timeLeft; this.velocity = nPC7.velocity; if (this.ai[3] < 240f) { this.ai[3] += 1f; } if (this.ai[3] == 2f) { this.TargetClosest(false); } if (Collision.CanHit(this.position, this.width, this.height, Main.player[this.target].position, Main.player[this.target].width, Main.player[this.target].height)) { Vector2 vector189 = Main.player[this.target].Center - base.Center; Vector2.Normalize(vector189); if (this.ai[3] >= 240f) { this.ai[3] = 0f; Vector2 center13 = Main.player[this.target].Center; Vector2 center14 = base.Center; Vector2 value27 = Vector2.Normalize(center13 - center14); if (float.IsNaN(value27.X) || float.IsNaN(value27.Y)) { value27 = Vector2.UnitY; } value27 *= 14f; value27 += Vector2.UnitY * -5f; if (Main.netMode != 1) { Projectile.NewProjectile(center14.X, center14.Y, value27.X, value27.Y, 240, 30, 0f, Main.myPlayer, 0f, 0f); } this.netUpdate = true; } else { float num1550 = this.ai[2]; float[] array4 = new float[8]; for (int num1551 = 0; num1551 < array4.Length; num1551++) { array4[num1551] = Vector2.Distance(base.Center + Vector2.UnitY.RotatedBy((double)((float)num1551 * -0.7853982f), default(Vector2)) * 50f, Main.player[this.target].Center); } int num1552 = 0; for (int num1553 = 1; num1553 < array4.Length; num1553++) { if (array4[num1552] > array4[num1553]) { num1552 = num1553; } } this.ai[2] = (float)(num1552 + 1); if (this.spriteDirection == 1) { this.ai[2] = 9f - this.ai[2]; } if (this.ai[2] != num1550) { this.netUpdate = true; } } } else { if (this.ai[2] != 0f) { this.netUpdate = true; } this.ai[2] = 0f; } } if (this.type == NPCID.MartianSaucerCannon) { this.timeLeft = nPC7.timeLeft; int num1554 = 50; if (Main.expertMode) { num1554 = 37; } this.ai[3] = nPC7.ai[3]; float num1555 = 440f; float num1556 = 140f; if (this.ai[3] >= num1555 && this.ai[3] < num1555 + num1556) { float num1557 = this.ai[3] - num1555; if (num1557 % 20f == 0f) { if (Main.netMode != 1) { Vector2 spinningpoint2 = (float)num1530 * Vector2.UnitX; spinningpoint2 = spinningpoint2.RotatedBy((Main.rand.NextDouble() - 0.5) * 0.78539818525314331, default(Vector2)); spinningpoint2 *= 8f; Vector2 vector190 = (float)num1530 * Vector2.UnitX * 36f + base.Center + Vector2.UnitY * 8f; Projectile.NewProjectile(vector190.X, vector190.Y, spinningpoint2.X, spinningpoint2.Y, 448, num1554, 0f, Main.myPlayer, 0f, 20f); } } } } if (this.type == NPCID.MartianSaucerTurret) { this.timeLeft = nPC7.timeLeft; int num1558 = 35; if (Main.expertMode) { num1558 = 30; } this.ai[3] = nPC7.ai[3]; float num1559 = 280f; float num1560 = 140f; bool flag141 = this.ai[3] >= num1559 && this.ai[3] < num1559 + num1560; if (!flag141) { this.TargetClosest(false); Player player7 = Main.player[this.target]; Vector2 v = player7.Center - base.Center; if (v.Y < 0f) { v.Y = 0f; } v.Normalize(); if (float.IsNaN(v.X) || float.IsNaN(v.Y)) { v = Vector2.UnitY; } this.ai[2] = v.ToRotation(); } if (flag141) { float num1561 = this.ai[3] - num1559; if (num1561 % 6f == 0f) { if (Main.netMode != 1) { Vector2 spinningpoint3 = this.ai[2].ToRotationVector2(); spinningpoint3 = spinningpoint3.RotatedBy((Main.rand.NextDouble() - 0.5) * 0.78539818525314331 / 3.0, default(Vector2)); spinningpoint3 *= 16f; Vector2 vector191 = base.Center + spinningpoint3 * 1f; Projectile.NewProjectile(vector191.X, vector191.Y, spinningpoint3.X, spinningpoint3.Y, 449, num1558, 0f, Main.myPlayer, 0f, 0f); } } } } if (this.type == NPCID.MartianSaucer) { this.timeLeft = nPC7.timeLeft; int num1562 = 70; if (Main.expertMode) { num1562 = 50; } this.ai[3] = nPC7.ai[3]; float num1563 = 20f; float num1564 = 240f; bool flag142 = this.ai[3] >= num1563 && this.ai[3] < num1563 + num1564 && nPC7.ai[0] == 0f; if (flag142) { float num1565 = this.ai[3] - num1563; if (num1565 == 0f) { if (Main.netMode != 1) { Vector2 center15 = base.Center; Projectile.NewProjectile(center15.X, center15.Y, 0f, 0f, 447, num1562, 0f, Main.myPlayer, (float)(this.whoAmI + 1), 0f); } } } flag142 = false; int maxValue10 = 1000; int maxValue11 = 1000; int num1566 = 450; int num1567 = 30; if (Main.expertMode) { num1567 = 25; } if (nPC7.ai[0] == 2f) { flag142 = true; maxValue11 = 120; maxValue10 = 120; } if (!flag142) { num1563 = 280f; num1564 = 120f; flag142 = (flag142 || (this.ai[3] >= num1563 && this.ai[3] < num1563 + num1564)); if (flag142) { maxValue11 = 90; maxValue10 = 60; } } if (!flag142) { num1563 = 440f; num1564 = 140f; flag142 = (flag142 || (this.ai[3] >= num1563 && this.ai[3] < num1563 + num1564)); if (flag142) { maxValue11 = 60; maxValue10 = 90; } } bool flag143 = true; bool flag144 = true; bool flag145 = true; bool flag146 = true; if (Main.npc[(int)this.localAI[0]].active && Main.npc[(int)this.localAI[0]].type == 393) { flag143 = false; } if (Main.npc[(int)this.localAI[1]].active && Main.npc[(int)this.localAI[1]].type == 393) { flag144 = false; } if (Main.npc[(int)this.localAI[2]].active && Main.npc[(int)this.localAI[2]].type == 394) { flag145 = false; } if (Main.npc[(int)this.localAI[3]].active && Main.npc[(int)this.localAI[3]].type == 394) { flag146 = false; } if (flag142) { bool flag147 = flag143; if (flag147 && Main.rand.Next(maxValue10) == 0) { if (Main.netMode != 1) { Vector2 spinningpoint4 = new Vector2(-1f * (float)Main.rand.NextDouble() * 3f, 1f); spinningpoint4 = spinningpoint4.RotatedBy((Main.rand.NextDouble() - 0.5) * 0.78539818525314331, default(Vector2)); spinningpoint4 *= 3f; Vector2 vector192 = -1f * Vector2.UnitX * (float)Main.rand.Next(50, 70) + base.Center + Vector2.UnitY * (float)Main.rand.Next(30, 45); Projectile.NewProjectile(vector192.X, vector192.Y, spinningpoint4.X, spinningpoint4.Y, num1566, num1567, 0f, Main.myPlayer, 0f, 0f); } } flag147 = flag144; if (flag147 && Main.rand.Next(maxValue10) == 0) { if (Main.netMode != 1) { Vector2 spinningpoint5 = new Vector2(1f * (float)Main.rand.NextDouble() * 3f, 1f); spinningpoint5 = spinningpoint5.RotatedBy((Main.rand.NextDouble() - 0.5) * 0.78539818525314331, default(Vector2)); spinningpoint5 *= 3f; Vector2 vector193 = 1f * Vector2.UnitX * (float)Main.rand.Next(50, 70) + base.Center + Vector2.UnitY * (float)Main.rand.Next(30, 45); Projectile.NewProjectile(vector193.X, vector193.Y, spinningpoint5.X, spinningpoint5.Y, num1566, num1567, 0f, Main.myPlayer, 0f, 0f); } } } if (flag142) { bool flag148 = flag145; if (flag148 && Main.rand.Next(maxValue11) == 0) { if (Main.netMode != 1) { Vector2 spinningpoint6 = new Vector2(-1f * (float)Main.rand.NextDouble() * 2f, -1f); spinningpoint6 = spinningpoint6.RotatedBy((Main.rand.NextDouble() - 0.5) * 0.78539818525314331, default(Vector2)); spinningpoint6 *= 3f; Vector2 vector194 = -1f * Vector2.UnitX * (float)Main.rand.Next(30, 60) + base.Center + Vector2.UnitY * (float)Main.rand.Next(-30, -10); Projectile.NewProjectile(vector194.X, vector194.Y, spinningpoint6.X, spinningpoint6.Y, num1566, num1567, 0f, Main.myPlayer, 0f, 0f); } } flag148 = flag146; if (flag148 && Main.rand.Next(maxValue11) == 0) { if (Main.netMode != 1) { Vector2 spinningpoint7 = new Vector2(1f * (float)Main.rand.NextDouble() * 2f, -1f); spinningpoint7 = spinningpoint7.RotatedBy((Main.rand.NextDouble() - 0.5) * 0.78539818525314331, default(Vector2)); spinningpoint7 *= 3f; Vector2 vector195 = 1f * Vector2.UnitX * (float)Main.rand.Next(30, 60) + base.Center + Vector2.UnitY * (float)Main.rand.Next(-30, -10); Projectile.NewProjectile(vector195.X, vector195.Y, spinningpoint7.X, spinningpoint7.Y, num1566, num1567, 0f, Main.myPlayer, 0f, 0f); } } } if (flag146 && Main.rand.Next(8) == 0) { return; } } } else { if (this.type == NPCID.ScutlixRider) { this.Transform(382); return; } if (this.type == NPCID.SolarDrakomireRider) { this.Transform(518); return; } this.life = 0; this.HitEffect(0, 10.0); this.active = false; return; } } else if (this.aiStyle == 76) { if (this.localAI[3] == 0f && Main.netMode != 1 && this.type == NPCID.MartianSaucerCore) { this.localAI[3] = 1f; int[] array5 = new int[4]; int num1572 = 0; for (int num1573 = 0; num1573 < 2; num1573++) { int num1574 = NPC.NewNPC((int)base.Center.X + num1573 * 300 - 150, (int)base.Center.Y, 393, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num1574].ai[1] = (float)num1573; Main.npc[num1574].netUpdate = true; array5[num1572++] = num1574; } for (int num1575 = 0; num1575 < 2; num1575++) { int num1576 = NPC.NewNPC((int)base.Center.X + num1575 * 300 - 150, (int)base.Center.Y, 394, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num1576].ai[1] = (float)num1575; Main.npc[num1576].netUpdate = true; array5[num1572++] = num1576; } int num1577 = NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 392, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num1577].ai[0] = (float)this.whoAmI; Main.npc[num1577].netUpdate = true; for (int num1578 = 0; num1578 < 4; num1578++) { Main.npc[array5[num1578]].ai[0] = (float)this.whoAmI; } for (int num1579 = 0; num1579 < 4; num1579++) { Main.npc[num1577].localAI[num1579] = (float)array5[num1579]; } } Vector2 center16 = base.Center; Player player8 = Main.player[this.target]; if (this.target < 0 || this.target == 255 || player8.dead || !player8.active) { this.TargetClosest(true); player8 = Main.player[this.target]; this.netUpdate = true; } if ((player8.dead || Vector2.Distance(player8.Center, center16) > 3200f) && this.ai[0] != 1f) { if (this.ai[0] == 0f) { this.ai[0] = -1f; } if (this.ai[0] == 2f) { this.ai[0] = -2f; } this.netUpdate = true; } if (this.ai[0] == -1f || this.ai[0] == -2f) { this.velocity.Y = this.velocity.Y - 0.4f; if (this.timeLeft > 10) { this.timeLeft = 10; } if (!player8.dead) { this.timeLeft = 300; if (this.ai[0] == -2f) { this.ai[0] = 2f; } if (this.ai[0] == 0f) { this.ai[0] = 0f; } this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; return; } } else if (this.ai[0] == 0f) { int num1580 = 0; if (this.ai[3] >= 580f) { num1580 = 0; } else if (this.ai[3] >= 440f) { num1580 = 5; } else if (this.ai[3] >= 420f) { num1580 = 4; } else if (this.ai[3] >= 280f) { num1580 = 3; } else if (this.ai[3] >= 260f) { num1580 = 2; } else if (this.ai[3] >= 20f) { num1580 = 1; } this.ai[3] += 1f; if (this.ai[3] >= 600f) { this.ai[3] = 0f; } int num1581 = num1580; if (this.ai[3] >= 580f) { num1580 = 0; } else if (this.ai[3] >= 440f) { num1580 = 5; } else if (this.ai[3] >= 420f) { num1580 = 4; } else if (this.ai[3] >= 280f) { num1580 = 3; } else if (this.ai[3] >= 260f) { num1580 = 2; } else if (this.ai[3] >= 20f) { num1580 = 1; } if (num1580 != num1581) { if (num1580 == 0) { this.ai[2] = 0f; } if (num1580 == 1) { this.ai[2] = (float)((Math.Sign((player8.Center - center16).X) == 1) ? 1 : -1); } if (num1580 == 2) { this.ai[2] = 0f; } this.netUpdate = true; } if (num1580 == 0) { if (this.ai[2] == 0f) { this.ai[2] = (float)(-600 * Math.Sign((center16 - player8.Center).X)); } Vector2 vector196 = player8.Center + new Vector2(this.ai[2], -250f) - center16; if (vector196.Length() < 50f) { this.ai[3] = 19f; } else { vector196.Normalize(); this.velocity = Vector2.Lerp(this.velocity, vector196 * 16f, 0.1f); } } if (num1580 == 1) { int num1582 = (int)base.Center.X / 16; int num1583 = (int)(this.position.Y + (float)this.height) / 16; int num1584 = 0; bool flag149 = Main.tile[num1582, num1583].nactive() && Main.tileSolid[(int)Main.tile[num1582, num1583].type] && !Main.tileSolidTop[(int)Main.tile[num1582, num1583].type]; if (flag149) { num1584 = 1; } else { while (num1584 < 150 && num1583 + num1584 < Main.maxTilesY) { int num1585 = num1583 + num1584; bool flag150 = Main.tile[num1582, num1585].nactive() && Main.tileSolid[(int)Main.tile[num1582, num1585].type] && !Main.tileSolidTop[(int)Main.tile[num1582, num1585].type]; if (flag150) { num1584--; break; } num1584++; } } float num1586 = (float)(num1584 * 16); float num1587 = 250f; if (num1586 < num1587) { float num1588 = -4f; if (-num1588 > num1586) { num1588 = -num1586; } this.velocity.Y = MathHelper.Lerp(this.velocity.Y, num1588, 0.05f); } else { this.velocity.Y = this.velocity.Y * 0.95f; } this.velocity.X = 3.5f * this.ai[2]; } if (num1580 == 2) { if (this.ai[2] == 0f) { this.ai[2] = (float)(300 * Math.Sign((center16 - player8.Center).X)); } Vector2 vector197 = player8.Center + new Vector2(this.ai[2], -170f) - center16; int num1589 = (int)base.Center.X / 16; int num1590 = (int)(this.position.Y + (float)this.height) / 16; int num1591 = 0; bool flag151 = Main.tile[num1589, num1590].nactive() && Main.tileSolid[(int)Main.tile[num1589, num1590].type] && !Main.tileSolidTop[(int)Main.tile[num1589, num1590].type]; if (flag151) { num1591 = 1; } else { while (num1591 < 150 && num1590 + num1591 < Main.maxTilesY) { int num1592 = num1590 + num1591; bool flag152 = Main.tile[num1589, num1592].nactive() && Main.tileSolid[(int)Main.tile[num1589, num1592].type] && !Main.tileSolidTop[(int)Main.tile[num1589, num1592].type]; if (flag152) { num1591--; break; } num1591++; } } float num1593 = (float)(num1591 * 16); float num1594 = 170f; if (num1593 < num1594) { vector197.Y -= num1594 - num1593; } if (vector197.Length() < 70f) { this.ai[3] = 279f; } else { vector197.Normalize(); this.velocity = Vector2.Lerp(this.velocity, vector197 * 20f, 0.1f); } } else if (num1580 == 3) { float num1595 = 0.85f; int num1596 = (int)base.Center.X / 16; int num1597 = (int)(this.position.Y + (float)this.height) / 16; int num1598 = 0; bool flag153 = Main.tile[num1596, num1597].nactive() && Main.tileSolid[(int)Main.tile[num1596, num1597].type] && !Main.tileSolidTop[(int)Main.tile[num1596, num1597].type]; if (flag153) { num1598 = 1; } else { while (num1598 < 150 && num1597 + num1598 < Main.maxTilesY) { int num1599 = num1597 + num1598; bool flag154 = Main.tile[num1596, num1599].nactive() && Main.tileSolid[(int)Main.tile[num1596, num1599].type] && !Main.tileSolidTop[(int)Main.tile[num1596, num1599].type]; if (flag154) { num1598--; break; } num1598++; } } float num1600 = (float)(num1598 * 16); float num1601 = 170f; if (num1600 < num1601) { float num1602 = -4f; if (-num1602 > num1600) { num1602 = -num1600; } this.velocity.Y = MathHelper.Lerp(this.velocity.Y, num1602, 0.05f); } else { this.velocity.Y = this.velocity.Y * num1595; } this.velocity.X = this.velocity.X * num1595; } if (num1580 == 4) { Vector2 vector198 = player8.Center + new Vector2(0f, -250f) - center16; if (vector198.Length() < 50f) { this.ai[3] = 439f; return; } vector198.Normalize(); this.velocity = Vector2.Lerp(this.velocity, vector198 * 16f, 0.1f); return; } else if (num1580 == 5) { this.velocity *= 0.85f; return; } } else if (this.ai[0] == 1f) { this.dontTakeDamage = false; this.velocity *= 0.96f; float num1603 = 150f; this.ai[1] += 1f; if (this.ai[1] >= num1603) { this.ai[0] = 2f; this.ai[1] = 0f; this.rotation = 0f; this.netUpdate = true; return; } if (this.ai[1] < 40f) { this.rotation = Vector2.UnitY.RotatedBy((double)(this.ai[1] / 40f * 6.28318548f), default(Vector2)).Y * 0.2f; return; } if (this.ai[1] < 80f) { this.rotation = Vector2.UnitY.RotatedBy((double)(this.ai[1] / 20f * 6.28318548f), default(Vector2)).Y * 0.3f; return; } if (this.ai[1] < 120f) { this.rotation = Vector2.UnitY.RotatedBy((double)(this.ai[1] / 10f * 6.28318548f), default(Vector2)).Y * 0.4f; return; } this.rotation = (this.ai[1] - 120f) / 30f * 6.28318548f; return; } else if (this.ai[0] == 2f) { int num1604 = 100; float num1605 = 3600f; float num1606 = 120f; float num1607 = 60f; int num1608 = 0; if (this.ai[3] % num1606 >= num1607) { num1608 = 1; } int num1609 = num1608; num1608 = 0; this.ai[3] += 1f; if (this.ai[3] % num1606 >= num1607) { num1608 = 1; } if (num1608 != num1609) { if (num1608 == 1) { this.ai[2] = (float)((Math.Sign((player8.Center - center16).X) == 1) ? 1 : -1); if (Main.netMode != 1) { Vector2 center17 = base.Center; Projectile.NewProjectile(center17.X, center17.Y, 0f, 0f, 447, num1604, 0f, Main.myPlayer, (float)(this.whoAmI + 1), 0f); } } this.netUpdate = true; } if (this.ai[3] >= num1605) { this.ai[0] = 2f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; } else if (num1608 == 0) { Vector2 vector199 = player8.Center + new Vector2(this.ai[2] * 350f, -250f) - center16; vector199.Normalize(); this.velocity = Vector2.Lerp(this.velocity, vector199 * 16f, 0.1f); } else { int num1610 = (int)base.Center.X / 16; int num1611 = (int)(this.position.Y + (float)this.height) / 16; int num1612 = 0; bool flag155 = Main.tile[num1610, num1611].nactive() && Main.tileSolid[(int)Main.tile[num1610, num1611].type] && !Main.tileSolidTop[(int)Main.tile[num1610, num1611].type]; if (flag155) { num1612 = 1; } else { while (num1612 < 150 && num1611 + num1612 < Main.maxTilesY) { int num1613 = num1611 + num1612; bool flag156 = Main.tile[num1610, num1613].nactive() && Main.tileSolid[(int)Main.tile[num1610, num1613].type] && !Main.tileSolidTop[(int)Main.tile[num1610, num1613].type]; if (flag156) { num1612--; break; } num1612++; } } float num1614 = (float)(num1612 * 16); float num1615 = 250f; if (num1614 < num1615) { float num1616 = -4f; if (-num1616 > num1614) { num1616 = -num1614; } this.velocity.Y = MathHelper.Lerp(this.velocity.Y, num1616, 0.05f); } else { this.velocity.Y = this.velocity.Y * 0.95f; } this.velocity.X = 8f * this.ai[2]; } this.rotation = 0f; return; } } else if (this.aiStyle == 77) { if (this.localAI[3] == 0f) { this.netUpdate = true; this.localAI[3] = 1f; this.ai[0] = -1f; } if (this.ai[0] == -2f) { this.dontTakeDamage = true; this.ai[1] += 1f; if (this.ai[1] < 60f) { MoonlordDeathDrama.RequestLight(this.ai[1] / 30f, base.Center); } if (this.ai[1] == 60f) { this.ai[1] = 0f; this.ai[0] = 0f; if (Main.netMode != 1 && this.type == NPCID.MoonLordCore) { this.ai[2] = (float)Main.rand.Next(3); this.ai[2] = 0f; this.netUpdate = true; } } } if (this.ai[0] == -1f) { this.dontTakeDamage = true; this.ai[1] += 1f; if (this.ai[1] < 60f) { MoonlordDeathDrama.RequestLight(this.ai[1] / 30f, base.Center); } if (this.ai[1] == 60f) { this.ai[1] = 0f; this.ai[0] = 0f; if (Main.netMode != 1 && this.type == NPCID.MoonLordCore) { this.ai[2] = (float)Main.rand.Next(3); this.ai[2] = 0f; this.netUpdate = true; int[] array6 = new int[3]; int num1617 = 0; for (int num1618 = 0; num1618 < 2; num1618++) { int num1619 = NPC.NewNPC((int)base.Center.X + num1618 * 800 - 400, (int)base.Center.Y - 100, 397, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num1619].ai[2] = (float)num1618; Main.npc[num1619].netUpdate = true; array6[num1617++] = num1619; } int num1620 = NPC.NewNPC((int)base.Center.X, (int)base.Center.Y - 400, 396, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num1620].netUpdate = true; array6[num1617++] = num1620; for (int num1621 = 0; num1621 < 3; num1621++) { Main.npc[array6[num1621]].ai[3] = (float)this.whoAmI; } for (int num1622 = 0; num1622 < 3; num1622++) { this.localAI[num1622] = (float)array6[num1622]; } } } } if (this.ai[0] == 0f) { this.dontTakeDamage = true; this.TargetClosest(false); Vector2 value28 = Main.player[this.target].Center - base.Center + new Vector2(0f, 130f); if (value28.Length() > 20f) { Vector2 desiredVelocity2 = Vector2.Normalize(value28 - this.velocity) * 8f; Vector2 velocity3 = this.velocity; this.SimpleFlyMovement(desiredVelocity2, 0.5f); this.velocity = Vector2.Lerp(this.velocity, velocity3, 0.5f); } if (Main.netMode != 1) { bool flag157 = false; if (this.localAI[0] < 0f || this.localAI[1] < 0f || this.localAI[2] < 0f) { flag157 = true; } else if (!Main.npc[(int)this.localAI[0]].active || Main.npc[(int)this.localAI[0]].type != 397) { flag157 = true; } else if (!Main.npc[(int)this.localAI[1]].active || Main.npc[(int)this.localAI[1]].type != 397) { flag157 = true; } else if (!Main.npc[(int)this.localAI[2]].active || Main.npc[(int)this.localAI[2]].type != 396) { flag157 = true; } if (flag157) { this.life = 0; this.HitEffect(0, 10.0); this.active = false; } bool flag158 = true; if (Main.npc[(int)this.localAI[0]].ai[0] != -2f) { flag158 = false; } if (Main.npc[(int)this.localAI[1]].ai[0] != -2f) { flag158 = false; } if (Main.npc[(int)this.localAI[2]].ai[0] != -2f) { flag158 = false; } if (flag158) { this.ai[0] = 1f; this.dontTakeDamage = false; this.netUpdate = true; } } } else if (this.ai[0] == 1f) { this.dontTakeDamage = false; this.TargetClosest(false); Vector2 value29 = Main.player[this.target].Center - base.Center + new Vector2(0f, 130f); if (value29.Length() > 20f) { Vector2 desiredVelocity3 = Vector2.Normalize(value29 - this.velocity) * 8f; Vector2 velocity4 = this.velocity; this.SimpleFlyMovement(desiredVelocity3, 0.5f); this.velocity = Vector2.Lerp(this.velocity, velocity4, 0.5f); } } else if (this.ai[0] == 2f) { this.dontTakeDamage = true; Vector2 value30 = new Vector2((float)this.direction, -0.5f); this.velocity = Vector2.Lerp(this.velocity, value30, 0.98f); this.ai[1] += 1f; if (this.ai[1] < 60f) { MoonlordDeathDrama.RequestLight(this.ai[1] / 60f, base.Center); } if (this.ai[1] == 60f) { for (int num1623 = 0; num1623 < 1000; num1623++) { Projectile projectile = Main.projectile[num1623]; if (projectile.active && (projectile.type == ProjectileID.MoonLeech || projectile.type == ProjectileID.PhantasmalBolt || projectile.type == ProjectileID.PhantasmalDeathray || projectile.type == ProjectileID.PhantasmalEye || projectile.type == ProjectileID.PhantasmalSphere)) { projectile.Kill(); } } for (int num1624 = 0; num1624 < 200; num1624++) { NPC nPC8 = Main.npc[num1624]; if (nPC8.active && nPC8.type == 400) { nPC8.HitEffect(0, 9999.0); nPC8.active = false; } } } if (this.ai[1] % 3f == 0f && this.ai[1] < 580f && this.ai[1] > 60f) { Vector2 vector200 = Utils.RandomVector2(Main.rand, -1f, 1f); if (vector200 != Vector2.Zero) { vector200.Normalize(); } vector200 *= 20f + Main.rand.NextFloat() * 400f; bool flag159 = true; Vector2 vec5 = base.Center + vector200; Point point7 = vec5.ToTileCoordinates(); if (!WorldGen.InWorld(point7.X, point7.Y, 0)) { flag159 = false; } if (!flag159 || WorldGen.SolidTile(point7.X, point7.Y)) { } float num1625 = (float)Main.rand.Next(6, 19); float num1626 = 6.28318548f / num1625; float num1627 = 6.28318548f * Main.rand.NextFloat(); float scaleFactor21 = 1f + Main.rand.NextFloat() * 2f; float num1628 = 1f + Main.rand.NextFloat(); float fadeIn = 0.4f + Main.rand.NextFloat(); int num1629 = Utils.SelectRandom<int>(Main.rand, new int[] { 31, 229 }); for (float num1630 = 0f; num1630 < this.ai[1] / 60f; num1630 += 1f) { Vector2 vector201 = Utils.RandomVector2(Main.rand, -1f, 1f); if (vector201 != Vector2.Zero) { vector201.Normalize(); } vector201 *= 20f + Main.rand.NextFloat() * 800f; Vector2 vector202 = base.Center + vector201; Point point8 = vector202.ToTileCoordinates(); bool flag160 = true; if (!WorldGen.InWorld(point8.X, point8.Y, 0)) { flag160 = false; } if (flag160 && WorldGen.SolidTile(point8.X, point8.Y)) { flag160 = false; } } } if (this.ai[1] % 15f == 0f && this.ai[1] < 480f && this.ai[1] >= 90f && Main.netMode != 1) { Vector2 vector203 = Utils.RandomVector2(Main.rand, -1f, 1f); if (vector203 != Vector2.Zero) { vector203.Normalize(); } vector203 *= 20f + Main.rand.NextFloat() * 400f; bool flag161 = true; Vector2 vec6 = base.Center + vector203; Point point9 = vec6.ToTileCoordinates(); if (!WorldGen.InWorld(point9.X, point9.Y, 0)) { flag161 = false; } if (flag161 && WorldGen.SolidTile(point9.X, point9.Y)) { flag161 = false; } if (flag161) { float num1631 = (float)(Main.rand.Next(4) < 2).ToDirectionInt() * (0.3926991f + 0.7853982f * Main.rand.NextFloat()); Vector2 vector204 = new Vector2(0f, -Main.rand.NextFloat() * 0.5f - 0.5f).RotatedBy((double)num1631, default(Vector2)) * 6f; Projectile.NewProjectile(vec6.X, vec6.Y, vector204.X, vector204.Y, 622, 0, 0f, Main.myPlayer, 0f, 0f); } } if (this.ai[1] >= 480f) { MoonlordDeathDrama.RequestLight((this.ai[1] - 480f) / 120f, base.Center); } if (this.ai[1] >= 600f) { this.life = 0; this.HitEffect(0, 1337.0); this.checkDead(); return; } } else if (this.ai[0] == 3f) { this.dontTakeDamage = true; Vector2 value31 = new Vector2((float)this.direction, -0.5f); this.velocity = Vector2.Lerp(this.velocity, value31, 0.98f); this.ai[1] += 1f; if (this.ai[1] < 60f) { MoonlordDeathDrama.RequestLight(this.ai[1] / 40f, base.Center); } if (this.ai[1] == 40f) { for (int num1632 = 0; num1632 < 1000; num1632++) { Projectile projectile2 = Main.projectile[num1632]; if (projectile2.active && (projectile2.type == 456 || projectile2.type == 462 || projectile2.type == 455 || projectile2.type == 452 || projectile2.type == 454)) { projectile2.active = false; if (Main.netMode != 1) { NetMessage.SendData((int)PacketTypes.ProjectileNew, -1, -1, "", num1632, 0f, 0f, 0f, 0, 0, 0); } } } for (int num1633 = 0; num1633 < 200; num1633++) { NPC nPC9 = Main.npc[num1633]; if (nPC9.active && nPC9.type == 400) { nPC9.active = false; if (Main.netMode != 1) { NetMessage.SendData((int)PacketTypes.NpcUpdate, -1, -1, "", nPC9.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } } } if (this.ai[1] >= 60f) { for (int num1635 = 0; num1635 < 200; num1635++) { NPC nPC10 = Main.npc[num1635]; if (nPC10.active && (nPC10.type == 400 || nPC10.type == 397 || nPC10.type == 396)) { nPC10.active = false; if (Main.netMode != 1) { NetMessage.SendData((int)PacketTypes.NpcUpdate, -1, -1, "", nPC10.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } } this.active = false; if (Main.netMode != 1) { NetMessage.SendData((int)PacketTypes.NpcUpdate, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); } NPC.LunarApocalypseIsUp = false; if (Main.netMode == 2) { NetMessage.SendData((int)PacketTypes.WorldInfo, -1, -1, "", 0, 0f, 0f, 0f, 0, 0, 0); } return; } } bool flag162 = false; if (this.ai[0] == -2f || this.ai[0] == -1f || this.ai[0] == -2f || this.ai[0] == 3f) { flag162 = true; } if (Main.player[this.target].active && !Main.player[this.target].dead) { flag162 = true; } if (!flag162) { for (int num1636 = 0; num1636 < 255; num1636++) { if (Main.player[num1636].active && !Main.player[num1636].dead) { flag162 = true; break; } } } if (!flag162) { this.ai[0] = 3f; this.ai[1] = 0f; this.netUpdate = true; } if (this.ai[0] >= 0f && this.ai[0] < 2f && Main.netMode != 1 && base.Distance(Main.player[this.target].Center) > 2400f) { this.ai[0] = -2f; this.netUpdate = true; Vector2 value32 = Main.player[this.target].Center - Vector2.UnitY * 150f - base.Center; this.position += value32; if (Main.npc[(int)this.localAI[0]].active) { Main.npc[(int)this.localAI[0]].position += value32; Main.npc[(int)this.localAI[0]].netUpdate = true; } if (Main.npc[(int)this.localAI[1]].active) { Main.npc[(int)this.localAI[1]].position += value32; Main.npc[(int)this.localAI[1]].netUpdate = true; } if (Main.npc[(int)this.localAI[2]].active) { Main.npc[(int)this.localAI[2]].position += value32; Main.npc[(int)this.localAI[2]].netUpdate = true; } for (int num1637 = 0; num1637 < 200; num1637++) { NPC nPC11 = Main.npc[num1637]; if (nPC11.active && nPC11.type == 400) { nPC11.position += value32; nPC11.netUpdate = true; } } return; } } else if (this.aiStyle == 78) { NPC.InitializeMoonLordAttacks(); if (!Main.npc[(int)this.ai[3]].active || Main.npc[(int)this.ai[3]].type != 398) { this.life = 0; this.HitEffect(0, 10.0); this.active = false; } bool flag163 = this.ai[2] == 0f; float num1638 = (float)(-(float)flag163.ToDirectionInt()); this.spriteDirection = (int)num1638; this.dontTakeDamage = (this.frameCounter >= 21.0); Vector2 vector205 = new Vector2(30f, 66f); float num1639 = 0f; float num1640 = 0f; bool flag164 = true; int num1641 = 0; if (this.ai[0] != -2f) { float num1642 = this.ai[0]; this.ai[1] += 1f; int num1643 = (int)Main.npc[(int)this.ai[3]].ai[2]; int num1644 = flag163 ? 0 : 1; int num1645 = 0; int num1646 = 0; while (num1645 < 5) { num1640 = (float)NPC.MoonLordAttacksArray[num1643, num1644, 1, num1645]; if (num1640 + (float)num1646 > this.ai[1]) { break; } num1646 += (int)num1640; num1645++; } if (num1645 == 5) { num1645 = 0; this.ai[1] = 0f; num1640 = (float)NPC.MoonLordAttacksArray[num1643, num1644, 1, num1645]; num1646 = 0; } this.ai[0] = (float)NPC.MoonLordAttacksArray[num1643, num1644, 0, num1645]; num1639 = (float)((int)this.ai[1] - num1646); if (this.ai[0] != num1642) { this.netUpdate = true; } } if (this.ai[0] == -2f) { this.damage = 80; num1641 = 0; this.dontTakeDamage = true; this.ai[1] += 1f; if (this.ai[1] >= 32f) { this.ai[1] = 0f; } if (this.ai[1] < 0f) { this.ai[1] = 0f; } Vector2 center18 = Main.npc[(int)this.ai[3]].Center; Vector2 value33 = center18 + new Vector2(350f * num1638, -100f); Vector2 vector206 = value33 - base.Center; if (vector206.Length() > 20f) { vector206.Normalize(); vector206 *= 6f; Vector2 velocity5 = this.velocity; if (vector206 != Vector2.Zero) { this.SimpleFlyMovement(vector206, 0.3f); } this.velocity = Vector2.Lerp(velocity5, this.velocity, 0.5f); } } else if (this.ai[0] == 0f) { num1641 = 3; this.localAI[1] -= 0.05f; if (this.localAI[1] < 0f) { this.localAI[1] = 0f; } Vector2 center19 = Main.npc[(int)this.ai[3]].Center; Vector2 value34 = center19 + new Vector2(350f * num1638, -100f); Vector2 vector207 = value34 - base.Center; if (vector207.Length() > 20f) { vector207.Normalize(); vector207 *= 6f; Vector2 velocity6 = this.velocity; if (vector207 != Vector2.Zero) { this.SimpleFlyMovement(vector207, 0.3f); } this.velocity = Vector2.Lerp(velocity6, this.velocity, 0.5f); } } else if (this.ai[0] == 1f) { num1641 = 0; int num1647 = 7; int num1648 = 4; if (num1639 >= (float)(num1647 * num1648 * 2)) { this.localAI[1] -= 0.07f; if (this.localAI[1] < 0f) { this.localAI[1] = 0f; } } else if (num1639 >= (float)(num1647 * num1648)) { this.localAI[1] += 0.05f; if (this.localAI[1] > 0.75f) { this.localAI[1] = 0.75f; } float num1649 = 6.28318548f * (num1639 % (float)(num1647 * num1648)) / (float)(num1647 * num1648) - 1.57079637f; this.localAI[0] = new Vector2((float)Math.Cos((double)num1649) * vector205.X, (float)Math.Sin((double)num1649) * vector205.Y).ToRotation(); if (num1639 % (float)num1648 == 0f) { Vector2 value35 = new Vector2(1f * -num1638, 3f); Vector2 vector208 = Utils.Vector2FromElipse(this.localAI[0].ToRotationVector2(), vector205 * this.localAI[1]); Vector2 vector209 = base.Center + Vector2.Normalize(vector208) * vector205.Length() * 0.4f + value35; Vector2 vector210 = Vector2.Normalize(vector208) * 8f; float ai = (6.28318548f * (float)Main.rand.NextDouble() - 3.14159274f) / 30f + 0.0174532924f * num1638; Projectile.NewProjectile(vector209.X, vector209.Y, vector210.X, vector210.Y, 452, 30, 0f, Main.myPlayer, 0f, ai); } } else { this.localAI[1] += 0.02f; if (this.localAI[1] > 0.75f) { this.localAI[1] = 0.75f; } float num1650 = 6.28318548f * (num1639 % (float)(num1647 * num1648)) / (float)(num1647 * num1648) - 1.57079637f; this.localAI[0] = new Vector2((float)Math.Cos((double)num1650) * vector205.X, (float)Math.Sin((double)num1650) * vector205.Y).ToRotation(); } } else if (this.ai[0] == 2f) { this.localAI[1] -= 0.05f; if (this.localAI[1] < 0f) { this.localAI[1] = 0f; } Vector2 center20 = Main.npc[(int)this.ai[3]].Center; Vector2 value36 = new Vector2(220f * num1638, -60f) + center20; value36 += new Vector2(num1638 * 100f, -50f); Vector2 value37 = new Vector2(400f * num1638, -60f); if (num1639 < 30f) { Vector2 vector211 = value36 - base.Center; if (vector211 != Vector2.Zero) { Vector2 vector212 = vector211; vector212.Normalize(); this.velocity = Vector2.SmoothStep(this.velocity, vector212 * Math.Min(8f, vector211.Length()), 0.2f); } } else if (num1639 < 210f) { num1641 = 1; int num1651 = (int)num1639 - 30; if (num1651 % 30 == 0 && Main.netMode != 1) { Vector2 vector213 = new Vector2(5f * num1638, -8f); int num1652 = num1651 / 30; vector213.X += ((float)num1652 - 3.5f) * num1638 * 3f; vector213.Y += ((float)num1652 - 4.5f) * 1f; vector213 *= 1.2f; Projectile.NewProjectile(base.Center.X, base.Center.Y, vector213.X, vector213.Y, 454, 50, 1f, Main.myPlayer, 0f, (float)this.whoAmI); } Vector2 vector214 = Vector2.SmoothStep(value36, value36 + value37, (num1639 - 30f) / 180f) - base.Center; if (vector214 != Vector2.Zero) { Vector2 vector215 = vector214; vector215.Normalize(); this.velocity = Vector2.Lerp(this.velocity, vector215 * Math.Min(20f, vector214.Length()), 0.5f); } } else if (num1639 < 282f) { num1641 = 0; this.velocity *= 0.9f; } else if (num1639 < 287f) { num1641 = 1; this.velocity *= 0.9f; } else if (num1639 < 292f) { num1641 = 2; this.velocity *= 0.9f; } else if (num1639 < 300f) { num1641 = 3; if (num1639 == 292f && Main.netMode != 1) { int num1653 = (int)Player.FindClosest(this.position, this.width, this.height); Vector2 velocity7 = Vector2.Normalize(Main.player[num1653].Center - (base.Center + Vector2.UnitY * -350f)); if (float.IsNaN(velocity7.X) || float.IsNaN(velocity7.Y)) { velocity7 = Vector2.UnitY; } velocity7 *= 12f; for (int num1654 = 0; num1654 < 1000; num1654++) { Projectile projectile3 = Main.projectile[num1654]; if (projectile3.active && projectile3.type == 454 && projectile3.ai[1] == (float)this.whoAmI && projectile3.ai[0] != -1f) { projectile3.ai[0] = -1f; projectile3.velocity = velocity7; projectile3.netUpdate = true; } } } Vector2 vector216 = Vector2.SmoothStep(value36, value36 + value37, 1f - (num1639 - 270f) / 30f) - base.Center; if (vector216 != Vector2.Zero) { Vector2 vector217 = vector216; vector217.Normalize(); this.velocity = Vector2.Lerp(this.velocity, vector217 * Math.Min(14f, vector216.Length()), 0.1f); } } else { num1641 = 3; Vector2 vector218 = value36 - base.Center; if (vector218 != Vector2.Zero) { Vector2 vector219 = vector218; vector219.Normalize(); this.velocity = Vector2.SmoothStep(this.velocity, vector219 * Math.Min(8f, vector218.Length()), 0.2f); } } } else if (this.ai[0] == 3f) { if (num1639 == 0f) { this.TargetClosest(false); this.netUpdate = true; } Vector2 v2 = Main.player[this.target].Center + Main.player[this.target].velocity * 20f - base.Center; this.localAI[0] = this.localAI[0].AngleLerp(v2.ToRotation(), 0.5f); this.localAI[1] += 0.05f; if (this.localAI[1] > 1f) { this.localAI[1] = 1f; } if ((num1639 == num1640 - 14f || num1639 == num1640 - 7f || num1639 == num1640) && Main.netMode != 1) { Vector2 vector220 = Utils.Vector2FromElipse(this.localAI[0].ToRotationVector2(), vector205 * this.localAI[1]); Vector2 vector221 = Vector2.Normalize(v2) * 8f; Projectile.NewProjectile(base.Center.X + vector220.X, base.Center.Y + vector220.Y, vector221.X, vector221.Y, 462, 30, 0f, Main.myPlayer, 0f, 0f); } } if (flag164) { Vector2 center21 = Main.npc[(int)this.ai[3]].Center; Vector2 value38 = new Vector2(220f * num1638, -60f) + center21; Vector2 vector222 = value38 + new Vector2(num1638 * 110f, -150f); Vector2 max = vector222 + new Vector2(num1638 * 370f, 150f); if (vector222.X > max.X) { Utils.Swap<float>(ref vector222.X, ref max.X); } if (vector222.Y > max.Y) { Utils.Swap<float>(ref vector222.Y, ref max.Y); } Vector2 value39 = Vector2.Clamp(base.Center + this.velocity, vector222, max); if (value39 != base.Center + this.velocity) { base.Center = value39 - this.velocity; } } int num1655 = num1641 * 7; if ((double)num1655 > this.frameCounter) { this.frameCounter += 1.0; } if ((double)num1655 < this.frameCounter) { this.frameCounter -= 1.0; } if (this.frameCounter < 0.0) { this.frameCounter = 0.0; } if (this.frameCounter > 21.0) { this.frameCounter = 21.0; } int num1656 = 0; if (flag163) { num1656 = 0; } if (num1656 == 0) { return; } if (num1656 == 1) { if (this.ai[0] == 0f) { if ((this.ai[1] += 1f) >= 20f) { this.ai[1] = 0f; this.ai[0] = 1f; this.netUpdate = true; } this.velocity = Vector2.UnitX * 4f; return; } if (this.ai[0] == 1f) { if ((this.ai[1] += 1f) >= 20f) { this.ai[1] = 0f; this.ai[0] = 2f; this.netUpdate = true; } this.velocity = Vector2.UnitX * -4f; return; } if (this.ai[0] == 2f || this.ai[0] == 4f) { if ((this.ai[1] += 1f) >= 20f) { this.ai[1] = 0f; this.ai[0] += 1f; this.netUpdate = true; } this.velocity = Vector2.UnitY * -4f * (float)(flag163 ? 1 : -1); return; } if (this.ai[0] == 3f || this.ai[0] == 5f) { if ((this.ai[1] += 1f) >= 20f) { this.ai[1] = 0f; this.ai[0] += 1f; if (this.ai[0] == 6f) { this.ai[0] = 0f; } this.netUpdate = true; } this.velocity = Vector2.UnitY * 4f * (float)(flag163 ? 1 : -1); return; } } else { if (num1656 == 2) { new Vector2(30f, 66f); this.TargetClosest(false); Vector2 v3 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - base.Center; float num1657 = v3.Length() / 200f; if (num1657 > 1f) { num1657 = 1f; } num1657 = 1f - num1657; num1657 *= 2f; if (num1657 > 1f) { num1657 = 1f; } this.localAI[0] = v3.ToRotation(); this.localAI[1] = num1657; this.localAI[1] = 1f; return; } if (num1656 == 3) { int num1658 = 7; int num1659 = 4; this.ai[1] += 1f; if (this.ai[1] >= (float)(num1658 * num1659 * 10)) { this.ai[1] = 0f; return; } if (this.ai[1] >= (float)(num1658 * num1659)) { this.localAI[1] -= 0.07f; if (this.localAI[1] < 0f) { this.localAI[1] = 0f; return; } } else { this.localAI[1] += 0.05f; if (this.localAI[1] > 0.75f) { this.localAI[1] = 0.75f; } float num1660 = 6.28318548f * (this.ai[1] % (float)(num1658 * num1659)) / (float)(num1658 * num1659) - 1.57079637f; this.localAI[0] = new Vector2((float)Math.Cos((double)num1660) * vector205.X, (float)Math.Sin((double)num1660) * vector205.Y).ToRotation(); if (this.ai[1] % (float)num1659 == 0f) { Vector2 value40 = new Vector2(1f * -num1638, 3f); Vector2 vector223 = Utils.Vector2FromElipse(this.localAI[0].ToRotationVector2(), vector205 * this.localAI[1]); Vector2 vector224 = base.Center + Vector2.Normalize(vector223) * vector205.Length() * 0.4f + value40; Vector2 vector225 = Vector2.Normalize(vector223) * 8f; float ai2 = (6.28318548f * (float)Main.rand.NextDouble() - 3.14159274f) / 30f + 0.0174532924f * num1638; Projectile.NewProjectile(vector224.X, vector224.Y, vector225.X, vector225.Y, 452, 5, 0f, Main.myPlayer, 0f, ai2); return; } } } else if (num1656 == 4) { Vector2 center22 = Main.npc[(int)this.ai[3]].Center; Vector2 value41 = new Vector2(220f * num1638, -60f) + center22; value41 += new Vector2(num1638 * 100f, -50f); Vector2 value42 = new Vector2(400f * num1638, -60f); this.ai[1] += 1f; if (this.ai[1] < 30f) { Vector2 vector226 = value41 - base.Center; if (vector226 != Vector2.Zero) { Vector2 vector227 = vector226; vector227.Normalize(); this.velocity = Vector2.SmoothStep(this.velocity, vector227 * Math.Min(8f, vector226.Length()), 0.2f); return; } } else if (this.ai[1] < 210f) { int num1661 = (int)this.ai[1] - 30; if (num1661 % 30 == 0 && Main.netMode != 1) { Vector2 vector228 = new Vector2(5f * num1638, -8f); int num1662 = num1661 / 30; vector228.X += ((float)num1662 - 3.5f) * num1638 * 3f; vector228.Y += ((float)num1662 - 4.5f) * 1f; vector228 *= 1.2f; Projectile.NewProjectile(base.Center.X, base.Center.Y, vector228.X, vector228.Y, 454, 1, 1f, Main.myPlayer, 0f, (float)this.whoAmI); } Vector2 vector229 = Vector2.SmoothStep(value41, value41 + value42, (this.ai[1] - 30f) / 180f) - base.Center; if (vector229 != Vector2.Zero) { Vector2 vector230 = vector229; vector230.Normalize(); this.velocity = Vector2.Lerp(this.velocity, vector230 * Math.Min(4f, vector229.Length()), 0.1f); return; } } else { if (this.ai[1] < 270f) { this.velocity *= 0.9f; return; } if (this.ai[1] >= 300f) { this.ai[1] = 0f; return; } if (this.ai[1] == 270f && Main.netMode != 1) { int num1663 = (int)Player.FindClosest(this.position, this.width, this.height); Vector2 velocity8 = Vector2.Normalize(Main.player[num1663].Center - (base.Center + Vector2.UnitY * -350f)); if (float.IsNaN(velocity8.X) || float.IsNaN(velocity8.Y)) { velocity8 = Vector2.UnitY; } velocity8 *= 12f; for (int num1664 = 0; num1664 < 1000; num1664++) { Projectile projectile4 = Main.projectile[num1664]; if (projectile4.active && projectile4.type == 454 && projectile4.ai[1] == (float)this.whoAmI && projectile4.ai[0] != -1f) { projectile4.ai[0] = -1f; projectile4.velocity = velocity8; projectile4.netUpdate = true; } } } Vector2 vector231 = Vector2.SmoothStep(value41, value41 + value42, 1f - (this.ai[1] - 270f) / 30f) - base.Center; if (vector231 != Vector2.Zero) { Vector2 vector232 = vector231; vector232.Normalize(); this.velocity = Vector2.Lerp(this.velocity, vector232 * Math.Min(14f, vector231.Length()), 0.1f); return; } } } else if (num1656 == 5) { this.dontTakeDamage = true; this.ai[1] += 1f; if (this.ai[1] >= 40f) { this.ai[1] = 0f; return; } } } } else if (this.aiStyle == 79) { if (!Main.npc[(int)this.ai[3]].active || Main.npc[(int)this.ai[3]].type != 398) { this.life = 0; this.HitEffect(0, 10.0); this.active = false; } this.dontTakeDamage = (this.localAI[3] >= 15f); this.velocity = Vector2.Zero; base.Center = Main.npc[(int)this.ai[3]].Center + new Vector2(0f, -400f); Vector2 value43 = new Vector2(27f, 59f); float num1665 = 0f; float num1666 = 0f; int num1667 = 0; int num1668 = 0; if (this.ai[0] >= 0f) { float num1669 = this.ai[0]; this.ai[1] += 1f; int num1670 = (int)Main.npc[(int)this.ai[3]].ai[2]; int num1671 = 2; int num1672 = 0; int num1673 = 0; while (num1672 < 5) { num1666 = (float)NPC.MoonLordAttacksArray[num1670, num1671, 1, num1672]; if (num1666 + (float)num1673 > this.ai[1]) { break; } num1673 += (int)num1666; num1672++; } if (num1672 == 5) { num1672 = 0; this.ai[1] = 0f; num1666 = (float)NPC.MoonLordAttacksArray[num1670, num1671, 1, num1672]; num1673 = 0; } this.ai[0] = (float)NPC.MoonLordAttacksArray[num1670, num1671, 0, num1672]; num1665 = (float)((int)this.ai[1] - num1673); if (this.ai[0] != num1669) { this.netUpdate = true; } } if (this.ai[0] == -3f) { this.damage = 0; this.dontTakeDamage = true; this.rotation = MathHelper.Lerp(this.rotation, 0.2617994f, 0.07f); this.ai[1] += 1f; if (this.ai[1] >= 32f) { this.ai[1] = 0f; } if (this.ai[1] < 0f) { this.ai[1] = 0f; } if (this.localAI[2] < 14f) { this.localAI[2] += 1f; } } else if (this.ai[0] == -2f) { if (Main.npc[(int)this.ai[3]].ai[0] == 2f) { this.ai[0] = -3f; return; } this.damage = 80; this.dontTakeDamage = true; this.ai[1] += 1f; if (this.ai[1] >= 32f) { this.ai[1] = 0f; } if (this.ai[1] < 0f) { this.ai[1] = 0f; } this.ai[2] += 1f; if (this.ai[2] >= 555f) { this.ai[2] = 0f; } if (this.ai[2] >= 120f) { num1665 = this.ai[2] - 120f; num1666 = 555f; num1667 = 2; Vector2 value44 = new Vector2(0f, 216f); if (num1665 == 0f && Main.netMode != 1) { Vector2 value45 = base.Center + value44; for (int num1674 = 0; num1674 < 255; num1674++) { Player player9 = Main.player[num1674]; if (player9.active && !player9.dead && Vector2.Distance(player9.Center, value45) <= 3000f) { Vector2 value46 = Main.player[this.target].Center - value45; if (value46 != Vector2.Zero) { value46.Normalize(); } Projectile.NewProjectile(value45.X, value45.Y, value46.X, value46.Y, 456, 0, 0f, Main.myPlayer, (float)(this.whoAmI + 1), (float)num1674); } } } if ((num1665 == 120f || num1665 == 180f || num1665 == 240f) && Main.netMode != 1) { for (int num1675 = 0; num1675 < 1000; num1675++) { Projectile projectile5 = Main.projectile[num1675]; if (projectile5.active && projectile5.type == 456 && Main.player[(int)projectile5.ai[1]].HasBuff(BuffID.MoonLeech) != -1) { Vector2 center23 = Main.player[this.target].Center; int num1676 = NPC.NewNPC((int)center23.X, (int)center23.Y, 401, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num1676].netUpdate = true; Main.npc[num1676].ai[0] = (float)(this.whoAmI + 1); Main.npc[num1676].ai[1] = (float)num1675; } } } } } else if (this.ai[0] == 0f) { num1668 = 3; this.TargetClosest(false); Vector2 v4 = Main.player[this.target].Center - base.Center - new Vector2(0f, -22f); float num1677 = v4.Length() / 500f; if (num1677 > 1f) { num1677 = 1f; } num1677 = 1f - num1677; num1677 *= 2f; if (num1677 > 1f) { num1677 = 1f; } this.localAI[0] = v4.ToRotation(); this.localAI[1] = num1677; this.localAI[2] = MathHelper.Lerp(this.localAI[2], 1f, 0.2f); } if (this.ai[0] == 1f) { if (num1665 < 180f) { this.localAI[1] -= 0.05f; if (this.localAI[1] < 0f) { this.localAI[1] = 0f; } } else if (num1665 < num1666 - 15f) { if (num1665 == 180f && Main.netMode != 1) { this.TargetClosest(false); Vector2 vector234 = Main.player[this.target].Center - base.Center; vector234.Normalize(); float num1683 = -1f; if (vector234.X < 0f) { num1683 = 1f; } vector234 = vector234.RotatedBy((double)(-(double)num1683 * 6.28318548f / 6f), default(Vector2)); Projectile.NewProjectile(base.Center.X, base.Center.Y, vector234.X, vector234.Y, 455, 75, 0f, Main.myPlayer, num1683 * 6.28318548f / 540f, (float)this.whoAmI); this.ai[2] = (vector234.ToRotation() + 9.424778f) * num1683; this.netUpdate = true; } this.localAI[1] += 0.05f; if (this.localAI[1] > 1f) { this.localAI[1] = 1f; } float num1684 = (float)(this.ai[2] >= 0f).ToDirectionInt(); float num1685 = this.ai[2]; if (num1685 < 0f) { num1685 *= -1f; } num1685 += -9.424778f; num1685 += num1684 * 6.28318548f / 540f; this.localAI[0] = num1685; this.ai[2] = (num1685 + 9.424778f) * num1684; } else { this.localAI[1] -= 0.07f; if (this.localAI[1] < 0f) { this.localAI[1] = 0f; } num1668 = 3; } } else if (this.ai[0] == 2f) { num1667 = 2; num1668 = 3; Vector2 value47 = new Vector2(0f, 216f); if (num1665 == 0f && Main.netMode != 1) { Vector2 value48 = base.Center + value47; for (int num1686 = 0; num1686 < 255; num1686++) { Player player10 = Main.player[num1686]; if (player10.active && !player10.dead && Vector2.Distance(player10.Center, value48) <= 3000f) { Vector2 value49 = Main.player[this.target].Center - value48; if (value49 != Vector2.Zero) { value49.Normalize(); } Projectile.NewProjectile(value48.X, value48.Y, value49.X, value49.Y, 456, 0, 0f, Main.myPlayer, (float)(this.whoAmI + 1), (float)num1686); } } } if ((num1665 == 120f || num1665 == 180f || num1665 == 240f) && Main.netMode != 1) { for (int num1687 = 0; num1687 < 1000; num1687++) { Projectile projectile6 = Main.projectile[num1687]; if (projectile6.active && projectile6.type == 456 && Main.player[(int)projectile6.ai[1]].HasBuff(BuffID.MoonLeech) != -1) { Vector2 center25 = Main.player[this.target].Center; int num1688 = NPC.NewNPC((int)center25.X, (int)center25.Y, 401, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num1688].netUpdate = true; Main.npc[num1688].ai[0] = (float)(this.whoAmI + 1); Main.npc[num1688].ai[1] = (float)num1687; } } } } else if (this.ai[0] == 3f) { if (num1665 == 0f) { this.TargetClosest(false); this.netUpdate = true; } Vector2 v5 = Main.player[this.target].Center + Main.player[this.target].velocity * 20f - base.Center; this.localAI[0] = this.localAI[0].AngleLerp(v5.ToRotation(), 0.5f); this.localAI[1] += 0.05f; if (this.localAI[1] > 1f) { this.localAI[1] = 1f; } if ((num1665 == num1666 - 14f || num1665 == num1666 - 7f || num1665 == num1666) && Main.netMode != 1) { Vector2 vector235 = Utils.Vector2FromElipse(this.localAI[0].ToRotationVector2(), value43 * this.localAI[1]); Vector2 vector236 = Vector2.Normalize(v5) * 8f; Projectile.NewProjectile(base.Center.X + vector235.X, base.Center.Y + vector235.Y, vector236.X, vector236.Y, 462, 30, 0f, Main.myPlayer, 0f, 0f); } } int num1689 = num1667 * 7; if ((float)num1689 > this.localAI[2]) { this.localAI[2] += 1f; } if ((float)num1689 < this.localAI[2]) { this.localAI[2] -= 1f; } if (this.localAI[2] < 0f) { this.localAI[2] = 0f; } if (this.localAI[2] > 14f) { this.localAI[2] = 14f; } int num1690 = num1668 * 5; if ((float)num1690 > this.localAI[3]) { this.localAI[3] += 1f; } if ((float)num1690 < this.localAI[3]) { this.localAI[3] -= 1f; } if (this.localAI[3] < 0f) { this.localAI[2] = 0f; } if (this.localAI[3] > 15f) { this.localAI[2] = 15f; } int num1691 = 0; if (num1691 == 1) { new Vector2(27f, 59f); this.TargetClosest(false); Vector2 v6 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - base.Center; float num1692 = v6.Length() / 200f; if (num1692 > 1f) { num1692 = 1f; } num1692 = 1f - num1692; num1692 *= 2f; if (num1692 > 1f) { num1692 = 1f; } this.localAI[0] = v6.ToRotation(); this.localAI[1] = num1692; this.localAI[1] = 1f; } if (num1691 == 2) { Vector2 vector237 = new Vector2(27f, 59f); float num1693 = 6.28318548f * ((float)Main.time % 600f) / 600f; this.localAI[0] = new Vector2((float)Math.Cos((double)num1693) * vector237.X, (float)Math.Sin((double)num1693) * vector237.Y).ToRotation(); this.localAI[1] = 0.75f; if (this.ai[1] == 0f) { Vector2 vector238 = num1693.ToRotationVector2(); vector238 = Vector2.One; Projectile.NewProjectile(base.Center.X, base.Center.Y, vector238.X, vector238.Y, 455, 1, 0f, Main.myPlayer, 0.0104719754f, (float)this.whoAmI); } this.ai[1] += 1f; if (this.ai[1] >= 600f) { this.ai[1] = 0f; } } if (num1691 == 3) { Vector2 vector239 = new Vector2(0f, 216f); if (this.ai[1] == 0f) { this.TargetClosest(false); Vector2 vector240 = Main.player[this.target].Center - base.Center; vector240.Normalize(); Projectile.NewProjectile(base.Center.X + vector239.X, base.Center.Y + vector239.Y, vector240.X, vector240.Y, 456, 0, 0f, Main.myPlayer, (float)(this.whoAmI + 1), (float)this.target); } this.ai[1] += 1f; if (this.ai[1] >= 600f) { this.ai[1] = 0f; } } if (num1691 == 4) { new Vector2(27f, 59f); this.TargetClosest(false); Vector2 v7 = Main.player[this.target].Center + Main.player[this.target].velocity * 20f - base.Center; this.localAI[0] = this.localAI[0].AngleLerp(v7.ToRotation(), 0.5f); this.localAI[1] = 1f; this.ai[1] += 1f; if (this.ai[1] == 76f || this.ai[1] == 83f || this.ai[1] == 90f) { value43 = new Vector2(27f, 59f); Vector2 vector241 = Utils.Vector2FromElipse(this.localAI[0].ToRotationVector2(), value43 * this.localAI[1]); Vector2 vector242 = Vector2.Normalize(v7) * 8f; Projectile.NewProjectile(base.Center.X + vector241.X, base.Center.Y + vector241.Y, vector242.X, vector242.Y, 462, 5, 0f, Main.myPlayer, 0f, 0f); } if (this.ai[1] >= 90f) { this.ai[1] = 0f; return; } } } else { if (this.aiStyle == 80) { if (this.ai[0] == 0f) { if (this.collideX) { this.direction = 1 - this.direction; } this.velocity.X = 3f * (float)((this.direction == 0) ? -1 : 1); Vector2 center26 = base.Center; Point point10 = center26.ToTileCoordinates(); int num1694 = 30; if (WorldGen.InWorld(point10.X, point10.Y, 30)) { for (int num1695 = 0; num1695 < 30; num1695++) { if (WorldGen.SolidTile(point10.X, point10.Y + num1695)) { num1694 = num1695; break; } } } if (num1694 < 15) { this.velocity.Y = Math.Max(this.velocity.Y - 0.05f, -3.5f); } else if (num1694 < 20) { this.velocity.Y = this.velocity.Y * 0.95f; } else { this.velocity.Y = Math.Min(this.velocity.Y + 0.05f, 1.5f); } float num1697; int num1696 = this.FindClosestPlayer(out num1697); if (num1696 == -1 || Main.player[num1696].dead) { return; } if (num1697 < 352f && Main.player[num1696].Center.Y > base.Center.Y) { this.ai[0] = 1f; this.ai[1] = 0f; this.netUpdate = true; } } else if (this.ai[0] == 1f) { this.ai[1] += 1f; this.velocity *= 0.95f; if (this.ai[1] >= 60f) { this.ai[1] = 0f; this.ai[0] = 2f; int num1698 = this.FindClosestPlayer(); if (num1698 != -1) { this.ai[3] = ((Main.player[num1698].Center.X > base.Center.X) ? -1f : 1f); } else { this.ai[3] = 1f; } this.netUpdate = true; } } else if (this.ai[0] == 2f) { this.noTileCollide = true; this.ai[1] += 1f; this.velocity.Y = Math.Max(this.velocity.Y - 0.1f, -10f); this.velocity.X = Math.Min(this.velocity.X + this.ai[3] * 0.05f, 4f); if (this.position.Y < (float)(-(float)this.height) || this.ai[1] >= 180f) { if (Main.netMode != 1) { Main.StartInvasion(4); } this.active = false; this.ai[0] = 3f; this.netUpdate = true; } } return; } if (this.aiStyle == 81) { Vector2 value50 = new Vector2(30f); if (!Main.npc[(int)this.ai[3]].active || Main.npc[(int)this.ai[3]].type != 398) { this.life = 0; this.HitEffect(0, 10.0); this.active = false; } float num1699 = 0f; float num1700 = this.ai[0]; this.ai[1] += 1f; int num1701 = 0; int num1702 = 0; while (num1701 < 10) { num1699 = (float)NPC.MoonLordAttacksArray2[1, num1701]; if (num1699 + (float)num1702 > this.ai[1]) { break; } num1702 += (int)num1699; num1701++; } if (num1701 == 10) { num1701 = 0; this.ai[1] = 0f; num1699 = (float)NPC.MoonLordAttacksArray2[1, num1701]; num1702 = 0; } this.ai[0] = (float)NPC.MoonLordAttacksArray2[0, num1701]; float num1703 = (float)((int)this.ai[1] - num1702); if (this.ai[0] != num1700) { this.netUpdate = true; } if (this.ai[0] == -1f) { this.ai[1] += 1f; if (this.ai[1] > 180f) { this.ai[1] = 0f; } float value51; if (this.ai[1] < 60f) { value51 = 0.75f; this.localAI[0] = 0f; this.localAI[1] = (float)Math.Sin((double)(this.ai[1] * 6.28318548f / 15f)) * 0.35f; if (this.localAI[1] < 0f) { this.localAI[0] = 3.14159274f; } } else if (this.ai[1] < 120f) { value51 = 1f; if (this.localAI[1] < 0.5f) { this.localAI[1] += 0.025f; } this.localAI[0] += 0.209439516f; } else { value51 = 1.15f; this.localAI[1] -= 0.05f; if (this.localAI[1] < 0f) { this.localAI[1] = 0f; } } this.localAI[2] = MathHelper.Lerp(this.localAI[2], value51, 0.3f); } if (this.ai[0] == 0f) { this.TargetClosest(false); Vector2 v8 = Main.player[this.target].Center + Main.player[this.target].velocity * 20f - base.Center; this.localAI[0] = this.localAI[0].AngleLerp(v8.ToRotation(), 0.5f); this.localAI[1] += 0.05f; if (this.localAI[1] > 0.7f) { this.localAI[1] = 0.7f; } this.localAI[2] = MathHelper.Lerp(this.localAI[2], 1f, 0.2f); float scaleFactor22 = 24f; Vector2 center27 = base.Center; Vector2 center28 = Main.player[this.target].Center; Vector2 value52 = center28 - center27; Vector2 vector243 = value52 - Vector2.UnitY * 200f; vector243 = Vector2.Normalize(vector243) * scaleFactor22; int num1704 = 30; this.velocity.X = (this.velocity.X * (float)(num1704 - 1) + vector243.X) / (float)num1704; this.velocity.Y = (this.velocity.Y * (float)(num1704 - 1) + vector243.Y) / (float)num1704; float num1705 = 0.25f; for (int num1706 = 0; num1706 < 200; num1706++) { if (num1706 != this.whoAmI && Main.npc[num1706].active && Main.npc[num1706].type == NPCID.MoonLordFreeEye && Vector2.Distance(base.Center, Main.npc[num1706].Center) < 150f) { if (this.position.X < Main.npc[num1706].position.X) { this.velocity.X = this.velocity.X - num1705; } else { this.velocity.X = this.velocity.X + num1705; } if (this.position.Y < Main.npc[num1706].position.Y) { this.velocity.Y = this.velocity.Y - num1705; } else { this.velocity.Y = this.velocity.Y + num1705; } } } return; } if (this.ai[0] == 1f) { if (num1703 == 0f) { this.TargetClosest(false); this.netUpdate = true; } this.velocity *= 0.95f; if (this.velocity.Length() < 1f) { this.velocity = Vector2.Zero; } Vector2 v9 = Main.player[this.target].Center + Main.player[this.target].velocity * 20f - base.Center; this.localAI[0] = this.localAI[0].AngleLerp(v9.ToRotation(), 0.5f); this.localAI[1] += 0.05f; if (this.localAI[1] > 1f) { this.localAI[1] = 1f; } if (num1703 < 20f) { this.localAI[2] = MathHelper.Lerp(this.localAI[2], 1.1f, 0.2f); } else { this.localAI[2] = MathHelper.Lerp(this.localAI[2], 0.4f, 0.2f); } if ((num1703 == num1699 - 14f || num1703 == num1699 - 7f || num1703 == num1699) && Main.netMode != 1) { Vector2 vector244 = Utils.Vector2FromElipse(this.localAI[0].ToRotationVector2(), value50 * this.localAI[1]); Vector2 vector245 = Vector2.Normalize(v9) * 8f; Projectile.NewProjectile(base.Center.X + vector244.X, base.Center.Y + vector244.Y, vector245.X, vector245.Y, 462, 35, 0f, Main.myPlayer, 0f, 0f); return; } } else if (this.ai[0] == 2f) { if (num1703 < 15f) { this.localAI[1] -= 0.07f; if (this.localAI[1] < 0f) { this.localAI[1] = 0f; } this.localAI[2] = MathHelper.Lerp(this.localAI[2], 0.4f, 0.2f); this.velocity *= 0.8f; if (this.velocity.Length() < 1f) { this.velocity = Vector2.Zero; return; } } else if (num1703 < 75f) { float num1707 = (num1703 - 15f) / 10f; int num1708 = 0; int num1709 = 0; switch ((int)num1707) { case 0: num1708 = 0; num1709 = 2; break; case 1: num1708 = 2; num1709 = 5; break; case 2: num1708 = 5; num1709 = 3; break; case 3: num1708 = 3; num1709 = 1; break; case 4: num1708 = 1; num1709 = 4; break; case 5: num1708 = 4; num1709 = 0; break; } Vector2 spinningpoint8 = Vector2.UnitY * -30f; Vector2 value53 = spinningpoint8.RotatedBy((double)((float)num1708 * 6.28318548f / 6f), default(Vector2)); Vector2 value54 = spinningpoint8.RotatedBy((double)((float)num1709 * 6.28318548f / 6f), default(Vector2)); Vector2 vector246 = Vector2.Lerp(value53, value54, num1707 - (float)((int)num1707)); float value55 = vector246.Length() / 30f; this.localAI[0] = vector246.ToRotation(); this.localAI[1] = MathHelper.Lerp(this.localAI[1], value55, 0.5f); if ((num1703 - 15f) % 10f == 0f && Main.netMode != 1) { Vector2 vec7 = Vector2.Normalize(vector246); if (vec7.HasNaNs()) { vec7 = Vector2.UnitY * -1f; } vec7 *= 4f; Projectile.NewProjectile(base.Center.X + vector246.X, base.Center.Y + vector246.Y, vec7.X, vec7.Y, 454, 55, 0f, Main.myPlayer, 30f, (float)this.whoAmI); return; } } else { if (num1703 < 105f) { this.localAI[0] = this.localAI[0].AngleLerp(this.ai[2] - 1.57079637f, 0.2f); this.localAI[2] = MathHelper.Lerp(this.localAI[2], 0.75f, 0.2f); if (num1703 == 75f) { this.TargetClosest(false); this.netUpdate = true; this.velocity = Vector2.UnitY * -7f; for (int num1712 = 0; num1712 < 1000; num1712++) { Projectile projectile7 = Main.projectile[num1712]; if (projectile7.active && projectile7.type == 454 && projectile7.ai[1] == (float)this.whoAmI && projectile7.ai[0] != -1f) { projectile7.velocity += this.velocity; projectile7.netUpdate = true; } } } this.velocity.Y = this.velocity.Y * 0.96f; this.ai[2] = (Main.player[this.target].Center - base.Center).ToRotation() + 1.57079637f; this.rotation = this.rotation.AngleTowards(this.ai[2], 0.104719758f); return; } if (num1703 < 120f) { if (num1703 == 105f) { this.netUpdate = true; } Vector2 velocity9 = (this.ai[2] - 1.57079637f).ToRotationVector2() * 12f; this.velocity = velocity9 * 2f; for (int num1713 = 0; num1713 < 1000; num1713++) { Projectile projectile8 = Main.projectile[num1713]; if (projectile8.active && projectile8.type == 454 && projectile8.ai[1] == (float)this.whoAmI && projectile8.ai[0] != -1f) { projectile8.ai[0] = -1f; projectile8.velocity = velocity9; projectile8.netUpdate = true; } } return; } this.velocity *= 0.92f; this.rotation = this.rotation.AngleLerp(0f, 0.2f); return; } } else if (this.ai[0] == 3f) { if (num1703 < 15f) { this.localAI[1] -= 0.07f; if (this.localAI[1] < 0f) { this.localAI[1] = 0f; } this.localAI[2] = MathHelper.Lerp(this.localAI[2], 0.4f, 0.2f); this.velocity *= 0.9f; if (this.velocity.Length() < 1f) { this.velocity = Vector2.Zero; return; } } else if (num1703 < 45f) { this.localAI[0] = 0f; this.localAI[1] = (float)Math.Sin((double)((num1703 - 15f) * 6.28318548f / 15f)) * 0.5f; if (this.localAI[1] < 0f) { this.localAI[0] = 3.14159274f; return; } } else { if (num1703 >= 185f) { this.velocity *= 0.88f; this.rotation = this.rotation.AngleLerp(0f, 0.2f); this.localAI[1] -= 0.07f; if (this.localAI[1] < 0f) { this.localAI[1] = 0f; } this.localAI[2] = MathHelper.Lerp(this.localAI[2], 1f, 0.2f); return; } if (num1703 == 45f) { this.ai[2] = (float)(Main.rand.Next(2) == 0).ToDirectionInt() * 6.28318548f / 40f; this.netUpdate = true; } if ((num1703 - 15f - 30f) % 40f == 0f) { this.ai[2] *= 0.95f; } this.localAI[0] += this.ai[2]; this.localAI[1] += 0.05f; if (this.localAI[1] > 1f) { this.localAI[1] = 1f; } Vector2 vector247 = this.localAI[0].ToRotationVector2() * value50 * this.localAI[1]; float scaleFactor23 = MathHelper.Lerp(8f, 20f, (num1703 - 15f - 30f) / 140f); this.velocity = Vector2.Normalize(vector247) * scaleFactor23; this.rotation = this.rotation.AngleLerp(this.velocity.ToRotation() + 1.57079637f, 0.2f); if ((num1703 - 15f - 30f) % 10f == 0f && Main.netMode != 1) { Vector2 vector248 = base.Center + Vector2.Normalize(vector247) * value50.Length() * 0.4f; Vector2 vector249 = Vector2.Normalize(vector247) * 8f; float ai3 = (6.28318548f * (float)Main.rand.NextDouble() - 3.14159274f) / 30f + 0.0174532924f * this.ai[2]; Projectile.NewProjectile(vector248.X, vector248.Y, vector249.X, vector249.Y, 452, 35, 0f, Main.myPlayer, 0f, ai3); return; } } } else if (this.ai[0] == 4f) { if (num1703 == 0f) { this.TargetClosest(false); this.netUpdate = true; } if (num1703 < 180f) { this.localAI[2] = MathHelper.Lerp(this.localAI[2], 1f, 0.2f); this.localAI[1] -= 0.05f; if (this.localAI[1] < 0f) { this.localAI[1] = 0f; } this.velocity *= 0.95f; if (this.velocity.Length() < 1f) { this.velocity = Vector2.Zero; } if (num1703 >= 60f) { return; } } else { if (num1703 < num1699 - 15f) { if (num1703 == 180f && Main.netMode != 1) { this.TargetClosest(false); Vector2 vector251 = Main.player[this.target].Center - base.Center; vector251.Normalize(); float num1719 = -1f; if (vector251.X < 0f) { num1719 = 1f; } vector251 = vector251.RotatedBy((double)(-(double)num1719 * 6.28318548f / 6f), default(Vector2)); Projectile.NewProjectile(base.Center.X, base.Center.Y, vector251.X, vector251.Y, 455, 50, 0f, Main.myPlayer, num1719 * 6.28318548f / 540f, (float)this.whoAmI); this.ai[2] = (vector251.ToRotation() + 9.424778f) * num1719; this.netUpdate = true; } this.localAI[1] += 0.05f; if (this.localAI[1] > 1f) { this.localAI[1] = 1f; } float num1720 = (float)(this.ai[2] >= 0f).ToDirectionInt(); float num1721 = this.ai[2]; if (num1721 < 0f) { num1721 *= -1f; } num1721 += -9.424778f; num1721 += num1720 * 6.28318548f / 540f; this.localAI[0] = num1721; this.ai[2] = (num1721 + 9.424778f) * num1720; return; } this.localAI[1] -= 0.07f; if (this.localAI[1] < 0f) { this.localAI[1] = 0f; return; } } } } else if (this.aiStyle == 82) { float num1722 = 90f; Vector2 value56 = new Vector2(0f, 216f); int num1723 = (int)Math.Abs(this.ai[0]) - 1; int num1724 = (int)this.ai[1]; if (!Main.npc[num1723].active || Main.npc[num1723].type != NPCID.MoonLordHead) { this.life = 0; this.HitEffect(0, 10.0); this.active = false; return; } this.ai[2] += 1f; if (this.ai[2] >= num1722) { if (Main.netMode != 1) { int num1725 = (int)Main.npc[num1723].ai[3]; int num1726 = -1; int num1727 = -1; int num1728 = num1723; for (int num1729 = 0; num1729 < 200; num1729++) { if (Main.npc[num1729].active && Main.npc[num1729].ai[3] == (float)num1725) { if (num1726 == -1 && Main.npc[num1729].type == NPCID.MoonLordHand && Main.npc[num1729].ai[2] == 0f) { num1726 = num1729; } if (num1727 == -1 && Main.npc[num1729].type == NPCID.MoonLordHand && Main.npc[num1729].ai[2] == 1f) { num1727 = num1729; } if (num1726 != -1 && num1727 != -1 && num1728 != -1) { break; } } } int num1730 = 1000; int num1731 = Main.npc[num1725].lifeMax - Main.npc[num1725].life; int num1732 = Main.npc[num1726].lifeMax - Main.npc[num1726].life; int num1733 = Main.npc[num1727].lifeMax - Main.npc[num1727].life; int num1734 = Main.npc[num1728].lifeMax - Main.npc[num1728].life; if (num1734 > 0 && num1730 > 0) { int num1735 = num1734 - num1730; if (num1735 > 0) { num1735 = 0; } int num1736 = num1730 + num1735; num1730 -= num1736; Main.npc[num1728].life += num1736; NPC.HealEffect(Utils.CenteredRectangle(Main.npc[num1728].Center, new Vector2(50f)), num1736, true); } if (num1731 > 0 && num1730 > 0) { int num1737 = num1731 - num1730; if (num1737 > 0) { num1737 = 0; } int num1738 = num1730 + num1737; num1730 -= num1738; Main.npc[num1725].life += num1738; NPC.HealEffect(Utils.CenteredRectangle(Main.npc[num1725].Center, new Vector2(50f)), num1738, true); } if (num1732 > 0 && num1730 > 0) { int num1739 = num1732 - num1730; if (num1739 > 0) { num1739 = 0; } int num1740 = num1730 + num1739; num1730 -= num1740; Main.npc[num1726].life += num1740; NPC.HealEffect(Utils.CenteredRectangle(Main.npc[num1726].Center, new Vector2(50f)), num1740, true); } if (num1733 > 0 && num1730 > 0) { int num1741 = num1733 - num1730; if (num1741 > 0) { num1741 = 0; } int num1742 = num1730 + num1741; num1730 -= num1742; Main.npc[num1727].life += num1742; NPC.HealEffect(Utils.CenteredRectangle(Main.npc[num1727].Center, new Vector2(50f)), num1742, true); } } this.life = 0; this.HitEffect(0, 10.0); this.active = false; return; } this.velocity = Vector2.Zero; base.Center = Vector2.Lerp(Main.projectile[num1724].Center, Main.npc[(int)Math.Abs(this.ai[0]) - 1].Center + value56, this.ai[2] / num1722); return; } else if (this.aiStyle == 83) { if (this.type == NPCID.CultistTablet) { if (this.localAI[3] == 0f && Main.netMode != 1) { this.localAI[3] = 1f; this.netUpdate = true; Point[] array7 = null; if (!CultistRitual.CheckFloor(base.Center, out array7)) { this.life = 0; this.HitEffect(0, 10.0); this.active = false; return; } int num1747 = 0; int num1748 = 1; for (int num1749 = 0; num1749 < 4; num1749++) { bool flag165 = num1749 == 1 || num1749 == 2; int num1750; if (flag165) { num1750 = 438; } else { num1750 = 379; } int num1751 = NPC.NewNPC(array7[num1749].X * 16 + 8, array7[num1749].Y * 16 - 48, num1750, 0, 0f, 0f, 0f, 0f, 255); if (flag165) { this.localAI[num1748++] = (float)(num1751 + 1); Main.npc[num1751].ai[3] = (float)(-(float)(this.whoAmI + 1)); } else { this.ai[num1747++] = (float)(num1751 + 1); Main.npc[num1751].ai[3] = (float)(-(float)(this.whoAmI + 1)); } Main.npc[num1751].netUpdate = true; } } if (this.localAI[0] == 1f && Main.netMode != 1) { this.localAI[0] = 2f; for (int num1752 = 0; num1752 < 2; num1752++) { Main.npc[(int)this.localAI[num1752 + 1] - 1].ai[1] = 1f; Main.npc[(int)this.localAI[num1752 + 1] - 1].netUpdate = true; Main.npc[(int)this.ai[num1752] - 1].ai[3] = 0f; Main.npc[(int)this.ai[num1752] - 1].TargetClosest(true); Main.npc[(int)this.ai[num1752] - 1].netUpdate = true; } } if (this.ai[0] != -1f && Main.netMode != 1) { bool flag166 = true; for (int num1753 = 0; num1753 < 2; num1753++) { if (Main.npc[(int)this.localAI[num1753 + 1] - 1].active && Main.npc[(int)this.localAI[num1753 + 1] - 1].type == 438) { flag166 = false; } if (Main.npc[(int)this.ai[num1753] - 1].active && Main.npc[(int)this.ai[num1753] - 1].type == 379) { flag166 = false; } } if (flag166) { this.ai[0] = -1f; this.ai[1] = 0f; this.ai[3] = 0f; int num1754 = (int)base.Center.X / 16 + 11 * (Main.rand.Next(2) == 0).ToDirectionInt(); int num1755 = 0; for (int num1756 = -5; num1756 < 12; num1756++) { int num1757 = num1754; int num1758 = (int)base.Center.Y / 16 + num1756; if (WorldGen.SolidTile(num1757, num1758) && !Collision.SolidTiles(num1757 - 1, num1757 + 1, num1758 - 3, num1758 - 1)) { num1755 = num1758; break; } if (num1756 == 11) { num1755 = num1758; } } int num1759 = NPC.NewNPC(num1754 * 16 + 10, num1755 * 16 - 2, 439, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num1759].direction = (Main.npc[num1759].spriteDirection = Math.Sign(base.Center.X - (float)(num1754 * 16) - 10f)); this.ai[2] = (float)num1759; this.netUpdate = true; CultistRitual.TabletDestroyed(); } } if (this.ai[0] == -1f) { this.ai[3] += 1f; if (this.ai[3] > 300f) { this.life = 0; this.HitEffect(0, 9999.0); this.active = false; if (Main.netMode != 1) { for (int num1760 = 0; num1760 < 6; num1760++) { float num1761 = 3f + Main.rand.NextFloat() * 6f; Vector2 vector252 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); Vector2 value57 = base.Center; value57 += vector252 * 30f; Projectile.NewProjectile(value57.X, value57.Y, vector252.X * num1761, vector252.Y * num1761, 526, 0, 0f, Main.myPlayer, Main.npc[(int)this.ai[2]].Center.X, Main.npc[(int)this.ai[2]].Center.Y); } for (int num1762 = 0; num1762 < 20; num1762++) { if (Main.rand.Next(2) != 0) { float num1763 = 3f + Main.rand.NextFloat() * 6f; Vector2 vector253 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); Vector2 value58 = base.Center; value58 += vector253 * 30f; Vector2 vector254 = base.Center + vector253 * (Main.rand.NextFloat() * 45f + 45f) + Vector2.UnitY * 20f; Projectile.NewProjectile(value58.X, value58.Y, vector253.X * num1763, -20f, 526, 0, 0f, Main.myPlayer, vector254.X, vector254.Y); } } } } else if (this.ai[3] % 10f == 1f && this.ai[3] > 120f && Main.netMode != 1) { float num1764 = 3f + Main.rand.NextFloat() * 6f; Vector2 vector255 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); Vector2 value59 = base.Center; value59 += vector255 * 25f; Projectile.NewProjectile(value59.X, value59.Y, vector255.X * num1764, vector255.Y * num1764, 526, 0, 0f, Main.myPlayer, Main.npc[(int)this.ai[2]].Center.X, Main.npc[(int)this.ai[2]].Center.Y); } } } if (this.type == NPCID.CultistDevote) { this.velocity.X = this.velocity.X * 0.93f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } int num1765 = (int)(-this.ai[3] - 1f); if (num1765 == -1) { this.life = 0; this.HitEffect(0, 10.0); this.active = false; return; } int num1766 = Math.Sign(Main.npc[num1765].Center.X - base.Center.X); if (num1766 != this.direction) { this.velocity.X = 0f; this.direction = (this.spriteDirection = num1766); this.netUpdate = true; } if (this.justHit && Main.netMode != 1 && Main.npc[num1765].localAI[0] == 0f) { Main.npc[num1765].localAI[0] = 1f; } if ((this.ai[0] += 1f) >= 300f) { this.ai[0] = 0f; this.netUpdate = true; } } if (this.type == NPCID.CultistTablet) { return; } } else { if (this.aiStyle == 84) { bool expertMode2 = Main.expertMode; bool flag167 = this.life <= this.lifeMax / 2; int num1767 = 120; int num1768 = 35; if (expertMode2) { num1767 = 90; num1768 = 25; } int num1769 = 18; int num1770 = 3; int num1771 = 30; if (expertMode2) { num1769 = 12; num1770 = 4; num1771 = 20; } int num1772 = 80; int num1773 = 45; if (expertMode2) { num1772 = 40; num1773 = 30; } int num1774 = 20; int num1775 = 2; if (expertMode2) { num1774 = 30; num1775 = 2; } int num1776 = 20; int num1777 = 3; bool flag168 = this.type == NPCID.CultistBoss; bool flag169 = false; bool flag170 = false; if (flag167) { this.defense = (int)((float)this.defDefense * 0.65f); } if (!flag168) { bool flag171 = this.ai[3] < 0f || !Main.npc[(int)this.ai[3]].active || Main.npc[(int)this.ai[3]].type != 439; if (flag171) { this.life = 0; this.HitEffect(0, 10.0); this.active = false; return; } this.ai[0] = Main.npc[(int)this.ai[3]].ai[0]; this.ai[1] = Main.npc[(int)this.ai[3]].ai[1]; if (this.ai[0] == 5f) { if (this.justHit) { this.life = 0; this.HitEffect(0, 10.0); this.active = false; NetMessage.SendData((int)PacketTypes.NpcUpdate, -1, -1, "", this.whoAmI, 0f, 0f, 0f, 0, 0, 0); NPC nPC12 = Main.npc[(int)this.ai[3]]; nPC12.ai[0] = 6f; nPC12.ai[1] = 0f; nPC12.netUpdate = true; } } else { flag169 = true; flag170 = true; } } else if (this.ai[0] == 5f && this.ai[1] >= 120f && this.ai[1] < 420f && this.justHit) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[3] += 1f; this.velocity = Vector2.Zero; this.netUpdate = true; List<int> list = new List<int>(); for (int num1778 = 0; num1778 < 200; num1778++) { if (Main.npc[num1778].active && Main.npc[num1778].type == NPCID.CultistBossClone && Main.npc[num1778].ai[3] == (float)this.whoAmI) { list.Add(num1778); } } int num1779 = 10; if (Main.expertMode) { num1779 = 3; } foreach (int current in list) { NPC nPC13 = Main.npc[current]; if (nPC13.localAI[1] == this.localAI[1] && num1779 > 0) { num1779--; nPC13.life = 0; nPC13.HitEffect(0, 10.0); nPC13.active = false; NetMessage.SendData((int)PacketTypes.NpcUpdate, -1, -1, "", current, 0f, 0f, 0f, 0, 0, 0); } else if (num1779 > 0) { num1779--; nPC13.life = 0; nPC13.HitEffect(0, 10.0); nPC13.active = false; } } Main.projectile[(int)this.ai[2]].ai[1] = -1f; Main.projectile[(int)this.ai[2]].netUpdate = true; } Vector2 center30 = base.Center; Player player11 = Main.player[this.target]; if (this.target < 0 || this.target == 255 || player11.dead || !player11.active) { this.TargetClosest(false); player11 = Main.player[this.target]; this.netUpdate = true; } if (player11.dead || Vector2.Distance(player11.Center, center30) > 5600f) { this.life = 0; this.HitEffect(0, 10.0); this.active = false; NetMessage.SendData((int)PacketTypes.NpcStrike, -1, -1, "", this.whoAmI, -1f, 0f, 0f, 0, 0, 0); List<int> list2 = new List<int>(); list2.Add(this.whoAmI); for (int num1780 = 0; num1780 < 200; num1780++) { if (Main.npc[num1780].active && Main.npc[num1780].type == NPCID.CultistBossClone && Main.npc[num1780].ai[3] == (float)this.whoAmI) { Main.npc[num1780].life = 0; Main.npc[num1780].HitEffect(0, 10.0); Main.npc[num1780].active = false; NetMessage.SendData((int)PacketTypes.NpcStrike, -1, -1, "", this.whoAmI, -1f, 0f, 0f, 0, 0, 0); } } } float num1781 = this.ai[3]; if (this.localAI[0] == 0f) { this.localAI[0] = 1f; this.alpha = 255; this.rotation = 0f; if (Main.netMode != 1) { this.ai[0] = -1f; this.netUpdate = true; } } if (this.ai[0] == -1f) { this.alpha -= 5; if (this.alpha < 0) { this.alpha = 0; } this.ai[1] += 1f; if (this.ai[1] >= 420f) { this.ai[0] = 0f; this.ai[1] = 0f; this.netUpdate = true; } else if (this.ai[1] > 360f) { this.velocity *= 0.95f; this.localAI[2] = 13f; } else if (this.ai[1] > 300f) { this.velocity = -Vector2.UnitY; this.localAI[2] = 10f; } else if (this.ai[1] > 120f) { this.localAI[2] = 1f; } else { this.localAI[2] = 0f; } flag169 = true; flag170 = true; } if (this.ai[0] == 0f) { if (this.ai[1] == 0f) { this.TargetClosest(false); } this.localAI[2] = 10f; int num1782 = Math.Sign(player11.Center.X - center30.X); if (num1782 != 0) { this.direction = (this.spriteDirection = num1782); } this.ai[1] += 1f; if (this.ai[1] >= 40f && flag168) { int num1783 = 0; if (flag167) { switch ((int)this.ai[3]) { case 0: num1783 = 0; break; case 1: num1783 = 1; break; case 2: num1783 = 0; break; case 3: num1783 = 5; break; case 4: num1783 = 0; break; case 5: num1783 = 3; break; case 6: num1783 = 0; break; case 7: num1783 = 5; break; case 8: num1783 = 0; break; case 9: num1783 = 2; break; case 10: num1783 = 0; break; case 11: num1783 = 3; break; case 12: num1783 = 0; break; case 13: num1783 = 4; this.ai[3] = -1f; break; default: this.ai[3] = -1f; break; } } else { switch ((int)this.ai[3]) { case 0: num1783 = 0; break; case 1: num1783 = 1; break; case 2: num1783 = 0; break; case 3: num1783 = 2; break; case 4: num1783 = 0; break; case 5: num1783 = 3; break; case 6: num1783 = 0; break; case 7: num1783 = 1; break; case 8: num1783 = 0; break; case 9: num1783 = 2; break; case 10: num1783 = 0; break; case 11: num1783 = 4; this.ai[3] = -1f; break; default: this.ai[3] = -1f; break; } } int maxValue12 = 6; if (this.life < this.lifeMax / 3) { maxValue12 = 4; } if (this.life < this.lifeMax / 4) { maxValue12 = 3; } if (expertMode2 && flag167 && Main.rand.Next(maxValue12) == 0 && num1783 != 0 && num1783 != 4 && num1783 != 5 && NPC.CountNPCS(523) < 10) { num1783 = 6; } if (num1783 == 0) { float num1784 = (float)Math.Ceiling((double)((player11.Center + new Vector2(0f, -100f) - center30).Length() / 50f)); if (num1784 == 0f) { num1784 = 1f; } List<int> list3 = new List<int>(); int num1785 = 0; list3.Add(this.whoAmI); for (int num1786 = 0; num1786 < 200; num1786++) { if (Main.npc[num1786].active && Main.npc[num1786].type == NPCID.CultistBossClone && Main.npc[num1786].ai[3] == (float)this.whoAmI) { list3.Add(num1786); } } bool flag172 = list3.Count % 2 == 0; foreach (int current2 in list3) { NPC nPC14 = Main.npc[current2]; Vector2 center31 = nPC14.Center; float num1787 = (float)((num1785 + flag172.ToInt() + 1) / 2) * 6.28318548f * 0.4f / (float)list3.Count; if (num1785 % 2 == 1) { num1787 *= -1f; } if (list3.Count == 1) { num1787 = 0f; } Vector2 value60 = new Vector2(0f, -1f).RotatedBy((double)num1787, default(Vector2)) * new Vector2(300f, 200f); Vector2 value61 = player11.Center + value60 - center31; nPC14.ai[0] = 1f; nPC14.ai[1] = num1784 * 2f; nPC14.velocity = value61 / num1784; if (this.whoAmI >= nPC14.whoAmI) { nPC14.position -= nPC14.velocity; } nPC14.netUpdate = true; num1785++; } } if (num1783 == 1) { this.ai[0] = 3f; this.ai[1] = 0f; } else if (num1783 == 2) { this.ai[0] = 2f; this.ai[1] = 0f; } else if (num1783 == 3) { this.ai[0] = 4f; this.ai[1] = 0f; } else if (num1783 == 4) { this.ai[0] = 5f; this.ai[1] = 0f; } if (num1783 == 5) { this.ai[0] = 7f; this.ai[1] = 0f; } if (num1783 == 6) { this.ai[0] = 8f; this.ai[1] = 0f; } this.netUpdate = true; } } else if (this.ai[0] == 1f) { flag169 = true; this.localAI[2] = 10f; if ((float)((int)this.ai[1]) % 2f != 0f && this.ai[1] != 1f) { this.position -= this.velocity; } this.ai[1] -= 1f; if (this.ai[1] <= 0f) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[3] += 1f; this.velocity = Vector2.Zero; this.netUpdate = true; } } else if (this.ai[0] == 2f) { this.localAI[2] = 11f; Vector2 vec8 = Vector2.Normalize(player11.Center - center30); if (vec8.HasNaNs()) { vec8 = new Vector2((float)this.direction, 0f); } if (this.ai[1] >= 4f && flag168 && (int)(this.ai[1] - 4f) % num1767 == 0) { if (Main.netMode != 1) { List<int> list4 = new List<int>(); for (int num1788 = 0; num1788 < 200; num1788++) { if (Main.npc[num1788].active && Main.npc[num1788].type == NPCID.CultistBossClone && Main.npc[num1788].ai[3] == (float)this.whoAmI) { list4.Add(num1788); } } foreach (int current3 in list4) { NPC nPC15 = Main.npc[current3]; Vector2 center32 = nPC15.Center; int num1789 = Math.Sign(player11.Center.X - center32.X); if (num1789 != 0) { nPC15.direction = (nPC15.spriteDirection = num1789); } vec8 = Vector2.Normalize(player11.Center - center32 + player11.velocity * 20f); if (vec8.HasNaNs()) { vec8 = new Vector2((float)this.direction, 0f); } Vector2 vector256 = center32 + new Vector2((float)(this.direction * 30), 12f); for (int num1790 = 0; num1790 < 1; num1790++) { Vector2 spinninpoint = vec8 * (6f + (float)Main.rand.NextDouble() * 4f); spinninpoint = spinninpoint.RotatedByRandom(0.52359879016876221); Projectile.NewProjectile(vector256.X, vector256.Y, spinninpoint.X, spinninpoint.Y, 468, 18, 0f, Main.myPlayer, 0f, 0f); } } } if (Main.netMode != 1) { vec8 = Vector2.Normalize(player11.Center - center30 + player11.velocity * 20f); if (vec8.HasNaNs()) { vec8 = new Vector2((float)this.direction, 0f); } Vector2 vector257 = base.Center + new Vector2((float)(this.direction * 30), 12f); for (int num1791 = 0; num1791 < 1; num1791++) { Vector2 vector258 = vec8 * 4f; Projectile.NewProjectile(vector257.X, vector257.Y, vector258.X, vector258.Y, 464, num1768, 0f, Main.myPlayer, 0f, 1f); } } } this.ai[1] += 1f; if (this.ai[1] >= (float)(4 + num1767)) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[3] += 1f; this.velocity = Vector2.Zero; this.netUpdate = true; } } else if (this.ai[0] == 3f) { this.localAI[2] = 11f; Vector2 vec9 = Vector2.Normalize(player11.Center - center30); if (vec9.HasNaNs()) { vec9 = new Vector2((float)this.direction, 0f); } if (this.ai[1] >= 4f && flag168 && (int)(this.ai[1] - 4f) % num1769 == 0) { int num1792 = (int)(this.ai[1] - 4f) / num1769; if (num1792 == 2) { List<int> list5 = new List<int>(); for (int num1793 = 0; num1793 < 200; num1793++) { if (Main.npc[num1793].active && Main.npc[num1793].type == NPCID.CultistBossClone && Main.npc[num1793].ai[3] == (float)this.whoAmI) { list5.Add(num1793); } } if (Main.netMode != 1) { foreach (int current4 in list5) { NPC nPC16 = Main.npc[current4]; Vector2 center33 = nPC16.Center; int num1794 = Math.Sign(player11.Center.X - center33.X); if (num1794 != 0) { nPC16.direction = (nPC16.spriteDirection = num1794); } vec9 = Vector2.Normalize(player11.Center - center33 + player11.velocity * 20f); if (vec9.HasNaNs()) { vec9 = new Vector2((float)this.direction, 0f); } Vector2 vector259 = center33 + new Vector2((float)(this.direction * 30), 12f); for (int num1795 = 0; num1795 < 1; num1795++) { Vector2 spinninpoint2 = vec9 * (6f + (float)Main.rand.NextDouble() * 4f); spinninpoint2 = spinninpoint2.RotatedByRandom(0.52359879016876221); Projectile.NewProjectile(vector259.X, vector259.Y, spinninpoint2.X, spinninpoint2.Y, 468, 18, 0f, Main.myPlayer, 0f, 0f); } } } } int num1796 = Math.Sign(player11.Center.X - center30.X); if (num1796 != 0) { this.direction = (this.spriteDirection = num1796); } if (Main.netMode != 1) { vec9 = Vector2.Normalize(player11.Center - center30 + player11.velocity * 20f); if (vec9.HasNaNs()) { vec9 = new Vector2((float)this.direction, 0f); } Vector2 vector260 = base.Center + new Vector2((float)(this.direction * 30), 12f); for (int num1797 = 0; num1797 < 1; num1797++) { Vector2 spinninpoint3 = vec9 * (6f + (float)Main.rand.NextDouble() * 4f); spinninpoint3 = spinninpoint3.RotatedByRandom(0.52359879016876221); Projectile.NewProjectile(vector260.X, vector260.Y, spinninpoint3.X, spinninpoint3.Y, 467, num1771, 0f, Main.myPlayer, 0f, 0f); } } } this.ai[1] += 1f; if (this.ai[1] >= (float)(4 + num1769 * num1770)) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[3] += 1f; this.velocity = Vector2.Zero; this.netUpdate = true; } } else if (this.ai[0] == 4f) { if (flag168) { this.localAI[2] = 12f; } else { this.localAI[2] = 11f; } if (this.ai[1] == 20f && flag168 && Main.netMode != 1) { List<int> list6 = new List<int>(); for (int num1798 = 0; num1798 < 200; num1798++) { if (Main.npc[num1798].active && Main.npc[num1798].type == NPCID.CultistBossClone && Main.npc[num1798].ai[3] == (float)this.whoAmI) { list6.Add(num1798); } } foreach (int current5 in list6) { NPC nPC17 = Main.npc[current5]; Vector2 center34 = nPC17.Center; int num1799 = Math.Sign(player11.Center.X - center34.X); if (num1799 != 0) { nPC17.direction = (nPC17.spriteDirection = num1799); } if (Main.netMode != 1) { Vector2 vec10 = Vector2.Normalize(player11.Center - center34 + player11.velocity * 20f); if (vec10.HasNaNs()) { vec10 = new Vector2((float)this.direction, 0f); } Vector2 vector261 = center34 + new Vector2((float)(this.direction * 30), 12f); for (int num1800 = 0; num1800 < 1; num1800++) { Vector2 spinninpoint4 = vec10 * (6f + (float)Main.rand.NextDouble() * 4f); spinninpoint4 = spinninpoint4.RotatedByRandom(0.52359879016876221); Projectile.NewProjectile(vector261.X, vector261.Y, spinninpoint4.X, spinninpoint4.Y, 468, 18, 0f, Main.myPlayer, 0f, 0f); } } } if ((int)(this.ai[1] - 20f) % num1772 == 0) { Projectile.NewProjectile(base.Center.X, base.Center.Y - 100f, 0f, 0f, 465, num1773, 0f, Main.myPlayer, 0f, 0f); } } this.ai[1] += 1f; if (this.ai[1] >= (float)(20 + num1772)) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[3] += 1f; this.velocity = Vector2.Zero; this.netUpdate = true; } } else if (this.ai[0] == 5f) { this.localAI[2] = 10f; Vector2 vec11 = Vector2.Normalize(player11.Center - center30); if (vec11.HasNaNs()) { vec11 = new Vector2((float)this.direction, 0f); } if (this.ai[1] >= 0f && this.ai[1] < 30f) { flag169 = true; flag170 = true; float num1801 = (this.ai[1] - 0f) / 30f; this.alpha = (int)(num1801 * 255f); } else if (this.ai[1] >= 30f && this.ai[1] < 90f) { if (this.ai[1] == 30f && Main.netMode != 1 && flag168) { this.localAI[1] += 1f; Vector2 spinningpoint10 = new Vector2(180f, 0f); List<int> list7 = new List<int>(); for (int num1802 = 0; num1802 < 200; num1802++) { if (Main.npc[num1802].active && Main.npc[num1802].type == NPCID.CultistBossClone && Main.npc[num1802].ai[3] == (float)this.whoAmI) { list7.Add(num1802); } } int num1803 = 6 - list7.Count; if (num1803 > 2) { num1803 = 2; } int num1804 = list7.Count + num1803 + 1; float[] array8 = new float[num1804]; for (int num1805 = 0; num1805 < array8.Length; num1805++) { array8[num1805] = Vector2.Distance(base.Center + spinningpoint10.RotatedBy((double)((float)num1805 * 6.28318548f / (float)num1804 - 1.57079637f), default(Vector2)), player11.Center); } int num1806 = 0; for (int num1807 = 1; num1807 < array8.Length; num1807++) { if (array8[num1806] > array8[num1807]) { num1806 = num1807; } } if (num1806 < num1804 / 2) { num1806 += num1804 / 2; } else { num1806 -= num1804 / 2; } int num1808 = num1803; for (int num1809 = 0; num1809 < array8.Length; num1809++) { if (num1806 != num1809) { Vector2 center35 = base.Center + spinningpoint10.RotatedBy((double)((float)num1809 * 6.28318548f / (float)num1804 - 1.57079637f), default(Vector2)); if (num1808-- > 0) { int num1810 = NPC.NewNPC((int)center35.X, (int)center35.Y + this.height / 2, 440, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num1810].ai[3] = (float)this.whoAmI; Main.npc[num1810].netUpdate = true; Main.npc[num1810].localAI[1] = this.localAI[1]; } else { int num1811 = list7[-num1808 - 1]; Main.npc[num1811].Center = center35; NetMessage.SendData((int)PacketTypes.NpcUpdate, -1, -1, "", num1811, 0f, 0f, 0f, 0, 0, 0); } } } this.ai[2] = (float)Projectile.NewProjectile(base.Center.X, base.Center.Y, 0f, 0f, 490, 0, 0f, Main.myPlayer, 0f, (float)this.whoAmI); base.Center += spinningpoint10.RotatedBy((double)((float)num1806 * 6.28318548f / (float)num1804 - 1.57079637f), default(Vector2)); this.netUpdate = true; list7.Clear(); } flag169 = true; flag170 = true; this.alpha = 255; if (flag168) { Vector2 value62 = Main.projectile[(int)this.ai[2]].Center; value62 -= base.Center; if (value62 == Vector2.Zero) { value62 = -Vector2.UnitY; } value62.Normalize(); if (Math.Abs(value62.Y) < 0.77f) { this.localAI[2] = 11f; } else if (value62.Y < 0f) { this.localAI[2] = 12f; } else { this.localAI[2] = 10f; } int num1812 = Math.Sign(value62.X); if (num1812 != 0) { this.direction = (this.spriteDirection = num1812); } } else { Vector2 value63 = Main.projectile[(int)Main.npc[(int)this.ai[3]].ai[2]].Center; value63 -= base.Center; if (value63 == Vector2.Zero) { value63 = -Vector2.UnitY; } value63.Normalize(); if (Math.Abs(value63.Y) < 0.77f) { this.localAI[2] = 11f; } else if (value63.Y < 0f) { this.localAI[2] = 12f; } else { this.localAI[2] = 10f; } int num1813 = Math.Sign(value63.X); if (num1813 != 0) { this.direction = (this.spriteDirection = num1813); } } } else if (this.ai[1] >= 90f && this.ai[1] < 120f) { flag169 = true; flag170 = true; float num1814 = (this.ai[1] - 90f) / 30f; this.alpha = 255 - (int)(num1814 * 255f); } else if (this.ai[1] >= 120f && this.ai[1] < 420f) { flag170 = true; this.alpha = 0; if (flag168) { Vector2 value64 = Main.projectile[(int)this.ai[2]].Center; value64 -= base.Center; if (value64 == Vector2.Zero) { value64 = -Vector2.UnitY; } value64.Normalize(); if (Math.Abs(value64.Y) < 0.77f) { this.localAI[2] = 11f; } else if (value64.Y < 0f) { this.localAI[2] = 12f; } else { this.localAI[2] = 10f; } int num1815 = Math.Sign(value64.X); if (num1815 != 0) { this.direction = (this.spriteDirection = num1815); } } else { Vector2 value65 = Main.projectile[(int)Main.npc[(int)this.ai[3]].ai[2]].Center; value65 -= base.Center; if (value65 == Vector2.Zero) { value65 = -Vector2.UnitY; } value65.Normalize(); if (Math.Abs(value65.Y) < 0.77f) { this.localAI[2] = 11f; } else if (value65.Y < 0f) { this.localAI[2] = 12f; } else { this.localAI[2] = 10f; } int num1816 = Math.Sign(value65.X); if (num1816 != 0) { this.direction = (this.spriteDirection = num1816); } } } this.ai[1] += 1f; if (this.ai[1] >= 420f) { flag170 = true; this.ai[0] = 0f; this.ai[1] = 0f; this.ai[3] += 1f; this.velocity = Vector2.Zero; this.netUpdate = true; } } else if (this.ai[0] == 6f) { this.localAI[2] = 13f; this.ai[1] += 1f; if (this.ai[1] >= 120f) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[3] += 1f; this.velocity = Vector2.Zero; this.netUpdate = true; } } else if (this.ai[0] == 7f) { this.localAI[2] = 11f; Vector2 vec12 = Vector2.Normalize(player11.Center - center30); if (vec12.HasNaNs()) { vec12 = new Vector2((float)this.direction, 0f); } if (this.ai[1] >= 4f && flag168 && (int)(this.ai[1] - 4f) % num1774 == 0) { int num1817 = (int)(this.ai[1] - 4f) / num1774; if (num1817 == 2) { List<int> list8 = new List<int>(); for (int num1818 = 0; num1818 < 200; num1818++) { if (Main.npc[num1818].active && Main.npc[num1818].type == NPCID.CultistBossClone && Main.npc[num1818].ai[3] == (float)this.whoAmI) { list8.Add(num1818); } } foreach (int current6 in list8) { NPC nPC18 = Main.npc[current6]; Vector2 center36 = nPC18.Center; int num1819 = Math.Sign(player11.Center.X - center36.X); if (num1819 != 0) { nPC18.direction = (nPC18.spriteDirection = num1819); } if (Main.netMode != 1) { vec12 = Vector2.Normalize(player11.Center - center36 + player11.velocity * 20f); if (vec12.HasNaNs()) { vec12 = new Vector2((float)this.direction, 0f); } Vector2 vector262 = center36 + new Vector2((float)(this.direction * 30), 12f); int num1820 = 0; while ((float)num1820 < 5f) { Vector2 spinninpoint5 = vec12 * (6f + (float)Main.rand.NextDouble() * 4f); spinninpoint5 = spinninpoint5.RotatedByRandom(1.2566370964050293); Projectile.NewProjectile(vector262.X, vector262.Y, spinninpoint5.X, spinninpoint5.Y, 468, 18, 0f, Main.myPlayer, 0f, 0f); num1820++; } } } } int num1821 = Math.Sign(player11.Center.X - center30.X); if (num1821 != 0) { this.direction = (this.spriteDirection = num1821); } if (Main.netMode != 1) { vec12 = Vector2.Normalize(player11.Center - center30 + player11.velocity * 20f); if (vec12.HasNaNs()) { vec12 = new Vector2((float)this.direction, 0f); } Vector2 vector263 = base.Center + new Vector2((float)(this.direction * 30), 12f); float scaleFactor24 = 8f; float num1822 = 0.251327425f; int num1823 = 0; while ((float)num1823 < 5f) { Vector2 vector264 = vec12 * scaleFactor24; vector264 = vector264.RotatedBy((double)(num1822 * (float)num1823 - (1.2566371f - num1822) / 2f), default(Vector2)); float ai4 = (Main.rand.NextFloat() - 0.5f) * 0.3f * 6.28318548f / 60f; int num1824 = NPC.NewNPC((int)vector263.X, (int)vector263.Y + 7, 522, 0, 0f, ai4, vector264.X, vector264.Y, 255); Main.npc[num1824].velocity = vector264; num1823++; } } } this.ai[1] += 1f; if (this.ai[1] >= (float)(4 + num1774 * num1775)) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[3] += 1f; this.velocity = Vector2.Zero; this.netUpdate = true; } } else if (this.ai[0] == 8f) { this.localAI[2] = 13f; if (this.ai[1] >= 4f && flag168 && (int)(this.ai[1] - 4f) % num1776 == 0) { List<int> list9 = new List<int>(); for (int num1825 = 0; num1825 < 200; num1825++) { if (Main.npc[num1825].active && Main.npc[num1825].type == NPCID.CultistBossClone && Main.npc[num1825].ai[3] == (float)this.whoAmI) { list9.Add(num1825); } } int num1826 = list9.Count + 1; if (num1826 > 3) { num1826 = 3; } int num1827 = Math.Sign(player11.Center.X - center30.X); if (num1827 != 0) { this.direction = (this.spriteDirection = num1827); } if (Main.netMode != 1) { for (int num1828 = 0; num1828 < num1826; num1828++) { Point point11 = base.Center.ToTileCoordinates(); Point point12 = Main.player[this.target].Center.ToTileCoordinates(); Vector2 vector265 = Main.player[this.target].Center - base.Center; int num1829 = 20; int num1830 = 3; int num1831 = 7; int num1832 = 2; int num1833 = 0; bool flag173 = false; if (vector265.Length() > 2000f) { flag173 = true; } while (!flag173 && num1833 < 100) { num1833++; int num1834 = Main.rand.Next(point12.X - num1829, point12.X + num1829 + 1); int num1835 = Main.rand.Next(point12.Y - num1829, point12.Y + num1829 + 1); if ((num1835 < point12.Y - num1831 || num1835 > point12.Y + num1831 || num1834 < point12.X - num1831 || num1834 > point12.X + num1831) && (num1835 < point11.Y - num1830 || num1835 > point11.Y + num1830 || num1834 < point11.X - num1830 || num1834 > point11.X + num1830) && !Main.tile[num1834, num1835].nactive()) { bool flag174 = true; if (flag174 && Collision.SolidTiles(num1834 - num1832, num1834 + num1832, num1835 - num1832, num1835 + num1832)) { flag174 = false; } if (flag174) { NPC.NewNPC(num1834 * 16 + 8, num1835 * 16 + 8, 523, 0, (float)this.whoAmI, 0f, 0f, 0f, 255); break; } } } } } } this.ai[1] += 1f; if (this.ai[1] >= (float)(4 + num1776 * num1777)) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[3] += 1f; this.velocity = Vector2.Zero; this.netUpdate = true; } } if (!flag168) { this.ai[3] = num1781; } this.dontTakeDamage = flag169; this.chaseable = !flag170; return; } if (this.aiStyle == 85) { this.noTileCollide = false; if (this.ai[0] == 0f) { this.TargetClosest(true); if (Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[0] = 1f; } else { Vector2 value66 = Main.player[this.target].Center - base.Center; value66.Y -= (float)(Main.player[this.target].height / 4); float num1836 = value66.Length(); if (num1836 > 800f) { this.ai[0] = 2f; } else { Vector2 center37 = base.Center; center37.X = Main.player[this.target].Center.X; Vector2 vector266 = center37 - base.Center; if (vector266.Length() > 8f && Collision.CanHit(base.Center, 1, 1, center37, 1, 1)) { this.ai[0] = 3f; this.ai[1] = center37.X; this.ai[2] = center37.Y; Vector2 center38 = base.Center; center38.Y = Main.player[this.target].Center.Y; if (vector266.Length() > 8f && Collision.CanHit(base.Center, 1, 1, center38, 1, 1) && Collision.CanHit(center38, 1, 1, Main.player[this.target].position, 1, 1)) { this.ai[0] = 3f; this.ai[1] = center38.X; this.ai[2] = center38.Y; } } else { center37 = base.Center; center37.Y = Main.player[this.target].Center.Y; if ((center37 - base.Center).Length() > 8f && Collision.CanHit(base.Center, 1, 1, center37, 1, 1)) { this.ai[0] = 3f; this.ai[1] = center37.X; this.ai[2] = center37.Y; } } if (this.ai[0] == 0f) { this.localAI[0] = 0f; value66.Normalize(); value66 *= 0.5f; this.velocity += value66; this.ai[0] = 4f; this.ai[1] = 0f; } } } } else if (this.ai[0] == 1f) { this.rotation += (float)this.direction * 0.3f; Vector2 value67 = Main.player[this.target].Center - base.Center; if (this.type == NPCID.NebulaHeadcrab) { value67 = Main.player[this.target].Top - base.Center; } float num1837 = value67.Length(); float num1838 = 5.5f; num1838 += num1837 / 100f; int num1839 = 50; value67.Normalize(); value67 *= num1838; this.velocity = (this.velocity * (float)(num1839 - 1) + value67) / (float)num1839; if (!Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[0] = 0f; this.ai[1] = 0f; } if (this.type == NPCID.NebulaHeadcrab && num1837 < 40f && Main.player[this.target].active && !Main.player[this.target].dead) { bool flag175 = true; for (int num1840 = 0; num1840 < 200; num1840++) { NPC nPC19 = Main.npc[num1840]; if (nPC19.active && nPC19.type == this.type && nPC19.ai[0] == 5f && nPC19.target == this.target) { flag175 = false; break; } } if (flag175) { base.Center = Main.player[this.target].Top; this.velocity = Vector2.Zero; this.ai[0] = 5f; this.ai[1] = 0f; this.netUpdate = true; } } } else if (this.ai[0] == 2f) { this.rotation = this.velocity.X * 0.1f; this.noTileCollide = true; Vector2 value68 = Main.player[this.target].Center - base.Center; float num1841 = value68.Length(); float scaleFactor25 = 3f; int num1842 = 3; value68.Normalize(); value68 *= scaleFactor25; this.velocity = (this.velocity * (float)(num1842 - 1) + value68) / (float)num1842; if (num1841 < 600f && !Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[0] = 0f; } } else if (this.ai[0] == 3f) { this.rotation = this.velocity.X * 0.1f; Vector2 value69 = new Vector2(this.ai[1], this.ai[2]); Vector2 value70 = value69 - base.Center; float num1843 = value70.Length(); float num1844 = 2f; float num1845 = 3f; value70.Normalize(); value70 *= num1844; this.velocity = (this.velocity * (num1845 - 1f) + value70) / num1845; if (this.collideX || this.collideY) { this.ai[0] = 4f; this.ai[1] = 0f; } if (num1843 < num1844 || num1843 > 800f || Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[0] = 0f; } } else if (this.ai[0] == 4f) { this.rotation = this.velocity.X * 0.1f; if (this.collideX) { this.velocity.X = this.velocity.X * -0.8f; } if (this.collideY) { this.velocity.Y = this.velocity.Y * -0.8f; } Vector2 value71; if (this.velocity.X == 0f && this.velocity.Y == 0f) { value71 = Main.player[this.target].Center - base.Center; value71.Y -= (float)(Main.player[this.target].height / 4); value71.Normalize(); this.velocity = value71 * 0.1f; } float scaleFactor26 = 2f; float num1846 = 20f; value71 = this.velocity; value71.Normalize(); value71 *= scaleFactor26; this.velocity = (this.velocity * (num1846 - 1f) + value71) / num1846; this.ai[1] += 1f; if (this.ai[1] > 180f) { this.ai[0] = 0f; this.ai[1] = 0f; } if (Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[0] = 0f; } this.localAI[0] += 1f; if (this.localAI[0] >= 5f && !Collision.SolidCollision(this.position - new Vector2(10f, 10f), this.width + 20, this.height + 20)) { this.localAI[0] = 0f; Vector2 center39 = base.Center; center39.X = Main.player[this.target].Center.X; if (Collision.CanHit(base.Center, 1, 1, center39, 1, 1) && Collision.CanHit(base.Center, 1, 1, center39, 1, 1) && Collision.CanHit(Main.player[this.target].Center, 1, 1, center39, 1, 1)) { this.ai[0] = 3f; this.ai[1] = center39.X; this.ai[2] = center39.Y; } else { center39 = base.Center; center39.Y = Main.player[this.target].Center.Y; if (Collision.CanHit(base.Center, 1, 1, center39, 1, 1) && Collision.CanHit(Main.player[this.target].Center, 1, 1, center39, 1, 1)) { this.ai[0] = 3f; this.ai[1] = center39.X; this.ai[2] = center39.Y; } } } } else if (this.ai[0] == 5f) { Player player12 = Main.player[this.target]; if (!player12.active || player12.dead) { this.ai[0] = 0f; this.ai[1] = 0f; this.netUpdate = true; } else { base.Center = ((player12.gravDir == 1f) ? player12.Top : player12.Bottom) + new Vector2((float)(player12.direction * 4), 0f); this.gfxOffY = player12.gfxOffY; this.velocity = Vector2.Zero; player12.AddBuff(BuffID.Obstructed, 59, true); } } if (this.type == NPCID.StardustCellBig) { this.rotation = 0f; for (int num1847 = 0; num1847 < 200; num1847++) { if (num1847 != this.whoAmI && Main.npc[num1847].active && Main.npc[num1847].type == this.type && Math.Abs(this.position.X - Main.npc[num1847].position.X) + Math.Abs(this.position.Y - Main.npc[num1847].position.Y) < (float)this.width) { if (this.position.X < Main.npc[num1847].position.X) { this.velocity.X = this.velocity.X - 0.05f; } else { this.velocity.X = this.velocity.X + 0.05f; } if (this.position.Y < Main.npc[num1847].position.Y) { this.velocity.Y = this.velocity.Y - 0.05f; } else { this.velocity.Y = this.velocity.Y + 0.05f; } } } return; } if (this.type == NPCID.NebulaHeadcrab) { this.hide = (this.ai[0] == 5f); this.rotation = this.velocity.X * 0.1f; for (int num1848 = 0; num1848 < 200; num1848++) { if (num1848 != this.whoAmI && Main.npc[num1848].active && Main.npc[num1848].type == this.type && Math.Abs(this.position.X - Main.npc[num1848].position.X) + Math.Abs(this.position.Y - Main.npc[num1848].position.Y) < (float)this.width) { if (this.position.X < Main.npc[num1848].position.X) { this.velocity.X = this.velocity.X - 0.05f; } else { this.velocity.X = this.velocity.X + 0.05f; } if (this.position.Y < Main.npc[num1848].position.Y) { this.velocity.Y = this.velocity.Y - 0.05f; } else { this.velocity.Y = this.velocity.Y + 0.05f; } } } return; } } else if (this.aiStyle == 86) { if (this.alpha > 0) { this.alpha -= 30; if (this.alpha < 0) { this.alpha = 0; } } this.noGravity = true; this.noTileCollide = true; this.knockBackResist = 0f; for (int num1849 = 0; num1849 < 200; num1849++) { if (num1849 != this.whoAmI && Main.npc[num1849].active && Main.npc[num1849].type == this.type) { Vector2 value72 = Main.npc[num1849].Center - base.Center; if (value72.Length() < 50f) { value72.Normalize(); if (value72.X == 0f && value72.Y == 0f) { if (num1849 > this.whoAmI) { value72.X = 1f; } else { value72.X = -1f; } } value72 *= 0.4f; this.velocity -= value72; Main.npc[num1849].velocity += value72; } } } if (this.type == NPCID.ShadowFlameApparition) { float num1850 = 120f; if (this.localAI[0] < num1850) { if (this.localAI[0] == 0f) { this.TargetClosest(true); if (this.direction > 0) { this.velocity.X = this.velocity.X + 2f; } else { this.velocity.X = this.velocity.X - 2f; } } this.localAI[0] += 1f; } } if (this.type == NPCID.AncientCultistSquidhead) { float num1857 = 120f; if (this.localAI[0] < num1857) { if (this.localAI[0] == 0f) { this.TargetClosest(true); if (this.direction > 0) { this.velocity.X = this.velocity.X + 2f; } else { this.velocity.X = this.velocity.X - 2f; } } this.localAI[0] += 1f; } } if (this.ai[0] == 0f) { this.TargetClosest(true); this.ai[0] = 1f; this.ai[1] = (float)this.direction; } else if (this.ai[0] == 1f) { this.TargetClosest(true); float num1861 = 0.3f; float num1862 = 7f; float num1863 = 4f; float num1864 = 660f; float num1865 = 4f; if (this.type == NPCID.AncientCultistSquidhead) { num1861 = 0.7f; num1862 = 14f; num1864 = 500f; num1863 = 6f; num1865 = 3f; } this.velocity.X = this.velocity.X + this.ai[1] * num1861; if (this.velocity.X > num1862) { this.velocity.X = num1862; } if (this.velocity.X < -num1862) { this.velocity.X = -num1862; } float num1866 = Main.player[this.target].Center.Y - base.Center.Y; if (Math.Abs(num1866) > num1863) { num1865 = 15f; } if (num1866 > num1863) { num1866 = num1863; } else if (num1866 < -num1863) { num1866 = -num1863; } this.velocity.Y = (this.velocity.Y * (num1865 - 1f) + num1866) / num1865; if ((this.ai[1] > 0f && Main.player[this.target].Center.X - base.Center.X < -num1864) || (this.ai[1] < 0f && Main.player[this.target].Center.X - base.Center.X > num1864)) { this.ai[0] = 2f; this.ai[1] = 0f; if (base.Center.Y + 20f > Main.player[this.target].Center.Y) { this.ai[1] = -1f; } else { this.ai[1] = 1f; } } } else if (this.ai[0] == 2f) { float num1867 = 0.4f; float scaleFactor27 = 0.95f; float num1868 = 5f; if (this.type == NPCID.AncientCultistSquidhead) { num1867 = 0.3f; num1868 = 7f; scaleFactor27 = 0.9f; } this.velocity.Y = this.velocity.Y + this.ai[1] * num1867; if (this.velocity.Length() > num1868) { this.velocity *= scaleFactor27; } if (this.velocity.X > -1f && this.velocity.X < 1f) { this.TargetClosest(true); this.ai[0] = 3f; this.ai[1] = (float)this.direction; } } else if (this.ai[0] == 3f) { float num1869 = 0.4f; float num1870 = 0.2f; float num1871 = 5f; float scaleFactor28 = 0.95f; if (this.type == NPCID.AncientCultistSquidhead) { num1869 = 0.6f; num1870 = 0.3f; num1871 = 7f; scaleFactor28 = 0.9f; } this.velocity.X = this.velocity.X + this.ai[1] * num1869; if (base.Center.Y > Main.player[this.target].Center.Y) { this.velocity.Y = this.velocity.Y - num1870; } else { this.velocity.Y = this.velocity.Y + num1870; } if (this.velocity.Length() > num1871) { this.velocity *= scaleFactor28; } if (this.velocity.Y > -1f && this.velocity.Y < 1f) { this.TargetClosest(true); this.ai[0] = 0f; this.ai[1] = (float)this.direction; } } if (this.type == NPCID.AncientCultistSquidhead) { return; } } else if (this.aiStyle == 87) { this.knockBackResist = 0.2f * Main.knockBackMultiplier; this.dontTakeDamage = false; this.noTileCollide = false; this.noGravity = false; this.reflectingProjectiles = false; if (this.ai[0] != 7f && Main.player[this.target].dead) { this.TargetClosest(true); if (Main.player[this.target].dead) { this.ai[0] = 7f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; } } if (this.ai[0] == 0f) { this.TargetClosest(true); Vector2 vector268 = Main.player[this.target].Center - base.Center; if (this.velocity.X != 0f || this.velocity.Y > 100f || this.justHit || vector268.Length() < 80f) { this.ai[0] = 1f; this.ai[1] = 0f; return; } } else if (this.ai[0] == 1f) { this.ai[1] += 1f; if (this.ai[1] > 36f) { this.ai[0] = 2f; this.ai[1] = 0f; return; } } else if (this.ai[0] == 2f) { if ((Main.player[this.target].Center - base.Center).Length() > 600f) { this.ai[0] = 5f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; } if (this.velocity.Y == 0f) { this.TargetClosest(true); this.velocity.X = this.velocity.X * 0.85f; this.ai[1] += 1f; float num1875 = 15f + 30f * ((float)this.life / (float)this.lifeMax); float num1876 = 3f + 4f * (1f - (float)this.life / (float)this.lifeMax); float num1877 = 4f; if (!Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { num1877 += 2f; } if (this.ai[1] > num1875) { this.ai[3] += 1f; if (this.ai[3] >= 3f) { this.ai[3] = 0f; num1877 *= 2f; num1876 /= 2f; } this.ai[1] = 0f; this.velocity.Y = this.velocity.Y - num1877; this.velocity.X = num1876 * (float)this.direction; } } else { this.knockBackResist = 0f; this.velocity.X = this.velocity.X * 0.99f; if (this.direction < 0 && this.velocity.X > -1f) { this.velocity.X = -1f; } if (this.direction > 0 && this.velocity.X < 1f) { this.velocity.X = 1f; } } this.ai[2] += 1f; if ((double)this.ai[2] > 210.0 && this.velocity.Y == 0f && Main.netMode != 1) { int num1878 = Main.rand.Next(3); if (num1878 == 0) { this.ai[0] = 3f; } else if (num1878 == 1) { this.ai[0] = 4f; this.noTileCollide = true; this.velocity.Y = -8f; } else if (num1878 == 2) { this.ai[0] = 6f; } else { this.ai[0] = 2f; } this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; return; } } else if (this.ai[0] == 3f) { this.velocity.X = this.velocity.X * 0.85f; this.dontTakeDamage = true; this.ai[1] += 1f; if (this.ai[1] >= 180f) { this.ai[0] = 2f; this.ai[1] = 0f; } if (Main.expertMode) { this.ReflectProjectiles(base.Hitbox); this.reflectingProjectiles = true; return; } } else if (this.ai[0] == 4f) { this.noTileCollide = true; this.noGravity = true; this.knockBackResist = 0f; if (this.velocity.X < 0f) { this.direction = -1; } else { this.direction = 1; } this.spriteDirection = this.direction; this.TargetClosest(true); Vector2 center40 = Main.player[this.target].Center; center40.Y -= 350f; Vector2 vector269 = center40 - base.Center; if (this.ai[2] == 1f) { this.ai[1] += 1f; vector269 = Main.player[this.target].Center - base.Center; vector269.Normalize(); vector269 *= 8f; this.velocity = (this.velocity * 4f + vector269) / 5f; if (this.ai[1] > 6f) { this.ai[1] = 0f; this.ai[0] = 4.1f; this.ai[2] = 0f; this.velocity = vector269; return; } } else { if (Math.Abs(base.Center.X - Main.player[this.target].Center.X) < 40f && base.Center.Y < Main.player[this.target].Center.Y - 300f) { this.ai[1] = 0f; this.ai[2] = 1f; return; } vector269.Normalize(); vector269 *= 12f; this.velocity = (this.velocity * 5f + vector269) / 6f; return; } } else if (this.ai[0] == 4.1f) { this.knockBackResist = 0f; if (this.ai[2] == 0f && Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1) && !Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[2] = 1f; } if (this.position.Y + (float)this.height >= Main.player[this.target].position.Y || this.velocity.Y <= 0f) { this.ai[1] += 1f; if (this.ai[1] > 10f) { this.ai[0] = 2f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; if (Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[0] = 5f; } } } else if (this.ai[2] == 0f) { this.noTileCollide = true; this.noGravity = true; this.knockBackResist = 0f; } this.velocity.Y = this.velocity.Y + 0.2f; if (this.velocity.Y > 16f) { this.velocity.Y = 16f; return; } } else { if (this.ai[0] == 5f) { if (this.velocity.X > 0f) { this.direction = 1; } else { this.direction = -1; } this.spriteDirection = this.direction; this.noTileCollide = true; this.noGravity = true; this.knockBackResist = 0f; Vector2 value74 = Main.player[this.target].Center - base.Center; value74.Y -= 4f; if (value74.Length() < 200f && !Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[0] = 2f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; } if (value74.Length() > 10f) { value74.Normalize(); value74 *= 10f; } this.velocity = (this.velocity * 4f + value74) / 5f; return; } if (this.ai[0] == 6f) { this.knockBackResist = 0f; if (this.velocity.Y == 0f) { this.TargetClosest(true); this.velocity.X = this.velocity.X * 0.8f; this.ai[1] += 1f; if (this.ai[1] > 5f) { this.ai[1] = 0f; this.velocity.Y = this.velocity.Y - 4f; if (Main.player[this.target].position.Y + (float)Main.player[this.target].height < base.Center.Y) { this.velocity.Y = this.velocity.Y - 1.25f; } if (Main.player[this.target].position.Y + (float)Main.player[this.target].height < base.Center.Y - 40f) { this.velocity.Y = this.velocity.Y - 1.5f; } if (Main.player[this.target].position.Y + (float)Main.player[this.target].height < base.Center.Y - 80f) { this.velocity.Y = this.velocity.Y - 1.75f; } if (Main.player[this.target].position.Y + (float)Main.player[this.target].height < base.Center.Y - 120f) { this.velocity.Y = this.velocity.Y - 2f; } if (Main.player[this.target].position.Y + (float)Main.player[this.target].height < base.Center.Y - 160f) { this.velocity.Y = this.velocity.Y - 2.25f; } if (Main.player[this.target].position.Y + (float)Main.player[this.target].height < base.Center.Y - 200f) { this.velocity.Y = this.velocity.Y - 2.5f; } if (!Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.velocity.Y = this.velocity.Y - 2f; } this.velocity.X = (float)(12 * this.direction); this.ai[2] += 1f; } } else { this.velocity.X = this.velocity.X * 0.98f; if (this.direction < 0 && this.velocity.X > -8f) { this.velocity.X = -8f; } if (this.direction > 0 && this.velocity.X < 8f) { this.velocity.X = 8f; } } if (this.ai[2] >= 3f && this.velocity.Y == 0f) { this.ai[0] = 2f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; return; } } else if (this.ai[0] == 7f) { this.damage = 0; this.life = this.lifeMax; this.defense = 9999; this.noTileCollide = true; this.alpha += 7; if (this.alpha > 255) { this.alpha = 255; } this.velocity.X = this.velocity.X * 0.98f; return; } } } else if (this.aiStyle == 88) { int num1879 = 7; this.noTileCollide = false; this.noGravity = true; this.knockBackResist = 0.2f * Main.expertKnockBack; this.damage = this.defDamage; if (!Main.eclipse) { this.ai[0] = -1f; } else if (this.target < 0 || Main.player[this.target].dead || !Main.player[this.target].active) { this.TargetClosest(true); Vector2 vector270 = Main.player[this.target].Center - base.Center; if (Main.player[this.target].dead || vector270.Length() > 3000f) { this.ai[0] = -1f; } } else { Vector2 vector271 = Main.player[this.target].Center - base.Center; if (this.ai[0] > 1f && vector271.Length() > 1000f) { this.ai[0] = 1f; } } if (this.ai[0] == -1f) { Vector2 value75 = new Vector2(0f, -8f); this.velocity = (this.velocity * 9f + value75) / 10f; this.noTileCollide = true; this.dontTakeDamage = true; return; } if (this.ai[0] == 0f) { this.TargetClosest(true); if (base.Center.X < Main.player[this.target].Center.X - 2f) { this.direction = 1; } if (base.Center.X > Main.player[this.target].Center.X + 2f) { this.direction = -1; } this.spriteDirection = this.direction; this.rotation = (this.rotation * 9f + this.velocity.X * 0.1f) / 10f; if (this.collideX) { this.velocity.X = this.velocity.X * (-this.oldVelocity.X * 0.5f); if (this.velocity.X > 4f) { this.velocity.X = 4f; } if (this.velocity.X < -4f) { this.velocity.X = -4f; } } if (this.collideY) { this.velocity.Y = this.velocity.Y * (-this.oldVelocity.Y * 0.5f); if (this.velocity.Y > 4f) { this.velocity.Y = 4f; } if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } } Vector2 value76 = Main.player[this.target].Center - base.Center; value76.Y -= 200f; if (value76.Length() > 800f) { this.ai[0] = 1f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; } else if (value76.Length() > 80f) { float scaleFactor29 = 6f; float num1880 = 30f; value76.Normalize(); value76 *= scaleFactor29; this.velocity = (this.velocity * (num1880 - 1f) + value76) / num1880; } else if (this.velocity.Length() > 2f) { this.velocity *= 0.95f; } else if (this.velocity.Length() < 1f) { this.velocity *= 1.05f; } this.ai[1] += 1f; if (this.justHit) { this.ai[1] += (float)Main.rand.Next(10, 30); } if (this.ai[1] >= 180f && Main.netMode != 1) { this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; this.netUpdate = true; while (this.ai[0] == 0f) { int num1881 = Main.rand.Next(3); if (num1881 == 0 && Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[0] = 2f; } else if (num1881 == 1) { this.ai[0] = 3f; } else if (num1881 == 2 && NPC.CountNPCS(478) + NPC.CountNPCS(479) < num1879) { this.ai[0] = 4f; } } return; } } else { if (this.ai[0] == 1f) { this.collideX = false; this.collideY = false; this.noTileCollide = true; this.knockBackResist = 0f; if (this.target < 0 || !Main.player[this.target].active || Main.player[this.target].dead) { this.TargetClosest(true); } if (this.velocity.X < 0f) { this.direction = -1; } else if (this.velocity.X > 0f) { this.direction = 1; } this.spriteDirection = this.direction; this.rotation = (this.rotation * 9f + this.velocity.X * 0.08f) / 10f; Vector2 value77 = Main.player[this.target].Center - base.Center; if (value77.Length() < 300f && !Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; } float scaleFactor30 = 7f + value77.Length() / 100f; float num1882 = 25f; value77.Normalize(); value77 *= scaleFactor30; this.velocity = (this.velocity * (num1882 - 1f) + value77) / num1882; return; } if (this.ai[0] == 2f) { this.damage = (int)((double)this.defDamage * 0.5); this.knockBackResist = 0f; if (this.target < 0 || !Main.player[this.target].active || Main.player[this.target].dead) { this.TargetClosest(true); this.ai[0] = 0f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; } if (Main.player[this.target].Center.X - 10f < base.Center.X) { this.direction = -1; } else if (Main.player[this.target].Center.X + 10f > base.Center.X) { this.direction = 1; } this.spriteDirection = this.direction; this.rotation = (this.rotation * 4f + this.velocity.X * 0.1f) / 5f; if (this.collideX) { this.velocity.X = this.velocity.X * (-this.oldVelocity.X * 0.5f); if (this.velocity.X > 4f) { this.velocity.X = 4f; } if (this.velocity.X < -4f) { this.velocity.X = -4f; } } if (this.collideY) { this.velocity.Y = this.velocity.Y * (-this.oldVelocity.Y * 0.5f); if (this.velocity.Y > 4f) { this.velocity.Y = 4f; } if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } } Vector2 value78 = Main.player[this.target].Center - base.Center; value78.Y -= 20f; this.ai[2] += 0.0222222228f; if (Main.expertMode) { this.ai[2] += 0.0166666675f; } float scaleFactor31 = 4f + this.ai[2] + value78.Length() / 120f; float num1883 = 20f; value78.Normalize(); value78 *= scaleFactor31; this.velocity = (this.velocity * (num1883 - 1f) + value78) / num1883; this.ai[1] += 1f; if (this.ai[1] > 240f || !Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; return; } } else { if (this.ai[0] == 3f) { this.knockBackResist = 0f; this.noTileCollide = true; if (this.velocity.X < 0f) { this.direction = -1; } else { this.direction = 1; } this.spriteDirection = this.direction; this.rotation = (this.rotation * 4f + this.velocity.X * 0.07f) / 5f; Vector2 value79 = Main.player[this.target].Center - base.Center; value79.Y -= 12f; if (base.Center.X > Main.player[this.target].Center.X) { value79.X += 400f; } else { value79.X -= 400f; } if (Math.Abs(base.Center.X - Main.player[this.target].Center.X) > 350f && Math.Abs(base.Center.Y - Main.player[this.target].Center.Y) < 20f) { this.ai[0] = 3.1f; this.ai[1] = 0f; } this.ai[1] += 0.0333333351f; float scaleFactor32 = 8f + this.ai[1]; float num1884 = 4f; value79.Normalize(); value79 *= scaleFactor32; this.velocity = (this.velocity * (num1884 - 1f) + value79) / num1884; return; } if (this.ai[0] == 3.1f) { this.knockBackResist = 0f; this.noTileCollide = true; this.rotation = (this.rotation * 4f + this.velocity.X * 0.07f) / 5f; Vector2 vector272 = Main.player[this.target].Center - base.Center; vector272.Y -= 12f; float scaleFactor33 = 16f; float num1885 = 8f; vector272.Normalize(); vector272 *= scaleFactor33; this.velocity = (this.velocity * (num1885 - 1f) + vector272) / num1885; if (this.velocity.X < 0f) { this.direction = -1; } else { this.direction = 1; } this.spriteDirection = this.direction; this.ai[1] += 1f; if (this.ai[1] > 10f) { this.velocity = vector272; if (this.velocity.X < 0f) { this.direction = -1; } else { this.direction = 1; } this.ai[0] = 3.2f; this.ai[1] = 0f; this.ai[1] = (float)this.direction; return; } } else { if (this.ai[0] == 3.2f) { this.damage = (int)((double)this.defDamage * 1.3); this.collideX = false; this.collideY = false; this.knockBackResist = 0f; this.noTileCollide = true; this.ai[2] += 0.0333333351f; this.velocity.X = (16f + this.ai[2]) * this.ai[1]; if ((this.ai[1] > 0f && base.Center.X > Main.player[this.target].Center.X + 260f) || (this.ai[1] < 0f && base.Center.X < Main.player[this.target].Center.X - 260f)) { if (!Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; } else if (Math.Abs(base.Center.X - Main.player[this.target].Center.X) > 800f) { this.ai[0] = 1f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; } } this.rotation = (this.rotation * 4f + this.velocity.X * 0.07f) / 5f; return; } if (this.ai[0] == 4f) { this.ai[0] = 0f; this.TargetClosest(true); if (Main.netMode != 1) { this.ai[1] = -1f; this.ai[2] = -1f; for (int num1886 = 0; num1886 < 1000; num1886++) { int num1887 = (int)Main.player[this.target].Center.X / 16; int num1888 = (int)Main.player[this.target].Center.Y / 16; int num1889 = 30 + num1886 / 50; int num1890 = 20 + num1886 / 75; num1887 += Main.rand.Next(-num1889, num1889 + 1); num1888 += Main.rand.Next(-num1890, num1890 + 1); if (!WorldGen.SolidTile(num1887, num1888)) { while (!WorldGen.SolidTile(num1887, num1888) && (double)num1888 < Main.worldSurface) { num1888++; } if ((new Vector2((float)(num1887 * 16 + 8), (float)(num1888 * 16 + 8)) - Main.player[this.target].Center).Length() < 600f) { this.ai[0] = 4.1f; this.ai[1] = (float)num1887; this.ai[2] = (float)num1888; break; } } } } this.netUpdate = true; return; } if (this.ai[0] == 4.1f) { if (this.velocity.X < -2f) { this.direction = -1; } else if (this.velocity.X > 2f) { this.direction = 1; } this.spriteDirection = this.direction; this.rotation = (this.rotation * 9f + this.velocity.X * 0.1f) / 10f; this.noTileCollide = true; int num1891 = (int)this.ai[1]; int num1892 = (int)this.ai[2]; float x2 = (float)(num1891 * 16 + 8); float y2 = (float)(num1892 * 16 - 20); Vector2 vector273 = new Vector2(x2, y2); vector273 -= base.Center; float num1893 = 6f + vector273.Length() / 150f; if (num1893 > 10f) { num1893 = 10f; } float num1894 = 10f; if (vector273.Length() < 10f) { this.ai[0] = 4.2f; } vector273.Normalize(); vector273 *= num1893; this.velocity = (this.velocity * (num1894 - 1f) + vector273) / num1894; return; } if (this.ai[0] == 4.2f) { this.rotation = (this.rotation * 9f + this.velocity.X * 0.1f) / 10f; this.knockBackResist = 0f; this.noTileCollide = true; int num1895 = (int)this.ai[1]; int num1896 = (int)this.ai[2]; float x3 = (float)(num1895 * 16 + 8); float y3 = (float)(num1896 * 16 - 20); Vector2 vector274 = new Vector2(x3, y3); vector274 -= base.Center; float num1897 = 4f; float num1898 = 2f; if (Main.netMode != 1 && vector274.Length() < 4f) { int num1899 = 70; if (Main.expertMode) { num1899 = (int)((double)num1899 * 0.75); } this.ai[3] += 1f; if (this.ai[3] == (float)num1899) { NPC.NewNPC(num1895 * 16 + 8, num1896 * 16, 478, this.whoAmI, 0f, 0f, 0f, 0f, 255); } else if (this.ai[3] == (float)(num1899 * 2)) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; if (NPC.CountNPCS(478) + NPC.CountNPCS(479) < num1879 && Main.rand.Next(3) != 0) { this.ai[0] = 4f; } else if (Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[0] = 1f; } } } if (vector274.Length() > num1897) { vector274.Normalize(); vector274 *= num1897; } this.velocity = (this.velocity * (num1898 - 1f) + vector274) / num1898; return; } } } } } else if (this.aiStyle == 89) { if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.9f; this.rotation += this.velocity.X * 0.02f; } else { this.velocity.X = this.velocity.X * 0.99f; this.rotation += this.velocity.X * 0.04f; } int num1900 = 900; if (Main.expertMode) { num1900 = 600; } if (this.justHit) { this.ai[0] -= (float)Main.rand.Next(10, 21); if (!Main.expertMode) { this.ai[0] -= (float)Main.rand.Next(10, 21); } } this.ai[0] += 1f; if (this.ai[0] >= (float)num1900) { this.Transform(479); } if (Main.netMode != 1 && this.velocity.Y == 0f && (double)Math.Abs(this.velocity.X) < 0.2 && (double)this.ai[0] >= (double)num1900 * 0.75) { float num1901 = this.ai[0] - (float)num1900 * 0.75f; num1901 /= (float)num1900 * 0.25f; if ((float)Main.rand.Next(-10, 120) < num1901 * 100f) { this.velocity.Y = this.velocity.Y - (float)Main.rand.Next(20, 40) * 0.025f; this.velocity.X = this.velocity.X + (float)Main.rand.Next(-20, 20) * 0.025f; this.velocity *= 1f + num1901 * 2f; this.netUpdate = true; return; } } } else if (this.aiStyle == 90) { this.noTileCollide = false; this.knockBackResist = 0.4f * Main.knockBackMultiplier; this.noGravity = true; this.rotation = (this.rotation * 9f + this.velocity.X * 0.1f) / 10f; if (!Main.eclipse) { if (this.timeLeft > 5) { this.timeLeft = 5; } this.velocity.Y = this.velocity.Y - 0.2f; if (this.velocity.Y < -8f) { this.velocity.Y = -8f; } this.noTileCollide = true; return; } if (this.ai[0] == 0f || this.ai[0] == 1f) { for (int num1902 = 0; num1902 < 200; num1902++) { if (num1902 != this.whoAmI && Main.npc[num1902].active && Main.npc[num1902].type == this.type) { Vector2 value80 = Main.npc[num1902].Center - base.Center; if (value80.Length() < (float)(this.width + this.height)) { value80.Normalize(); value80 *= -0.1f; this.velocity += value80; Main.npc[num1902].velocity -= value80; } } } } if (this.target < 0 || Main.player[this.target].dead || !Main.player[this.target].active) { this.TargetClosest(true); Vector2 vector275 = Main.player[this.target].Center - base.Center; if (Main.player[this.target].dead || vector275.Length() > 3000f) { this.ai[0] = -1f; } } else { Vector2 vector276 = Main.player[this.target].Center - base.Center; if (this.ai[0] > 1f && vector276.Length() > 1000f) { this.ai[0] = 1f; } } if (this.ai[0] == -1f) { Vector2 value81 = new Vector2(0f, -8f); this.velocity = (this.velocity * 9f + value81) / 10f; this.noTileCollide = true; this.dontTakeDamage = true; return; } if (this.ai[0] == 0f) { this.TargetClosest(true); this.spriteDirection = this.direction; if (this.collideX) { this.velocity.X = this.velocity.X * (-this.oldVelocity.X * 0.5f); if (this.velocity.X > 4f) { this.velocity.X = 4f; } if (this.velocity.X < -4f) { this.velocity.X = -4f; } } if (this.collideY) { this.velocity.Y = this.velocity.Y * (-this.oldVelocity.Y * 0.5f); if (this.velocity.Y > 4f) { this.velocity.Y = 4f; } if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } } Vector2 value82 = Main.player[this.target].Center - base.Center; if (value82.Length() > 800f) { this.ai[0] = 1f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; } else if (value82.Length() > 200f) { float scaleFactor34 = 5.5f + value82.Length() / 100f + this.ai[1] / 15f; float num1903 = 40f; value82.Normalize(); value82 *= scaleFactor34; this.velocity = (this.velocity * (num1903 - 1f) + value82) / num1903; } else if (this.velocity.Length() > 2f) { this.velocity *= 0.95f; } else if (this.velocity.Length() < 1f) { this.velocity *= 1.05f; } this.ai[1] += 1f; if (this.ai[1] >= 90f) { this.ai[1] = 0f; this.ai[0] = 2f; return; } } else { if (this.ai[0] == 1f) { this.collideX = false; this.collideY = false; this.noTileCollide = true; this.knockBackResist = 0f; if (this.target < 0 || !Main.player[this.target].active || Main.player[this.target].dead) { this.TargetClosest(true); } if (this.velocity.X < 0f) { this.direction = -1; } else if (this.velocity.X > 0f) { this.direction = 1; } this.spriteDirection = this.direction; this.rotation = (this.rotation * 9f + this.velocity.X * 0.08f) / 10f; Vector2 value83 = Main.player[this.target].Center - base.Center; if (value83.Length() < 300f && !Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; } this.ai[2] += 0.0166666675f; float scaleFactor35 = 5.5f + this.ai[2] + value83.Length() / 150f; float num1904 = 35f; value83.Normalize(); value83 *= scaleFactor35; this.velocity = (this.velocity * (num1904 - 1f) + value83) / num1904; return; } if (this.ai[0] == 2f) { if (this.velocity.X < 0f) { this.direction = -1; } else if (this.velocity.X > 0f) { this.direction = 1; } this.spriteDirection = this.direction; this.rotation = (this.rotation * 7f + this.velocity.X * 0.1f) / 8f; this.knockBackResist = 0f; this.noTileCollide = true; Vector2 vector277 = Main.player[this.target].Center - base.Center; vector277.Y -= 8f; float scaleFactor36 = 9f; float num1905 = 8f; vector277.Normalize(); vector277 *= scaleFactor36; this.velocity = (this.velocity * (num1905 - 1f) + vector277) / num1905; if (this.velocity.X < 0f) { this.direction = -1; } else { this.direction = 1; } this.spriteDirection = this.direction; this.ai[1] += 1f; if (this.ai[1] > 10f) { this.velocity = vector277; if (this.velocity.X < 0f) { this.direction = -1; } else { this.direction = 1; } this.ai[0] = 2.1f; this.ai[1] = 0f; return; } } else if (this.ai[0] == 2.1f) { if (this.velocity.X < 0f) { this.direction = -1; } else if (this.velocity.X > 0f) { this.direction = 1; } this.spriteDirection = this.direction; this.velocity *= 1.01f; this.knockBackResist = 0f; this.noTileCollide = true; this.ai[1] += 1f; int num1906 = 45; if (this.ai[1] > (float)num1906) { if (!Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[0] = 0f; this.ai[1] = 0f; this.ai[2] = 0f; return; } if (this.ai[1] > (float)(num1906 * 2)) { this.ai[0] = 1f; this.ai[1] = 0f; this.ai[2] = 0f; return; } } } } } else if (this.aiStyle == 91) { this.noGravity = true; this.noTileCollide = false; this.dontTakeDamage = false; if (this.justHit && Main.netMode != 1 && Main.expertMode && Main.rand.Next(6) == 0) { this.netUpdate = true; this.ai[0] = -1f; this.ai[1] = 0f; } if (this.ai[0] == -1f) { this.dontTakeDamage = true; this.noGravity = false; this.velocity.X = this.velocity.X * 0.98f; this.ai[1] += 1f; if (this.ai[1] >= 120f) { this.ai[0] = (this.ai[1] = (this.ai[2] = (this.ai[3] = 0f))); return; } } else if (this.ai[0] == 0f) { this.TargetClosest(true); if (Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[0] = 1f; return; } Vector2 value84 = Main.player[this.target].Center - base.Center; value84.Y -= (float)(Main.player[this.target].height / 4); float num1907 = value84.Length(); if (num1907 > 800f) { this.ai[0] = 2f; return; } Vector2 center41 = base.Center; center41.X = Main.player[this.target].Center.X; Vector2 vector278 = center41 - base.Center; if (vector278.Length() > 8f && Collision.CanHit(base.Center, 1, 1, center41, 1, 1)) { this.ai[0] = 3f; this.ai[1] = center41.X; this.ai[2] = center41.Y; Vector2 center42 = base.Center; center42.Y = Main.player[this.target].Center.Y; if (vector278.Length() > 8f && Collision.CanHit(base.Center, 1, 1, center42, 1, 1) && Collision.CanHit(center42, 1, 1, Main.player[this.target].position, 1, 1)) { this.ai[0] = 3f; this.ai[1] = center42.X; this.ai[2] = center42.Y; } } else { center41 = base.Center; center41.Y = Main.player[this.target].Center.Y; if ((center41 - base.Center).Length() > 8f && Collision.CanHit(base.Center, 1, 1, center41, 1, 1)) { this.ai[0] = 3f; this.ai[1] = center41.X; this.ai[2] = center41.Y; } } if (this.ai[0] == 0f) { this.localAI[0] = 0f; value84.Normalize(); value84 *= 0.5f; this.velocity += value84; this.ai[0] = 4f; this.ai[1] = 0f; return; } } else if (this.ai[0] == 1f) { Vector2 value85 = Main.player[this.target].Center - base.Center; float num1908 = value85.Length(); float num1909 = 2f; num1909 += num1908 / 200f; int num1910 = 50; value85.Normalize(); value85 *= num1909; this.velocity = (this.velocity * (float)(num1910 - 1) + value85) / (float)num1910; if (!Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[0] = 0f; this.ai[1] = 0f; return; } } else if (this.ai[0] == 2f) { this.noTileCollide = true; Vector2 value86 = Main.player[this.target].Center - base.Center; float num1911 = value86.Length(); float scaleFactor37 = 2f; int num1912 = 4; value86.Normalize(); value86 *= scaleFactor37; this.velocity = (this.velocity * (float)(num1912 - 1) + value86) / (float)num1912; if (num1911 < 600f && !Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[0] = 0f; return; } } else if (this.ai[0] == 3f) { Vector2 value87 = new Vector2(this.ai[1], this.ai[2]); Vector2 value88 = value87 - base.Center; float num1913 = value88.Length(); float num1914 = 1f; float num1915 = 3f; value88.Normalize(); value88 *= num1914; this.velocity = (this.velocity * (num1915 - 1f) + value88) / num1915; if (this.collideX || this.collideY) { this.ai[0] = 4f; this.ai[1] = 0f; } if (num1913 < num1914 || num1913 > 800f || Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[0] = 0f; return; } } else if (this.ai[0] == 4f) { if (this.collideX) { this.velocity.X = this.velocity.X * -0.8f; } if (this.collideY) { this.velocity.Y = this.velocity.Y * -0.8f; } Vector2 value89; if (this.velocity.X == 0f && this.velocity.Y == 0f) { value89 = Main.player[this.target].Center - base.Center; value89.Y -= (float)(Main.player[this.target].height / 4); value89.Normalize(); this.velocity = value89 * 0.1f; } float scaleFactor38 = 1.5f; float num1916 = 20f; value89 = this.velocity; value89.Normalize(); value89 *= scaleFactor38; this.velocity = (this.velocity * (num1916 - 1f) + value89) / num1916; this.ai[1] += 1f; if (this.ai[1] > 180f) { this.ai[0] = 0f; this.ai[1] = 0f; } if (Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1)) { this.ai[0] = 0f; } this.localAI[0] += 1f; if (this.localAI[0] >= 5f && !Collision.SolidCollision(this.position - new Vector2(10f, 10f), this.width + 20, this.height + 20)) { this.localAI[0] = 0f; Vector2 center43 = base.Center; center43.X = Main.player[this.target].Center.X; if (Collision.CanHit(base.Center, 1, 1, center43, 1, 1) && Collision.CanHit(base.Center, 1, 1, center43, 1, 1) && Collision.CanHit(Main.player[this.target].Center, 1, 1, center43, 1, 1)) { this.ai[0] = 3f; this.ai[1] = center43.X; this.ai[2] = center43.Y; return; } center43 = base.Center; center43.Y = Main.player[this.target].Center.Y; if (Collision.CanHit(base.Center, 1, 1, center43, 1, 1) && Collision.CanHit(Main.player[this.target].Center, 1, 1, center43, 1, 1)) { this.ai[0] = 3f; this.ai[1] = center43.X; this.ai[2] = center43.Y; return; } } } } else if (this.aiStyle == 92) { if (Main.rand.Next(20) == 0) { this.soundHit = Main.rand.Next(15, 18); } if (Main.netMode != 1) { bool flag176 = false; int num1917 = (int)this.ai[0]; int num1918 = (int)this.ai[1]; if (!flag176 && (!Main.tile[num1917, num1918].active() || Main.tile[num1917, num1918].type != TileID.TargetDummy)) { flag176 = true; } if (!flag176 && (this.target == 255 || Main.player[this.target].dead || Vector2.Distance(base.Center, Main.player[this.target].Center) > 160000f)) { this.TargetClosest(false); if (this.target == 255 || Main.player[this.target].dead || Vector2.Distance(base.Center, Main.player[this.target].Center) > 160000f) { flag176 = true; } } if (flag176) { this.life = 0; this.HitEffect(0, 10.0); this.active = false; int num1919 = TETrainingDummy.Find((int)this.ai[0], (int)this.ai[1]); if (num1919 != -1) { ((TETrainingDummy)TileEntity.ByID[num1919]).Deactivate(); } return; } } } else if (this.aiStyle == 93) { if (this.localAI[0] == 0f) { this.localAI[0] = 1f; for (int num1920 = 0; num1920 < 4; num1920++) { int num1921 = NPC.NewNPC((int)base.Center.X + num1920 * 40 - 150, (int)base.Center.Y, 492, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num1921].netUpdate = true; Main.npc[num1921].ai[0] = (float)this.whoAmI; Main.npc[num1921].ai[1] = (float)num1920; Main.npc[num1921].ai[3] = (float)(60 * num1920); Main.npc[num1921].TargetClosest(false); Main.npc[num1921].timeLeft = 600; this.ai[num1920] = (float)num1921; } } bool flag177 = true; for (int num1922 = 0; num1922 < 4; num1922++) { if (this.ai[num1922] >= 0f && (!Main.npc[(int)this.ai[num1922]].active || Main.npc[(int)this.ai[num1922]].type != 492)) { this.ai[num1922] = -1f; this.netUpdate = true; } else if (this.ai[num1922] >= 0f) { flag177 = false; } } if (flag177) { this.life = 0; this.HitEffect(9999, 10.0); this.checkDead(); return; } if (Main.netMode != 1 && Main.rand.Next(300) == 0) { Vector2 value90 = new Vector2((Main.rand.NextFloat() - 0.5f) * (float)(this.width - 70), (Main.rand.NextFloat() - 0.5f) * 20f - (float)(this.height / 2) - 20f).RotatedBy((double)this.rotation, default(Vector2)); value90 += base.Center; int num1923 = NPC.NewNPC((int)value90.X, (int)value90.Y, Utils.SelectRandom<int>(Main.rand, new int[] { 213, 215, 214, 212 }), 0, 0f, 0f, 0f, 0f, 255); Main.npc[num1923].velocity = new Vector2((Main.rand.NextFloat() - 0.5f) * 5f, -8.01f) + this.velocity; Main.npc[num1923].netUpdate = true; Main.npc[num1923].timeLeft = 600; } if ((this.localAI[3] += 1f) >= 64f) { this.localAI[3] = 0f; } this.TargetClosest(true); int num1924 = (int)base.Center.X / 16 + Math.Sign(this.velocity.X) * 10; int num1925 = (int)(this.position.Y + (float)this.height) / 16; int num1926 = 0; bool flag178 = Main.tile[num1924, num1925].nactive() && Main.tileSolid[(int)Main.tile[num1924, num1925].type] && !Main.tileSolidTop[(int)Main.tile[num1924, num1925].type]; if (flag178) { num1926 = 1; } else { while (num1926 < 150 && num1925 + num1926 < Main.maxTilesY) { int num1927 = num1925 + num1926; bool flag179 = Main.tile[num1924, num1927].nactive() && Main.tileSolid[(int)Main.tile[num1924, num1927].type] && !Main.tileSolidTop[(int)Main.tile[num1924, num1927].type]; if (flag179) { num1926--; break; } num1926++; } } float num1928 = (float)(num1926 * 16); if (num1928 < 350f) { float num1929 = num1928 - 350f; if (num1929 < -4f) { num1929 = -4f; } this.velocity.Y = MathHelper.Lerp(this.velocity.Y, num1929, 0.05f); } else if (num1928 > 450f) { float num1930 = num1928 - 350f; if (num1930 > 4f) { num1930 = 4f; } this.velocity.Y = MathHelper.Lerp(this.velocity.Y, num1930, 0.05f); } else { this.velocity.Y = this.velocity.Y * 0.95f; } float num1931 = Main.player[this.target].Center.X - base.Center.X; if (Math.Abs(num1931) >= 300f && (Math.Abs(this.velocity.X) < 6f || Math.Sign(this.velocity.X) != this.direction)) { this.velocity.X = this.velocity.X + (float)this.direction * 0.06f; } this.rotation = this.velocity.X * 0.025f; this.spriteDirection = -Math.Sign(this.velocity.X); return; } else if (this.aiStyle == 94) { int num75; if (this.ai[2] == 1f) { this.velocity = Vector2.UnitY * this.velocity.Length(); if (this.velocity.Y < 0.25f) { this.velocity.Y = this.velocity.Y + 0.02f; } if (this.velocity.Y > 0.25f) { this.velocity.Y = this.velocity.Y - 0.02f; } this.dontTakeDamage = true; this.ai[1] += 1f; if (this.ai[1] > 120f) { this.Opacity = 1f - (this.ai[1] - 120f) / 60f; } num75 = this.type; if (this.ai[1] >= 180f) { this.life = 0; this.HitEffect(0, 1337.0); this.checkDead(); } return; } if (this.ai[3] > 0f) { bool flag180 = this.dontTakeDamage; num75 = this.type; if (num75 <= 493) { if (num75 != 422) { if (num75 == 493) { flag180 = (NPC.ShieldStrengthTowerStardust != 0); } } else { flag180 = (NPC.ShieldStrengthTowerVortex != 0); } } else if (num75 != 507) { if (num75 == 517) { flag180 = (NPC.ShieldStrengthTowerSolar != 0); } } else { flag180 = (NPC.ShieldStrengthTowerNebula != 0); } this.ai[3] += 1f; if (this.ai[3] > 120f) { this.ai[3] = 0f; } } num75 = this.type; if (num75 <= 493) { if (num75 != 422) { if (num75 == 493) { this.dontTakeDamage = (NPC.ShieldStrengthTowerStardust != 0); } } else { this.dontTakeDamage = (NPC.ShieldStrengthTowerVortex != 0); } } else if (num75 != 507) { if (num75 == 517) { this.dontTakeDamage = (NPC.ShieldStrengthTowerSolar != 0); } } else { this.dontTakeDamage = (NPC.ShieldStrengthTowerNebula != 0); } this.TargetClosest(false); if (Main.player[this.target].Distance(base.Center) > 2000f) { this.localAI[0] += 1f; } if (this.localAI[0] >= 60f && Main.netMode != 1) { this.localAI[0] = 0f; this.netUpdate = true; this.life = (int)MathHelper.Clamp((float)(this.life + 200), 0f, (float)this.lifeMax); } else { this.localAI[0] = 0f; } this.velocity = new Vector2(0f, (float)Math.Sin((double)(6.28318548f * this.ai[0] / 300f)) * 0.5f); this.ai[0] += 1f; if (this.ai[0] >= 300f) { this.ai[0] = 0f; this.netUpdate = true; } if (this.type == NPCID.LunarTowerStardust) { if (this.ai[1] > 0f) { this.ai[1] -= 1f; } if (Main.netMode != 1 && this.ai[1] <= 0f && Main.player[this.target].active && !Main.player[this.target].dead && base.Distance(Main.player[this.target].Center) < 1080f && Main.player[this.target].position.Y - this.position.Y < 400f) { List<int> list10 = new List<int>(); if (NPC.CountNPCS(405) + NPC.CountNPCS(406) < 2) { list10.Add(405); } if (NPC.CountNPCS(402) < 2) { list10.Add(402); } if (NPC.CountNPCS(407) < 1) { list10.Add(407); } if (list10.Count > 0) { int num1940 = Utils.SelectRandom<int>(Main.rand, list10.ToArray()); this.ai[1] = (float)(30 * Main.rand.Next(5, 16)); int num1941 = Main.rand.Next(3, 6); int num1942 = Main.rand.Next(0, 4); int num1943 = 0; List<Tuple<Vector2, int, int>> list11 = new List<Tuple<Vector2, int, int>>(); List<Vector2> list12 = new List<Vector2>(); list11.Add(Tuple.Create<Vector2, int, int>(base.Top - Vector2.UnitY * 120f, num1941, 0)); int num1944 = 0; int num1945 = list11.Count; while (list11.Count > 0) { Vector2 item = list11[0].Item1; int num1946 = 1; int num1947 = 1; if (num1944 > 0 && num1942 > 0 && (Main.rand.Next(3) != 0 || num1944 == 1)) { num1947 = Main.rand.Next(Math.Max(1, list11[0].Item2)); num1946++; num1942--; } for (int num1948 = 0; num1948 < num1946; num1948++) { int num1949 = list11[0].Item3; if (num1944 == 0) { num1949 = Utils.SelectRandom<int>(Main.rand, new int[] { -1, 1 }); } else if (num1948 == 1) { num1949 *= -1; } float num1950 = ((num1944 % 2 == 0) ? 0f : 3.14159274f) + (0.5f - Main.rand.NextFloat()) * 0.7853982f + (float)num1949 * 0.7853982f * (float)(num1944 % 2 == 0).ToDirectionInt(); float scaleFactor39 = 100f + 50f * Main.rand.NextFloat(); int num1951 = list11[0].Item2; if (num1948 != 0) { num1951 = num1947; } if (num1944 == 0) { num1950 = (0.5f - Main.rand.NextFloat()) * 0.7853982f; scaleFactor39 = 100f + 100f * Main.rand.NextFloat(); } Vector2 value92 = (-Vector2.UnitY).RotatedBy((double)num1950, default(Vector2)) * scaleFactor39; if (num1951 - 1 < 0) { value92 = Vector2.Zero; } num1943 = Projectile.NewProjectile(item.X, item.Y, value92.X, value92.Y, 540, 0, 0f, Main.myPlayer, (float)(-(float)num1944) * 10f, 0.5f + Main.rand.NextFloat() * 0.5f); list12.Add(item + value92); if (num1944 < num1941 && list11[0].Item2 > 0) { list11.Add(Tuple.Create<Vector2, int, int>(item + value92, num1951 - 1, num1949)); } } list11.Remove(list11[0]); if (--num1945 == 0) { num1945 = list11.Count; num1944++; } } Main.projectile[num1943].localAI[0] = (float)num1940; } else { this.ai[1] = 30f; } } } if (this.type == NPCID.LunarTowerVortex) { if (this.ai[1] > 0f) { this.ai[1] -= 1f; } if (Main.netMode != 1 && this.ai[1] <= 0f && Main.player[this.target].active && !Main.player[this.target].dead && base.Distance(Main.player[this.target].Center) < 3240f && !Collision.CanHitLine(base.Center, 0, 0, Main.player[this.target].Center, 0, 0)) { this.ai[1] = (float)(60 + Main.rand.Next(120)); Point point13 = Main.player[this.target].Top.ToTileCoordinates(); bool flag181 = NPC.CountNPCS(427) + NPC.CountNPCS(426) < 14; int num1954 = 0; while (num1954 < 10 && !WorldGen.SolidTile(point13.X, point13.Y) && point13.Y > 10) { point13.Y--; num1954++; } if (flag181) { Projectile.NewProjectile((float)(point13.X * 16 + 8), (float)(point13.Y * 16 + 24), 0f, 0f, 579, 0, 0f, Main.myPlayer, 0f, 0f); } else { Projectile.NewProjectile((float)(point13.X * 16 + 8), (float)(point13.Y * 16 + 17), 0f, 0f, 578, 0, 1f, Main.myPlayer, 0f, 0f); } } if (Main.netMode != 1 && this.ai[1] <= 0f && Main.player[this.target].active && !Main.player[this.target].dead && base.Distance(Main.player[this.target].Center) < 1080f && Main.player[this.target].position.Y - this.position.Y < 400f) { bool flag182 = NPC.CountNPCS(427) + NPC.CountNPCS(426) * 3 + NPC.CountNPCS(428) < 20; if (flag182) { this.ai[1] = (float)(420 + Main.rand.Next(360)); Point point14 = base.Center.ToTileCoordinates(); Point point15 = Main.player[this.target].Center.ToTileCoordinates(); Vector2 vector279 = Main.player[this.target].Center - base.Center; int num1955 = 20; int num1956 = 3; int num1957 = 8; int num1958 = 2; int num1959 = 0; bool flag183 = false; if (vector279.Length() > 2000f) { flag183 = true; } while (!flag183 && num1959 < 100) { num1959++; int num1960 = Main.rand.Next(point15.X - num1955, point15.X + num1955 + 1); int num1961 = Main.rand.Next(point15.Y - num1955, point15.Y + num1955 + 1); if ((num1961 < point15.Y - num1957 || num1961 > point15.Y + num1957 || num1960 < point15.X - num1957 || num1960 > point15.X + num1957) && (num1961 < point14.Y - num1956 || num1961 > point14.Y + num1956 || num1960 < point14.X - num1956 || num1960 > point14.X + num1956) && !Main.tile[num1960, num1961].nactive()) { bool flag184 = true; if (flag184 && Main.tile[num1960, num1961].lava()) { flag184 = false; } if (flag184 && Collision.SolidTiles(num1960 - num1958, num1960 + num1958, num1961 - num1958, num1961 + num1958)) { flag184 = false; } if (flag184 && !Collision.CanHitLine(base.Center, 0, 0, Main.player[this.target].Center, 0, 0)) { flag184 = false; } if (flag184) { Projectile.NewProjectile((float)(num1960 * 16 + 8), (float)(num1961 * 16 + 8), 0f, 0f, 579, 0, 0f, Main.myPlayer, 0f, 0f); break; } } } } } } if (this.type == NPCID.LunarTowerSolar) { if (this.ai[1] > 0f) { this.ai[1] -= 1f; } if (Main.netMode != 1 && this.ai[1] <= 0f && Main.player[this.target].active && !Main.player[this.target].dead && base.Distance(Main.player[this.target].Center) < 1080f && Main.player[this.target].position.Y - this.position.Y < 700f) { Vector2 vector280 = base.Top + new Vector2((float)(-(float)this.width) * 0.33f, -20f) + new Vector2((float)this.width * 0.66f, 20f) * Utils.RandomVector2(Main.rand, 0f, 1f); Vector2 velocity10 = -Vector2.UnitY.RotatedByRandom(0.78539818525314331) * (7f + Main.rand.NextFloat() * 5f); int num1963 = NPC.NewNPC((int)vector280.X, (int)vector280.Y, 519, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num1963].velocity = velocity10; Main.npc[num1963].netUpdate = true; this.ai[1] = 60f; return; } } } else if (this.aiStyle == 95) { float num1964 = 300f; if (this.velocity.Length() > 4f) { this.velocity *= 0.95f; } this.velocity *= 0.99f; this.ai[0] += 1f; this.scale = 1f + 0.3f * (this.ai[0] / num1964); if (this.ai[0] >= num1964) { if (Main.netMode != 1) { this.Transform(405); } return; } this.rotation += this.velocity.X * 0.1f; if (this.ai[0] > 20f) { return; } } else if (this.aiStyle == 96) { float num1970 = 5f; float moveSpeed = 0.15f; this.TargetClosest(true); Vector2 desiredVelocity4 = Main.player[this.target].Center - base.Center + new Vector2(0f, -250f); float num1971 = desiredVelocity4.Length(); if (num1971 < 20f) { desiredVelocity4 = this.velocity; } else if (num1971 < 40f) { desiredVelocity4.Normalize(); desiredVelocity4 *= num1970 * 0.35f; } else if (num1971 < 80f) { desiredVelocity4.Normalize(); desiredVelocity4 *= num1970 * 0.65f; } else { desiredVelocity4.Normalize(); desiredVelocity4 *= num1970; } this.SimpleFlyMovement(desiredVelocity4, moveSpeed); this.rotation = this.velocity.X * 0.1f; if ((this.ai[0] += 1f) >= 70f) { this.ai[0] = 0f; if (Main.netMode != 1) { Vector2 vector282 = Vector2.Zero; while (Math.Abs(vector282.X) < 1.5f) { vector282 = Vector2.UnitY.RotatedByRandom(1.5707963705062866) * new Vector2(5f, 3f); } Projectile.NewProjectile(base.Center.X, base.Center.Y, vector282.X, vector282.Y, 539, 60, 0f, Main.myPlayer, 0f, (float)this.whoAmI); return; } } } else if (this.aiStyle == 97) { float num1972 = 7f; int num1973 = 480; if (this.localAI[2] < 180f) { this.localAI[2] += 1f; if (Main.netMode != 1 && this.localAI[2] % 60f == 0f) { Vector2 vector283 = Vector2.Zero; while (Math.Abs(vector283.X) < 1.5f) { vector283 = Vector2.UnitY.RotatedByRandom(1.5707963705062866) * new Vector2(4f, 2.5f); } Projectile.NewProjectile(base.Center.X, base.Center.Y, vector283.X, vector283.Y, 574, 0, 0f, Main.myPlayer, 0f, (float)this.whoAmI); } } if (this.localAI[1] == 1f) { this.localAI[1] = 0f; if (Main.rand.Next(4) == 0) { this.ai[0] = (float)num1973; } } this.TargetClosest(true); this.rotation = Math.Abs(this.velocity.X) * (float)this.direction * 0.1f; this.spriteDirection = -this.direction; Vector2 value93 = base.Center + new Vector2((float)(this.direction * 20), 6f); Vector2 vector284 = Main.player[this.target].Center - value93; bool flag185 = Collision.CanHit(base.Center, 1, 1, Main.player[this.target].Center, 1, 1); bool flag186 = false; if (vector284.Length() > 400f || !flag185) { Vector2 value94 = vector284; if (value94.Length() > num1972) { value94.Normalize(); value94 *= num1972; } int num1974 = 30; this.velocity = (this.velocity * (float)(num1974 - 1) + value94) / (float)num1974; } else { this.velocity *= 0.98f; flag186 = true; } if (this.ai[2] != 0f && this.ai[3] != 0f) { base.Center = new Vector2(this.ai[2] * 16f, this.ai[3] * 16f); this.velocity = Vector2.Zero; this.ai[2] = 0f; this.ai[3] = 0f; } this.ai[0] += 1f; if (this.ai[0] >= (float)num1973 && Main.netMode != 1) { this.ai[0] = 0f; Point point16 = base.Center.ToTileCoordinates(); Point point17 = Main.player[this.target].Center.ToTileCoordinates(); int num1979 = 20; int num1980 = 3; int num1981 = 10; int num1982 = 1; int num1983 = 0; bool flag187 = false; if (vector284.Length() > 2000f) { flag187 = true; } while (!flag187 && num1983 < 100) { num1983++; int num1984 = Main.rand.Next(point17.X - num1979, point17.X + num1979 + 1); int num1985 = Main.rand.Next(point17.Y - num1979, point17.Y + num1979 + 1); if ((num1985 < point17.Y - num1981 || num1985 > point17.Y + num1981 || num1984 < point17.X - num1981 || num1984 > point17.X + num1981) && (num1985 < point16.Y - num1980 || num1985 > point16.Y + num1980 || num1984 < point16.X - num1980 || num1984 > point16.X + num1980) && !Main.tile[num1984, num1985].nactive()) { bool flag188 = true; if (flag188 && Main.tile[num1984, num1985].lava()) { flag188 = false; } if (flag188 && Collision.SolidTiles(num1984 - num1982, num1984 + num1982, num1985 - num1982, num1985 + num1982)) { flag188 = false; } if (flag188) { this.ai[1] = 20f; this.ai[2] = (float)num1984; this.ai[3] = (float)num1985; break; } } } this.netUpdate = true; } if (flag186 && this.velocity.Length() < 2f && Main.netMode != 1) { this.localAI[0] += 1f; if (this.localAI[0] >= 13f) { return; } } } else if (this.aiStyle == 98) { this.noTileCollide = false; if (this.ai[0] == 0f) { this.TargetClosest(true); this.ai[0] = 1f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; } bool flag189 = Collision.CanHit(base.Center, 1, 1, Main.player[this.target].position, 1, 1); bool flag190 = true; if (!flag189 || Main.player[this.target].dead) { flag190 = false; } else { int num1986 = (int)(Main.player[this.target].Center.X / 16f); int num1987 = (int)(Main.player[this.target].Center.Y / 16f); for (int num1988 = num1986 - 2; num1988 <= num1986 + 2; num1988++) { for (int num1989 = num1987; num1989 <= num1987 + 25; num1989++) { if (WorldGen.SolidTile2(num1988, num1989)) { flag190 = false; } } } } if (this.ai[0] < 0f) { Vector2 vector285 = Main.player[this.target].Center - base.Center; float num1990 = vector285.Length(); if (this.ai[0] == -1f) { vector285.Normalize(); if (vector285.HasNaNs()) { vector285 = new Vector2((float)this.direction, 0f); } float num1991 = 8f + num1990 / 100f; float num1992 = 12f; if (Main.player[this.target].velocity.Length() > num1992) { num1992 = Main.player[this.target].velocity.Length(); } if (num1991 > num1992) { num1991 = num1992; } vector285 *= num1991; float num1993 = 10f; this.velocity = (this.velocity * (num1993 - 1f) + vector285) / num1993; for (int num1994 = 0; num1994 < 200; num1994++) { if (Main.npc[num1994].active && Main.npc[num1994].type == this.type && num1994 != this.whoAmI) { Vector2 value95 = Main.npc[num1994].Center - base.Center; if (value95.Length() < 40f) { value95.Normalize(); value95 *= 1f; this.velocity -= value95; } } } this.rotation += this.velocity.X * 0.03f; if ((double)this.rotation < -6.2831) { this.rotation += 6.2831f; } if ((double)this.rotation > 6.2831) { this.rotation -= 6.2831f; } if (this.velocity.X > 0f) { this.direction = 1; } else if (this.velocity.X < 0f) { this.direction = -1; } this.spriteDirection = this.direction; } this.ai[1] += 1f; if (this.ai[1] >= 60f && !flag190) { this.ai[0] = 0f; } } else if (this.ai[0] == 2f) { this.rotation *= 0.92f; if ((double)Math.Abs(this.rotation) < 0.02) { this.rotation = 0f; } int num1995 = 300; float num1996 = Math.Abs(base.Center.X - Main.player[this.target].Center.X); if (num1996 < (float)num1995 && Collision.CanHit(base.Center, 1, 1, Main.player[this.target].position, 1, 1)) { this.velocity.X = this.velocity.X * 0.96f; this.velocity.Y = this.velocity.Y * 0.96f; this.ai[1] += 1f; if (this.ai[1] == 20f) { if (Main.netMode != 1) { NPC.NewNPC((int)base.Center.X, (int)base.Center.Y + 26, 516, 0, 0f, 0f, 0f, 0f, this.target); } } else if (this.ai[1] >= 30f) { this.ai[1] = 0f; } for (int num1997 = 0; num1997 < 200; num1997++) { if (Main.npc[num1997].active && Main.npc[num1997].type == this.type && num1997 != this.whoAmI) { Vector2 value96 = Main.npc[num1997].Center - base.Center; if (value96.Length() < 100f) { value96.Normalize(); value96 *= 0.1f; this.velocity -= value96; } } } } else { this.ai[0] = 0f; } if (Main.player[this.target].Center.X < base.Center.X) { this.direction = -1; } else if (Main.player[this.target].Center.X > base.Center.X) { this.direction = 1; } this.spriteDirection = this.direction; } if (this.ai[0] == 1f) { this.rotation *= 0.92f; if ((double)Math.Abs(this.rotation) < 0.02) { this.rotation = 0f; } if (flag190) { this.ai[0] = -1f; this.ai[1] = 0f; this.ai[2] = 0f; this.ai[3] = 0f; } int num1998 = 300; for (int num1999 = 0; num1999 < 200; num1999++) { if (Main.npc[num1999].active && Main.npc[num1999].type == this.type && num1999 != this.whoAmI) { Vector2 value97 = Main.npc[num1999].Center - base.Center; if (value97.Length() < 50f) { value97.Normalize(); value97 *= 0.1f; this.velocity -= value97; this.velocity.X = this.velocity.X - value97.X * 1f; } } } int num2000 = 800; float num2001 = Math.Abs(base.Center.X - Main.player[this.target].Center.X); if (num2001 < (float)num1998 && flag189) { this.ai[0] = 2f; this.ai[1] = 0f; } else { if (this.collideX) { this.velocity.X = this.velocity.X * -0.5f; this.ai[1] = 60f; this.direction *= -1; } if (this.ai[1] > 0f) { this.ai[1] -= 1f; } else if (flag189) { if (base.Center.X > Main.player[this.target].Center.X) { this.direction = -1; } else { this.direction = 1; } } else if (num2001 > (float)num2000) { if (base.Center.X > Main.player[this.target].Center.X) { this.direction = -1; } else { this.direction = 1; } } float num2002 = 2f; float num2003 = 0.1f; if (this.velocity.X > num2002 || this.velocity.X < -num2002) { if (Math.Abs(this.velocity.X) < num2002 + num2003 * 2f) { if (this.velocity.X < 0f) { this.velocity.X = -num2002; } else { this.velocity.X = num2002; } } else { this.velocity.X = this.velocity.X * 0.99f; } } else { this.velocity.X = this.velocity.X + (float)this.direction * num2003; } this.spriteDirection = this.direction; } if (this.collideY) { this.ai[2] = 60f; this.directionY *= -1; this.velocity.Y = this.velocity.Y * -0.5f; } if (this.ai[2] > 0f) { this.ai[2] -= 1f; } else { int num2004 = (int)(base.Center.Y / 16f); int num2005 = (int)((base.Center.X - 8f) / 16f); int num2006 = 30; int num2007 = 15; int num2008 = 0; for (int num2009 = num2004; num2009 < num2004 + num2006; num2009++) { for (int num2010 = num2005; num2010 <= num2005 + 1; num2010++) { if (WorldGen.SolidTile(num2010, num2009) || Main.tile[num2010, num2009].liquid > 0) { num2008 = num2009 - num2004; break; } } if (num2008 != 0) { break; } } if (num2008 == 0) { this.directionY = 1; } else if (num2008 < num2007) { this.directionY = -1; } } float num2011 = 2f; float num2012 = 0.1f; if (this.velocity.Y <= num2011 && this.velocity.Y >= -num2011) { this.velocity.Y = this.velocity.Y + (float)this.directionY * num2012; return; } if (Math.Abs(this.velocity.Y) >= num2011 + num2012 * 2f) { this.velocity.Y = this.velocity.Y * 0.99f; return; } if (this.velocity.Y < 0f) { this.velocity.Y = -num2011; return; } this.velocity.Y = num2011; return; } } else if (this.aiStyle == 99) { if (this.velocity.Y == 0f && this.ai[0] == 0f) { this.ai[0] = 1f; this.ai[1] = 0f; this.netUpdate = true; return; } if (this.ai[0] == 1f) { this.velocity = Vector2.Zero; this.position = this.oldPosition; this.ai[1] += 1f; if (this.ai[1] >= 5f) { this.HitEffect(0, 9999.0); this.active = false; } return; } this.velocity.Y = this.velocity.Y + 0.2f; if (this.velocity.Y > 12f) { this.velocity.Y = 12f; } this.rotation = this.velocity.ToRotation() - 1.57079637f; if (this.type == NPCID.SolarGoop) { if (this.localAI[0] == 0f) { this.localAI[0] = 1f; } return; } } else if (this.aiStyle == 100) { if (this.velocity.Y == 0f && this.ai[0] >= 0f) { this.ai[0] = -1f; this.ai[1] = 0f; this.netUpdate = true; return; } if (this.ai[0] == -1f) { this.velocity = Vector2.Zero; this.position = this.oldPosition; this.ai[1] += 1f; if (this.ai[1] >= 5f) { this.HitEffect(0, 9999.0); this.active = false; } return; } this.rotation = this.velocity.ToRotation() - 1.57079637f; if (this.type == NPCID.AncientLight) { if (this.localAI[0] == 0f) { this.localAI[0] = 1f; this.velocity.X = this.ai[2]; this.velocity.Y = this.ai[3]; } this.dontTakeDamage = (this.ai[0] >= 0f && this.ai[0] <= 20f); if (this.ai[0] >= 0f) { this.ai[0] += 1f; if (this.ai[0] > 60f) { this.velocity = this.velocity.RotatedBy((double)this.ai[1], default(Vector2)); } if (this.ai[0] > 120f) { this.velocity *= 0.98f; } if (this.velocity.Length() < 0.2f) { this.velocity = Vector2.Zero; return; } } } } else if (this.aiStyle == 101) { float num2021 = 420f; float num2022 = 120f; int num2023 = 1; float value98 = 0f; float value99 = 1f; float num2024 = 4f; bool flag191 = this.ai[1] < 0f || !Main.npc[(int)this.ai[0]].active; if (Main.npc[(int)this.ai[0]].type == 439) { if (Main.npc[(int)this.ai[0]].life < Main.npc[(int)this.ai[0]].lifeMax / 2) { num2023 = 2; } if (Main.npc[(int)this.ai[0]].life < Main.npc[(int)this.ai[0]].lifeMax / 4) { num2023 = 3; } } else { flag191 = true; } this.ai[1] += (float)num2023; float num2025 = this.ai[1] / num2022; num2025 = MathHelper.Clamp(num2025, 0f, 1f); this.position = base.Center; this.scale = MathHelper.Lerp(value98, value99, num2025); base.Center = this.position; this.alpha = (int)(255f - num2025 * 255f); this.localAI[0] += 0.05235988f; this.localAI[1] = 0.25f + Vector2.UnitY.RotatedBy((double)(this.ai[1] * 6.28318548f / 60f), default(Vector2)).Y * 0.25f; if (this.ai[1] >= num2021) { flag191 = true; if (Main.netMode != 1) { for (int num2026 = 0; num2026 < 4; num2026++) { Vector2 vector287 = new Vector2(0f, -num2024).RotatedBy((double)(1.57079637f * (float)num2026), default(Vector2)); Projectile.NewProjectile(base.Center.X, base.Center.Y, vector287.X, vector287.Y, 593, this.damage, 0f, Main.myPlayer, 0f, 0f); } } } if (flag191) { this.HitEffect(0, 9999.0); this.active = false; } } } } } } } } } } }
public void AI() { if (this.aiStyle == 1) { this.AI_001(); return; } if (this.aiStyle == 2) { if (this.type == 872)// { this.ai[15]++; int randColor = Main.rand.Next(0, Ulterraria.rainbow.Length); Color color = Ulterraria.RainbowColor[randColor]; this.ai[16] = color.R; this.ai[17] = color.G; this.ai[18] = color.B; int num = Dust.NewDust(this.position, this.width, this.height, 21, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 0.3f); } if (this.type == 93 && Main.rand.Next(5) == 0) { int num = Dust.NewDust(this.position, this.width, this.height, 57, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 0.3f); Dust expr_A0_cp_0 = Main.dust[num]; expr_A0_cp_0.velocity.X = expr_A0_cp_0.velocity.X * 0.3f; Dust expr_BD_cp_0 = Main.dust[num]; expr_BD_cp_0.velocity.Y = expr_BD_cp_0.velocity.Y * 0.3f; } // if (this.type == 724) { int d = Dust.NewDust(this.position, this.width, this.height, 171, 0f, 0f); Main.dust[d].noGravity = true; } if (this.type == 725) { int num428 = Main.rand.Next(3); if (num428 == 0) { num428 = 15; } else if (num428 == 1) { num428 = 57; } else { num428 = 58; } int d = Dust.NewDust(this.position, this.width, this.height, num428, 0f, 0f); Main.dust[d].noGravity = true; } if (this.type == 726) { int d = Dust.NewDust(this.position, this.width, this.height, 169, 0f, 0f); Main.dust[d].noGravity = true; } if (this.type == 727) { for (int i = 0; i < 2; i++) { int d = Dust.NewDust(this.position, this.width, this.height, 35, 0f, 0f); Main.dust[d].noGravity = true; } } if (this.type == 728) { int d = Dust.NewDust(this.position, this.width, this.height, 232, 0f, 0f); Main.dust[d].noGravity = true; } if (this.type == 729) { int d = Dust.NewDust(this.position, this.width, this.height, 135, 0f, 0f); Main.dust[d].noGravity = true; } if (this.type == 730) { int d = Dust.NewDust(this.position, this.width, this.height, 127, 0f, 0f); Main.dust[d].noGravity = true; } if (this.type == 731) { int d = Dust.NewDust(this.position, this.width, this.height, 35, 0f, 0f); Main.dust[d].noGravity = true; } // if (this.type == 304 && this.localAI[0] == 0f) { this.localAI[0] += 1f; this.alpha = 0; } if (this.type == 335) { this.frame = (int)this.ai[1]; } if (this.type == 510) { this.rotation += Math.Abs(this.velocity.X) * 0.04f * (float)this.direction; } else { this.rotation += (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) * 0.03f * (float)this.direction; } if (this.type == 162) { if (this.ai[1] == 0f) { this.ai[1] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); } this.ai[0] += 1f; if (this.ai[0] >= 18f) { this.velocity.Y = this.velocity.Y + 0.28f; this.velocity.X = this.velocity.X * 0.99f; } if (this.ai[0] > 2f) { this.alpha = 0; if (this.ai[0] == 3f) { for (int i = 0; i < 10; i++) { int num2 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num2].velocity *= 0.5f; Main.dust[num2].velocity += this.velocity * 0.1f; } for (int j = 0; j < 5; j++) { int num3 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 2f); Main.dust[num3].noGravity = true; Main.dust[num3].velocity *= 3f; Main.dust[num3].velocity += this.velocity * 0.2f; num3 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 1f); Main.dust[num3].velocity *= 2f; Main.dust[num3].velocity += this.velocity * 0.3f; } for (int k = 0; k < 1; k++) { int num4 = Gore.NewGore(new Vector2(this.position.X - 10f, this.position.Y - 10f), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num4].position += this.velocity * 1.25f; Main.gore[num4].scale = 1.5f; Main.gore[num4].velocity += this.velocity * 0.5f; Main.gore[num4].velocity *= 0.02f; } } } } else if (this.type == 281) { if (this.ai[1] == 0f) { this.ai[1] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); } this.ai[0] += 1f; if (this.ai[0] >= 18f) { this.velocity.Y = this.velocity.Y + 0.28f; this.velocity.X = this.velocity.X * 0.99f; } if (this.ai[0] > 2f) { this.alpha = 0; if (this.ai[0] == 3f) { for (int l = 0; l < 10; l++) { int num5 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num5].velocity *= 0.5f; Main.dust[num5].velocity += this.velocity * 0.1f; } for (int m = 0; m < 5; m++) { int num6 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 2f); Main.dust[num6].noGravity = true; Main.dust[num6].velocity *= 3f; Main.dust[num6].velocity += this.velocity * 0.2f; num6 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 1f); Main.dust[num6].velocity *= 2f; Main.dust[num6].velocity += this.velocity * 0.3f; } for (int n = 0; n < 1; n++) { int num7 = Gore.NewGore(new Vector2(this.position.X - 10f, this.position.Y - 10f), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num7].position += this.velocity * 1.25f; Main.gore[num7].scale = 1.5f; Main.gore[num7].velocity += this.velocity * 0.5f; Main.gore[num7].velocity *= 0.02f; } } } } else if (this.type == 240) { if (this.ai[1] == 0f) { this.ai[1] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); } this.ai[0] += 1f; if (this.ai[0] >= 16f) { this.velocity.Y = this.velocity.Y + 0.18f; this.velocity.X = this.velocity.X * 0.991f; } if (this.ai[0] > 2f) { this.alpha = 0; if (this.ai[0] == 3f) { for (int num8 = 0; num8 < 7; num8++) { int num9 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num9].velocity *= 0.5f; Main.dust[num9].velocity += this.velocity * 0.1f; } for (int num10 = 0; num10 < 3; num10++) { int num11 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 2f); Main.dust[num11].noGravity = true; Main.dust[num11].velocity *= 3f; Main.dust[num11].velocity += this.velocity * 0.2f; num11 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 1f); Main.dust[num11].velocity *= 2f; Main.dust[num11].velocity += this.velocity * 0.3f; } for (int num12 = 0; num12 < 1; num12++) { int num13 = Gore.NewGore(new Vector2(this.position.X - 10f, this.position.Y - 10f), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num13].position += this.velocity * 1.25f; Main.gore[num13].scale = 1.25f; Main.gore[num13].velocity += this.velocity * 0.5f; Main.gore[num13].velocity *= 0.02f; } } } } if (this.type == 497) { int num14 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 27, this.velocity.X, this.velocity.Y, 100, default(Color), 1.2f); Main.dust[num14].position = (Main.dust[num14].position + base.Center) / 2f; Main.dust[num14].noGravity = true; Main.dust[num14].velocity *= 0.3f; Main.dust[num14].velocity -= this.velocity * 0.1f; this.ai[0] += 1f; if (this.ai[0] >= 30f) { this.velocity.X = this.velocity.X * 0.99f; this.velocity.Y = this.velocity.Y + 0.5f; } else { this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f; } } else if (this.type == 249) { this.ai[0] += 1f; if (this.ai[0] >= 0f) { this.velocity.Y = this.velocity.Y + 0.25f; } } else if (this.type == 347) { this.ai[0] += 1f; if (this.ai[0] >= 5f) { this.velocity.Y = this.velocity.Y + 0.25f; } } else if (this.type == 501) { this.ai[0] += 1f; if (this.ai[0] >= 18f) { this.velocity.X = this.velocity.X * 0.995f; this.velocity.Y = this.velocity.Y + 0.2f; } } else if (this.type == 504 || this.type == 874) { this.alpha = 255; this.ai[0] += 1f; if (this.ai[0] > 3f) { int num15 = 100; if (this.ai[0] > 20f) { int num16 = 40; float num17 = this.ai[0] - 20f; num15 = (int)(100f * (1f - num17 / (float)num16)); if (num17 >= (float)num16) { this.Kill(); } } if (this.ai[0] <= 10f) { num15 = (int)this.ai[0] * 10; } if (Main.rand.Next(100) < num15) { int num18 = Dust.NewDust(this.position, this.width, this.height, 6, 0f, 0f, 150, default(Color), 1f); Main.dust[num18].position = (Main.dust[num18].position + base.Center) / 2f; Main.dust[num18].noGravity = true; Main.dust[num18].velocity *= 2f; Main.dust[num18].scale *= 1.2f; Main.dust[num18].velocity += this.velocity; } } if (this.ai[0] >= 20f) { this.velocity.X = this.velocity.X * 0.99f; this.velocity.Y = this.velocity.Y + 0.1f; } } else if (this.type == 69 || this.type == 70 || this.type == 621 || this.type == 756)// { this.ai[0] += 1f; if (this.ai[0] >= 10f) { this.velocity.Y = this.velocity.Y + 0.25f; this.velocity.X = this.velocity.X * 0.99f; } } else if (this.type == 166) { this.ai[0] += 1f; if (this.ai[0] >= 20f) { this.velocity.Y = this.velocity.Y + 0.3f; this.velocity.X = this.velocity.X * 0.98f; } } else if (this.type == 300) { if (this.ai[0] == 0f) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 1); } this.ai[0] += 1f; if (this.ai[0] >= 60f) { this.velocity.Y = this.velocity.Y + 0.2f; this.velocity.X = this.velocity.X * 0.99f; } } else if (this.type == 306) { if (this.alpha <= 200) { for (int num19 = 0; num19 < 4; num19++) { float num20 = this.velocity.X / 4f * (float)num19; float num21 = this.velocity.Y / 4f * (float)num19; int num22 = Dust.NewDust(this.position, this.width, this.height, 184, 0f, 0f, 0, default(Color), 1f); Main.dust[num22].position.X = base.Center.X - num20; Main.dust[num22].position.Y = base.Center.Y - num21; Main.dust[num22].velocity *= 0f; Main.dust[num22].scale = 0.7f; } } this.alpha -= 50; if (this.alpha < 0) { this.alpha = 0; } this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 0.785f; } else if (this.type == 304) { this.ai[0] += 1f; if (this.ai[0] >= 30f) { this.alpha += 10; this.damage = (int)((double)this.damage * 0.9); this.knockBack = (float)((int)((double)this.knockBack * 0.9)); if (this.alpha >= 255) { this.active = false; } } if (this.ai[0] < 30f) { this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f; } } else if (this.type == 370 || this.type == 371 || this.type == 781)// { this.ai[0] += 1f; if (this.ai[0] >= 15f) { this.velocity.Y = this.velocity.Y + 0.3f; this.velocity.X = this.velocity.X * 0.98f; } } else { this.ai[0] += 1f; if (this.ai[0] >= 20f) { this.velocity.Y = this.velocity.Y + 0.4f; this.velocity.X = this.velocity.X * 0.97f; } else if (this.type == 48 || this.type == 54 || this.type == 93 || this.type == 520 || this.type == 599) { this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f; } } if (this.velocity.Y > 16f) { this.velocity.Y = 16f; } if (this.type == 54 && Main.rand.Next(20) == 0) { Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 40, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 0, default(Color), 0.75f); return; } } else if (this.aiStyle == 3) { if (this.type == 814 && this.ai[15] == 0f) { this.ai[15]++; int randColor = Main.rand.Next(0, Ulterraria.rainbow.Length); Color color = Ulterraria.RainbowColor[randColor]; this.ai[16] = color.R; this.ai[17] = color.G; this.ai[18] = color.B; } if (this.soundDelay == 0 && this.type != 383) { this.soundDelay = 8; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 7); } if (this.type == 19) { for (int num23 = 0; num23 < 2; num23++) { int num24 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, default(Color), 2f); Main.dust[num24].noGravity = true; Dust expr_1788_cp_0 = Main.dust[num24]; expr_1788_cp_0.velocity.X = expr_1788_cp_0.velocity.X * 0.3f; Dust expr_17A6_cp_0 = Main.dust[num24]; expr_17A6_cp_0.velocity.Y = expr_17A6_cp_0.velocity.Y * 0.3f; } } else if (this.type == 33) { if (Main.rand.Next(1) == 0) { int num25 = Dust.NewDust(this.position, this.width, this.height, 40, this.velocity.X * 0.25f, this.velocity.Y * 0.25f, 0, default(Color), 1.4f); Main.dust[num25].noGravity = true; } } else if (this.type == 320) { if (Main.rand.Next(3) == 0) { int num26 = Dust.NewDust(this.position, this.width, this.height, 5, this.velocity.X * 0.25f, this.velocity.Y * 0.25f, 0, default(Color), 1.1f); if (Main.rand.Next(2) == 0) { Main.dust[num26].scale = 0.9f; Main.dust[num26].velocity *= 0.2f; } else { Main.dust[num26].noGravity = true; } } } else if (this.type == 6) { if (Main.rand.Next(5) == 0) { int num27 = Main.rand.Next(3); if (num27 == 0) { num27 = 15; } else if (num27 == 1) { num27 = 57; } else { num27 = 58; } Dust.NewDust(this.position, this.width, this.height, num27, this.velocity.X * 0.25f, this.velocity.Y * 0.25f, 150, default(Color), 0.7f); } } else if (this.type == 113 && Main.rand.Next(1) == 0) { int num28 = Dust.NewDust(this.position, this.width, this.height, 76, this.velocity.X * 0.15f, this.velocity.Y * 0.15f, 0, default(Color), 1.1f); Main.dust[num28].noGravity = true; Dust.NewDust(this.position, this.width, this.height, 15, this.velocity.X * 0.05f, this.velocity.Y * 0.05f, 150, default(Color), 0.6f); } else if (this.type == 708) { int numTum = Dust.NewDust(this.Center, this.width, this.height, 139, this.velocity.X * 0.15f, this.velocity.Y * 0.15f, 10, default(Color), 1.1f); Main.dust[numTum].noGravity = true; numTum = Dust.NewDust(this.Center, this.width, this.height, 137, this.velocity.X * 0.10f, this.velocity.Y * 0.10f, 10, default(Color), 0.8f); } if (this.ai[0] == 0f) { this.ai[1] += 1f; if (this.type == 106 || this.type == 708 && this.ai[1] >= 45f) { this.ai[0] = 1f; this.ai[1] = 0f; this.netUpdate = true; } if (this.type == 320 || this.type == 383) { if (this.ai[1] >= 10f) { this.velocity.Y = this.velocity.Y + 0.5f; if (this.type == 383 && this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y + 0.35f; } this.velocity.X = this.velocity.X * 0.95f; if (this.velocity.Y > 16f) { this.velocity.Y = 16f; } if (this.type == 383 && Vector2.Distance(base.Center, Main.player[this.owner].Center) > 800f) { this.ai[0] = 1f; } } } else if (this.type == 182) { if (Main.rand.Next(2) == 0) { int num29 = Dust.NewDust(this.position, this.width, this.height, 57, 0f, 0f, 255, default(Color), 0.75f); Main.dust[num29].velocity *= 0.1f; Main.dust[num29].noGravity = true; } if (this.velocity.X > 0f) { this.spriteDirection = 1; } else if (this.velocity.X < 0f) { this.spriteDirection = -1; } float num30 = this.position.X; float num31 = this.position.Y; bool flag = false; if (this.ai[1] > 10f) { for (int num32 = 0; num32 < 200; num32++) { if (Main.npc[num32].CanBeChasedBy(this, false)) { float num33 = Main.npc[num32].position.X + (float)(Main.npc[num32].width / 2); float num34 = Main.npc[num32].position.Y + (float)(Main.npc[num32].height / 2); float num35 = Math.Abs(this.position.X + (float)(this.width / 2) - num33) + Math.Abs(this.position.Y + (float)(this.height / 2) - num34); if (num35 < 800f && Collision.CanHit(new Vector2(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2)), 1, 1, Main.npc[num32].position, Main.npc[num32].width, Main.npc[num32].height)) { num30 = num33; num31 = num34; flag = true; } } } } if (!flag) { num30 = this.position.X + (float)(this.width / 2) + this.velocity.X * 100f; num31 = this.position.Y + (float)(this.height / 2) + this.velocity.Y * 100f; if (this.ai[1] >= 30f) { this.ai[0] = 1f; this.ai[1] = 0f; this.netUpdate = true; } } float num36 = 12f; float num37 = 0.25f; Vector2 vector = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num38 = num30 - vector.X; float num39 = num31 - vector.Y; float num40 = (float)Math.Sqrt((double)(num38 * num38 + num39 * num39)); num40 = num36 / num40; num38 *= num40; num39 *= num40; if (this.velocity.X < num38) { this.velocity.X = this.velocity.X + num37; if (this.velocity.X < 0f && num38 > 0f) { this.velocity.X = this.velocity.X + num37 * 2f; } } else if (this.velocity.X > num38) { this.velocity.X = this.velocity.X - num37; if (this.velocity.X > 0f && num38 < 0f) { this.velocity.X = this.velocity.X - num37 * 2f; } } if (this.velocity.Y < num39) { this.velocity.Y = this.velocity.Y + num37; if (this.velocity.Y < 0f && num39 > 0f) { this.velocity.Y = this.velocity.Y + num37 * 2f; } } else if (this.velocity.Y > num39) { this.velocity.Y = this.velocity.Y - num37; if (this.velocity.Y > 0f && num39 < 0f) { this.velocity.Y = this.velocity.Y - num37 * 2f; } } } else if (this.type == 301) { if (this.ai[1] >= 20f) { this.ai[0] = 1f; this.ai[1] = 0f; this.netUpdate = true; } } else if (this.ai[1] >= 30f) { this.ai[0] = 1f; this.ai[1] = 0f; this.netUpdate = true; } } else { this.tileCollide = false; float num41 = 9f; float num42 = 0.4f; if (this.type == 19) { num41 = 13f; num42 = 0.6f; } else if (this.type == 33) { num41 = 15f; num42 = 0.8f; } else if (this.type == 182) { num41 = 16f; num42 = 1.2f; } else if (this.type == 106) { num41 = 16f; num42 = 1.2f; } else if (this.type == 272) { num41 = 15f; num42 = 1f; } else if (this.type == 333) { num41 = 12f; num42 = 0.6f; } else if (this.type == 301) { num41 = 15f; num42 = 3f; } else if (this.type == 320) { num41 = 15f; num42 = 3f; } else if (this.type == 383) { num41 = 16f; num42 = 4f; } else if (this.type == 708)// { num41 = 16f; num42 = 2.8f; } Vector2 vector2 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num43 = Main.player[this.owner].position.X + (float)(Main.player[this.owner].width / 2) - vector2.X; float num44 = Main.player[this.owner].position.Y + (float)(Main.player[this.owner].height / 2) - vector2.Y; float num45 = (float)Math.Sqrt((double)(num43 * num43 + num44 * num44)); if (num45 > 3000f) { this.Kill(); } num45 = num41 / num45; num43 *= num45; num44 *= num45; if (this.type == 383) { Vector2 vector3 = new Vector2(num43, num44) - this.velocity; if (vector3 != Vector2.Zero) { Vector2 value = vector3; value.Normalize(); this.velocity += value * Math.Min(num42, vector3.Length()); } } else { if (this.velocity.X < num43) { this.velocity.X = this.velocity.X + num42; if (this.velocity.X < 0f && num43 > 0f) { this.velocity.X = this.velocity.X + num42; } } else if (this.velocity.X > num43) { this.velocity.X = this.velocity.X - num42; if (this.velocity.X > 0f && num43 < 0f) { this.velocity.X = this.velocity.X - num42; } } if (this.velocity.Y < num44) { this.velocity.Y = this.velocity.Y + num42; if (this.velocity.Y < 0f && num44 > 0f) { this.velocity.Y = this.velocity.Y + num42; } } else if (this.velocity.Y > num44) { this.velocity.Y = this.velocity.Y - num42; if (this.velocity.Y > 0f && num44 < 0f) { this.velocity.Y = this.velocity.Y - num42; } } } if (Main.myPlayer == this.owner) { Rectangle rectangle = new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height); Rectangle value2 = new Rectangle((int)Main.player[this.owner].position.X, (int)Main.player[this.owner].position.Y, Main.player[this.owner].width, Main.player[this.owner].height); if (rectangle.Intersects(value2)) { this.Kill(); } } } if (this.type == 106 || this.type == 708)// { this.rotation += 0.3f * (float)this.direction; return; } if (this.type != 383) { this.rotation += 0.4f * (float)this.direction; return; } if (this.ai[0] == 0f) { Vector2 velocity = this.velocity; velocity.Normalize(); this.rotation = (float)Math.Atan2((double)velocity.Y, (double)velocity.X) + 1.57f; return; } Vector2 vector4 = base.Center - Main.player[this.owner].Center; vector4.Normalize(); this.rotation = (float)Math.Atan2((double)vector4.Y, (double)vector4.X) + 1.57f; return; } else if (this.aiStyle == 4) { this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f; if (this.ai[0] == 0f) { if (this.type >= 150 && this.type <= 152 && this.ai[1] == 0f && this.alpha == 255 && Main.rand.Next(2) == 0) { this.type++; this.netUpdate = true; } this.alpha -= 50; if (this.type >= 150 && this.type <= 152) { this.alpha -= 25; } else if (this.type == 493 || this.type == 494) { this.alpha -= 50; } if (this.alpha <= 0) { this.alpha = 0; this.ai[0] = 1f; if (this.ai[1] == 0f) { this.ai[1] += 1f; this.position += this.velocity * 1f; } if (this.type == 7 && Main.myPlayer == this.owner) { int num46 = this.type; if (this.ai[1] >= 6f) { num46++; } int num47 = Projectile.NewProjectile(this.position.X + this.velocity.X + (float)(this.width / 2), this.position.Y + this.velocity.Y + (float)(this.height / 2), this.velocity.X, this.velocity.Y, num46, this.damage, this.knockBack, this.owner, 0f, 0f); Main.projectile[num47].damage = this.damage; Main.projectile[num47].ai[1] = this.ai[1] + 1f; NetMessage.SendData(27, -1, -1, "", num47, 0f, 0f, 0f, 0, 0, 0); return; } if (this.type == 494 && Main.myPlayer == this.owner) { int num48 = this.type; if (this.ai[1] >= (float)(7 + Main.rand.Next(2))) { num48--; } int num49 = this.damage; float num50 = this.knockBack; if (num48 == 493) { num49 = (int)((double)this.damage * 1.25); num50 = this.knockBack * 1.25f; } int number = Projectile.NewProjectile(this.position.X + this.velocity.X + (float)(this.width / 2), this.position.Y + this.velocity.Y + (float)(this.height / 2), this.velocity.X, this.velocity.Y, num48, num49, num50, this.owner, 0f, this.ai[1] + 1f); NetMessage.SendData(27, -1, -1, "", number, 0f, 0f, 0f, 0, 0, 0); return; } if ((this.type == 150 || this.type == 151) && Main.myPlayer == this.owner) { int num51 = this.type; if (this.type == 150) { num51 = 151; } else if (this.type == 151) { num51 = 150; } if (this.ai[1] >= 10f && this.type == 151) { num51 = 152; } int num52 = Projectile.NewProjectile(this.position.X + this.velocity.X + (float)(this.width / 2), this.position.Y + this.velocity.Y + (float)(this.height / 2), this.velocity.X, this.velocity.Y, num51, this.damage, this.knockBack, this.owner, 0f, 0f); Main.projectile[num52].damage = this.damage; Main.projectile[num52].ai[1] = this.ai[1] + 1f; NetMessage.SendData(27, -1, -1, "", num52, 0f, 0f, 0f, 0, 0, 0); return; } } } else { if (this.alpha < 170 && this.alpha + 5 >= 170) { if (this.type >= 150 && this.type <= 152) { for (int num53 = 0; num53 < 8; num53++) { int num54 = Dust.NewDust(this.position, this.width, this.height, 7, this.velocity.X * 0.025f, this.velocity.Y * 0.025f, 200, default(Color), 1.3f); Main.dust[num54].noGravity = true; Main.dust[num54].velocity *= 0.5f; } } else if (this.type == 493 || this.type == 494) { for (int num55 = 0; num55 < 8; num55++) { int num56 = Dust.NewDust(this.position, this.width, this.height, Main.rand.Next(68, 71), this.velocity.X * 0.025f, this.velocity.Y * 0.025f, 200, default(Color), 1.3f); Main.dust[num56].noGravity = true; Main.dust[num56].velocity *= 0.5f; } } else { for (int num57 = 0; num57 < 3; num57++) { Dust.NewDust(this.position, this.width, this.height, 18, this.velocity.X * 0.025f, this.velocity.Y * 0.025f, 170, default(Color), 1.2f); } Dust.NewDust(this.position, this.width, this.height, 14, 0f, 0f, 170, default(Color), 1.1f); } } if (this.type >= 150 && this.type <= 152) { this.alpha += 3; } else if (this.type == 493 || this.type == 494) { this.alpha += 7; } else { this.alpha += 5; } if (this.alpha >= 255) { this.Kill(); return; } } } else if (this.aiStyle == 5) { if (this.type == 503) { if (base.Center.Y > this.ai[1]) { this.tileCollide = true; } } else if (this.type == 92) { if (this.position.Y > this.ai[1]) { this.tileCollide = true; } } else { if (this.ai[1] == 0f && !Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[1] = 1f; this.netUpdate = true; } if (this.ai[1] != 0f) { this.tileCollide = true; } } if (this.soundDelay == 0) { this.soundDelay = 20 + Main.rand.Next(40); Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 9); } if (this.type == 503) { this.alpha -= 15; int num58 = 150; if (base.Center.Y >= this.ai[1]) { num58 = 0; } if (this.alpha < num58) { this.alpha = num58; } this.localAI[0] += (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) * 0.01f * (float)this.direction; } else { if (this.localAI[0] == 0f) { this.localAI[0] = 1f; } this.alpha += (int)(25f * this.localAI[0]); if (this.alpha > 200) { this.alpha = 200; this.localAI[0] = -1f; } if (this.alpha < 0) { this.alpha = 0; this.localAI[0] = 1f; } } if (this.type == 503) { this.rotation = this.velocity.ToRotation() - 1.57079637f; } else { this.rotation += (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) * 0.01f * (float)this.direction; } if (this.type == 503) { if (Main.rand.Next(16) == 0) { Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)this.velocity.ToRotation(), default(Vector2)); int num59 = Dust.NewDust(this.position, this.width, this.height, 58, this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 150, default(Color), 1.2f); Main.dust[num59].velocity = value3 * 0.66f; Main.dust[num59].position = base.Center + value3 * 12f; } if (Main.rand.Next(48) == 0) { int num60 = Gore.NewGore(base.Center, new Vector2(this.velocity.X * 0.2f, this.velocity.Y * 0.2f), 16, 1f); Main.gore[num60].velocity *= 0.66f; Main.gore[num60].velocity += this.velocity * 0.3f; } } if (this.ai[1] == 1f || this.type == 92) { this.light = 0.9f; if (Main.rand.Next(10) == 0) { int dust = 58; if (this.type == 785) { dust = 152;// } // VVVVVVVV Dust.NewDust(this.position, this.width, this.height, dust, this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 150, default(Color), 1.2f); } if (Main.rand.Next(20) == 0) { Gore.NewGore(this.position, new Vector2(this.velocity.X * 0.2f, this.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); return; } } } else if (this.aiStyle == 6) { this.velocity *= 0.95f; this.ai[0] += 1f; if (this.ai[0] == 180f) { this.Kill(); } if (this.ai[1] == 0f) { this.ai[1] = 1f; int num61 = 10 + this.type; if (this.type == 463) { num61 = 231; } for (int num62 = 0; num62 < 30; num62++) { // if (this.type == 864) { Dust.NewDust(this.position, this.width, this.height, num61, this.velocity.X, this.velocity.Y, 23, default(Color), 1f); } else { Dust.NewDust(this.position, this.width, this.height, num61, this.velocity.X, this.velocity.Y, 50, default(Color), 1f); } } } if (this.type == 10 || this.type == 11 || this.type == 463) { int num63 = (int)(this.position.X / 16f) - 1; int num64 = (int)((this.position.X + (float)this.width) / 16f) + 2; int num65 = (int)(this.position.Y / 16f) - 1; int num66 = (int)((this.position.Y + (float)this.height) / 16f) + 2; if (num63 < 0) { num63 = 0; } if (num64 > Main.maxTilesX) { num64 = Main.maxTilesX; } if (num65 < 0) { num65 = 0; } if (num66 > Main.maxTilesY) { num66 = Main.maxTilesY; } for (int num67 = num63; num67 < num64; num67++) { for (int num68 = num65; num68 < num66; num68++) { Vector2 vector5; vector5.X = (float)(num67 * 16); vector5.Y = (float)(num68 * 16); if (this.position.X + (float)this.width > vector5.X && this.position.X < vector5.X + 16f && this.position.Y + (float)this.height > vector5.Y && this.position.Y < vector5.Y + 16f && Main.myPlayer == this.owner && Main.tile[num67, num68].active()) { if (this.type == 10) { if (Main.tile[num67, num68].type == 23 || Main.tile[num67, num68].type == 199) { Main.tile[num67, num68].type = 2; WorldGen.SquareTileFrame(num67, num68, true); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num67, num68, 1); } } if (Main.tile[num67, num68].type == 25 || Main.tile[num67, num68].type == 203) { Main.tile[num67, num68].type = 1; WorldGen.SquareTileFrame(num67, num68, true); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num67, num68, 1); } } if (Main.tile[num67, num68].type == 112 || Main.tile[num67, num68].type == 234) { Main.tile[num67, num68].type = 53; WorldGen.SquareTileFrame(num67, num68, true); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num67, num68, 1); } } if (Main.tile[num67, num68].type == 163 || Main.tile[num67, num68].type == 200) { Main.tile[num67, num68].type = 161; WorldGen.SquareTileFrame(num67, num68, true); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num67, num68, 1); } } if (Main.tile[num67, num68].type == 400 || Main.tile[num67, num68].type == 401) { Main.tile[num67, num68].type = 396; WorldGen.SquareTileFrame(num67, num68, true); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num67, num68, 1); } } if (Main.tile[num67, num68].type == 398 || Main.tile[num67, num68].type == 399) { Main.tile[num67, num68].type = 397; WorldGen.SquareTileFrame(num67, num68, true); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num67, num68, 1); } } } else if (this.type == 11 || this.type == 463) { if (Main.tile[num67, num68].type == 109) { Main.tile[num67, num68].type = 2; WorldGen.SquareTileFrame(num67, num68, true); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num67, num68, 1); } } if (Main.tile[num67, num68].type == 116) { Main.tile[num67, num68].type = 53; WorldGen.SquareTileFrame(num67, num68, true); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num67, num68, 1); } } if (Main.tile[num67, num68].type == 117) { Main.tile[num67, num68].type = 1; WorldGen.SquareTileFrame(num67, num68, true); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num67, num68, 1); } } if (Main.tile[num67, num68].type == 164) { Main.tile[num67, num68].type = 161; WorldGen.SquareTileFrame(num67, num68, true); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num67, num68, 1); } } if (Main.tile[num67, num68].type == 403) { Main.tile[num67, num68].type = 396; WorldGen.SquareTileFrame(num67, num68, true); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num67, num68, 1); } } if (Main.tile[num67, num68].type == 402) { Main.tile[num67, num68].type = 397; WorldGen.SquareTileFrame(num67, num68, true); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num67, num68, 1); } } } } } } return; } } else if (this.aiStyle == 7) { if (Main.player[this.owner].dead || Main.player[this.owner].stoned || Main.player[this.owner].webbed || Main.player[this.owner].frozen) { this.Kill(); return; } Vector2 mountedCenter = Main.player[this.owner].MountedCenter; Vector2 vector6 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num69 = mountedCenter.X - vector6.X; float num70 = mountedCenter.Y - vector6.Y; float num71 = (float)Math.Sqrt((double)(num69 * num69 + num70 * num70)); this.rotation = (float)Math.Atan2((double)num70, (double)num69) - 1.57f; if (this.type == 256) { this.rotation = (float)Math.Atan2((double)num70, (double)num69) + 3.92500019f; } if (this.type == 446) { Lighting.AddLight(mountedCenter, 0f, 0.4f, 0.3f); this.localAI[0] += 1f; if (this.localAI[0] >= 28f) { this.localAI[0] = 0f; } DelegateMethods.v3_1 = new Vector3(0f, 0.4f, 0.3f); Utils.PlotTileLine(base.Center, mountedCenter, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); } if (this.type >= 646 && this.type <= 649) { Vector3 zero = Vector3.Zero; switch (this.type) { case 646: zero = new Vector3(0.7f, 0.5f, 0.1f); break; case 647: zero = new Vector3(0f, 0.6f, 0.7f); break; case 648: zero = new Vector3(0.6f, 0.2f, 0.6f); break; case 649: zero = new Vector3(0.6f, 0.6f, 0.9f); break; } Lighting.AddLight(mountedCenter, zero); Lighting.AddLight(base.Center, zero); DelegateMethods.v3_1 = zero; Utils.PlotTileLine(base.Center, mountedCenter, 8f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); } if (this.ai[0] == 0f) { if ((num71 > 300f && this.type == 13) || (num71 > 400f && this.type == 32) || (num71 > 440f && this.type == 73) || (num71 > 440f && this.type == 74) || (num71 > 250f && this.type == 165) || (num71 > 350f && this.type == 256) || (num71 > 500f && this.type == 315) || (num71 > 550f && this.type == 322) || (num71 > 400f && this.type == 331) || (num71 > 550f && this.type == 332) || (num71 > 400f && this.type == 372) || (num71 > 300f && this.type == 396) || (num71 > 550f && this.type >= 646 && this.type <= 649) || (num71 > 480f && ((this.type >= 486 && this.type <= 489) || this.type == 820)) || (num71 > 500f && this.type == 446))// { this.ai[0] = 1f; } else if (this.type >= 230 && this.type <= 235) { int num72 = 300 + (this.type - 230) * 30; if (num71 > (float)num72) { this.ai[0] = 1f; } } Vector2 value4 = base.Center - new Vector2(5f); Vector2 value5 = base.Center + new Vector2(5f); Point point = (value4 - new Vector2(16f)).ToTileCoordinates(); Point point2 = (value5 + new Vector2(32f)).ToTileCoordinates(); int num73 = point.X; int num74 = point2.X; int num75 = point.Y; int num76 = point2.Y; if (num73 < 0) { num73 = 0; } if (num74 > Main.maxTilesX) { num74 = Main.maxTilesX; } if (num75 < 0) { num75 = 0; } if (num76 > Main.maxTilesY) { num76 = Main.maxTilesY; } for (int num77 = num73; num77 < num74; num77++) { int num78 = num75; while (num78 < num76) { if (Main.tile[num77, num78] == null) { Main.tile[num77, num78] = new Tile(); } Vector2 vector7; vector7.X = (float)(num77 * 16); vector7.Y = (float)(num78 * 16); if (value4.X + 10f > vector7.X && value4.X < vector7.X + 16f && value4.Y + 10f > vector7.Y && value4.Y < vector7.Y + 16f && Main.tile[num77, num78].nactive() && (Main.tileSolid[(int)Main.tile[num77, num78].type] || Main.tile[num77, num78].type == 314) && (this.type != 403 || Main.tile[num77, num78].type == 314)) { if (Main.player[this.owner].grapCount < 10) { Main.player[this.owner].grappling[Main.player[this.owner].grapCount] = this.whoAmI; Main.player[this.owner].grapCount++; } if (Main.myPlayer == this.owner) { int num79 = 0; int num80 = -1; int num81 = 100000; if (this.type == 73 || this.type == 74) { for (int num82 = 0; num82 < 1000; num82++) { if (num82 != this.whoAmI && Main.projectile[num82].active && Main.projectile[num82].owner == this.owner && Main.projectile[num82].aiStyle == 7 && Main.projectile[num82].ai[0] == 2f) { Main.projectile[num82].Kill(); } } } else { int num83 = 3; if (this.type == 165) { num83 = 8; } if (this.type == 256) { num83 = 2; } if (this.type == 372) { num83 = 2; } if (this.type >= 646 && this.type <= 649) { num83 = 4; } for (int num84 = 0; num84 < 1000; num84++) { if (Main.projectile[num84].active && Main.projectile[num84].owner == this.owner && Main.projectile[num84].aiStyle == 7) { if (Main.projectile[num84].timeLeft < num81) { num80 = num84; num81 = Main.projectile[num84].timeLeft; } num79++; } } if (num79 > num83) { Main.projectile[num80].Kill(); } } } WorldGen.KillTile(num77, num78, true, true, false); Main.PlaySound(0, num77 * 16, num78 * 16, 1); this.velocity.X = 0f; this.velocity.Y = 0f; this.ai[0] = 2f; this.position.X = (float)(num77 * 16 + 8 - this.width / 2); this.position.Y = (float)(num78 * 16 + 8 - this.height / 2); this.damage = 0; this.netUpdate = true; if (Main.myPlayer == this.owner) { NetMessage.SendData(13, -1, -1, "", this.owner, 0f, 0f, 0f, 0, 0, 0); break; } break; } else { num78++; } } if (this.ai[0] == 2f) { return; } } return; } if (this.ai[0] == 1f) { float num85 = 11f; if (this.type == 32) { num85 = 15f; } if (this.type == 73 || this.type == 74) { num85 = 17f; } if (this.type == 315) { num85 = 20f; } if (this.type == 322) { num85 = 22f; } if (this.type >= 230 && this.type <= 235) { num85 = 11f + (float)(this.type - 230) * 0.75f; } if (this.type == 446) { num85 = 20f; } if ((this.type >= 486 && this.type <= 489) || this.type == 820) { num85 = 18f; } if (this.type >= 646 && this.type <= 649) { num85 = 24f; } if (this.type == 332) { num85 = 17f; } if (num71 < 24f) { this.Kill(); } num71 = num85 / num71; num69 *= num71; num70 *= num71; this.velocity.X = num69; this.velocity.Y = num70; return; } if (this.ai[0] == 2f) { int num86 = (int)(this.position.X / 16f) - 1; int num87 = (int)((this.position.X + (float)this.width) / 16f) + 2; int num88 = (int)(this.position.Y / 16f) - 1; int num89 = (int)((this.position.Y + (float)this.height) / 16f) + 2; if (num86 < 0) { num86 = 0; } if (num87 > Main.maxTilesX) { num87 = Main.maxTilesX; } if (num88 < 0) { num88 = 0; } if (num89 > Main.maxTilesY) { num89 = Main.maxTilesY; } bool flag2 = true; for (int num90 = num86; num90 < num87; num90++) { for (int num91 = num88; num91 < num89; num91++) { if (Main.tile[num90, num91] == null) { Main.tile[num90, num91] = new Tile(); } Vector2 vector8; vector8.X = (float)(num90 * 16); vector8.Y = (float)(num91 * 16); if (this.position.X + (float)(this.width / 2) > vector8.X && this.position.X + (float)(this.width / 2) < vector8.X + 16f && this.position.Y + (float)(this.height / 2) > vector8.Y && this.position.Y + (float)(this.height / 2) < vector8.Y + 16f && Main.tile[num90, num91].nactive() && (Main.tileSolid[(int)Main.tile[num90, num91].type] || Main.tile[num90, num91].type == 314 || Main.tile[num90, num91].type == 5)) { flag2 = false; } } } if (flag2) { this.ai[0] = 1f; return; } if (Main.player[this.owner].grapCount < 10) { Main.player[this.owner].grappling[Main.player[this.owner].grapCount] = this.whoAmI; Main.player[this.owner].grapCount++; return; } } } else if (this.aiStyle == 8) { if (this.type == 258 && this.localAI[0] == 0f) { this.localAI[0] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 20); } if (this.type == 96 && this.localAI[0] == 0f) { this.localAI[0] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 20); } if (this.type == 27) { for (int num92 = 0; num92 < 5; num92++) { float num93 = this.velocity.X / 3f * (float)num92; float num94 = this.velocity.Y / 3f * (float)num92; int num95 = 4; int num96 = Dust.NewDust(new Vector2(this.position.X + (float)num95, this.position.Y + (float)num95), this.width - num95 * 2, this.height - num95 * 2, 172, 0f, 0f, 100, default(Color), 1.2f); Main.dust[num96].noGravity = true; Main.dust[num96].velocity *= 0.1f; Main.dust[num96].velocity += this.velocity * 0.1f; Dust expr_47FA_cp_0 = Main.dust[num96]; expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num93; Dust expr_4815_cp_0 = Main.dust[num96]; expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num94; } if (Main.rand.Next(5) == 0) { int num97 = 4; int num98 = Dust.NewDust(new Vector2(this.position.X + (float)num97, this.position.Y + (float)num97), this.width - num97 * 2, this.height - num97 * 2, 172, 0f, 0f, 100, default(Color), 0.6f); Main.dust[num98].velocity *= 0.25f; Main.dust[num98].velocity += this.velocity * 0.5f; } } else if (this.type == 656 || this.type == 658) { for (int num92 = 0; num92 < 5; num92++) { float num93 = this.velocity.X / 3f * (float)num92; float num94 = this.velocity.Y / 3f * (float)num92; int num95 = 4; int num96 = Dust.NewDust(new Vector2(this.position.X + (float)num95, this.position.Y + (float)num95), this.width - num95 * 2, this.height - num95 * 2, 182, 0f, 0f, 100, default(Color), 1.2f); Main.dust[num96].noGravity = true; Main.dust[num96].velocity *= 0.1f; Main.dust[num96].velocity += this.velocity * 0.1f; Dust expr_47FA_cp_0 = Main.dust[num96]; expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num93; Dust expr_4815_cp_0 = Main.dust[num96]; expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num94; } if (Main.rand.Next(5) == 0) { int num97 = 4; int num98 = Dust.NewDust(new Vector2(this.position.X + (float)num97, this.position.Y + (float)num97), this.width - num97 * 2, this.height - num97 * 2, 182, 0f, 0f, 100, default(Color), 0.6f); Main.dust[num98].velocity *= 0.25f; Main.dust[num98].velocity += this.velocity * 0.5f; } } else if (this.type == 502) { float num99 = (float)Main.DiscoR / 255f; float num100 = (float)Main.DiscoG / 255f; float num101 = (float)Main.DiscoB / 255f; num99 = (0.5f + num99) / 2f; num100 = (0.5f + num100) / 2f; num101 = (0.5f + num101) / 2f; Lighting.AddLight(base.Center, num99, num100, num101); } else if (this.type == 95 || this.type == 96) { int num102 = Dust.NewDust(new Vector2(this.position.X + this.velocity.X, this.position.Y + this.velocity.Y), this.width, this.height, 75, this.velocity.X, this.velocity.Y, 100, default(Color), 3f * this.scale); Main.dust[num102].noGravity = true; } else if (this.type == 253) { for (int num103 = 0; num103 < 2; num103++) { int num104 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 135, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, default(Color), 2f); Main.dust[num104].noGravity = true; Dust expr_4AB0_cp_0 = Main.dust[num104]; expr_4AB0_cp_0.velocity.X = expr_4AB0_cp_0.velocity.X * 0.3f; Dust expr_4ACE_cp_0 = Main.dust[num104]; expr_4ACE_cp_0.velocity.Y = expr_4ACE_cp_0.velocity.Y * 0.3f; } } else { for (int num105 = 0; num105 < 2; num105++) { int num106 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, default(Color), 2f); Main.dust[num106].noGravity = true; Dust expr_4B7B_cp_0 = Main.dust[num106]; expr_4B7B_cp_0.velocity.X = expr_4B7B_cp_0.velocity.X * 0.3f; Dust expr_4B99_cp_0 = Main.dust[num106]; expr_4B99_cp_0.velocity.Y = expr_4B99_cp_0.velocity.Y * 0.3f; } } if (this.type != 27 && this.type != 96 && this.type != 258) { this.ai[1] += 1f; } if (this.ai[1] >= 20f) { this.velocity.Y = this.velocity.Y + 0.2f; } if (this.type == 502) { this.rotation = this.velocity.ToRotation() + 1.57079637f; if (this.velocity.X != 0f) { this.spriteDirection = (this.direction = Math.Sign(this.velocity.X)); } } else { this.rotation += 0.3f * (float)this.direction; } if (this.velocity.Y > 16f) { this.velocity.Y = 16f; return; } } else if (this.aiStyle == 9) { if (this.type == 491) { if (Main.rand.Next(2) == 0) { int num107 = Main.rand.Next(3); if (num107 == 0) { num107 = 15; } else if (num107 == 1) { num107 = 57; } else { num107 = 58; } int num108 = Dust.NewDust(this.position, this.width, this.height, num107, this.velocity.X * 0.25f, this.velocity.Y * 0.25f, 255, default(Color), 0.7f); Main.dust[num108].velocity *= 0.25f; Main.dust[num108].position = (Main.dust[num108].position + this.position) / 2f; } } else if (this.type == 34) { int num109 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, default(Color), 3.5f); Main.dust[num109].noGravity = true; Main.dust[num109].velocity *= 1.4f; num109 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, default(Color), 1.5f); } else if (this.type == 79) { if (this.soundDelay == 0 && Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) > 2f) { this.soundDelay = 10; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 9); } for (int num110 = 0; num110 < 1; num110++) { int num111 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.5f); Main.dust[num111].velocity *= 0.1f; Main.dust[num111].velocity += this.velocity * 0.2f; Main.dust[num111].position.X = this.position.X + (float)(this.width / 2) + 4f + (float)Main.rand.Next(-2, 3); Main.dust[num111].position.Y = this.position.Y + (float)(this.height / 2) + (float)Main.rand.Next(-2, 3); Main.dust[num111].noGravity = true; } } else { if (this.soundDelay == 0 && Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) > 2f) { this.soundDelay = 10; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 9); } int num112 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 15, 0f, 0f, 100, default(Color), 2f); Main.dust[num112].velocity *= 0.3f; Main.dust[num112].position.X = this.position.X + (float)(this.width / 2) + 4f + (float)Main.rand.Next(-4, 5); Main.dust[num112].position.Y = this.position.Y + (float)(this.height / 2) + (float)Main.rand.Next(-4, 5); Main.dust[num112].noGravity = true; } if (Main.myPlayer == this.owner && this.ai[0] <= 0f) { if (Main.player[this.owner].channel) { float num113 = 12f; if (this.type == 16) { num113 = 15f; } if (this.type == 491) { num113 = 20f; } Vector2 vector9 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num114 = (float)Main.mouseX + Main.screenPosition.X - vector9.X; float num115 = (float)Main.mouseY + Main.screenPosition.Y - vector9.Y; if (Main.player[this.owner].gravDir == -1f) { num115 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector9.Y; } float num116 = (float)Math.Sqrt((double)(num114 * num114 + num115 * num115)); num116 = (float)Math.Sqrt((double)(num114 * num114 + num115 * num115)); if (this.ai[0] < 0f) { this.ai[0] += 1f; } if (this.type == 491 && num116 < 100f) { if (this.velocity.Length() < num113) { this.velocity *= 1.1f; if (this.velocity.Length() > num113) { this.velocity.Normalize(); this.velocity *= num113; } } if (this.ai[0] == 0f) { this.ai[0] = -10f; } } else if (num116 > num113) { num116 = num113 / num116; num114 *= num116; num115 *= num116; int num117 = (int)(num114 * 1000f); int num118 = (int)(this.velocity.X * 1000f); int num119 = (int)(num115 * 1000f); int num120 = (int)(this.velocity.Y * 1000f); if (num117 != num118 || num119 != num120) { this.netUpdate = true; } if (this.type == 491) { Vector2 value6 = new Vector2(num114, num115); this.velocity = (this.velocity * 4f + value6) / 5f; } else { this.velocity.X = num114; this.velocity.Y = num115; } } else { int num121 = (int)(num114 * 1000f); int num122 = (int)(this.velocity.X * 1000f); int num123 = (int)(num115 * 1000f); int num124 = (int)(this.velocity.Y * 1000f); if (num121 != num122 || num123 != num124) { this.netUpdate = true; } this.velocity.X = num114; this.velocity.Y = num115; } } else if (this.ai[0] <= 0f) { this.netUpdate = true; if (this.type != 491) { float num125 = 12f; Vector2 vector10 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num126 = (float)Main.mouseX + Main.screenPosition.X - vector10.X; float num127 = (float)Main.mouseY + Main.screenPosition.Y - vector10.Y; if (Main.player[this.owner].gravDir == -1f) { num127 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector10.Y; } float num128 = (float)Math.Sqrt((double)(num126 * num126 + num127 * num127)); if (num128 == 0f || this.ai[0] < 0f) { vector10 = new Vector2(Main.player[this.owner].position.X + (float)(Main.player[this.owner].width / 2), Main.player[this.owner].position.Y + (float)(Main.player[this.owner].height / 2)); num126 = this.position.X + (float)this.width * 0.5f - vector10.X; num127 = this.position.Y + (float)this.height * 0.5f - vector10.Y; num128 = (float)Math.Sqrt((double)(num126 * num126 + num127 * num127)); } num128 = num125 / num128; num126 *= num128; num127 *= num128; this.velocity.X = num126; this.velocity.Y = num127; if (this.velocity.X == 0f && this.velocity.Y == 0f) { this.Kill(); } } this.ai[0] = 1f; } } if (this.type == 491) { this.localAI[0] += 1f; if (this.ai[0] > 0f && this.localAI[0] > 15f) { this.tileCollide = false; Vector2 vector11 = Main.player[this.owner].Center - base.Center; if (vector11.Length() < 20f) { this.Kill(); } vector11.Normalize(); vector11 *= 25f; this.velocity = (this.velocity * 5f + vector11) / 6f; } if (this.ai[0] < 0f || (this.velocity.X == 0f && this.velocity.Y == 0f)) { this.rotation += 0.3f; } else if (this.ai[0] > 0f) { this.rotation += 0.3f * (float)this.direction; } else { this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f; } } else if (this.type == 34) { this.rotation += 0.3f * (float)this.direction; } else if (this.velocity.X != 0f || this.velocity.Y != 0f) { this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 2.355f; } if (this.velocity.Y > 16f) { this.velocity.Y = 16f; return; } } else if (this.aiStyle == 10) { if (this.type == 31 && this.ai[0] != 2f) { if (Main.rand.Next(2) == 0) { int num129 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 32, 0f, this.velocity.Y / 2f, 0, default(Color), 1f); Dust expr_5991_cp_0 = Main.dust[num129]; expr_5991_cp_0.velocity.X = expr_5991_cp_0.velocity.X * 0.4f; } } else if (this.type == 39) { if (Main.rand.Next(2) == 0) { int num130 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 38, 0f, this.velocity.Y / 2f, 0, default(Color), 1f); Dust expr_5A2B_cp_0 = Main.dust[num130]; expr_5A2B_cp_0.velocity.X = expr_5A2B_cp_0.velocity.X * 0.4f; } } else if (this.type >= 411 && this.type <= 414) { if (Main.rand.Next(3) == 0) { int num131 = 9; if (this.type == 412 || this.type == 414) { num131 = 11; } if (this.type == 413) { num131 = 19; } int num132 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, num131, 0f, this.velocity.Y / 2f, 0, default(Color), 1f); Main.dust[num132].noGravity = true; Main.dust[num132].velocity -= this.velocity * 0.5f; } } else if (this.type == 40) { if (Main.rand.Next(2) == 0) { int num133 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 36, 0f, this.velocity.Y / 2f, 0, default(Color), 1f); Main.dust[num133].velocity *= 0.4f; } } else if (this.type == 42 || this.type == 31) { if (Main.rand.Next(2) == 0) { int num134 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 32, 0f, 0f, 0, default(Color), 1f); Dust expr_5C54_cp_0 = Main.dust[num134]; expr_5C54_cp_0.velocity.X = expr_5C54_cp_0.velocity.X * 0.4f; } } else if (this.type == 56 || this.type == 65) { if (Main.rand.Next(2) == 0) { int num135 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 14, 0f, 0f, 0, default(Color), 1f); Dust expr_5CEC_cp_0 = Main.dust[num135]; expr_5CEC_cp_0.velocity.X = expr_5CEC_cp_0.velocity.X * 0.4f; } } else if (this.type == 67 || this.type == 68) { if (Main.rand.Next(2) == 0) { int num136 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 51, 0f, 0f, 0, default(Color), 1f); Dust expr_5D84_cp_0 = Main.dust[num136]; expr_5D84_cp_0.velocity.X = expr_5D84_cp_0.velocity.X * 0.4f; } } else if (this.type == 71) { if (Main.rand.Next(2) == 0) { int num137 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 53, 0f, 0f, 0, default(Color), 1f); Dust expr_5E12_cp_0 = Main.dust[num137]; expr_5E12_cp_0.velocity.X = expr_5E12_cp_0.velocity.X * 0.4f; } } else if (this.type == 179) { if (Main.rand.Next(2) == 0) { int num138 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 149, 0f, 0f, 0, default(Color), 1f); Dust expr_5EA6_cp_0 = Main.dust[num138]; expr_5EA6_cp_0.velocity.X = expr_5EA6_cp_0.velocity.X * 0.4f; } } else if (this.type == 241 || this.type == 354) { if (Main.rand.Next(2) == 0) { int num139 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 36, 0f, 0f, 0, default(Color), 1f); Dust expr_5F41_cp_0 = Main.dust[num139]; expr_5F41_cp_0.velocity.X = expr_5F41_cp_0.velocity.X * 0.4f; } } 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, 0f, 0f, 0, default(Color), 1f); } this.tileCollide = true; this.localAI[1] = 0f; if (Main.myPlayer == this.owner && this.ai[0] == 0f) { this.tileCollide = false; if (Main.player[this.owner].channel) { this.localAI[1] = -1f; float num140 = 12f; Vector2 vector12 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num141 = (float)Main.mouseX + Main.screenPosition.X - vector12.X; float num142 = (float)Main.mouseY + Main.screenPosition.Y - vector12.Y; if (Main.player[this.owner].gravDir == -1f) { num142 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector12.Y; } float num143 = (float)Math.Sqrt((double)(num141 * num141 + num142 * num142)); num143 = (float)Math.Sqrt((double)(num141 * num141 + num142 * num142)); if (num143 > num140) { num143 = num140 / num143; num141 *= num143; num142 *= num143; if (num141 != this.velocity.X || num142 != this.velocity.Y) { this.netUpdate = true; } this.velocity.X = num141; this.velocity.Y = num142; } else { if (num141 != this.velocity.X || num142 != this.velocity.Y) { this.netUpdate = true; } this.velocity.X = num141; this.velocity.Y = num142; } } else { this.ai[0] = 1f; this.netUpdate = true; } } if (this.ai[0] == 1f && this.type != 109) { if (this.type == 42 || this.type == 65 || this.type == 68 || this.type == 354) { this.ai[1] += 1f; if (this.ai[1] >= 60f) { this.ai[1] = 60f; this.velocity.Y = this.velocity.Y + 0.2f; } } else { this.velocity.Y = this.velocity.Y + 0.41f; } } else if (this.ai[0] == 2f && this.type != 109) { this.velocity.Y = this.velocity.Y + 0.2f; if ((double)this.velocity.X < -0.04) { this.velocity.X = this.velocity.X + 0.04f; } else if ((double)this.velocity.X > 0.04) { this.velocity.X = this.velocity.X - 0.04f; } else { this.velocity.X = 0f; } } this.rotation += 0.1f; if (this.velocity.Y > 10f) { this.velocity.Y = 10f; return; } } else if (this.aiStyle == 11) { if (this.type == 778) { if (Main.player[Main.myPlayer].shenaniganBirdnana) { this.timeLeft = 2; } } if (this.type == 72 || this.type == 86 || this.type == 87) { if (this.velocity.X > 0f) { this.spriteDirection = -1; } else if (this.velocity.X < 0f) { this.spriteDirection = 1; } this.rotation = this.velocity.X * 0.1f; this.frameCounter++; if (this.frameCounter >= 4) { this.frame++; this.frameCounter = 0; } if (this.frame >= 4) { this.frame = 0; } if (Main.rand.Next(6) == 0) { int num144 = 56; if (this.type == 86) { num144 = 73; } else if (this.type == 87) { num144 = 74; } int num145 = Dust.NewDust(this.position, this.width, this.height, num144, 0f, 0f, 200, default(Color), 0.8f); Main.dust[num145].velocity *= 0.3f; Main.dust[num145].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cLight, Main.player[this.owner]); } } else { this.rotation += 0.02f; } if (Main.myPlayer == this.owner) { if (this.type == 72) { if (Main.player[Main.myPlayer].blueFairy) { this.timeLeft = 2; } } else if (this.type == 86) { if (Main.player[Main.myPlayer].redFairy) { this.timeLeft = 2; } } else if (this.type == 87) { if (Main.player[Main.myPlayer].greenFairy) { this.timeLeft = 2; } } else if (Main.player[Main.myPlayer].lightOrb) { this.timeLeft = 2; } } if (Main.player[this.owner].dead) { this.Kill(); return; } float num146 = 3f; if (this.type == 72 || this.type == 86 || this.type == 87) { num146 = 3.75f; } Vector2 vector13 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num147 = Main.player[this.owner].position.X + (float)(Main.player[this.owner].width / 2) - vector13.X; float num148 = Main.player[this.owner].position.Y + (float)(Main.player[this.owner].height / 2) - vector13.Y; int num149 = 70; if (this.type == 18) { if (Main.player[this.owner].controlUp) { num148 = Main.player[this.owner].position.Y - 40f - vector13.Y; num147 -= 6f; num149 = 4; } else if (Main.player[this.owner].controlDown) { num148 = Main.player[this.owner].position.Y + (float)Main.player[this.owner].height + 40f - vector13.Y; num147 -= 6f; num149 = 4; } } float num150 = (float)Math.Sqrt((double)(num147 * num147 + num148 * num148)); num150 = (float)Math.Sqrt((double)(num147 * num147 + num148 * num148)); if (this.type == 72 || this.type == 86 || this.type == 87) { num149 = 40; } if (num150 > 800f) { this.position.X = Main.player[this.owner].position.X + (float)(Main.player[this.owner].width / 2) - (float)(this.width / 2); this.position.Y = Main.player[this.owner].position.Y + (float)(Main.player[this.owner].height / 2) - (float)(this.height / 2); return; } if (num150 > (float)num149) { num150 = num146 / num150; num147 *= num150; num148 *= num150; this.velocity.X = num147; this.velocity.Y = num148; return; } this.velocity.X = 0f; this.velocity.Y = 0f; return; } else if (this.aiStyle == 12) { if (this.type == 288 && this.localAI[0] == 0f || this.type == 774) { this.localAI[0] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 17); } if (this.type == 280 || this.type == 288 || this.type == 804)// { this.scale -= 0.002f; if (this.scale <= 0f) { this.Kill(); } if (this.type == 288) { this.ai[0] = 4f; } if (this.ai[0] <= 3f) { this.ai[0] += 1f; return; } this.velocity.Y = this.velocity.Y + 0.075f; for (int num151 = 0; num151 < 3; num151++) { float num152 = this.velocity.X / 3f * (float)num151; float num153 = this.velocity.Y / 3f * (float)num151; int num154 = 14; int dust = 170; if (this.type == 804) { dust = 201;//and newdust below has this too } int num155 = Dust.NewDust(new Vector2(this.position.X + (float)num154, this.position.Y + (float)num154), this.width - num154 * 2, this.height - num154 * 2, dust, 0f, 0f, 100, default(Color), 1f); Main.dust[num155].noGravity = true; Main.dust[num155].velocity *= 0.1f; Main.dust[num155].velocity += this.velocity * 0.5f; Dust expr_6A04_cp_0 = Main.dust[num155]; expr_6A04_cp_0.position.X = expr_6A04_cp_0.position.X - num152; Dust expr_6A1F_cp_0 = Main.dust[num155]; expr_6A1F_cp_0.position.Y = expr_6A1F_cp_0.position.Y - num153; } if (Main.rand.Next(8) == 0) { int num156 = 16; int num157 = Dust.NewDust(new Vector2(this.position.X + (float)num156, this.position.Y + (float)num156), this.width - num156 * 2, this.height - num156 * 2, 170, 0f, 0f, 100, default(Color), 0.5f); Main.dust[num157].velocity *= 0.25f; Main.dust[num157].velocity += this.velocity * 0.5f; return; } } else { this.scale -= 0.02f; if (this.scale <= 0f) { this.Kill(); } if (this.ai[0] > 3f) { this.velocity.Y = this.velocity.Y + 0.2f; for (int num158 = 0; num158 < 1; num158++) { for (int num159 = 0; num159 < 3; num159++) { float num160 = this.velocity.X / 3f * (float)num159; float num161 = this.velocity.Y / 3f * (float)num159; int num162 = 6; int num163 = Dust.NewDust(new Vector2(this.position.X + (float)num162, this.position.Y + (float)num162), this.width - num162 * 2, this.height - num162 * 2, 172, 0f, 0f, 100, default(Color), 1.2f); Main.dust[num163].noGravity = true; Main.dust[num163].velocity *= 0.3f; Main.dust[num163].velocity += this.velocity * 0.5f; Dust expr_6C6A_cp_0 = Main.dust[num163]; expr_6C6A_cp_0.position.X = expr_6C6A_cp_0.position.X - num160; Dust expr_6C85_cp_0 = Main.dust[num163]; expr_6C85_cp_0.position.Y = expr_6C85_cp_0.position.Y - num161; } if (Main.rand.Next(8) == 0) { int num164 = 6; int num165 = Dust.NewDust(new Vector2(this.position.X + (float)num164, this.position.Y + (float)num164), this.width - num164 * 2, this.height - num164 * 2, 172, 0f, 0f, 100, default(Color), 0.75f); Main.dust[num165].velocity *= 0.5f; Main.dust[num165].velocity += this.velocity * 0.5f; } } return; } this.ai[0] += 1f; return; } } else if (this.aiStyle == 13) { if (Main.player[this.owner].dead) { this.Kill(); return; } if (this.type != 481) { Main.player[this.owner].itemAnimation = 5; Main.player[this.owner].itemTime = 5; } if (this.alpha == 0) { if (this.position.X + (float)(this.width / 2) > Main.player[this.owner].position.X + (float)(Main.player[this.owner].width / 2)) { Main.player[this.owner].ChangeDir(1); } else { Main.player[this.owner].ChangeDir(-1); } } if (this.type == 481) { if (this.ai[0] == 0f) { this.extraUpdates = 0; } else { this.extraUpdates = 1; } } Vector2 vector14 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num166 = Main.player[this.owner].position.X + (float)(Main.player[this.owner].width / 2) - vector14.X; float num167 = Main.player[this.owner].position.Y + (float)(Main.player[this.owner].height / 2) - vector14.Y; float num168 = (float)Math.Sqrt((double)(num166 * num166 + num167 * num167)); if (this.type == 661) { Lighting.AddLight((int)this.Center.X / 16, (int)this.Center.Y / 16, 0.93f, 0.84f, 0.42f); } if (this.ai[0] == 0f) { if (num168 > 700f) { this.ai[0] = 1f; } else if ((this.type == 262 || this.type == 661) && num168 > 500f) { this.ai[0] = 1f; } else if (this.type == 271 && num168 > 200f) { this.ai[0] = 1f; } else if (this.type == 273 && num168 > 150f) { this.ai[0] = 1f; } else if (this.type == 481 && num168 > 350f) { this.ai[0] = 1f; } this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f; this.ai[1] += 1f; if (this.ai[1] > 5f) { this.alpha = 0; } if ((this.type == 262 || this.type == 661) && this.ai[1] > 8f) { this.ai[1] = 8f; } if (this.type == 271 && this.ai[1] > 8f) { this.ai[1] = 8f; } if (this.type == 273 && this.ai[1] > 8f) { this.ai[1] = 8f; } if (this.type == 481 && this.ai[1] > 8f) { this.ai[1] = 8f; } if (this.type == 404 && this.ai[1] > 8f) { this.ai[1] = 0f; } if (this.ai[1] >= 10f) { this.ai[1] = 15f; this.velocity.Y = this.velocity.Y + 0.3f; } if ((this.type == 262 || this.type == 661) && this.velocity.X < 0f) { this.spriteDirection = -1; } else if (this.type == 262 || this.type == 661) { this.spriteDirection = 1; } if (this.type == 271 && this.velocity.X < 0f) { this.spriteDirection = -1; return; } if (this.type == 271) { this.spriteDirection = 1; return; } } else if (this.ai[0] == 1f) { this.tileCollide = false; this.rotation = (float)Math.Atan2((double)num167, (double)num166) - 1.57f; float num169 = 20f; if (this.type == 262 || this.type == 661) { num169 = 30f; } if (num168 < 50f) { this.Kill(); } num168 = num169 / num168; num166 *= num168; num167 *= num168; this.velocity.X = num166; this.velocity.Y = num167; if ((this.type == 262 || this.type == 661) && this.velocity.X < 0f) { this.spriteDirection = 1; } else if (this.type == 262 || this.type == 661) { this.spriteDirection = -1; } if (this.type == 271 && this.velocity.X < 0f) { this.spriteDirection = 1; return; } if (this.type == 271) { this.spriteDirection = -1; return; } } } else if (this.aiStyle == 14) { if (this.type == 473 && Main.netMode != 2) { this.localAI[0] += 1f; if (this.localAI[0] >= 10f) { this.localAI[0] = 0f; int num170 = 30; if ((base.Center - Main.player[Main.myPlayer].Center).Length() < (float)(Main.screenWidth + num170 * 16)) { int num171 = (int)base.Center.X / 16; int num172 = (int)base.Center.Y / 16; for (int num173 = num171 - num170; num173 <= num171 + num170; num173++) { for (int num174 = num172 - num170; num174 <= num172 + num170; num174++) { if (Main.rand.Next(4) == 0) { Vector2 vector15 = new Vector2((float)(num171 - num173), (float)(num172 - num174)); if (vector15.Length() < (float)num170 && num173 > 0 && num173 < Main.maxTilesX - 1 && num174 > 0 && num174 < Main.maxTilesY - 1 && Main.tile[num173, num174] != null && Main.tile[num173, num174].active()) { bool flag3 = false; if (Main.tile[num173, num174].type == 185 && Main.tile[num173, num174].frameY == 18) { if (Main.tile[num173, num174].frameX >= 576 && Main.tile[num173, num174].frameX <= 882) { flag3 = true; } } else if (Main.tile[num173, num174].type == 186 && Main.tile[num173, num174].frameX >= 864 && Main.tile[num173, num174].frameX <= 1170) { flag3 = true; } if (flag3 || Main.tileSpelunker[(int)Main.tile[num173, num174].type] || (Main.tileAlch[(int)Main.tile[num173, num174].type] && Main.tile[num173, num174].type != 82)) { int num175 = Dust.NewDust(new Vector2((float)(num173 * 16), (float)(num174 * 16)), 16, 16, 204, 0f, 0f, 150, default(Color), 0.3f); Main.dust[num175].fadeIn = 0.75f; Main.dust[num175].velocity *= 0.1f; Main.dust[num175].noLight = true; } } } } } } } } if (this.type == 352) { if (this.localAI[1] == 0f) { this.localAI[1] = 1f; } this.alpha += (int)(25f * this.localAI[1]); if (this.alpha <= 0) { this.alpha = 0; this.localAI[1] = 1f; } else if (this.alpha >= 255) { this.alpha = 255; this.localAI[1] = -1f; } this.scale += this.localAI[1] * 0.01f; } if (this.type == 346) { if (this.localAI[0] == 0f) { this.localAI[0] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 1); } this.frame = (int)this.ai[1]; if (this.owner == Main.myPlayer && this.timeLeft == 1) { for (int num176 = 0; num176 < 5; num176++) { float num177 = 10f; Vector2 vector16 = new Vector2(base.Center.X, base.Center.Y); float num178 = (float)Main.rand.Next(-20, 21); float num179 = (float)Main.rand.Next(-20, 0); float num180 = (float)Math.Sqrt((double)(num178 * num178 + num179 * num179)); num180 = num177 / num180; num178 *= num180; num179 *= num180; num178 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; num179 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; Projectile.NewProjectile(vector16.X, vector16.Y, num178, num179, 347, 40, 0f, Main.myPlayer, 0f, this.ai[1]); } } } if (this.type == 196) { int num181 = Main.rand.Next(1, 3); for (int num182 = 0; num182 < num181; num182++) { int num183 = Dust.NewDust(this.position, this.width, this.height, 31, 0f, 0f, 100, default(Color), 1f); Main.dust[num183].alpha += Main.rand.Next(100); Main.dust[num183].velocity *= 0.3f; Dust expr_78AB_cp_0 = Main.dust[num183]; expr_78AB_cp_0.velocity.X = expr_78AB_cp_0.velocity.X + (float)Main.rand.Next(-10, 11) * 0.025f; Dust expr_78D9_cp_0 = Main.dust[num183]; expr_78D9_cp_0.velocity.Y = expr_78D9_cp_0.velocity.Y - (0.4f + (float)Main.rand.Next(-3, 14) * 0.15f); Main.dust[num183].fadeIn = 1.25f + (float)Main.rand.Next(20) * 0.15f; } } if (this.type == 53) { try { int num184 = (int)(this.position.X / 16f) - 1; int num185 = (int)((this.position.X + (float)this.width) / 16f) + 2; int num186 = (int)(this.position.Y / 16f) - 1; int num187 = (int)((this.position.Y + (float)this.height) / 16f) + 2; if (num184 < 0) { num184 = 0; } if (num185 > Main.maxTilesX) { num185 = Main.maxTilesX; } if (num186 < 0) { num186 = 0; } if (num187 > Main.maxTilesY) { num187 = Main.maxTilesY; } for (int num188 = num184; num188 < num185; num188++) { for (int num189 = num186; num189 < num187; num189++) { if (Main.tile[num188, num189] != null && Main.tile[num188, num189].nactive() && (Main.tileSolid[(int)Main.tile[num188, num189].type] || (Main.tileSolidTop[(int)Main.tile[num188, num189].type] && Main.tile[num188, num189].frameY == 0))) { Vector2 vector17; vector17.X = (float)(num188 * 16); vector17.Y = (float)(num189 * 16); if (this.position.X + (float)this.width > vector17.X && this.position.X < vector17.X + 16f && this.position.Y + (float)this.height > vector17.Y && this.position.Y < vector17.Y + 16f) { this.velocity.X = 0f; this.velocity.Y = -0.2f; } } } } } catch { } } if (this.type == 277) { if (this.alpha > 0) { this.alpha -= 30; if (this.alpha < 0) { this.alpha = 0; } } if (Main.expertMode) { float scaleFactor = 12f; int num190 = (int)Player.FindClosest(base.Center, 1, 1); Vector2 value7 = Main.player[num190].Center - base.Center; value7.Normalize(); value7 *= scaleFactor; int num191 = 200; this.velocity.X = (this.velocity.X * (float)(num191 - 1) + value7.X) / (float)num191; if (this.velocity.Length() > 16f) { this.velocity.Normalize(); this.velocity *= 16f; } } } if (this.type == 261 || this.type == 277) { this.ai[0] += 1f; if (this.ai[0] > 15f) { this.ai[0] = 15f; if (this.velocity.Y == 0f && this.velocity.X != 0f) { this.velocity.X = this.velocity.X * 0.97f; if ((double)this.velocity.X > -0.01 && (double)this.velocity.X < 0.01) { this.Kill(); } } this.velocity.Y = this.velocity.Y + 0.2f; } this.rotation += this.velocity.X * 0.05f; } else if (this.type == 378) { if (this.localAI[0] == 0f) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 17); this.localAI[0] += 1f; } Rectangle rectangle2 = new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height); for (int num192 = 0; num192 < 200; num192++) { if (Main.npc[num192].CanBeChasedBy(this, true)) { Rectangle value8 = new Rectangle((int)Main.npc[num192].position.X, (int)Main.npc[num192].position.Y, Main.npc[num192].width, Main.npc[num192].height); if (rectangle2.Intersects(value8)) { this.Kill(); return; } } } this.ai[0] += 1f; if (this.ai[0] > 10f) { this.ai[0] = 90f; if (this.velocity.Y == 0f && this.velocity.X != 0f) { this.velocity.X = this.velocity.X * 0.96f; if ((double)this.velocity.X > -0.01 && (double)this.velocity.X < 0.01) { this.Kill(); } } this.velocity.Y = this.velocity.Y + 0.2f; } this.rotation += this.velocity.X * 0.1f; } else if (this.type == 483) { this.ai[0] += 1f; if (this.ai[0] > 5f) { if (this.owner == Main.myPlayer && this.ai[0] > (float)Main.rand.Next(20, 130)) { this.Kill(); } if (this.velocity.Y == 0f && this.velocity.X != 0f) { this.velocity.X = this.velocity.X * 0.97f; if ((double)this.velocity.X > -0.01 && (double)this.velocity.X < 0.01) { this.velocity.X = 0f; this.netUpdate = true; } } this.velocity.Y = this.velocity.Y + 0.3f; this.velocity.X = this.velocity.X * 0.99f; } this.rotation += this.velocity.X * 0.05f; } else if (this.type == 538) { this.ai[0] += 1f; if (this.ai[0] > 60f || this.velocity.Y >= 0f) { this.alpha += 6; this.velocity *= 0.5f; } else if (this.ai[0] > 5f) { this.velocity.Y = this.velocity.Y + 0.1f; this.velocity.X = this.velocity.X * 1.025f; this.alpha -= 23; this.scale = 0.8f * (255f - (float)this.alpha) / 255f; if (this.alpha < 0) { this.alpha = 0; } } if (this.alpha >= 255 && this.ai[0] > 5f) { this.Kill(); return; } } else { this.ai[0] += 1f; if (this.ai[0] > 5f) { this.ai[0] = 5f; if (this.velocity.Y == 0f && this.velocity.X != 0f) { this.velocity.X = this.velocity.X * 0.97f; if ((double)this.velocity.X > -0.01 && (double)this.velocity.X < 0.01) { this.velocity.X = 0f; this.netUpdate = true; } } this.velocity.Y = this.velocity.Y + 0.2f; } this.rotation += this.velocity.X * 0.1f; } if (this.type == 538) { if (this.localAI[1] == 0f) { this.localAI[1] = 1f; Main.PlaySound(4, (int)this.position.X, (int)this.position.Y, 7); } if (this.velocity.Y < 0f && this.ai[0] < 60f) { if (Main.rand.Next(4) == 0) { int num193 = Dust.NewDust(this.position, this.width, this.height, 180, 0f, 0f, 100, default(Color), 1f); Main.dust[num193].position = base.Center; Main.dust[num193].scale += (float)Main.rand.Next(50) * 0.01f; Main.dust[num193].noGravity = true; Dust expr_835F_cp_0 = Main.dust[num193]; expr_835F_cp_0.velocity.Y = expr_835F_cp_0.velocity.Y - 2f; } if (Main.rand.Next(6) == 0) { int num194 = Dust.NewDust(this.position, this.width, this.height, 176, 0f, 0f, 100, default(Color), 1f); Main.dust[num194].position = base.Center; Main.dust[num194].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; Main.dust[num194].noGravity = true; Main.dust[num194].velocity *= 0.1f; } } } if (this.type == 450) { if (this.ai[1] == 0f) { this.ai[1] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 13); } if (Main.rand.Next(2) == 0) { int num195 = Dust.NewDust(this.position, this.width, this.height, 228, 0f, 0f, 100, default(Color), 1f); Dust expr_84CE_cp_0 = Main.dust[num195]; expr_84CE_cp_0.position.X = expr_84CE_cp_0.position.X - 2f; Dust expr_84EC_cp_0 = Main.dust[num195]; expr_84EC_cp_0.position.Y = expr_84EC_cp_0.position.Y + 2f; Main.dust[num195].scale += (float)Main.rand.Next(50) * 0.01f; Main.dust[num195].noGravity = true; Dust expr_853F_cp_0 = Main.dust[num195]; expr_853F_cp_0.velocity.Y = expr_853F_cp_0.velocity.Y - 2f; } if (Main.rand.Next(4) == 0) { int num196 = Dust.NewDust(this.position, this.width, this.height, 228, 0f, 0f, 100, default(Color), 1f); Dust expr_85AA_cp_0 = Main.dust[num196]; expr_85AA_cp_0.position.X = expr_85AA_cp_0.position.X - 2f; Dust expr_85C8_cp_0 = Main.dust[num196]; expr_85C8_cp_0.position.Y = expr_85C8_cp_0.position.Y + 2f; Main.dust[num196].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; Main.dust[num196].noGravity = true; Main.dust[num196].velocity *= 0.1f; } if (++this.frameCounter >= 3) { this.frameCounter = 0; if (++this.frame >= 5) { this.frame = 0; } } if ((double)this.velocity.Y < 0.25 && (double)this.velocity.Y > 0.15) { this.velocity.X = this.velocity.X * 0.8f; } this.rotation = -this.velocity.X * 0.05f; } if (this.type == 480) { this.alpha = 255; int num197 = Dust.NewDust(this.position, this.width, this.height, 75, 0f, 0f, 100, default(Color), 1f); Dust expr_8732_cp_0 = Main.dust[num197]; expr_8732_cp_0.position.X = expr_8732_cp_0.position.X - 2f; Dust expr_8750_cp_0 = Main.dust[num197]; expr_8750_cp_0.position.Y = expr_8750_cp_0.position.Y + 2f; Main.dust[num197].scale += (float)Main.rand.Next(50) * 0.01f; Main.dust[num197].noGravity = true; Dust expr_87A3_cp_0 = Main.dust[num197]; expr_87A3_cp_0.velocity.Y = expr_87A3_cp_0.velocity.Y - 2f; if (Main.rand.Next(2) == 0) { int num198 = Dust.NewDust(this.position, this.width, this.height, 75, 0f, 0f, 100, default(Color), 1f); Dust expr_880B_cp_0 = Main.dust[num198]; expr_880B_cp_0.position.X = expr_880B_cp_0.position.X - 2f; Dust expr_8829_cp_0 = Main.dust[num198]; expr_8829_cp_0.position.Y = expr_8829_cp_0.position.Y + 2f; Main.dust[num198].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; Main.dust[num198].noGravity = true; Main.dust[num198].velocity *= 0.1f; } } if ((this.type >= 326 && this.type <= 328) || (this.type >= 400 && this.type <= 402) || this.type == 665) { if (this.wet) { this.Kill(); } if (this.ai[1] == 0f && ((this.type >= 326 && this.type <= 328) || this.type == 665) ) { this.ai[1] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 13); } int num199 = Dust.NewDust(this.position, this.width, this.height, 6, 0f, 0f, 100, default(Color), 1f); Dust expr_8976_cp_0 = Main.dust[num199]; expr_8976_cp_0.position.X = expr_8976_cp_0.position.X - 2f; Dust expr_8994_cp_0 = Main.dust[num199]; expr_8994_cp_0.position.Y = expr_8994_cp_0.position.Y + 2f; Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; Main.dust[num199].noGravity = true; Dust expr_89E7_cp_0 = Main.dust[num199]; expr_89E7_cp_0.velocity.Y = expr_89E7_cp_0.velocity.Y - 2f; if (Main.rand.Next(2) == 0) { int num200 = Dust.NewDust(this.position, this.width, this.height, 6, 0f, 0f, 100, default(Color), 1f); Dust expr_8A4E_cp_0 = Main.dust[num200]; expr_8A4E_cp_0.position.X = expr_8A4E_cp_0.position.X - 2f; Dust expr_8A6C_cp_0 = Main.dust[num200]; expr_8A6C_cp_0.position.Y = expr_8A6C_cp_0.position.Y + 2f; Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; Main.dust[num200].noGravity = true; Main.dust[num200].velocity *= 0.1f; } if ((double)this.velocity.Y < 0.25 && (double)this.velocity.Y > 0.15) { this.velocity.X = this.velocity.X * 0.8f; } this.rotation = -this.velocity.X * 0.05f; } if (this.velocity.Y > 16f) { this.velocity.Y = 16f; return; } // if (this.type == 743) { if (this.penetrate == 1) { this.penetrate = -1; this.tileCollide = false; this.alpha = 255; this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 64; this.height = 64; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.damage = 70; this.knockBack = 8f; for (int i = 0; i < 15; i++) { int d = Dust.NewDust(this.position, this.width, this.height, 6, Main.rand.Next(-3, 4), Main.rand.Next(-3, 4)); Main.dust[d].noGravity = true; } for (int num657 = 0; num657 < 2; num657++) { int num658 = Gore.NewGore(new Vector2(this.position.X + (float)(this.width / 2) - 24f, this.position.Y + (float)(this.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num658].scale = 1.5f; Gore expr_1533D_cp_0 = Main.gore[num658]; expr_1533D_cp_0.velocity.X = expr_1533D_cp_0.velocity.X + 1.5f; Gore expr_1535D_cp_0 = Main.gore[num658]; expr_1535D_cp_0.velocity.Y = expr_1535D_cp_0.velocity.Y + 1.5f; num658 = Gore.NewGore(new Vector2(this.position.X + (float)(this.width / 2) - 24f, this.position.Y + (float)(this.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num658].scale = 1.5f; Gore expr_153F6_cp_0 = Main.gore[num658]; expr_153F6_cp_0.velocity.X = expr_153F6_cp_0.velocity.X - 1.5f; Gore expr_15416_cp_0 = Main.gore[num658]; expr_15416_cp_0.velocity.Y = expr_15416_cp_0.velocity.Y + 1.5f; num658 = Gore.NewGore(new Vector2(this.position.X + (float)(this.width / 2) - 24f, this.position.Y + (float)(this.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num658].scale = 1.5f; Gore expr_154AF_cp_0 = Main.gore[num658]; expr_154AF_cp_0.velocity.X = expr_154AF_cp_0.velocity.X + 1.5f; Gore expr_154CF_cp_0 = Main.gore[num658]; expr_154CF_cp_0.velocity.Y = expr_154CF_cp_0.velocity.Y - 1.5f; num658 = Gore.NewGore(new Vector2(this.position.X + (float)(this.width / 2) - 24f, this.position.Y + (float)(this.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num658].scale = 1.5f; Gore expr_15568_cp_0 = Main.gore[num658]; expr_15568_cp_0.velocity.X = expr_15568_cp_0.velocity.X - 1.5f; Gore expr_15588_cp_0 = Main.gore[num658]; expr_15588_cp_0.velocity.Y = expr_15588_cp_0.velocity.Y - 1.5f; } Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 62); } } } else if (this.aiStyle == 15) { if (this.type == 25) { if (Main.rand.Next(15) == 0) { Dust.NewDust(this.position, this.width, this.height, 14, 0f, 0f, 150, default(Color), 1.3f); } } else if (this.type == 26) { int num201 = Dust.NewDust(this.position, this.width, this.height, 172, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 100, default(Color), 1.5f); Main.dust[num201].noGravity = true; Dust expr_8C3E_cp_0 = Main.dust[num201]; expr_8C3E_cp_0.velocity.X = expr_8C3E_cp_0.velocity.X / 2f; Dust expr_8C5C_cp_0 = Main.dust[num201]; expr_8C5C_cp_0.velocity.Y = expr_8C5C_cp_0.velocity.Y / 2f; } else if (this.type == 35) { int num202 = Dust.NewDust(this.position, this.width, this.height, 6, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 100, default(Color), 3f); Main.dust[num202].noGravity = true; Dust expr_8CEB_cp_0 = Main.dust[num202]; expr_8CEB_cp_0.velocity.X = expr_8CEB_cp_0.velocity.X * 2f; Dust expr_8D09_cp_0 = Main.dust[num202]; expr_8D09_cp_0.velocity.Y = expr_8D09_cp_0.velocity.Y * 2f; } else if (this.type == 154) { int num203 = Dust.NewDust(this.position, this.width, this.height, 115, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 140, default(Color), 1.5f); Main.dust[num203].noGravity = true; Main.dust[num203].velocity *= 0.25f; } if (Main.player[this.owner].dead) { this.Kill(); return; } Main.player[this.owner].itemAnimation = 10; Main.player[this.owner].itemTime = 10; if (this.type != 719)// { if (this.position.X + (float)(this.width / 2) > Main.player[this.owner].position.X + (float)(Main.player[this.owner].width / 2)) { Main.player[this.owner].ChangeDir(1); this.direction = 1; } else { Main.player[this.owner].ChangeDir(-1); this.direction = -1; } } Vector2 mountedCenter2 = Main.player[this.owner].MountedCenter; Vector2 vector18 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num204 = mountedCenter2.X - vector18.X; float num205 = mountedCenter2.Y - vector18.Y; float num206 = (float)Math.Sqrt((double)(num204 * num204 + num205 * num205)); if (this.ai[0] == 0f) { float num207 = 160f; if (this.type == 63) { num207 *= 1.5f; } if (this.type == 247) { num207 *= 1.5f; } this.tileCollide = true; if (num206 > num207) { this.ai[0] = 1f; this.netUpdate = true; } else if (!Main.player[this.owner].channel) { if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y * 0.9f; } this.velocity.Y = this.velocity.Y + 1f; this.velocity.X = this.velocity.X * 0.9f; } } else if (this.ai[0] == 1f) { float num208 = 14f / Main.player[this.owner].meleeSpeed; float num209 = 0.9f / Main.player[this.owner].meleeSpeed; float num210 = 300f; if (this.type == 63) { num210 *= 1.5f; num208 *= 1.5f; num209 *= 1.5f; } if (this.type == 247) { num210 *= 1.5f; num208 = 15.9f; num209 *= 2f; } Math.Abs(num204); Math.Abs(num205); if (this.ai[1] == 1f) { this.tileCollide = false; } if (!Main.player[this.owner].channel || num206 > num210 || !this.tileCollide) { this.ai[1] = 1f; if (this.tileCollide) { this.netUpdate = true; } this.tileCollide = false; if (num206 < 20f) { this.Kill(); } } if (!this.tileCollide) { num209 *= 2f; } int num211 = 60; if (this.type == 247) { num211 = 100; } if (num206 > (float)num211 || !this.tileCollide) { num206 = num208 / num206; num204 *= num206; num205 *= num206; new Vector2(this.velocity.X, this.velocity.Y); float num212 = num204 - this.velocity.X; float num213 = num205 - this.velocity.Y; float num214 = (float)Math.Sqrt((double)(num212 * num212 + num213 * num213)); num214 = num209 / num214; num212 *= num214; num213 *= num214; this.velocity.X = this.velocity.X * 0.98f; this.velocity.Y = this.velocity.Y * 0.98f; this.velocity.X = this.velocity.X + num212; this.velocity.Y = this.velocity.Y + num213; } else { if (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) < 6f) { this.velocity.X = this.velocity.X * 0.96f; this.velocity.Y = this.velocity.Y + 0.2f; } if (Main.player[this.owner].velocity.X == 0f) { this.velocity.X = this.velocity.X * 0.96f; } } } if (this.type != 247) { this.rotation = (float)Math.Atan2((double)num205, (double)num204) - this.velocity.X * 0.1f; return; } if (this.velocity.X < 0f) { this.rotation -= (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) * 0.01f; } else { this.rotation += (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) * 0.01f; } float num215 = this.position.X; float num216 = this.position.Y; float num217 = 600f; bool flag4 = false; if (this.owner == Main.myPlayer) { this.localAI[1] += 1f; if (this.localAI[1] > 20f) { this.localAI[1] = 20f; for (int num218 = 0; num218 < 200; num218++) { if (Main.npc[num218].CanBeChasedBy(this, false)) { float num219 = Main.npc[num218].position.X + (float)(Main.npc[num218].width / 2); float num220 = Main.npc[num218].position.Y + (float)(Main.npc[num218].height / 2); float num221 = Math.Abs(this.position.X + (float)(this.width / 2) - num219) + Math.Abs(this.position.Y + (float)(this.height / 2) - num220); if (num221 < num217 && Collision.CanHit(this.position, this.width, this.height, Main.npc[num218].position, Main.npc[num218].width, Main.npc[num218].height)) { num217 = num221; num215 = num219; num216 = num220; flag4 = true; } } } } } if (flag4) { this.localAI[1] = 0f; float num222 = 14f; vector18 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); num204 = num215 - vector18.X; num205 = num216 - vector18.Y; num206 = (float)Math.Sqrt((double)(num204 * num204 + num205 * num205)); num206 = num222 / num206; num204 *= num206; num205 *= num206; Projectile.NewProjectile(vector18.X, vector18.Y, num204, num205, 248, (int)((double)this.damage / 1.5), this.knockBack / 2f, Main.myPlayer, 0f, 0f); return; } } else if (this.aiStyle == 16) { if (this.type == 108 || this.type == 164) { this.ai[0] += 1f; if (this.ai[0] > 3f) { this.Kill(); } } if (this.type != 37 && this.type != 397 && this.type != 470) { if (this.type != 519) { goto IL_98D0; } } try { int num223 = (int)(this.position.X / 16f) - 1; int num224 = (int)((this.position.X + (float)this.width) / 16f) + 2; int num225 = (int)(this.position.Y / 16f) - 1; int num226 = (int)((this.position.Y + (float)this.height) / 16f) + 2; if (num223 < 0) { num223 = 0; } if (num224 > Main.maxTilesX) { num224 = Main.maxTilesX; } if (num225 < 0) { num225 = 0; } if (num226 > Main.maxTilesY) { num226 = Main.maxTilesY; } for (int num227 = num223; num227 < num224; num227++) { for (int num228 = num225; num228 < num226; num228++) { if (Main.tile[num227, num228] != null && Main.tile[num227, num228].nactive() && (Main.tileSolid[(int)Main.tile[num227, num228].type] || (Main.tileSolidTop[(int)Main.tile[num227, num228].type] && Main.tile[num227, num228].frameY == 0))) { Vector2 vector19; vector19.X = (float)(num227 * 16); vector19.Y = (float)(num228 * 16); if (this.position.X + (float)this.width - 4f > vector19.X && this.position.X + 4f < vector19.X + 16f && this.position.Y + (float)this.height - 4f > vector19.Y && this.position.Y + 4f < vector19.Y + 16f) { this.velocity.X = 0f; this.velocity.Y = -0.2f; } } } } } catch { } IL_98D0: if (this.type == 519) { this.localAI[1] += 1f; float num229 = 180f - this.localAI[1]; if (num229 < 0f) { num229 = 0f; } this.frameCounter++; if (num229 < 15f) { this.frameCounter++; } if ((float)this.frameCounter >= (num229 / 10f + 6f) / 2f) { this.frame++; this.frameCounter = 0; if (this.frame >= Main.projFrames[this.type]) { this.frame = 0; } } } if (this.type == 102) { if (this.velocity.Y > 10f) { this.velocity.Y = 10f; } if (this.localAI[0] == 0f) { this.localAI[0] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 10); } this.frameCounter++; if (this.frameCounter > 3) { this.frame++; this.frameCounter = 0; } if (this.frame > 1) { this.frame = 0; } if (this.velocity.Y == 0f) { this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 128; this.height = 128; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.damage = 40; this.knockBack = 8f; this.timeLeft = 3; this.netUpdate = true; } } if (this.type == 303 && this.timeLeft <= 3 && this.hostile) { this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 128; this.height = 128; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); } if (this.owner == Main.myPlayer && this.timeLeft <= 3) { this.tileCollide = false; this.ai[1] = 0f; this.alpha = 255; if (this.type == 849) { this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 128; this.height = 128;// this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.damage = 54; this.knockBack = 8f; } if (this.type == 752) { this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 64; this.height = 64;// this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.damage = 50; this.knockBack = 8f; } if (this.type == 753) { this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 48; this.height = 48; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); //this.damage = 34; this.knockBack = 3f; } if (this.type == 654) { this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 128; this.height = 128; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.damage = 40; this.knockBack = 8f; } if (this.type == 657) { this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 128; this.height = 128; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.damage = 40; this.knockBack = 8f; } if (this.type == 655) { this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 84; this.height = 84; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.damage = 19; this.knockBack = 5f; } if (this.type == 28 || this.type == 37 || this.type == 75 || this.type == 516 || this.type == 519) { this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 128; this.height = 128; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.damage = 100; this.knockBack = 8f; } else if (this.type == 29 || this.type == 470 || this.type == 637) { this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 250; this.height = 250; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.damage = 250; this.knockBack = 10f; } else if (this.type == 30 || this.type == 397 || this.type == 517 || this.type == 588) { this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 128; this.height = 128; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.knockBack = 8f; } else if (this.type == 133 || this.type == 134 || this.type == 135 || this.type == 136 || this.type == 137 || this.type == 138 || this.type == 338 || this.type == 339) { this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 128; this.height = 128; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.knockBack = 8f; } else if (this.type == 139 || this.type == 140 || this.type == 141 || this.type == 142 || this.type == 143 || this.type == 144 || this.type == 340 || this.type == 341) { this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 200; this.height = 200; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.knockBack = 10f; } } else { if (this.type != 30 && this.type != 517 && 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 < 341) { this.damage = 0; } if (this.type == 338 || this.type == 339 || this.type == 340 || this.type == 341) { this.localAI[1] += 1f; if (this.localAI[1] > 6f) { this.alpha = 0; } else { this.alpha = (int)(255f - 42f * this.localAI[1]) + 100; if (this.alpha > 255) { this.alpha = 255; } } for (int num230 = 0; num230 < 2; num230++) { float num231 = 0f; float num232 = 0f; if (num230 == 1) { num231 = this.velocity.X * 0.5f; num232 = this.velocity.Y * 0.5f; } if (this.localAI[1] > 9f) { if (Main.rand.Next(2) == 0) { int num233 = Dust.NewDust(new Vector2(this.position.X + 3f + num231, this.position.Y + 3f + num232) - this.velocity * 0.5f, this.width - 8, this.height - 8, 6, 0f, 0f, 100, default(Color), 1f); Main.dust[num233].scale *= 1.4f + (float)Main.rand.Next(10) * 0.1f; Main.dust[num233].velocity *= 0.2f; Main.dust[num233].noGravity = true; } if (Main.rand.Next(2) == 0) { int num234 = Dust.NewDust(new Vector2(this.position.X + 3f + num231, this.position.Y + 3f + num232) - this.velocity * 0.5f, this.width - 8, this.height - 8, 31, 0f, 0f, 100, default(Color), 0.5f); Main.dust[num234].fadeIn = 0.5f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num234].velocity *= 0.05f; } } } float num235 = this.position.X; float num236 = this.position.Y; float num237 = 600f; bool flag5 = false; this.ai[0] += 1f; if (this.ai[0] > 30f) { this.ai[0] = 30f; for (int num238 = 0; num238 < 200; num238++) { if (Main.npc[num238].CanBeChasedBy(this, false)) { float num239 = Main.npc[num238].position.X + (float)(Main.npc[num238].width / 2); float num240 = Main.npc[num238].position.Y + (float)(Main.npc[num238].height / 2); float num241 = Math.Abs(this.position.X + (float)(this.width / 2) - num239) + Math.Abs(this.position.Y + (float)(this.height / 2) - num240); if (num241 < num237 && Collision.CanHit(this.position, this.width, this.height, Main.npc[num238].position, Main.npc[num238].width, Main.npc[num238].height)) { num237 = num241; num235 = num239; num236 = num240; flag5 = true; } } } } if (!flag5) { num235 = this.position.X + (float)(this.width / 2) + this.velocity.X * 100f; num236 = this.position.Y + (float)(this.height / 2) + this.velocity.Y * 100f; } float num242 = 16f; Vector2 vector20 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num243 = num235 - vector20.X; float num244 = num236 - vector20.Y; float num245 = (float)Math.Sqrt((double)(num243 * num243 + num244 * num244)); num245 = num242 / num245; num243 *= num245; num244 *= num245; this.velocity.X = (this.velocity.X * 11f + num243) / 12f; this.velocity.Y = (this.velocity.Y * 11f + num244) / 12f; } else if (this.type == 134 || this.type == 137 || this.type == 140 || this.type == 143 || this.type == 303) { if (Math.Abs(this.velocity.X) >= 8f || Math.Abs(this.velocity.Y) >= 8f) { for (int num246 = 0; num246 < 2; num246++) { float num247 = 0f; float num248 = 0f; if (num246 == 1) { num247 = this.velocity.X * 0.5f; num248 = this.velocity.Y * 0.5f; } int num249 = Dust.NewDust(new Vector2(this.position.X + 3f + num247, this.position.Y + 3f + num248) - this.velocity * 0.5f, this.width - 8, this.height - 8, 6, 0f, 0f, 100, default(Color), 1f); Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; Main.dust[num249].velocity *= 0.2f; Main.dust[num249].noGravity = true; num249 = Dust.NewDust(new Vector2(this.position.X + 3f + num247, this.position.Y + 3f + num248) - this.velocity * 0.5f, this.width - 8, this.height - 8, 31, 0f, 0f, 100, default(Color), 0.5f); Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num249].velocity *= 0.05f; } } if (Math.Abs(this.velocity.X) < 15f && Math.Abs(this.velocity.Y) < 15f) { this.velocity *= 1.1f; } } else if (this.type == 133 || this.type == 136 || this.type == 139 || this.type == 142) { int num250 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1f); Main.dust[num250].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; Main.dust[num250].velocity *= 0.2f; Main.dust[num250].noGravity = true; } else if (this.type == 135 || this.type == 138 || this.type == 141 || this.type == 144) { 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 num251 = Dust.NewDust(new Vector2(this.position.X + 3f, this.position.Y + 3f) - this.velocity * 0.5f, this.width - 8, this.height - 8, 31, 0f, 0f, 100, default(Color), 1f); Main.dust[num251].scale *= 1.6f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num251].velocity *= 0.05f; Main.dust[num251].noGravity = true; } } else if (this.type == 752) { int num252 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1f); Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; Main.dust[num252].position = base.Center + new Vector2(this.width/2, (-this.height / 2)+6).RotatedBy((double)this.rotation, default(Vector2)) * 1.1f; Main.rand.Next(2); num252 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 1f); Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; Main.dust[num252].position = base.Center + new Vector2(this.width/2, (-this.height / 2)+12).RotatedBy((double)this.rotation, default(Vector2)) * 1.1f; } else if (this.type != 30 && this.type != 517 && this.type != 397 && this.type != 519 && this.type != 588 && this.type != 753 && Main.rand.Next(2) == 0)// { int num252 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1f); Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; Main.dust[num252].position = base.Center + new Vector2(0f, (float)(-(float)this.height / 2)).RotatedBy((double)this.rotation, default(Vector2)) * 1.1f; Main.rand.Next(2); num252 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 1f); Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f; Main.dust[num252].noGravity = true; Main.dust[num252].position = base.Center + new Vector2(0f, (float)(-(float)this.height / 2 - 6)).RotatedBy((double)this.rotation, default(Vector2)) * 1.1f; } } this.ai[0] += 1f; if (this.type == 338 || this.type == 339 || this.type == 340 || this.type == 341) { if (this.velocity.X < 0f) { this.spriteDirection = -1; this.rotation = (float)Math.Atan2((double)(-(double)this.velocity.Y), (double)(-(double)this.velocity.X)) - 1.57f; } else { this.spriteDirection = 1; this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f; } } else if (this.type == 134 || this.type == 137 || this.type == 140 || this.type == 143 || this.type == 303) { 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.velocity.Y = this.velocity.Y + 0.2f; this.velocity *= 0.97f; if ((double)this.velocity.X > -0.1 && (double)this.velocity.X < 0.1) { this.velocity.X = 0f; } if ((double)this.velocity.Y > -0.1 && (double)this.velocity.Y < 0.1) { this.velocity.Y = 0f; } } else if (this.type == 133 || this.type == 136 || this.type == 139 || this.type == 142) { if (this.ai[0] > 15f) { if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.95f; } this.velocity.Y = this.velocity.Y + 0.2f; } } else if (((this.type == 30 || this.type == 397 || this.type == 517 || this.type == 588 || this.type == 654 || this.type == 657 || this.type == 655) && this.ai[0] > 10f) || (this.type != 30 && this.type != 397 && this.type != 517 && this.type != 588 && this.ai[0] > 5f)) { this.ai[0] = 10f; if (this.velocity.Y == 0f && this.velocity.X != 0f) { this.velocity.X = this.velocity.X * 0.97f; if (this.type == 29 || this.type == 470 || this.type == 637) { this.velocity.X = this.velocity.X * 0.99f; } if ((double)this.velocity.X > -0.01 && (double)this.velocity.X < 0.01) { this.velocity.X = 0f; this.netUpdate = true; } } this.velocity.Y = this.velocity.Y + 0.2f; } if (this.type == 519) { this.rotation += this.velocity.X * 0.06f; return; } if (this.type != 134 && this.type != 137 && this.type != 140 && this.type != 143 && this.type != 303 && (this.type < 338 || this.type > 341)) { this.rotation += this.velocity.X * 0.1f; return; } } else if (this.aiStyle == 17) { if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.98f; } this.rotation += this.velocity.X * 0.1f; this.velocity.Y = this.velocity.Y + 0.2f; if (this.owner == Main.myPlayer) { int num253 = (int)((this.position.X + (float)(this.width / 2)) / 16f); int num254 = (int)((this.position.Y + (float)this.height - 4f) / 16f); if (Main.tile[num253, num254] != null && !Main.tile[num253, num254].active()) { int num255 = 0; if (this.type >= 201 && this.type <= 205) { num255 = this.type - 200; } if (this.type >= 527 && this.type <= 531) { num255 = this.type - 527 + 6; } WorldGen.PlaceTile(num253, num254, 85, false, false, this.owner, num255); if (Main.tile[num253, num254].active()) { if (Main.netMode != 0) { NetMessage.SendData(17, -1, -1, "", 1, (float)num253, (float)num254, 85f, num255, 0, 0); } int num256 = Sign.ReadSign(num253, num254, true); if (num256 >= 0) { Sign.TextSign(num256, this.miscText); } this.Kill(); return; } } } } else if (this.aiStyle == 18) { if (this.ai[1] == 0f && this.type == 44) { this.ai[1] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8); } if (this.type != 263 && this.type != 274) { this.rotation += (float)this.direction * 0.8f; this.ai[0] += 1f; if (this.ai[0] >= 30f) { if (this.ai[0] < 100f) { this.velocity *= 1.06f; } else { this.ai[0] = 200f; } } for (int num257 = 0; num257 < 2; num257++) { int num258 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 27, 0f, 0f, 100, default(Color), 1f); Main.dust[num258].noGravity = true; } return; } if (this.type == 274 && this.velocity.X < 0f) { this.spriteDirection = -1; } this.rotation += (float)this.direction * 0.05f; this.rotation += (float)this.direction * 0.5f * ((float)this.timeLeft / 180f); if (this.type == 274) { this.velocity *= 0.96f; return; } this.velocity *= 0.95f; return; } else if (this.aiStyle == 19) { Vector2 vector21 = Main.player[this.owner].RotatedRelativePoint(Main.player[this.owner].MountedCenter, true); this.direction = Main.player[this.owner].direction; Main.player[this.owner].heldProj = this.whoAmI; Main.player[this.owner].itemTime = Main.player[this.owner].itemAnimation; this.position.X = vector21.X - (float)(this.width / 2); this.position.Y = vector21.Y - (float)(this.height / 2); if (!Main.player[this.owner].frozen) { if (this.type == 46) { if (this.ai[0] == 0f) { this.ai[0] = 3f; this.netUpdate = true; } if (Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3) { this.ai[0] -= 1.6f; } else { this.ai[0] += 1.4f; } } else if (this.type == 105) { if (this.ai[0] == 0f) { this.ai[0] = 3f; this.netUpdate = true; } if (Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3) { this.ai[0] -= 2.4f; } else { this.ai[0] += 2.1f; } } else if (this.type == 367) { this.spriteDirection = -this.direction; if (this.ai[0] == 0f) { this.ai[0] = 3f; this.netUpdate = true; } if (Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3) { this.ai[0] -= 1.6f; } else { this.ai[0] += 1.5f; } } else if (this.type == 368) { this.spriteDirection = -this.direction; if (this.ai[0] == 0f) { this.ai[0] = 3f; this.netUpdate = true; } if (Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3) { this.ai[0] -= 1.5f; } else { this.ai[0] += 1.4f; } } else if (this.type == 222) { if (this.ai[0] == 0f) { this.ai[0] = 3f; this.netUpdate = true; } if (Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3) { this.ai[0] -= 2.4f; if (this.localAI[0] == 0f && Main.myPlayer == this.owner) { this.localAI[0] = 1f; Projectile.NewProjectile(base.Center.X + this.velocity.X * this.ai[0], base.Center.Y + this.velocity.Y * this.ai[0], this.velocity.X, this.velocity.Y, 228, this.damage, this.knockBack, this.owner, 0f, 0f); } } else { this.ai[0] += 2.1f; } } else if (this.type == 342) { if (this.ai[0] == 0f) { this.ai[0] = 3f; this.netUpdate = true; } if (Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3) { this.ai[0] -= 2.4f; if (this.localAI[0] == 0f && Main.myPlayer == this.owner) { this.localAI[0] = 1f; if (Collision.CanHit(Main.player[this.owner].position, Main.player[this.owner].width, Main.player[this.owner].height, new Vector2(base.Center.X + this.velocity.X * this.ai[0], base.Center.Y + this.velocity.Y * this.ai[0]), this.width, this.height)) { Projectile.NewProjectile(base.Center.X + this.velocity.X * this.ai[0], base.Center.Y + this.velocity.Y * this.ai[0], this.velocity.X * 2.4f, this.velocity.Y * 2.4f, 343, (int)((double)this.damage * 0.8), this.knockBack * 0.85f, this.owner, 0f, 0f); } } } else { this.ai[0] += 2.1f; } } else if (this.type == 47) { if (this.ai[0] == 0f) { this.ai[0] = 4f; this.netUpdate = true; } if (Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3) { this.ai[0] -= 1.2f; } else { this.ai[0] += 0.9f; } } else if (this.type == 153) { this.spriteDirection = -this.direction; if (this.ai[0] == 0f) { this.ai[0] = 4f; this.netUpdate = true; } if (Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3) { this.ai[0] -= 1.5f; } else { this.ai[0] += 1.3f; } } else if (this.type == 49) { if (this.ai[0] == 0f) { this.ai[0] = 4f; this.netUpdate = true; } if (Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3) { this.ai[0] -= 1.1f; } else { this.ai[0] += 0.85f; } } else if (this.type == 64 || this.type == 215) { this.spriteDirection = -this.direction; if (this.ai[0] == 0f) { this.ai[0] = 3f; this.netUpdate = true; } if (Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3) { this.ai[0] -= 1.9f; } else { this.ai[0] += 1.7f; } } else if (this.type == 66 || this.type == 97 || this.type == 212 || this.type == 218) { this.spriteDirection = -this.direction; if (this.ai[0] == 0f) { this.ai[0] = 3f; this.netUpdate = true; } if (Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3) { this.ai[0] -= 2.1f; } else { this.ai[0] += 1.9f; } } else if (this.type == 130) { this.spriteDirection = -this.direction; if (this.ai[0] == 0f) { this.ai[0] = 3f; this.netUpdate = true; } if (Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3) { this.ai[0] -= 1.3f; } else { this.ai[0] += 1f; } } else if (this.type == 709)// { this.spriteDirection = -this.direction; if (this.ai[0] == 0f) { this.ai[0] = 3f; this.netUpdate = true; } if (Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3) { this.ai[0] -= 1.3f; } else { this.ai[0] += 1f; } } else if (this.type == 819)// { this.spriteDirection = -this.direction; if (this.ai[0] == 0f) { this.ai[0] = 3f; this.netUpdate = true; } if (Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3) { this.ai[0] -= 1.08f; } else { this.ai[0] += 0.89f; } } else if (this.type == 710)// { if (this.ai[0] == 0f) { this.ai[0] = 2f; this.netUpdate = true; } if (Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3) { this.ai[0] -= 1.3f; } else { this.ai[0] += 1f; } } else if (this.type == 712 || this.type == 760)// { if (this.ai[0] == 0f) { this.ai[0] = 2f; this.netUpdate = true; } if (Main.player[this.owner].itemAnimation < Main.player[this.owner].itemAnimationMax / 3) { this.ai[0] -= 1.3f; } else { this.ai[0] += 1f; } } } this.position += this.velocity * this.ai[0]; if (this.type == 130) { if (this.ai[1] == 0f || this.ai[1] == 4f || this.ai[1] == 8f || this.ai[1] == 12f || this.ai[1] == 16f || this.ai[1] == 20f || this.ai[1] == 24f) { Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), this.velocity.X, this.velocity.Y, 131, this.damage / 3, 0f, this.owner, 0f, 0f); } this.ai[1] += 1f; } if (this.type == 712) { if (this.ai[1] == 10f) { for (int i = 0; i < 3; i++) { float num148 = this.velocity.X; float num149 = this.velocity.Y; float num150 = 0.05f * (float)i; num148 += (float)Main.rand.Next(-15, 16) * num150; num149 += (float)Main.rand.Next(-15, 16) * num150; float num80 = (float)Math.Sqrt((double)(num148 * num148 + num149 * num149)); num80 = 12f / num80; num148 *= num80; num149 *= num80; Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), num148, num149, 713, this.damage / 3, 0f, this.owner, 0f, 0f); } } this.ai[1]++; } if (this.type == 760) { if (this.ai[1] == 8f) { for (int i = 0; i < 2; i++) { float num148 = this.velocity.X; float num149 = this.velocity.Y; float num150 = 0.05f * (float)i; num148 += (float)Main.rand.Next(-15, 16) * num150; num149 += (float)Main.rand.Next(-15, 16) * num150; float num80 = (float)Math.Sqrt((double)(num148 * num148 + num149 * num149)); num80 = (Main.rand.Next(40, 60) / 10) / num80; num148 *= num80; num149 *= num80; int proj = Projectile.NewProjectile(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2), num148, num149, 761, 16, 0f, this.owner, 0f, 0f); Main.projectile[proj].frame = Main.rand.Next(0, 4); } } 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, 0f, 0f, 150, default(Color), 1.4f); } int num259 = Dust.NewDust(this.position, this.width, this.height, 27, this.velocity.X * 0.2f + (float)(this.direction * 3), this.velocity.Y * 0.2f, 100, default(Color), 1.2f); Main.dust[num259].noGravity = true; Dust expr_C499_cp_0 = Main.dust[num259]; expr_C499_cp_0.velocity.X = expr_C499_cp_0.velocity.X / 2f; Dust expr_C4B9_cp_0 = Main.dust[num259]; expr_C4B9_cp_0.velocity.Y = expr_C4B9_cp_0.velocity.Y / 2f; num259 = Dust.NewDust(this.position - this.velocity * 2f, this.width, this.height, 27, 0f, 0f, 150, default(Color), 1.4f); Dust expr_C52D_cp_0 = Main.dust[num259]; expr_C52D_cp_0.velocity.X = expr_C52D_cp_0.velocity.X / 5f; Dust expr_C54D_cp_0 = Main.dust[num259]; expr_C54D_cp_0.velocity.Y = expr_C54D_cp_0.velocity.Y / 5f; return; } if (this.type == 105) { if (Main.rand.Next(3) == 0) { int num260 = 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, default(Color), 1.2f); Main.dust[num260].velocity += this.velocity * 0.3f; Main.dust[num260].velocity *= 0.2f; } if (Main.rand.Next(4) == 0) { int num261 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 43, 0f, 0f, 254, default(Color), 0.3f); Main.dust[num261].velocity += this.velocity * 0.5f; Main.dust[num261].velocity *= 0.5f; return; } } else if (this.type == 153) { int num262 = Dust.NewDust(this.position - this.velocity * 3f, this.width, this.height, 115, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 140, default(Color), 1f); Main.dust[num262].noGravity = true; Main.dust[num262].fadeIn = 1.25f; Main.dust[num262].velocity *= 0.25f; return; } else if (this.type == 710)// { int num262 = Dust.NewDust(this.position - this.velocity * 3f, this.width, this.height, 174, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 40, default(Color), 1.1f); Main.dust[num262].noGravity = true; Main.dust[num262].fadeIn = 1.25f; Main.dust[num262].velocity *= 0.25f; return; } else if (this.type == 712) { int num262 = Dust.NewDust(this.position - this.velocity * 3f, this.width, this.height, 272 + Main.rand.Next(0, 7), this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 40, default(Color), 1.1f); Main.dust[num262].noGravity = true; Main.dust[num262].fadeIn = 1.25f; Main.dust[num262].velocity *= 0.65f; return; } } else if (this.aiStyle == 20) { if (this.type == 252) { this.frameCounter++; if (this.frameCounter >= 4) { this.frameCounter = 0; this.frame++; } if (this.frame > 3) { this.frame = 0; } } if (this.type == 509) { this.frameCounter++; if (this.frameCounter >= 2) { this.frameCounter = 0; this.frame++; } if (this.frame > 1) { this.frame = 0; } } if (this.soundDelay <= 0) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 22); this.soundDelay = 30; } Vector2 vector22 = Main.player[this.owner].RotatedRelativePoint(Main.player[this.owner].MountedCenter, true); if (Main.myPlayer == this.owner) { if (Main.player[this.owner].channel) { float num263 = Main.player[this.owner].inventory[Main.player[this.owner].selectedItem].shootSpeed * this.scale; Vector2 vector23 = vector22; float num264 = (float)Main.mouseX + Main.screenPosition.X - vector23.X; float num265 = (float)Main.mouseY + Main.screenPosition.Y - vector23.Y; if (Main.player[this.owner].gravDir == -1f) { num265 = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector23.Y; } float num266 = (float)Math.Sqrt((double)(num264 * num264 + num265 * num265)); num266 = (float)Math.Sqrt((double)(num264 * num264 + num265 * num265)); num266 = num263 / num266; num264 *= num266; num265 *= num266; if (num264 != this.velocity.X || num265 != this.velocity.Y) { this.netUpdate = true; } this.velocity.X = num264; this.velocity.Y = num265; } else { this.Kill(); } } if (this.velocity.X > 0f) { Main.player[this.owner].ChangeDir(1); } else if (this.velocity.X < 0f) { Main.player[this.owner].ChangeDir(-1); } this.spriteDirection = this.direction; Main.player[this.owner].ChangeDir(this.direction); Main.player[this.owner].heldProj = this.whoAmI; Main.player[this.owner].itemTime = 2; Main.player[this.owner].itemAnimation = 2; this.position.X = vector22.X - (float)(this.width / 2); this.position.Y = vector22.Y - (float)(this.height / 2); this.rotation = (float)(Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.5700000524520874); if (Main.player[this.owner].direction == 1) { Main.player[this.owner].itemRotation = (float)Math.Atan2((double)(this.velocity.Y * (float)this.direction), (double)(this.velocity.X * (float)this.direction)); } else { Main.player[this.owner].itemRotation = (float)Math.Atan2((double)(this.velocity.Y * (float)this.direction), (double)(this.velocity.X * (float)this.direction)); } this.velocity.X = this.velocity.X * (1f + (float)Main.rand.Next(-3, 4) * 0.01f); if (Main.rand.Next(6) == 0) { int num267 = Dust.NewDust(this.position + this.velocity * (float)Main.rand.Next(6, 10) * 0.1f, this.width, this.height, 31, 0f, 0f, 80, default(Color), 1.4f); Dust expr_CC79_cp_0 = Main.dust[num267]; expr_CC79_cp_0.position.X = expr_CC79_cp_0.position.X - 4f; Main.dust[num267].noGravity = true; Main.dust[num267].velocity *= 0.2f; Main.dust[num267].velocity.Y = (float)(-(float)Main.rand.Next(7, 13)) * 0.15f; return; } } else if (this.aiStyle == 21) { this.rotation = this.velocity.X * 0.1f; this.spriteDirection = -this.direction; if (Main.rand.Next(3) == 0) { int num268 = Dust.NewDust(this.position, this.width, this.height, 27, 0f, 0f, 80, default(Color), 1f); Main.dust[num268].noGravity = true; Main.dust[num268].velocity *= 0.2f; } if (this.ai[1] == 1f) { this.ai[1] = 0f; Main.harpNote = this.ai[0]; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 26); return; } } else if (this.aiStyle == 22) { if (this.velocity.X == 0f && this.velocity.Y == 0f) { this.alpha = 255; } if (this.ai[1] < 0f) { if (this.velocity.X > 0f) { this.rotation += 0.3f; } else { this.rotation -= 0.3f; } int num269 = (int)(this.position.X / 16f) - 1; int num270 = (int)((this.position.X + (float)this.width) / 16f) + 2; int num271 = (int)(this.position.Y / 16f) - 1; int num272 = (int)((this.position.Y + (float)this.height) / 16f) + 2; if (num269 < 0) { num269 = 0; } if (num270 > Main.maxTilesX) { num270 = Main.maxTilesX; } if (num271 < 0) { num271 = 0; } if (num272 > Main.maxTilesY) { num272 = Main.maxTilesY; } int num273 = (int)this.position.X + 4; int num274 = (int)this.position.Y + 4; for (int num275 = num269; num275 < num270; num275++) { for (int num276 = num271; num276 < num272; num276++) { if (Main.tile[num275, num276] != null && Main.tile[num275, num276].active() && Main.tile[num275, num276].type != 127 && Main.tileSolid[(int)Main.tile[num275, num276].type] && !Main.tileSolidTop[(int)Main.tile[num275, num276].type]) { Vector2 vector24; vector24.X = (float)(num275 * 16); vector24.Y = (float)(num276 * 16); if ((float)(num273 + 8) > vector24.X && (float)num273 < vector24.X + 16f && (float)(num274 + 8) > vector24.Y && (float)num274 < vector24.Y + 16f) { this.Kill(); } } } } int num277 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 67, 0f, 0f, 0, default(Color), 1f); Main.dust[num277].noGravity = true; Main.dust[num277].velocity *= 0.3f; return; } if (this.ai[0] < 0f) { if (this.ai[0] == -1f) { for (int num278 = 0; num278 < 10; num278++) { int num279 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 67, 0f, 0f, 0, default(Color), 1.1f); Main.dust[num279].noGravity = true; Main.dust[num279].velocity *= 1.3f; } } else if (Main.rand.Next(30) == 0) { int num280 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 67, 0f, 0f, 100, default(Color), 1f); Main.dust[num280].velocity *= 0.2f; } int num281 = (int)this.position.X / 16; int num282 = (int)this.position.Y / 16; if (Main.tile[num281, num282] == null || !Main.tile[num281, num282].active()) { this.Kill(); } this.ai[0] -= 1f; if (this.ai[0] <= -900f && (Main.myPlayer == this.owner || Main.netMode == 2) && Main.tile[num281, num282].active() && Main.tile[num281, num282].type == 127) { WorldGen.KillTile(num281, num282, false, false, false); if (Main.netMode == 1) { NetMessage.SendData(17, -1, -1, "", 0, (float)num281, (float)num282, 0f, 0, 0, 0); } this.Kill(); return; } } else { int num283 = (int)(this.position.X / 16f) - 1; int num284 = (int)((this.position.X + (float)this.width) / 16f) + 2; int num285 = (int)(this.position.Y / 16f) - 1; int num286 = (int)((this.position.Y + (float)this.height) / 16f) + 2; if (num283 < 0) { num283 = 0; } if (num284 > Main.maxTilesX) { num284 = Main.maxTilesX; } if (num285 < 0) { num285 = 0; } if (num286 > Main.maxTilesY) { num286 = Main.maxTilesY; } int num287 = (int)this.position.X + 4; int num288 = (int)this.position.Y + 4; for (int num289 = num283; num289 < num284; num289++) { for (int num290 = num285; num290 < num286; num290++) { if (Main.tile[num289, num290] != null && Main.tile[num289, num290].nactive() && Main.tile[num289, num290].type != 127 && Main.tileSolid[(int)Main.tile[num289, num290].type] && !Main.tileSolidTop[(int)Main.tile[num289, num290].type]) { Vector2 vector25; vector25.X = (float)(num289 * 16); vector25.Y = (float)(num290 * 16); if ((float)(num287 + 8) > vector25.X && (float)num287 < vector25.X + 16f && (float)(num288 + 8) > vector25.Y && (float)num288 < vector25.Y + 16f) { this.Kill(); } } } } if (this.lavaWet) { this.Kill(); } if (this.active) { int num291 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 67, 0f, 0f, 0, default(Color), 1f); Main.dust[num291].noGravity = true; Main.dust[num291].velocity *= 0.3f; int num292 = (int)this.ai[0]; int num293 = (int)this.ai[1]; if (WorldGen.SolidTile(num292, num293)) { if (Math.Abs(this.velocity.X) > Math.Abs(this.velocity.Y)) { if (base.Center.Y < (float)(num293 * 16 + 8) && !WorldGen.SolidTile(num292, num293 - 1)) { num293--; } else if (!WorldGen.SolidTile(num292, num293 + 1)) { num293++; } else if (!WorldGen.SolidTile(num292, num293 - 1)) { num293--; } else if (base.Center.X < (float)(num292 * 16 + 8) && !WorldGen.SolidTile(num292 - 1, num293)) { num292--; } else if (!WorldGen.SolidTile(num292 + 1, num293)) { num292++; } else if (!WorldGen.SolidTile(num292 - 1, num293)) { num292--; } } else if (base.Center.X < (float)(num292 * 16 + 8) && !WorldGen.SolidTile(num292 - 1, num293)) { num292--; } else if (!WorldGen.SolidTile(num292 + 1, num293)) { num292++; } else if (!WorldGen.SolidTile(num292 - 1, num293)) { num292--; } else if (base.Center.Y < (float)(num293 * 16 + 8) && !WorldGen.SolidTile(num292, num293 - 1)) { num293--; } else if (!WorldGen.SolidTile(num292, num293 + 1)) { num293++; } else if (!WorldGen.SolidTile(num292, num293 - 1)) { num293--; } } if (this.velocity.X > 0f) { this.rotation += 0.3f; } else { this.rotation -= 0.3f; } if (Main.myPlayer == this.owner) { int num294 = (int)((this.position.X + (float)(this.width / 2)) / 16f); int num295 = (int)((this.position.Y + (float)(this.height / 2)) / 16f); bool flag6 = false; if (num294 == num292 && num295 == num293) { flag6 = true; } if (((this.velocity.X <= 0f && num294 <= num292) || (this.velocity.X >= 0f && num294 >= num292)) && ((this.velocity.Y <= 0f && num295 <= num293) || (this.velocity.Y >= 0f && num295 >= num293))) { flag6 = true; } if (flag6) { if (WorldGen.PlaceTile(num292, num293, 127, false, false, this.owner, 0)) { if (Main.netMode == 1) { NetMessage.SendData(17, -1, -1, "", 1, (float)((int)this.ai[0]), (float)((int)this.ai[1]), 127f, 0, 0, 0); } this.damage = 0; this.ai[0] = -1f; this.velocity *= 0f; this.alpha = 255; this.position.X = (float)(num292 * 16); this.position.Y = (float)(num293 * 16); this.netUpdate = true; return; } this.ai[1] = -1f; return; } } } } } else { if (this.aiStyle == 23) { if (this.type == 188 && this.ai[0] < 8f) { this.ai[0] = 8f; } if (this.type == 818 && this.timeLeft > 30) { this.timeLeft = 30;// } if (this.type == 846 && this.timeLeft > 25) { this.timeLeft = 25;// } else if (this.type != 652 && this.timeLeft > 60) { this.timeLeft = 60; } else if (this.type == 652 && this.timeLeft > 90) { this.timeLeft = 90; } if (this.ai[0] > 7f) { float num296 = 1f; if (this.ai[0] == 8f) { num296 = 0.25f; } else if (this.ai[0] == 9f) { num296 = 0.5f; } else if (this.ai[0] == 10f) { num296 = 0.75f; } this.ai[0] += 1f; int num297 = 6; if (this.type == 101) { num297 = 75; } if (this.type == 652) { num297 = 135;// } if (this.type == 846) { num297 = 32;// } if (num297 == 6 || num297 == 135 || Main.rand.Next(2) == 0)// { for (int num298 = 0; num298 < 1; num298++) { int num299 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, num297, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, default(Color), 1f); if (Main.rand.Next(3) != 0 || (num297 == 75 && Main.rand.Next(3) == 0)) { Main.dust[num299].noGravity = true; Main.dust[num299].scale *= 3f; Dust expr_DBEF_cp_0 = Main.dust[num299]; expr_DBEF_cp_0.velocity.X = expr_DBEF_cp_0.velocity.X * 2f; Dust expr_DC0F_cp_0 = Main.dust[num299]; expr_DC0F_cp_0.velocity.Y = expr_DC0F_cp_0.velocity.Y * 2f; } if (this.type == 188) { Main.dust[num299].scale *= 1.25f; } else { Main.dust[num299].scale *= 1.5f; } Dust expr_DC74_cp_0 = Main.dust[num299]; expr_DC74_cp_0.velocity.X = expr_DC74_cp_0.velocity.X * 1.2f; Dust expr_DC94_cp_0 = Main.dust[num299]; expr_DC94_cp_0.velocity.Y = expr_DC94_cp_0.velocity.Y * 1.2f; Main.dust[num299].scale *= num296; if (num297 == 75) { Main.dust[num299].velocity += this.velocity; if (!Main.dust[num299].noGravity) { Main.dust[num299].velocity *= 0.5f; } } } } } else { this.ai[0] += 1f; } this.rotation += 0.3f * (float)this.direction; return; } if (this.aiStyle == 24) { this.light = this.scale * 0.5f; this.rotation += this.velocity.X * 0.2f; this.ai[1] += 1f; if (this.type == 94) { if (Main.rand.Next(4) == 0) { int num300 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 70, 0f, 0f, 0, default(Color), 1f); Main.dust[num300].noGravity = true; Main.dust[num300].velocity *= 0.5f; Main.dust[num300].scale *= 0.9f; } this.velocity *= 0.985f; if (this.ai[1] > 130f) { this.scale -= 0.05f; if ((double)this.scale <= 0.2) { this.scale = 0.2f; this.Kill(); return; } } } else { this.velocity *= 0.96f; if (this.ai[1] > 15f) { this.scale -= 0.05f; if ((double)this.scale <= 0.2) { this.scale = 0.2f; this.Kill(); return; } } } } else { if (this.aiStyle == 25) { if (this.ai[0] != 0f && this.velocity.Y <= 0f && this.velocity.X == 0f) { float num301 = 0.5f; int i2 = (int)((this.position.X - 8f) / 16f); int num302 = (int)(this.position.Y / 16f); bool flag7 = false; bool flag8 = false; if (WorldGen.SolidTile(i2, num302) || WorldGen.SolidTile(i2, num302 + 1)) { flag7 = true; } i2 = (int)((this.position.X + (float)this.width + 8f) / 16f); if (WorldGen.SolidTile(i2, num302) || WorldGen.SolidTile(i2, num302 + 1)) { flag8 = true; } if (flag7) { this.velocity.X = num301; } else if (flag8) { this.velocity.X = -num301; } else { i2 = (int)((this.position.X - 8f - 16f) / 16f); num302 = (int)(this.position.Y / 16f); flag7 = false; flag8 = false; if (WorldGen.SolidTile(i2, num302) || WorldGen.SolidTile(i2, num302 + 1)) { flag7 = true; } i2 = (int)((this.position.X + (float)this.width + 8f + 16f) / 16f); if (WorldGen.SolidTile(i2, num302) || WorldGen.SolidTile(i2, num302 + 1)) { flag8 = true; } if (flag7) { this.velocity.X = num301; } else if (flag8) { this.velocity.X = -num301; } else { i2 = (int)((this.position.X + 4f) / 16f); num302 = (int)((this.position.Y + (float)this.height + 8f) / 16f); if (WorldGen.SolidTile(i2, num302) || WorldGen.SolidTile(i2, num302 + 1)) { flag7 = true; } if (!flag7) { this.velocity.X = num301; } else { this.velocity.X = -num301; } } } } this.rotation += this.velocity.X * 0.06f; this.ai[0] = 1f; if (this.velocity.Y > 16f) { this.velocity.Y = 16f; } if (this.velocity.Y <= 6f) { if (this.velocity.X > 0f && this.velocity.X < 7f) { this.velocity.X = this.velocity.X + 0.05f; } if (this.velocity.X < 0f && this.velocity.X > -7f) { this.velocity.X = this.velocity.X - 0.05f; } } this.velocity.Y = this.velocity.Y + 0.3f; return; } if (this.aiStyle == 26) { this.AI_026(); return; } if (this.aiStyle == 27) { if (this.type == 115) { this.ai[0] += 1f; if (this.ai[0] < 30f) { this.velocity *= 1.125f; } } if (this.type == 115 && this.localAI[1] < 5f) { this.localAI[1] = 5f; for (int num303 = 5; num303 < 25; num303++) { float num304 = this.velocity.X * (30f / (float)num303); float num305 = this.velocity.Y * (30f / (float)num303); num304 *= 80f; num305 *= 80f; int num306 = Dust.NewDust(new Vector2(this.position.X - num304, this.position.Y - num305), 8, 8, 27, this.oldVelocity.X, this.oldVelocity.Y, 100, default(Color), 0.9f); Main.dust[num306].velocity *= 0.25f; Main.dust[num306].velocity -= this.velocity * 5f; } } if (this.localAI[1] > 7f && this.type == 173) { int num307 = Main.rand.Next(3); if (num307 == 0) { num307 = 15; } else if (num307 == 1) { num307 = 57; } else { num307 = 58; } int num308 = Dust.NewDust(new Vector2(this.position.X - this.velocity.X * 4f + 2f, this.position.Y + 2f - this.velocity.Y * 4f), 8, 8, num307, 0f, 0f, 100, default(Color), 1.25f); Main.dust[num308].velocity *= 0.1f; } if (this.localAI[1] > 7f && this.type == 132) { int num309 = Dust.NewDust(new Vector2(this.position.X - this.velocity.X * 4f + 2f, this.position.Y + 2f - this.velocity.Y * 4f), 8, 8, 107, this.oldVelocity.X, this.oldVelocity.Y, 100, default(Color), 1.25f); Main.dust[num309].velocity *= -0.25f; num309 = Dust.NewDust(new Vector2(this.position.X - this.velocity.X * 4f + 2f, this.position.Y + 2f - this.velocity.Y * 4f), 8, 8, 107, this.oldVelocity.X, this.oldVelocity.Y, 100, default(Color), 1.25f); Main.dust[num309].velocity *= -0.25f; Main.dust[num309].position -= this.velocity * 0.5f; } if (this.localAI[1] > 4f && this.type == 651) { int dust1 = Dust.NewDust(new Vector2(this.position.X - this.velocity.X * 4f + 2f, this.position.Y + 2f - this.velocity.Y * 4f), 9, 9, 153, this.oldVelocity.X, this.oldVelocity.Y, 100, default(Color), 1.3f); Main.dust[dust1].velocity *= -0.25f; dust1 = Dust.NewDust(new Vector2(this.position.X - this.velocity.X * 4f + 2f, this.position.Y + 2f - this.velocity.Y * 4f), 9, 9, 153, this.oldVelocity.X, this.oldVelocity.Y, 100, default(Color), 1.3f); Main.dust[dust1].velocity *= -0.25f; Main.dust[dust1].position -= this.velocity * 0.5f; Lighting.AddLight(this.position, 1f, 0.5f, 0.005f); } if (this.localAI[1] < 15f) { this.localAI[1] += 1f; } else { if (this.type == 114 || this.type == 115) { int num310 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 4f), 8, 8, 27, this.oldVelocity.X, this.oldVelocity.Y, 100, default(Color), 0.6f); Main.dust[num310].velocity *= -0.25f; } else if (this.type == 116) { int num311 = Dust.NewDust(new Vector2(this.position.X - this.velocity.X * 5f + 2f, this.position.Y + 2f - this.velocity.Y * 5f), 8, 8, 64, this.oldVelocity.X, this.oldVelocity.Y, 100, default(Color), 1.5f); Main.dust[num311].velocity *= -0.25f; Main.dust[num311].noGravity = true; } if (this.localAI[0] == 0f) { this.scale -= 0.02f; this.alpha += 30; if (this.alpha >= 250) { this.alpha = 255; this.localAI[0] = 1f; } } else if (this.localAI[0] == 1f) { this.scale += 0.02f; this.alpha -= 30; if (this.alpha <= 0) { this.alpha = 0; this.localAI[0] = 0f; } } } if (this.ai[1] == 0f) { this.ai[1] = 1f; if (this.type == 132 || this.type == 651) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 60); } else { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8); } } if (this.type == 157) { this.rotation += (float)this.direction * 0.4f; this.spriteDirection = this.direction; } else { this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 0.785f; } if (this.velocity.Y > 16f) { this.velocity.Y = 16f; return; } } else if (this.aiStyle == 28) { if (this.type == 177) { for (int num312 = 0; num312 < 3; num312++) { int num313 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 137, this.velocity.X, this.velocity.Y, Main.rand.Next(0, 101), default(Color), 1f + (float)Main.rand.Next(-20, 40) * 0.01f); Main.dust[num313].noGravity = true; Main.dust[num313].velocity *= 0.3f; } } if (this.type == 118) { for (int num314 = 0; num314 < 2; num314++) { int num315 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 92, this.velocity.X, this.velocity.Y, 50, default(Color), 1.2f); Main.dust[num315].noGravity = true; Main.dust[num315].velocity *= 0.3f; } } if (this.type == 119 || this.type == 128 || this.type == 359) { for (int num316 = 0; num316 < 3; num316++) { int num317 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 92, this.velocity.X, this.velocity.Y, 50, default(Color), 1.2f); Main.dust[num317].noGravity = true; Main.dust[num317].velocity *= 0.3f; } } if (this.type == 309) { for (int num318 = 0; num318 < 3; num318++) { int num319 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 185, this.velocity.X, this.velocity.Y, 50, default(Color), 1.2f); Main.dust[num319].noGravity = true; Main.dust[num319].velocity *= 0.3f; } } if (this.type == 129) { for (int num320 = 0; num320 < 6; num320++) { int num321 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 106, this.velocity.X, this.velocity.Y, 100, default(Color), 1f); Main.dust[num321].noGravity = true; Main.dust[num321].velocity *= 0.1f + (float)Main.rand.Next(4) * 0.1f; Main.dust[num321].scale *= 1f + (float)Main.rand.Next(5) * 0.1f; } } if (this.ai[1] == 0f) { this.ai[1] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 28); return; } } else if (this.aiStyle == 29) { if (this.type == 619) { int num322 = (int)this.ai[0]; for (int num323 = 0; num323 < 3; num323++) { int num324 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 254, this.velocity.X, this.velocity.Y, num322, default(Color), 1.2f); Main.dust[num324].position = (Main.dust[num324].position + base.Center) / 2f; Main.dust[num324].noGravity = true; Main.dust[num324].velocity *= 0.5f; } for (int num325 = 0; num325 < 2; num325++) { int num324 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 255, this.velocity.X, this.velocity.Y, num322, default(Color), 0.4f); if (num325 == 0) { Main.dust[num324].position = (Main.dust[num324].position + base.Center * 5f) / 6f; } else if (num325 == 1) { Main.dust[num324].position = (Main.dust[num324].position + (base.Center + this.velocity / 2f) * 5f) / 6f; } Main.dust[num324].velocity *= 0.1f; Main.dust[num324].noGravity = true; Main.dust[num324].fadeIn = 1f; } return; } if (this.type == 620) { int num326 = (int)this.ai[0]; this.ai[1] += 1f; float num327 = (60f - this.ai[1]) / 60f; if (this.ai[1] > 40f) { this.Kill(); } this.velocity.Y = this.velocity.Y + 0.2f; if (this.velocity.Y > 18f) { this.velocity.Y = 18f; } this.velocity.X = this.velocity.X * 0.98f; for (int num328 = 0; num328 < 2; num328++) { int num329 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, num326, this.velocity.X, this.velocity.Y, 50, default(Color), 1.1f); Main.dust[num329].position = (Main.dust[num329].position + base.Center) / 2f; Main.dust[num329].noGravity = true; Main.dust[num329].velocity *= 0.3f; Main.dust[num329].scale *= num327; } for (int num330 = 0; num330 < 1; num330++) { int num329 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, num326, this.velocity.X, this.velocity.Y, 50, default(Color), 0.6f); Main.dust[num329].position = (Main.dust[num329].position + base.Center * 5f) / 6f; Main.dust[num329].velocity *= 0.1f; Main.dust[num329].noGravity = true; Main.dust[num329].fadeIn = 0.9f * num327; Main.dust[num329].scale *= num327; } return; } if (this.type == 521) { for (int num331 = 0; num331 < 3; num331++) { int num332 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 254, this.velocity.X, this.velocity.Y, 50, default(Color), 1.2f); Main.dust[num332].position = (Main.dust[num332].position + base.Center) / 2f; Main.dust[num332].noGravity = true; Main.dust[num332].velocity *= 0.5f; } for (int num333 = 0; num333 < 2; num333++) { int num332 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 255, this.velocity.X, this.velocity.Y, 50, default(Color), 0.4f); if (num333 == 0) { Main.dust[num332].position = (Main.dust[num332].position + base.Center * 5f) / 6f; } else if (num333 == 1) { Main.dust[num332].position = (Main.dust[num332].position + (base.Center + this.velocity / 2f) * 5f) / 6f; } Main.dust[num332].velocity *= 0.1f; Main.dust[num332].noGravity = true; Main.dust[num332].fadeIn = 1f; } return; } if (this.type == 522) { this.ai[1] += 1f; float num334 = (60f - this.ai[1]) / 60f; if (this.ai[1] > 40f) { this.Kill(); } this.velocity.Y = this.velocity.Y + 0.2f; if (this.velocity.Y > 18f) { this.velocity.Y = 18f; } this.velocity.X = this.velocity.X * 0.98f; for (int num335 = 0; num335 < 2; num335++) { int num336 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 254, this.velocity.X, this.velocity.Y, 50, default(Color), 1.1f); Main.dust[num336].position = (Main.dust[num336].position + base.Center) / 2f; Main.dust[num336].noGravity = true; Main.dust[num336].velocity *= 0.3f; Main.dust[num336].scale *= num334; } for (int num337 = 0; num337 < 1; num337++) { int num336 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 255, this.velocity.X, this.velocity.Y, 50, default(Color), 0.6f); Main.dust[num336].position = (Main.dust[num336].position + base.Center * 5f) / 6f; Main.dust[num336].velocity *= 0.1f; Main.dust[num336].noGravity = true; Main.dust[num336].fadeIn = 0.9f * num334; Main.dust[num336].scale *= num334; } return; } int num338 = this.type - 121 + 86; if (this.type == 597) { num338 = 262; } for (int num339 = 0; num339 < 2; num339++) { int num340 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, num338, this.velocity.X, this.velocity.Y, 50, default(Color), 1.2f); Main.dust[num340].noGravity = true; Main.dust[num340].velocity *= 0.3f; } if (this.ai[1] == 0f) { this.ai[1] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8); return; } } else if (this.aiStyle == 30) { this.velocity *= 0.8f; this.rotation += 0.2f; this.alpha += 4; if (this.alpha >= 255) { this.Kill(); return; } } else { if (this.aiStyle == 31) { int num341 = 110; int conversionType = 0; if (this.type == 146) { num341 = 111; conversionType = 2; } if (this.type == 147) { num341 = 112; conversionType = 1; } if (this.type == 148) { num341 = 113; conversionType = 3; } if (this.type == 149) { num341 = 114; conversionType = 4; } if (this.type == 780)// { num341 = 124; conversionType = 5; } if (this.owner == Main.myPlayer) { WorldGen.Convert((int)(this.position.X + (float)(this.width / 2)) / 16, (int)(this.position.Y + (float)(this.height / 2)) / 16, conversionType, 2); } if (this.timeLeft > 133) { this.timeLeft = 133; } if (this.ai[0] > 7f) { float num342 = 1f; if (this.ai[0] == 8f) { num342 = 0.2f; } else if (this.ai[0] == 9f) { num342 = 0.4f; } else if (this.ai[0] == 10f) { num342 = 0.6f; } else if (this.ai[0] == 11f) { num342 = 0.8f; } this.ai[0] += 1f; for (int num343 = 0; num343 < 1; num343++) { int num344 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, num341, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, default(Color), 1f); Main.dust[num344].noGravity = true; Main.dust[num344].scale *= 1.75f; Dust expr_FC50_cp_0 = Main.dust[num344]; expr_FC50_cp_0.velocity.X = expr_FC50_cp_0.velocity.X * 2f; Dust expr_FC70_cp_0 = Main.dust[num344]; expr_FC70_cp_0.velocity.Y = expr_FC70_cp_0.velocity.Y * 2f; Main.dust[num344].scale *= num342; } } else { this.ai[0] += 1f; } this.rotation += 0.3f * (float)this.direction; return; } if (this.aiStyle == 32) { this.timeLeft = 10; this.ai[0] += 1f; if (this.ai[0] >= 20f) { this.ai[0] = 15f; for (int num345 = 0; num345 < 255; num345++) { Rectangle rectangle3 = new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height); if (Main.player[num345].active) { Rectangle value9 = new Rectangle((int)Main.player[num345].position.X, (int)Main.player[num345].position.Y, Main.player[num345].width, Main.player[num345].height); if (rectangle3.Intersects(value9)) { this.ai[0] = 0f; this.velocity.Y = -4.5f; if (this.velocity.X > 2f) { this.velocity.X = 2f; } if (this.velocity.X < -2f) { this.velocity.X = -2f; } this.velocity.X = (this.velocity.X + (float)Main.player[num345].direction * 1.75f) / 2f; this.velocity.X = this.velocity.X + Main.player[num345].velocity.X * 3f; this.velocity.Y = this.velocity.Y + Main.player[num345].velocity.Y; if (this.velocity.X > 6f) { this.velocity.X = 6f; } if (this.velocity.X < -6f) { this.velocity.X = -6f; } this.netUpdate = true; this.ai[1] += 1f; } } } } if (this.velocity.X == 0f && this.velocity.Y == 0f) { this.Kill(); } this.rotation += 0.02f * this.velocity.X; if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.98f; } else if (this.wet) { this.velocity.X = this.velocity.X * 0.99f; } else { this.velocity.X = this.velocity.X * 0.995f; } if ((double)this.velocity.X > -0.03 && (double)this.velocity.X < 0.03) { this.velocity.X = 0f; } if (this.wet) { this.ai[1] = 0f; if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.95f; } this.velocity.Y = this.velocity.Y - 0.1f; if (this.velocity.Y < -4f) { this.velocity.Y = -4f; } if (this.velocity.X == 0f) { this.Kill(); } } else { this.velocity.Y = this.velocity.Y + 0.1f; } if (this.velocity.Y > 10f) { this.velocity.Y = 10f; return; } } else { if (this.aiStyle == 33) { if (this.alpha > 0) { this.alpha -= 50; if (this.alpha < 0) { this.alpha = 0; } } float num346 = 4f; float num347 = this.ai[0]; float num348 = this.ai[1]; if (num347 == 0f && num348 == 0f) { num347 = 1f; } float num349 = (float)Math.Sqrt((double)(num347 * num347 + num348 * num348)); num349 = num346 / num349; num347 *= num349; num348 *= num349; if (this.alpha < 70) { int num350 = 127; if (this.type == 310) { num350 = 187; } int num351 = Dust.NewDust(new Vector2(this.position.X, this.position.Y - 2f), 6, 6, num350, this.velocity.X, this.velocity.Y, 100, default(Color), 1.6f); Main.dust[num351].noGravity = true; Dust expr_10265_cp_0 = Main.dust[num351]; expr_10265_cp_0.position.X = expr_10265_cp_0.position.X - num347 * 1f; Dust expr_1028A_cp_0 = Main.dust[num351]; expr_1028A_cp_0.position.Y = expr_1028A_cp_0.position.Y - num348 * 1f; Dust expr_102AF_cp_0 = Main.dust[num351]; expr_102AF_cp_0.velocity.X = expr_102AF_cp_0.velocity.X - num347; Dust expr_102CE_cp_0 = Main.dust[num351]; expr_102CE_cp_0.velocity.Y = expr_102CE_cp_0.velocity.Y - num348; } if (this.localAI[0] == 0f) { this.ai[0] = this.velocity.X; this.ai[1] = this.velocity.Y; this.localAI[1] += 1f; if (this.localAI[1] >= 30f) { this.velocity.Y = this.velocity.Y + 0.09f; this.localAI[1] = 30f; } } else { if (!Collision.SolidCollision(this.position, this.width, this.height)) { this.localAI[0] = 0f; this.localAI[1] = 30f; } this.damage = 0; } if (this.velocity.Y > 16f) { this.velocity.Y = 16f; } this.rotation = (float)Math.Atan2((double)this.ai[1], (double)this.ai[0]) + 1.57f; return; } if (this.aiStyle == 34) { this.rotation = this.velocity.ToRotation() + 1.57079637f; if (this.type == 711) { float num472 = this.Center.X; float num473 = this.Center.Y; float num474 = 400f; bool flag17 = false; for (int num475 = 0; num475 < 200; num475++) { if (Main.npc[num475].CanBeChasedBy(this, false) && Collision.CanHit(this.Center, 1, 1, Main.npc[num475].Center, 1, 1)) { float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); float num478 = Math.Abs(this.position.X + (float)(this.width / 2) - num476) + Math.Abs(this.position.Y + (float)(this.height / 2) - num477); if (num478 < num474) { num474 = num478; num472 = num476; num473 = num477; flag17 = true; } } } if (flag17) { float num483 = 8f; Vector2 vector35 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num484 = num472 - vector35.X; float num485 = num473 - vector35.Y; float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); num486 = num483 / num486; num484 *= num486; num485 *= num486; this.velocity.X = (this.velocity.X * 20f + num484) / 21f; this.velocity.Y = (this.velocity.Y * 20f + num485) / 21f; return; } } if (this.ai[1] == 1f) { this.ai[0] += 1f; if (this.ai[0] == 1f) { for (int num352 = 0; num352 < 8; num352++) { int num353 = Dust.NewDust(this.position, this.width, this.height, 6, 0f, 0f, 100, default(Color), 1.8f); Main.dust[num353].noGravity = true; Main.dust[num353].velocity *= 3f; Main.dust[num353].fadeIn = 0.5f; Main.dust[num353].position += this.velocity / 2f; Main.dust[num353].velocity += this.velocity / 4f + Main.player[this.owner].velocity * 0.1f; } } if (this.ai[0] > 2f) { int num354 = Dust.NewDust(new Vector2(this.position.X + 2f, this.position.Y + 20f), 8, 8, 6, this.velocity.X, this.velocity.Y, 100, default(Color), 1.2f); Main.dust[num354].noGravity = true; Main.dust[num354].velocity *= 0.2f; Main.dust[num354].position = Main.dust[num354].position.RotatedBy((double)this.rotation, base.Center); num354 = Dust.NewDust(new Vector2(this.position.X + 2f, this.position.Y + 15f), 8, 8, 6, this.velocity.X, this.velocity.Y, 100, default(Color), 1.2f); Main.dust[num354].noGravity = true; Main.dust[num354].velocity *= 0.2f; Main.dust[num354].position = Main.dust[num354].position.RotatedBy((double)this.rotation, base.Center); num354 = Dust.NewDust(new Vector2(this.position.X + 2f, this.position.Y + 10f), 8, 8, 6, this.velocity.X, this.velocity.Y, 100, default(Color), 1.2f); Main.dust[num354].noGravity = true; Main.dust[num354].velocity *= 0.2f; Main.dust[num354].position = Main.dust[num354].position.RotatedBy((double)this.rotation, base.Center); return; } } else { if (this.type < 415 || this.type > 418) { int num355 = Dust.NewDust(new Vector2(this.position.X + 2f, this.position.Y + 20f), 8, 8, 6, this.velocity.X, this.velocity.Y, 100, default(Color), 1.2f); Main.dust[num355].noGravity = true; Main.dust[num355].velocity *= 0.2f; Main.dust[num355].position = Main.dust[num355].position.RotatedBy((double)this.rotation, base.Center); return; } this.ai[0] += 1f; if (this.ai[0] > 4f) { int num356 = Dust.NewDust(new Vector2(this.position.X + 2f, this.position.Y + 20f), 8, 8, 6, this.velocity.X, this.velocity.Y, 100, default(Color), 1.2f); Main.dust[num356].noGravity = true; Main.dust[num356].velocity *= 0.2f; Main.dust[num356].position = Main.dust[num356].position.RotatedBy((double)this.rotation, base.Center); return; } } } else if (this.aiStyle == 35) { this.ai[0] += 1f; if (this.ai[0] > 30f) { this.velocity.Y = this.velocity.Y + 0.2f; this.velocity.X = this.velocity.X * 0.985f; if (this.velocity.Y > 14f) { this.velocity.Y = 14f; } } this.rotation += (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) * (float)this.direction * 0.02f; if (this.owner == Main.myPlayer) { Vector2 vector26 = Collision.TileCollision(this.position, this.velocity, this.width, this.height, true, true, 1); bool flag9 = false; if (vector26 != this.velocity) { flag9 = true; } else { int num357 = (int)(base.Center.X + this.velocity.X) / 16; int num358 = (int)(base.Center.Y + this.velocity.Y) / 16; if (Main.tile[num357, num358] != null && Main.tile[num357, num358].active() && Main.tile[num357, num358].bottomSlope()) { flag9 = true; this.position.Y = (float)(num358 * 16 + 16 + 8); this.position.X = (float)(num357 * 16 + 8); } } if (flag9) { int num359 = 213; if (this.type == 475) { num359 = 353; } if (this.type == 506) { num359 = 366; } if (this.type == 505) { num359 = 365; } int num360 = (int)(this.position.X + (float)(this.width / 2)) / 16; int num361 = (int)(this.position.Y + (float)(this.height / 2)) / 16; this.position += vector26; int num362 = 10; if (Main.tile[num360, num361] != null) { while (Main.tile[num360, num361] != null && Main.tile[num360, num361].active()) { if (!Main.tileRope[(int)Main.tile[num360, num361].type]) { break; } num361++; } while (num362 > 0) { num362--; if (Main.tile[num360, num361] == null) { break; } if (Main.tile[num360, num361].active() && (Main.tileCut[(int)Main.tile[num360, num361].type] || Main.tile[num360, num361].type == 165)) { WorldGen.KillTile(num360, num361, false, false, false); NetMessage.SendData(17, -1, -1, "", 0, (float)num360, (float)num361, 0f, 0, 0, 0); } if (!Main.tile[num360, num361].active()) { WorldGen.PlaceTile(num360, num361, num359, false, false, -1, 0); NetMessage.SendData(17, -1, -1, "", 1, (float)num360, (float)num361, (float)num359, 0, 0, 0); this.ai[1] += 1f; } else { num362 = 0; } num361++; } this.Kill(); return; } } } } else if (this.aiStyle == 36) { if (this.type != 307 && this.wet && !this.honeyWet) { this.Kill(); } if (this.alpha > 0) { this.alpha -= 50; } else { this.extraUpdates = 0; } if (this.alpha < 0) { this.alpha = 0; } if (this.type == 307) { this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 1.57f; this.frameCounter++; if (this.frameCounter >= 6) { this.frame++; this.frameCounter = 0; } if (this.frame >= 2) { this.frame = 0; } for (int num363 = 0; num363 < 3; num363++) { float num364 = this.velocity.X / 3f * (float)num363; float num365 = this.velocity.Y / 3f * (float)num363; int num366 = Dust.NewDust(this.position, this.width, this.height, 184, 0f, 0f, 0, default(Color), 1f); Main.dust[num366].position.X = base.Center.X - num364; Main.dust[num366].position.Y = base.Center.Y - num365; Main.dust[num366].velocity *= 0f; Main.dust[num366].scale = 0.5f; } } else { if (this.type == 316) { if (this.velocity.X > 0f) { this.spriteDirection = -1; } else if (this.velocity.X < 0f) { this.spriteDirection = 1; } } else if (this.velocity.X > 0f) { this.spriteDirection = 1; } else if (this.velocity.X < 0f) { this.spriteDirection = -1; } this.rotation = this.velocity.X * 0.1f; this.frameCounter++; if (this.frameCounter >= 3) { this.frame++; this.frameCounter = 0; } if (this.frame >= 3) { this.frame = 0; } } float num367 = this.position.X; float num368 = this.position.Y; float num369 = 100000f; bool flag10 = false; this.ai[0] += 1f; if (this.ai[0] > 30f) { this.ai[0] = 30f; for (int num370 = 0; num370 < 200; num370++) { if (Main.npc[num370].CanBeChasedBy(this, false) && (!Main.npc[num370].wet || this.type == 307)) { float num371 = Main.npc[num370].position.X + (float)(Main.npc[num370].width / 2); float num372 = Main.npc[num370].position.Y + (float)(Main.npc[num370].height / 2); float num373 = Math.Abs(this.position.X + (float)(this.width / 2) - num371) + Math.Abs(this.position.Y + (float)(this.height / 2) - num372); if (num373 < 800f && num373 < num369 && Collision.CanHit(this.position, this.width, this.height, Main.npc[num370].position, Main.npc[num370].width, Main.npc[num370].height)) { num369 = num373; num367 = num371; num368 = num372; flag10 = true; } } } } if (!flag10) { num367 = this.position.X + (float)(this.width / 2) + this.velocity.X * 100f; num368 = this.position.Y + (float)(this.height / 2) + this.velocity.Y * 100f; } else if (this.type == 307) { this.friendly = true; } float num374 = 6f; float num375 = 0.1f; if (this.type == 189) { num374 = 7f; num375 = 0.15f; } if (this.type == 307) { num374 = 9f; num375 = 0.2f; } if (this.type == 316) { num374 = 10f; num375 = 0.25f; } if (this.type == 566) { num374 = 6.8f; num375 = 0.14f; } Vector2 vector27 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num376 = num367 - vector27.X; float num377 = num368 - vector27.Y; float num378 = (float)Math.Sqrt((double)(num376 * num376 + num377 * num377)); num378 = num374 / num378; num376 *= num378; num377 *= num378; if (this.velocity.X < num376) { this.velocity.X = this.velocity.X + num375; if (this.velocity.X < 0f && num376 > 0f) { this.velocity.X = this.velocity.X + num375 * 2f; } } else if (this.velocity.X > num376) { this.velocity.X = this.velocity.X - num375; if (this.velocity.X > 0f && num376 < 0f) { this.velocity.X = this.velocity.X - num375 * 2f; } } if (this.velocity.Y < num377) { this.velocity.Y = this.velocity.Y + num375; if (this.velocity.Y < 0f && num377 > 0f) { this.velocity.Y = this.velocity.Y + num375 * 2f; return; } } else if (this.velocity.Y > num377) { this.velocity.Y = this.velocity.Y - num375; if (this.velocity.Y > 0f && num377 < 0f) { this.velocity.Y = this.velocity.Y - num375 * 2f; return; } } } else if (this.aiStyle == 37) { if (this.ai[1] == 0f) { this.ai[1] = this.position.Y - 5f; } if (this.ai[0] == 0f) { if (Collision.SolidCollision(this.position, this.width, this.height)) { this.velocity.Y = this.velocity.Y * -1f; this.ai[0] += 1f; return; } float num379 = this.position.Y - this.ai[1]; if (num379 > 300f) { this.velocity.Y = this.velocity.Y * -1f; this.ai[0] += 1f; return; } } else if (Collision.SolidCollision(this.position, this.width, this.height) || this.position.Y < this.ai[1]) { this.Kill(); return; } } else if (this.aiStyle == 38) { this.ai[0] += 1f; if (this.ai[0] >= 6f) { this.ai[0] = 0f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 34); if (Main.myPlayer == this.owner) { Projectile.NewProjectile(this.position.X, this.position.Y, this.velocity.X, this.velocity.Y, 188, this.damage, this.knockBack, this.owner, 0f, 0f); return; } } } else if (this.aiStyle == 39) { this.alpha -= 50; if (this.alpha < 0) { this.alpha = 0; } if (Main.player[this.owner].dead) { this.Kill(); return; } if (this.alpha == 0) { Main.player[this.owner].itemAnimation = 5; Main.player[this.owner].itemTime = 5; if (this.position.X + (float)(this.width / 2) > Main.player[this.owner].position.X + (float)(Main.player[this.owner].width / 2)) { Main.player[this.owner].ChangeDir(1); } else { Main.player[this.owner].ChangeDir(-1); } } Vector2 vector28 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num380 = Main.player[this.owner].position.X + (float)(Main.player[this.owner].width / 2) - vector28.X; float num381 = Main.player[this.owner].position.Y + (float)(Main.player[this.owner].height / 2) - vector28.Y; float num382 = (float)Math.Sqrt((double)(num380 * num380 + num381 * num381)); if (!Main.player[this.owner].channel && this.alpha == 0) { this.ai[0] = 1f; this.ai[1] = -1f; } if (this.ai[1] > 0f && num382 > 1500f) { this.ai[1] = 0f; this.ai[0] = 1f; } if (this.ai[1] > 0f) { this.tileCollide = false; int num383 = (int)this.ai[1] - 1; if (Main.npc[num383].active && Main.npc[num383].life > 0) { float num384 = 16f; vector28 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); num380 = Main.npc[num383].position.X + (float)(Main.npc[num383].width / 2) - vector28.X; num381 = Main.npc[num383].position.Y + (float)(Main.npc[num383].height / 2) - vector28.Y; num382 = (float)Math.Sqrt((double)(num380 * num380 + num381 * num381)); if (num382 < num384) { this.velocity.X = num380; this.velocity.Y = num381; if (num382 > num384 / 2f) { if (this.velocity.X < 0f) { this.spriteDirection = -1; this.rotation = (float)Math.Atan2((double)(-(double)this.velocity.Y), (double)(-(double)this.velocity.X)); } else { this.spriteDirection = 1; this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X); } } } else { num382 = num384 / num382; num380 *= num382; num381 *= num382; this.velocity.X = num380; this.velocity.Y = num381; if (this.velocity.X < 0f) { this.spriteDirection = -1; this.rotation = (float)Math.Atan2((double)(-(double)this.velocity.Y), (double)(-(double)this.velocity.X)); } else { this.spriteDirection = 1; this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X); } } this.ai[0] = 1f; } else { this.ai[1] = 0f; float num385 = this.position.X; float num386 = this.position.Y; float num387 = 3000f; int num388 = -1; for (int num389 = 0; num389 < 200; num389++) { if (Main.npc[num389].CanBeChasedBy(this, false)) { float num390 = Main.npc[num389].position.X + (float)(Main.npc[num389].width / 2); float num391 = Main.npc[num389].position.Y + (float)(Main.npc[num389].height / 2); float num392 = Math.Abs(this.position.X + (float)(this.width / 2) - num390) + Math.Abs(this.position.Y + (float)(this.height / 2) - num391); if (num392 < num387 && Collision.CanHit(this.position, this.width, this.height, Main.npc[num389].position, Main.npc[num389].width, Main.npc[num389].height)) { num387 = num392; num385 = num390; num386 = num391; num388 = num389; } } } if (num388 >= 0) { float num393 = 16f; vector28 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); num380 = num385 - vector28.X; num381 = num386 - vector28.Y; num382 = (float)Math.Sqrt((double)(num380 * num380 + num381 * num381)); num382 = num393 / num382; num380 *= num382; num381 *= num382; this.velocity.X = num380; this.velocity.Y = num381; this.ai[0] = 0f; this.ai[1] = (float)(num388 + 1); } } } else if (this.ai[0] == 0f) { if (num382 > 700f) { this.ai[0] = 1f; } if (this.velocity.X < 0f) { this.spriteDirection = -1; this.rotation = (float)Math.Atan2((double)(-(double)this.velocity.Y), (double)(-(double)this.velocity.X)); } else { this.spriteDirection = 1; this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X); } } else if (this.ai[0] == 1f) { this.tileCollide = false; if (this.velocity.X < 0f) { this.spriteDirection = 1; this.rotation = (float)Math.Atan2((double)(-(double)this.velocity.Y), (double)(-(double)this.velocity.X)); } else { this.spriteDirection = -1; this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X); } if (this.velocity.X < 0f) { this.spriteDirection = -1; this.rotation = (float)Math.Atan2((double)(-(double)this.velocity.Y), (double)(-(double)this.velocity.X)); } else { this.spriteDirection = 1; this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X); } float num394 = 20f; if (num382 < 70f) { this.Kill(); } num382 = num394 / num382; num380 *= num382; num381 *= num382; this.velocity.X = num380; this.velocity.Y = num381; } this.frameCounter++; if (this.frameCounter >= 4) { this.frame++; this.frameCounter = 0; } if (this.frame >= 4) { this.frame = 0; return; } } else { if (this.aiStyle == 40) { this.localAI[0] += 1f; if (this.localAI[0] > 3f) { this.localAI[0] = 100f; this.alpha -= 50; if (this.alpha < 0) { this.alpha = 0; } } this.frameCounter++; if (this.frameCounter >= 3) { this.frame++; this.frameCounter = 0; } if (this.frame >= 5) { this.frame = 0; } this.velocity.X = this.velocity.X + this.ai[0]; this.velocity.Y = this.velocity.Y + this.ai[1]; this.localAI[1] += 1f; if (this.localAI[1] == 50f) { this.localAI[1] = 51f; this.ai[0] = (float)Main.rand.Next(-100, 101) * 6E-05f; this.ai[1] = (float)Main.rand.Next(-100, 101) * 6E-05f; } if (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) > 16f) { this.velocity.X = this.velocity.X * 0.95f; this.velocity.Y = this.velocity.Y * 0.95f; } if (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) < 12f) { this.velocity.X = this.velocity.X * 1.05f; this.velocity.Y = this.velocity.Y * 1.05f; } this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 3.14f; return; } if (this.aiStyle == 41) { if (this.localAI[0] == 0f) { this.localAI[0] = 1f; this.frame = Main.rand.Next(3); } this.rotation += this.velocity.X * 0.01f; return; } if (this.aiStyle == 42) { if (!Main.player[this.owner].crystalLeaf) { this.Kill(); return; } this.position.X = Main.player[this.owner].Center.X - (float)(this.width / 2); this.position.Y = Main.player[this.owner].Center.Y - (float)(this.height / 2) + Main.player[this.owner].gfxOffY - 60f; if (Main.player[this.owner].gravDir == -1f) { this.position.Y = this.position.Y + 120f; this.rotation = 3.14f; } else { this.rotation = 0f; } this.position.X = (float)((int)this.position.X); this.position.Y = (float)((int)this.position.Y); float num395 = (float)Main.mouseTextColor / 200f - 0.35f; num395 *= 0.2f; this.scale = num395 + 0.95f; if (this.owner == Main.myPlayer) { if (this.ai[0] != 0f) { this.ai[0] -= 1f; return; } float num396 = this.position.X; float num397 = this.position.Y; float num398 = 700f; bool flag11 = false; for (int num399 = 0; num399 < 200; num399++) { if (Main.npc[num399].CanBeChasedBy(this, true)) { float num400 = Main.npc[num399].position.X + (float)(Main.npc[num399].width / 2); float num401 = Main.npc[num399].position.Y + (float)(Main.npc[num399].height / 2); float num402 = Math.Abs(this.position.X + (float)(this.width / 2) - num400) + Math.Abs(this.position.Y + (float)(this.height / 2) - num401); if (num402 < num398 && Collision.CanHit(this.position, this.width, this.height, Main.npc[num399].position, Main.npc[num399].width, Main.npc[num399].height)) { num398 = num402; num396 = num400; num397 = num401; flag11 = true; } } } if (flag11) { float num403 = 12f; Vector2 vector29 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num404 = num396 - vector29.X; float num405 = num397 - vector29.Y; float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); num406 = num403 / num406; num404 *= num406; num405 *= num406; Projectile.NewProjectile(base.Center.X - 4f, base.Center.Y, num404, num405, 227, Player.crystalLeafDamage, (float)Player.crystalLeafKB, this.owner, 0f, 0f); this.ai[0] = 50f; return; } } } else { if (this.aiStyle == 43) { if (this.localAI[1] == 0f) { Main.PlaySound(6, (int)this.position.X, (int)this.position.Y, 1); this.localAI[1] += 1f; for (int num407 = 0; num407 < 5; num407++) { int num408 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 157, 0f, 0f, 0, default(Color), 1f); Main.dust[num408].noGravity = true; Main.dust[num408].velocity *= 3f; Main.dust[num408].scale = 1.5f; } } this.ai[0] = (float)Main.rand.Next(-100, 101) * 0.0025f; this.ai[1] = (float)Main.rand.Next(-100, 101) * 0.0025f; if (this.localAI[0] == 0f) { this.scale += 0.05f; if ((double)this.scale > 1.2) { this.localAI[0] = 1f; } } else { this.scale -= 0.05f; if ((double)this.scale < 0.8) { this.localAI[0] = 0f; } } this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 3.14f; int num409 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 157, 0f, 0f, 0, default(Color), 1f); Main.dust[num409].noGravity = true; Main.dust[num409].velocity *= 0.1f; Main.dust[num409].scale = 1.5f; return; } if (this.aiStyle == 44) { if (this.type == 228) { this.velocity *= 0.96f; this.alpha += 4; if (this.alpha > 255) { this.Kill(); } } else if (this.type == 229) { if (this.ai[0] == 0f) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8); } this.ai[0] += 1f; if (this.ai[0] > 20f) { this.velocity.Y = this.velocity.Y + 0.3f; this.velocity.X = this.velocity.X * 0.98f; } } this.frameCounter++; if (this.frameCounter > 5) { this.frame++; this.frameCounter = 0; } if (this.frame >= Main.projFrames[this.type]) { this.frame = 0; return; } } else if (this.aiStyle == 45) { if (this.type == 237 || this.type == 243 || this.type == 696) { float num410 = this.ai[0]; float num411 = this.ai[1]; if (num410 != 0f && num411 != 0f) { bool flag12 = false; bool flag13 = false; if ((this.velocity.X < 0f && base.Center.X < num410) || (this.velocity.X > 0f && base.Center.X > num410)) { flag12 = true; } if ((this.velocity.Y < 0f && base.Center.Y < num411) || (this.velocity.Y > 0f && base.Center.Y > num411)) { flag13 = true; } if (flag12 && flag13) { this.Kill(); } } this.rotation += this.velocity.X * 0.02f; this.frameCounter++; if (this.frameCounter > 4) { this.frameCounter = 0; this.frame++; if (this.frame > 3) { this.frame = 0; return; } } } else if (this.type == 238 || this.type == 244 || this.type == 694) // { this.frameCounter++; if (this.frameCounter > 8) { this.frameCounter = 0; this.frame++; if (this.frame > 5) { this.frame = 0; } } this.ai[1] += 1f; if (this.type == 244 && this.ai[1] >= 3600f) { this.alpha += 5; if (this.alpha > 255) { this.alpha = 255; this.Kill(); } } else if (this.type == 238 && this.ai[1] >= 7200f) { this.alpha += 5; if (this.alpha > 255) { this.alpha = 255; this.Kill(); } } else if (this.type == 694 && this.ai[1] >= 7200f) { this.alpha += 5; if (this.alpha > 255) { this.alpha = 255; this.Kill(); } } else { this.ai[0] += 1f; if (this.type == 244) { if (this.ai[0] > 10f) { this.ai[0] = 0f; if (this.owner == Main.myPlayer) { int num412 = (int)(this.position.X + 14f + (float)Main.rand.Next(this.width - 28)); int num413 = (int)(this.position.Y + (float)this.height + 4f); Projectile.NewProjectile((float)num412, (float)num413, 0f, 5f, 245, this.damage, 0f, this.owner, 0f, 0f); } } } else if (this.type == 694) { if (this.ai[0] > 6f) { this.ai[0] = 0f; if (this.owner == Main.myPlayer) { int num412 = (int)(this.position.X + 14f + (float)Main.rand.Next(this.width - 28)); int num413 = (int)(this.position.Y + (float)this.height + 4f); Projectile.NewProjectile((float)num412, (float)num413, 0f, 5f, 695, this.damage, 0f, this.owner, 0f, 0f); } } } else if (this.ai[0] > 8f) { this.ai[0] = 0f; if (this.owner == Main.myPlayer) { int num414 = (int)(this.position.X + 14f + (float)Main.rand.Next(this.width - 28)); int num415 = (int)(this.position.Y + (float)this.height + 4f); Projectile.NewProjectile((float)num414, (float)num415, 0f, 5f, 239, this.damage, 0f, this.owner, 0f, 0f); } } } this.localAI[0] += 1f; if (this.localAI[0] >= 10f) { this.localAI[0] = 0f; int num416 = 0; int num417 = 0; float num418 = 0f; int num419 = this.type; for (int num420 = 0; num420 < 1000; num420++) { if (Main.projectile[num420].active && Main.projectile[num420].owner == this.owner && Main.projectile[num420].type == num419 && Main.projectile[num420].ai[1] < 3600f) { num416++; if (Main.projectile[num420].ai[1] > num418) { num417 = num420; num418 = Main.projectile[num420].ai[1]; } } } if (this.type == 244) { if (num416 > 1) { Main.projectile[num417].netUpdate = true; Main.projectile[num417].ai[1] = 36000f; return; } } else if (num416 > 2) { Main.projectile[num417].netUpdate = true; Main.projectile[num417].ai[1] = 36000f; return; } } } else { if (this.type == 239) { this.alpha = 50; return; } if (this.type == 245) { this.alpha = 100; return; } if (this.type == 695) { this.alpha = 30; return; } if (this.type == 264) { this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f; return; } } } else if (this.aiStyle == 46) { int num421 = 1200; if (this.type == 250) { if (this.owner == Main.myPlayer) { this.localAI[0] += 1f; if (this.localAI[0] > 4f) { this.localAI[0] = 3f; Projectile.NewProjectile(base.Center.X, base.Center.Y, this.velocity.X * 0.001f, this.velocity.Y * 0.001f, 251, this.damage, this.knockBack, this.owner, 0f, 0f); } if (this.timeLeft > num421) { this.timeLeft = num421; } } float num422 = 1f; if (this.velocity.Y < 0f) { num422 -= this.velocity.Y / 3f; } this.ai[0] += num422; if (this.ai[0] > 30f) { this.velocity.Y = this.velocity.Y + 0.5f; if (this.velocity.Y > 0f) { this.velocity.X = this.velocity.X * 0.95f; } else { this.velocity.X = this.velocity.X * 1.05f; } } float num423 = this.velocity.X; float num424 = this.velocity.Y; float num425 = (float)Math.Sqrt((double)(num423 * num423 + num424 * num424)); num425 = 15.95f * this.scale / num425; num423 *= num425; num424 *= num425; this.velocity.X = num423; this.velocity.Y = num424; this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 1.57f; return; } if (this.localAI[0] == 0f) { if (this.velocity.X > 0f) { this.spriteDirection = -1; this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 1.57f; } else { this.spriteDirection = 1; this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) - 1.57f; } this.localAI[0] = 1f; this.timeLeft = num421; } this.velocity.X = this.velocity.X * 0.98f; this.velocity.Y = this.velocity.Y * 0.98f; if (this.rotation == 0f) { this.alpha = 255; return; } if (this.timeLeft < 10) { this.alpha = 255 - (int)(255f * (float)this.timeLeft / 10f); return; } if (this.timeLeft > num421 - 10) { int num426 = num421 - this.timeLeft; this.alpha = 255 - (int)(255f * (float)num426 / 10f); return; } this.alpha = 0; return; } else if (this.aiStyle == 47) { if (this.ai[0] == 0f) { this.ai[0] = this.velocity.X; this.ai[1] = this.velocity.Y; } if (this.velocity.X > 0f) { this.rotation += (Math.Abs(this.velocity.Y) + Math.Abs(this.velocity.X)) * 0.001f; } else { this.rotation -= (Math.Abs(this.velocity.Y) + Math.Abs(this.velocity.X)) * 0.001f; } this.frameCounter++; if (this.frameCounter > 6) { this.frameCounter = 0; this.frame++; if (this.frame > 4) { this.frame = 0; } } if (Math.Sqrt((double)(this.velocity.X * this.velocity.X + this.velocity.Y * this.velocity.Y)) > 2.0) { this.velocity *= 0.98f; } for (int num427 = 0; num427 < 1000; num427++) { if (num427 != this.whoAmI && Main.projectile[num427].active && Main.projectile[num427].owner == this.owner && Main.projectile[num427].type == this.type && this.timeLeft > Main.projectile[num427].timeLeft && Main.projectile[num427].timeLeft > 30) { Main.projectile[num427].timeLeft = 30; } } int[] array = new int[20]; int num428 = 0; float num429 = 300f; bool flag14 = false; for (int num430 = 0; num430 < 200; num430++) { if (Main.npc[num430].CanBeChasedBy(this, false)) { float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); float num433 = Math.Abs(this.position.X + (float)(this.width / 2) - num431) + Math.Abs(this.position.Y + (float)(this.height / 2) - num432); if (num433 < num429 && Collision.CanHit(base.Center, 1, 1, Main.npc[num430].Center, 1, 1)) { if (num428 < 20) { array[num428] = num430; num428++; } flag14 = true; } } } if (this.timeLeft < 30) { flag14 = false; } if (flag14) { int num434 = Main.rand.Next(num428); num434 = array[num434]; float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); this.localAI[0] += 1f; if (this.localAI[0] > 8f) { this.localAI[0] = 0f; float num437 = 6f; Vector2 value10 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); value10 += this.velocity * 4f; float num438 = num435 - value10.X; float num439 = num436 - value10.Y; float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); num440 = num437 / num440; num438 *= num440; num439 *= num440; Projectile.NewProjectile(value10.X, value10.Y, num438, num439, 255, this.damage, this.knockBack, this.owner, 0f, 0f); return; } } } else if (this.aiStyle == 48) { if (this.type == 873) { if (this.localAI[0] == 0f) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8); } this.localAI[0] += 1f; if (this.localAI[0] > 3f) { for (int num445 = 0; num445 < 3; num445++) { Vector2 vector32 = this.position; vector32 -= this.velocity * ((float)num445 * 0.3334f); this.alpha = 255; int num446 = Dust.NewDust(vector32, 1, 1, 158, 0f, 0f, 0, default(Color), 1f); Main.dust[num446].position = vector32; Main.dust[num446].scale = (float)Main.rand.Next(70, 110) * 0.013f; Main.dust[num446].velocity *= 0.2f; } return; } } if (this.type == 255) { for (int num441 = 0; num441 < 4; num441++) { Vector2 vector30 = this.position; vector30 -= this.velocity * ((float)num441 * 0.25f); this.alpha = 255; int num442 = Dust.NewDust(vector30, 1, 1, 160, 0f, 0f, 0, default(Color), 1f); Main.dust[num442].position = vector30; Dust expr_13A3E_cp_0 = Main.dust[num442]; expr_13A3E_cp_0.position.X = expr_13A3E_cp_0.position.X + (float)(this.width / 2); Dust expr_13A62_cp_0 = Main.dust[num442]; expr_13A62_cp_0.position.Y = expr_13A62_cp_0.position.Y + (float)(this.height / 2); Main.dust[num442].scale = (float)Main.rand.Next(70, 110) * 0.013f; Main.dust[num442].velocity *= 0.2f; } return; } if (this.type == 433) { for (int num443 = 0; num443 < 2; num443++) { Vector2 vector31 = this.position; vector31 -= this.velocity * ((float)num443 * 0.25f); this.alpha = 255; int num444 = Dust.NewDust(vector31, 1, 1, 160, 0f, 0f, 0, default(Color), 1f); Main.dust[num444].position = vector31; Dust expr_13B75_cp_0 = Main.dust[num444]; expr_13B75_cp_0.position.X = expr_13B75_cp_0.position.X + (float)(this.width / 2); Dust expr_13B99_cp_0 = Main.dust[num444]; expr_13B99_cp_0.position.Y = expr_13B99_cp_0.position.Y + (float)(this.height / 2); if (Main.rand.Next(2) == 0) { Main.dust[num444].color = Color.LimeGreen; } else { Main.dust[num444].color = Color.CornflowerBlue; } Main.dust[num444].scale = (float)Main.rand.Next(70, 110) * 0.013f; Main.dust[num444].velocity *= 0.2f; } return; } if (this.type == 290) { if (this.localAI[0] == 0f) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8); } this.localAI[0] += 1f; if (this.localAI[0] > 3f) { for (int num445 = 0; num445 < 3; num445++) { Vector2 vector32 = this.position; vector32 -= this.velocity * ((float)num445 * 0.3334f); this.alpha = 255; int num446 = Dust.NewDust(vector32, 1, 1, 173, 0f, 0f, 0, default(Color), 1f); Main.dust[num446].position = vector32; Main.dust[num446].scale = (float)Main.rand.Next(70, 110) * 0.013f; Main.dust[num446].velocity *= 0.2f; } return; } } else if (this.type == 294) { this.localAI[0] += 1f; if (this.localAI[0] > 9f) { for (int num447 = 0; num447 < 2; num447++) { Vector2 vector33 = this.position; vector33 -= this.velocity * ((float)num447 * 0.25f); this.alpha = 255; int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default(Color), 1f); Main.dust[num448].position = vector33; Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; Main.dust[num448].velocity *= 0.2f; } return; } } else if (this.type == 662) { this.localAI[0] += 1f; if (this.localAI[0] > 9f) { for (int num447 = 0; num447 < 2; num447++) { Vector2 vector33 = this.position; vector33 -= this.velocity * ((float)num447 * 0.25f); this.alpha = 255; int num448 = Dust.NewDust(vector33, 1, 1, 162, 0f, 0f, 0, default(Color), 1f); Main.dust[num448].position = vector33; Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; Main.dust[num448].velocity *= 0.2f; } return; } } else { this.localAI[0] += 1f; if (this.localAI[0] > 3f) { for (int num449 = 0; num449 < 4; num449++) { Vector2 vector34 = this.position; vector34 -= this.velocity * ((float)num449 * 0.25f); this.alpha = 255; int num450 = Dust.NewDust(vector34, 1, 1, 162, 0f, 0f, 0, default(Color), 1f); Main.dust[num450].position = vector34; Dust expr_13F6C_cp_0 = Main.dust[num450]; expr_13F6C_cp_0.position.X = expr_13F6C_cp_0.position.X + (float)(this.width / 2); Dust expr_13F90_cp_0 = Main.dust[num450]; expr_13F90_cp_0.position.Y = expr_13F90_cp_0.position.Y + (float)(this.height / 2); Main.dust[num450].scale = (float)Main.rand.Next(70, 110) * 0.013f; Main.dust[num450].velocity *= 0.2f; } return; } } } else if (this.aiStyle == 49) { if (this.ai[1] == 0f) { this.ai[1] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); } if (this.ai[1] == 1f) { if (this.velocity.X > 0f) { this.direction = 1; } else if (this.velocity.X < 0f) { this.direction = -1; } this.spriteDirection = this.direction; this.ai[0] += 1f; this.rotation += this.velocity.X * 0.05f + (float)this.direction * 0.05f; if (this.ai[0] >= 18f) { this.velocity.Y = this.velocity.Y + 0.28f; this.velocity.X = this.velocity.X * 0.99f; } if ((double)this.velocity.Y > 15.9) { this.velocity.Y = 15.9f; } if (this.ai[0] > 2f) { this.alpha = 0; if (this.ai[0] == 3f) { for (int num451 = 0; num451 < 10; num451++) { int num452 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num452].velocity *= 0.5f; Main.dust[num452].velocity += this.velocity * 0.1f; } for (int num453 = 0; num453 < 5; num453++) { int num454 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 2f); Main.dust[num454].noGravity = true; Main.dust[num454].velocity *= 3f; Main.dust[num454].velocity += this.velocity * 0.2f; num454 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 1f); Main.dust[num454].velocity *= 2f; Main.dust[num454].velocity += this.velocity * 0.3f; } for (int num455 = 0; num455 < 1; num455++) { int num456 = Gore.NewGore(new Vector2(this.position.X - 10f, this.position.Y - 10f), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num456].position += this.velocity * 1.25f; Main.gore[num456].scale = 1.5f; Main.gore[num456].velocity += this.velocity * 0.5f; Main.gore[num456].velocity *= 0.02f; } return; } } } else if (this.ai[1] == 2f) { this.rotation = 0f; this.velocity.X = this.velocity.X * 0.95f; this.velocity.Y = this.velocity.Y + 0.2f; return; } } else if (this.aiStyle == 50) { if (this.type == 291) { if (this.localAI[0] == 0f) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 20); this.localAI[0] += 1f; } bool flag15 = false; bool flag16 = false; if (this.velocity.X < 0f && this.position.X < this.ai[0]) { flag15 = true; } if (this.velocity.X > 0f && this.position.X > this.ai[0]) { flag15 = true; } if (this.velocity.Y < 0f && this.position.Y < this.ai[1]) { flag16 = true; } if (this.velocity.Y > 0f && this.position.Y > this.ai[1]) { flag16 = true; } if (flag15 && flag16) { this.Kill(); } for (int num457 = 0; num457 < 10; num457++) { int num458 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 174, 0f, 0f, 100, default(Color), 1.2f); Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0.5f; Main.dust[num458].velocity += this.velocity * 0.1f; } return; } if (this.type == 295) { for (int num459 = 0; num459 < 8; num459++) { int num460 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 174, 0f, 0f, 100, default(Color), 1.2f); Main.dust[num460].noGravity = true; Main.dust[num460].velocity *= 0.5f; Main.dust[num460].velocity += this.velocity * 0.1f; } return; } if (this.localAI[0] == 0f) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 74); this.localAI[0] += 1f; } this.ai[0] += 1f; if (this.type == 296) { this.ai[0] += 3f; } float num461 = 25f; if (this.ai[0] > 180f) { num461 -= (this.ai[0] - 180f) / 2f; } if (num461 <= 0f) { num461 = 0f; this.Kill(); } if (this.type == 296) { num461 *= 0.7f; } int num462 = 0; while ((float)num462 < num461) { float num463 = (float)Main.rand.Next(-10, 11); float num464 = (float)Main.rand.Next(-10, 11); float num465 = (float)Main.rand.Next(3, 9); float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); num466 = num465 / num466; num463 *= num466; num464 *= num466; int num467 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 174, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num467].noGravity = true; Main.dust[num467].position.X = base.Center.X; Main.dust[num467].position.Y = base.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; } return; } else if (this.aiStyle == 51) { if (this.type == 297) { this.localAI[0] += 1f; if (this.localAI[0] > 4f) { for (int num468 = 0; num468 < 5; num468++) { int num469 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 175, 0f, 0f, 100, default(Color), 2f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } } } else if (this.type == 663) { this.localAI[0] += 1f; if (this.localAI[0] > 3f) { for (int num468 = 0; num468 < 4; num468++) { int num469 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 127, 0f, 0f, 100, default(Color), 2f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } } } else { if (this.localAI[0] == 0f) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 8); this.localAI[0] += 1f; } for (int num470 = 0; num470 < 9; num470++) { int num471 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 175, 0f, 0f, 100, default(Color), 1.3f); Main.dust[num471].noGravity = true; Main.dust[num471].velocity *= 0f; } } float num472 = base.Center.X; float num473 = base.Center.Y; float num474 = 400f; bool flag17 = false; if (this.type == 297 || this.type == 663) { for (int num475 = 0; num475 < 200; num475++) { if (Main.npc[num475].CanBeChasedBy(this, false) && Collision.CanHit(base.Center, 1, 1, Main.npc[num475].Center, 1, 1)) { float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); float num478 = Math.Abs(this.position.X + (float)(this.width / 2) - num476) + Math.Abs(this.position.Y + (float)(this.height / 2) - num477); if (num478 < num474) { num474 = num478; num472 = num476; num473 = num477; flag17 = true; } } } } else { num474 = 200f; for (int num479 = 0; num479 < 255; num479++) { if (Main.player[num479].active && !Main.player[num479].dead) { float num480 = Main.player[num479].position.X + (float)(Main.player[num479].width / 2); float num481 = Main.player[num479].position.Y + (float)(Main.player[num479].height / 2); float num482 = Math.Abs(this.position.X + (float)(this.width / 2) - num480) + Math.Abs(this.position.Y + (float)(this.height / 2) - num481); if (num482 < num474) { num474 = num482; num472 = num480; num473 = num481; flag17 = true; } } } } if (flag17) { float num483 = 3f; if (this.type == 297) { num483 = 6f; } if (this.type == 663) { num483 = 8f; } Vector2 vector35 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num484 = num472 - vector35.X; float num485 = num473 - vector35.Y; float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); num486 = num483 / num486; num484 *= num486; num485 *= num486; if (this.type == 297 || this.type == 663) { this.velocity.X = (this.velocity.X * 20f + num484) / 21f; this.velocity.Y = (this.velocity.Y * 20f + num485) / 21f; return; } this.velocity.X = (this.velocity.X * 100f + num484) / 101f; this.velocity.Y = (this.velocity.Y * 100f + num485) / 101f; return; } } else if (this.aiStyle == 52) { int num487 = (int)this.ai[0]; float num488 = 4f; Vector2 vector36 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num489 = Main.player[num487].Center.X - vector36.X; float num490 = Main.player[num487].Center.Y - vector36.Y; float num491 = (float)Math.Sqrt((double)(num489 * num489 + num490 * num490)); if (num491 < 50f && this.position.X < Main.player[num487].position.X + (float)Main.player[num487].width && this.position.X + (float)this.width > Main.player[num487].position.X && this.position.Y < Main.player[num487].position.Y + (float)Main.player[num487].height && this.position.Y + (float)this.height > Main.player[num487].position.Y) { if (this.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) { int num492 = (int)this.ai[1]; Main.player[num487].HealEffect(num492, false); Main.player[num487].statLife += num492; if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) { Main.player[num487].statLife = Main.player[num487].statLifeMax2; } NetMessage.SendData(66, -1, -1, "", num487, (float)num492, 0f, 0f, 0, 0, 0); } this.Kill(); } num491 = num488 / num491; num489 *= num491; num490 *= num491; this.velocity.X = (this.velocity.X * 15f + num489) / 16f; this.velocity.Y = (this.velocity.Y * 15f + num490) / 16f; if (this.type == 305) { for (int num493 = 0; num493 < 3; num493++) { float num494 = this.velocity.X * 0.334f * (float)num493; float num495 = -(this.velocity.Y * 0.334f) * (float)num493; int num496 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 183, 0f, 0f, 100, default(Color), 1.1f); Main.dust[num496].noGravity = true; Main.dust[num496].velocity *= 0f; Dust expr_153E2_cp_0 = Main.dust[num496]; expr_153E2_cp_0.position.X = expr_153E2_cp_0.position.X - num494; Dust expr_15401_cp_0 = Main.dust[num496]; expr_15401_cp_0.position.Y = expr_15401_cp_0.position.Y - num495; } return; } for (int num497 = 0; num497 < 5; num497++) { float num498 = this.velocity.X * 0.2f * (float)num497; float num499 = -(this.velocity.Y * 0.2f) * (float)num497; int num500 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 175, 0f, 0f, 100, default(Color), 1.3f); Main.dust[num500].noGravity = true; Main.dust[num500].velocity *= 0f; Dust expr_154F9_cp_0 = Main.dust[num500]; expr_154F9_cp_0.position.X = expr_154F9_cp_0.position.X - num498; Dust expr_15518_cp_0 = Main.dust[num500]; expr_15518_cp_0.position.Y = expr_15518_cp_0.position.Y - num499; } return; } else if (this.aiStyle == 53) { if (this.localAI[0] == 0f) { this.localAI[1] = 1f; this.localAI[0] = 1f; this.ai[0] = 120f; int num501 = 80; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 46); if (this.type == 308) { for (int num502 = 0; num502 < num501; num502++) { int num503 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 16f), this.width, this.height - 16, 185, 0f, 0f, 0, default(Color), 1f); Main.dust[num503].velocity *= 2f; Main.dust[num503].noGravity = true; Main.dust[num503].scale *= 1.15f; } } if (this.type == 377) { this.frame = 4; num501 = 40; for (int num504 = 0; num504 < num501; num504++) { int num505 = Dust.NewDust(this.position + Vector2.UnitY * 16f, this.width, this.height - 16, 171, 0f, 0f, 100, default(Color), 1f); Main.dust[num505].scale = (float)Main.rand.Next(1, 10) * 0.1f; Main.dust[num505].noGravity = true; Main.dust[num505].fadeIn = 1.5f; Main.dust[num505].velocity *= 0.75f; } } } this.velocity.X = 0f; this.velocity.Y = this.velocity.Y + 0.2f; if (this.velocity.Y > 16f) { this.velocity.Y = 16f; } bool flag18 = false; float num506 = base.Center.X; float num507 = base.Center.Y; float num508 = 1000f; for (int num509 = 0; num509 < 200; num509++) { if (Main.npc[num509].CanBeChasedBy(this, false)) { float num510 = Main.npc[num509].position.X + (float)(Main.npc[num509].width / 2); float num511 = Main.npc[num509].position.Y + (float)(Main.npc[num509].height / 2); float num512 = Math.Abs(this.position.X + (float)(this.width / 2) - num510) + Math.Abs(this.position.Y + (float)(this.height / 2) - num511); if (num512 < num508 && Collision.CanHit(this.position, this.width, this.height, Main.npc[num509].position, Main.npc[num509].width, Main.npc[num509].height)) { num508 = num512; num506 = num510; num507 = num511; flag18 = true; } } } if (flag18) { float num513 = num506; float num514 = num507; num506 -= base.Center.X; num507 -= base.Center.Y; if (num506 < 0f) { this.spriteDirection = -1; } else { this.spriteDirection = 1; } int num515; if (num507 > 0f) { num515 = 0; } else if (Math.Abs(num507) > Math.Abs(num506) * 3f) { num515 = 4; } else if (Math.Abs(num507) > Math.Abs(num506) * 2f) { num515 = 3; } else if (Math.Abs(num506) > Math.Abs(num507) * 3f) { num515 = 0; } else if (Math.Abs(num506) > Math.Abs(num507) * 2f) { num515 = 1; } else { num515 = 2; } if (this.type == 308) { this.frame = num515 * 2; } else if (this.type == 377) { this.frame = num515; } if (this.ai[0] > 40f && this.localAI[1] == 0f && this.type == 308) { this.frame++; } if (this.ai[0] <= 0f) { this.localAI[1] = 0f; this.ai[0] = 60f; if (Main.myPlayer == this.owner) { float num516 = 6f; int num517 = 309; if (this.type == 377) { num517 = 378; num516 = 9f; } Vector2 vector37 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); if (num515 == 0) { vector37.Y += 12f; vector37.X += (float)(24 * this.spriteDirection); } else if (num515 == 1) { vector37.Y += 0f; vector37.X += (float)(24 * this.spriteDirection); } else if (num515 == 2) { vector37.Y -= 2f; vector37.X += (float)(24 * this.spriteDirection); } else if (num515 == 3) { vector37.Y -= 6f; vector37.X += (float)(14 * this.spriteDirection); } else if (num515 == 4) { vector37.Y -= 14f; vector37.X += (float)(2 * this.spriteDirection); } if (this.spriteDirection < 0) { vector37.X += 10f; } float num518 = num513 - vector37.X; float num519 = num514 - vector37.Y; float num520 = (float)Math.Sqrt((double)(num518 * num518 + num519 * num519)); num520 = num516 / num520; num518 *= num520; num519 *= num520; int num521 = this.damage; Projectile.NewProjectile(vector37.X, vector37.Y, num518, num519, num517, num521, this.knockBack, Main.myPlayer, 0f, 0f); } } } else if (this.ai[0] <= 60f && (this.frame == 1 || this.frame == 3 || this.frame == 5 || this.frame == 7 || this.frame == 9)) { this.frame--; } if (this.ai[0] > 0f) { this.ai[0] -= 1f; return; } } else if (this.aiStyle == 54) { if (this.type == 317) { if (Main.player[Main.myPlayer].dead) { Main.player[Main.myPlayer].raven = false; } if (Main.player[Main.myPlayer].raven) { this.timeLeft = 2; } } if (this.type == 768) { if (Main.player[Main.myPlayer].dead) { Main.player[Main.myPlayer].wonderbeastMinion = false; } if (Main.player[Main.myPlayer].wonderbeastMinion) { this.timeLeft = 2; } } for (int num522 = 0; num522 < 1000; num522++) { if (num522 != this.whoAmI && Main.projectile[num522].active && Main.projectile[num522].owner == this.owner && Main.projectile[num522].type == this.type && Math.Abs(this.position.X - Main.projectile[num522].position.X) + Math.Abs(this.position.Y - Main.projectile[num522].position.Y) < (float)this.width) { if (this.position.X < Main.projectile[num522].position.X) { this.velocity.X = this.velocity.X - 0.05f; } else { this.velocity.X = this.velocity.X + 0.05f; } if (this.position.Y < Main.projectile[num522].position.Y) { this.velocity.Y = this.velocity.Y - 0.05f; } else { this.velocity.Y = this.velocity.Y + 0.05f; } } } float num523 = this.position.X; float num524 = this.position.Y; float num525 = 900f; bool flag19 = false; int num526 = 500; if (this.type == 768) { num526 = 800; } if (this.ai[1] != 0f || this.friendly) { num526 = 1400; } if (Math.Abs(base.Center.X - Main.player[this.owner].Center.X) + Math.Abs(base.Center.Y - Main.player[this.owner].Center.Y) > (float)num526) { this.ai[0] = 1f; } if (this.ai[0] == 0f) { this.tileCollide = true; for (int num527 = 0; num527 < 200; num527++) { if (Main.npc[num527].CanBeChasedBy(this, false)) { float num528 = Main.npc[num527].position.X + (float)(Main.npc[num527].width / 2); float num529 = Main.npc[num527].position.Y + (float)(Main.npc[num527].height / 2); float num530 = Math.Abs(this.position.X + (float)(this.width / 2) - num528) + Math.Abs(this.position.Y + (float)(this.height / 2) - num529); if (num530 < num525 && Collision.CanHit(this.position, this.width, this.height, Main.npc[num527].position, Main.npc[num527].width, Main.npc[num527].height)) { num525 = num530; num523 = num528; num524 = num529; flag19 = true; } } } } else { this.tileCollide = false; } if (!flag19) { this.friendly = true; float num531 = 8f; if (this.type == 768) { num531 = 8f; } if (this.ai[0] == 1f) { num531 = 12f; } Vector2 vector38 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num532 = Main.player[this.owner].Center.X - vector38.X; float num533 = Main.player[this.owner].Center.Y - vector38.Y - 60f; if (this.type == 768) { num532 = Main.player[this.owner].Center.X - vector38.X + (120f * Main.player[this.owner].direction); num533 = Main.player[this.owner].Center.Y - vector38.Y - 25f; } float num534 = (float)Math.Sqrt((double)(num532 * num532 + num533 * num533)); if (num534 < 100f && this.ai[0] == 1f && !Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[0] = 0f; } if (num534 > 2000f) { this.position.X = Main.player[this.owner].Center.X - (float)(this.width / 2); this.position.Y = Main.player[this.owner].Center.Y - (float)(this.width / 2); } if (num534 > 70f) { num534 = num531 / num534; num532 *= num534; num533 *= num534; this.velocity.X = (this.velocity.X * 20f + num532) / 21f; this.velocity.Y = (this.velocity.Y * 20f + num533) / 21f; } else { if (this.velocity.X == 0f && this.velocity.Y == 0f) { this.velocity.X = -0.15f; this.velocity.Y = -0.05f; } this.velocity *= 1.01f; } this.friendly = false; this.rotation = this.velocity.X * 0.05f; if (this.type != 768) { this.frameCounter++; if (this.frameCounter >= 4) { this.frameCounter = 0; this.frame++; } if (this.frame > 3) { this.frame = 0; } } else { this.frame = 0; } if ((double)Math.Abs(this.velocity.X) > 0.2) { this.spriteDirection = -this.direction; return; } } else { if (this.ai[1] == -1f) { this.ai[1] = 17f; } if (this.ai[1] > 0f) { this.ai[1] -= 1f; } if (this.ai[1] == 0f) { this.friendly = true; float num535 = 8f; if (this.type == 768) { num535 = 6f; } Vector2 vector39 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num536 = num523 - vector39.X; float num537 = num524 - vector39.Y; float num538 = (float)Math.Sqrt((double)(num536 * num536 + num537 * num537)); if (num538 < 100f) { num535 += 2f;// } num538 = num535 / num538; num536 *= num538; num537 *= num538; this.velocity.X = (this.velocity.X * 14f + num536) / 15f; this.velocity.Y = (this.velocity.Y * 14f + num537) / 15f; } else { this.friendly = false; if (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) < 10f) { this.velocity *= 1.05f; } } this.rotation = this.velocity.X * 0.05f; this.frameCounter++; if (this.type != 768)// { if (this.frameCounter >= 4) { this.frameCounter = 0; this.frame++; } if (this.frame < 4) { this.frame = 4; } if (this.frame > 7) { this.frame = 4; } } else { if (this.frameCounter >= 7) { this.frameCounter = 0; this.ai[4]++; } if (this.ai[4] == 3) { this.frame = 2; } if (this.ai[4] > 3) { this.ai[4] = 0; } if (this.ai[4] < 3) { this.frame = (int)this.ai[4]; } } if ((double)Math.Abs(this.velocity.X) > 0.2) { this.spriteDirection = -this.direction; return; } } } else if (this.aiStyle == 55) { this.frameCounter++; if (this.frameCounter > 0) { this.frame++; this.frameCounter = 0; if (this.frame > 2) { this.frame = 0; } } if (this.velocity.X < 0f) { this.spriteDirection = -1; this.rotation = (float)Math.Atan2((double)(-(double)this.velocity.Y), (double)(-(double)this.velocity.X)); } else { this.spriteDirection = 1; this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X); } if (this.ai[0] >= 0f && this.ai[0] < 200f) { int num539 = (int)this.ai[0]; if (Main.npc[num539].active) { float num540 = 8f; Vector2 vector40 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num541 = Main.npc[num539].position.X - vector40.X; float num542 = Main.npc[num539].position.Y - vector40.Y; float num543 = (float)Math.Sqrt((double)(num541 * num541 + num542 * num542)); num543 = num540 / num543; num541 *= num543; num542 *= num543; this.velocity.X = (this.velocity.X * 14f + num541) / 15f; this.velocity.Y = (this.velocity.Y * 14f + num542) / 15f; } else { float num544 = 1000f; for (int num545 = 0; num545 < 200; num545++) { if (Main.npc[num545].CanBeChasedBy(this, false)) { float num546 = Main.npc[num545].position.X + (float)(Main.npc[num545].width / 2); float num547 = Main.npc[num545].position.Y + (float)(Main.npc[num545].height / 2); float num548 = Math.Abs(this.position.X + (float)(this.width / 2) - num546) + Math.Abs(this.position.Y + (float)(this.height / 2) - num547); if (num548 < num544 && Collision.CanHit(this.position, this.width, this.height, Main.npc[num545].position, Main.npc[num545].width, Main.npc[num545].height)) { num544 = num548; this.ai[0] = (float)num545; } } } } int num549 = 8; int num550 = Dust.NewDust(new Vector2(this.position.X + (float)num549, this.position.Y + (float)num549), this.width - num549 * 2, this.height - num549 * 2, 6, 0f, 0f, 0, default(Color), 1f); Main.dust[num550].velocity *= 0.5f; Main.dust[num550].velocity += this.velocity * 0.5f; Main.dust[num550].noGravity = true; Main.dust[num550].noLight = true; Main.dust[num550].scale = 1.4f; return; } this.Kill(); return; } else { if (this.aiStyle == 56) { if (this.localAI[0] == 0f) { this.localAI[0] = 1f; this.rotation = this.ai[0]; this.spriteDirection = -(int)this.ai[1]; } if (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y) < 16f) { this.velocity *= 1.05f; } if (this.velocity.X < 0f) { this.direction = -1; } else { this.direction = 1; } this.rotation += (Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) * 0.025f * (float)this.direction; return; } if (this.aiStyle == 57) { this.ai[0] += 1f; if (this.ai[0] > 30f) { this.ai[0] = 30f; this.velocity.Y = this.velocity.Y + 0.25f; if (this.velocity.Y > 16f) { this.velocity.Y = 16f; } this.velocity.X = this.velocity.X * 0.995f; } this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f; this.alpha -= 50; if (this.alpha < 0) { this.alpha = 0; } if (this.owner == Main.myPlayer) { this.localAI[0] += 1f; if (this.localAI[0] >= 4f) { this.localAI[0] = 0f; int num551 = 0; for (int num552 = 0; num552 < 1000; num552++) { if (Main.projectile[num552].active && Main.projectile[num552].owner == this.owner && Main.projectile[num552].type == 344) { num551++; } } float num553 = (float)this.damage * 0.8f; if (num551 > 100) { float num554 = (float)(num551 - 100); num554 = 1f - num554 / 100f; num553 *= num554; } if (num551 > 100) { this.localAI[0] -= 1f; } if (num551 > 120) { this.localAI[0] -= 1f; } if (num551 > 140) { this.localAI[0] -= 1f; } if (num551 > 150) { this.localAI[0] -= 1f; } if (num551 > 160) { this.localAI[0] -= 1f; } if (num551 > 165) { this.localAI[0] -= 1f; } if (num551 > 170) { this.localAI[0] -= 2f; } if (num551 > 175) { this.localAI[0] -= 3f; } if (num551 > 180) { this.localAI[0] -= 4f; } if (num551 > 185) { this.localAI[0] -= 5f; } if (num551 > 190) { this.localAI[0] -= 6f; } if (num551 > 195) { this.localAI[0] -= 7f; } if (num553 > (float)this.damage * 0.1f) { Projectile.NewProjectile(base.Center.X, base.Center.Y, 0f, 0f, 344, (int)num553, this.knockBack * 0.55f, this.owner, 0f, (float)Main.rand.Next(3)); return; } } } } else { if (this.aiStyle == 58) { this.alpha -= 50; if (this.alpha < 0) { this.alpha = 0; } if (this.ai[0] == 0f) { this.frame = 0; this.ai[1] += 1f; if (this.ai[1] > 30f) { this.velocity.Y = this.velocity.Y + 0.1f; } if (this.velocity.Y >= 0f) { this.ai[0] = 1f; } } if (this.ai[0] == 1f) { this.frame = 1; this.velocity.Y = this.velocity.Y + 0.1f; if (this.velocity.Y > 3f) { this.velocity.Y = 3f; } this.velocity.X = this.velocity.X * 0.99f; } this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f; return; } if (this.aiStyle == 59) { this.ai[1] += 1f; if (this.ai[1] >= 60f) { this.friendly = true; int num555 = (int)this.ai[0]; if (!Main.npc[num555].active) { int[] array2 = new int[200]; int num556 = 0; for (int num557 = 0; num557 < 200; num557++) { if (Main.npc[num557].CanBeChasedBy(this, false)) { float num558 = Math.Abs(Main.npc[num557].position.X + (float)(Main.npc[num557].width / 2) - this.position.X + (float)(this.width / 2)) + Math.Abs(Main.npc[num557].position.Y + (float)(Main.npc[num557].height / 2) - this.position.Y + (float)(this.height / 2)); if (num558 < 800f) { array2[num556] = num557; num556++; } } } if (num556 == 0) { this.Kill(); return; } num555 = array2[Main.rand.Next(num556)]; this.ai[0] = (float)num555; } float num559 = 4f; Vector2 vector41 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num560 = Main.npc[num555].Center.X - vector41.X; float num561 = Main.npc[num555].Center.Y - vector41.Y; float num562 = (float)Math.Sqrt((double)(num560 * num560 + num561 * num561)); num562 = num559 / num562; num560 *= num562; num561 *= num562; int num563 = 30; this.velocity.X = (this.velocity.X * (float)(num563 - 1) + num560) / (float)num563; this.velocity.Y = (this.velocity.Y * (float)(num563 - 1) + num561) / (float)num563; } for (int num564 = 0; num564 < 5; num564++) { float num565 = this.velocity.X * 0.2f * (float)num564; float num566 = -(this.velocity.Y * 0.2f) * (float)num564; int num567 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 175, 0f, 0f, 100, default(Color), 1.3f); Main.dust[num567].noGravity = true; Main.dust[num567].velocity *= 0f; Dust expr_174BB_cp_0 = Main.dust[num567]; expr_174BB_cp_0.position.X = expr_174BB_cp_0.position.X - num565; Dust expr_174DA_cp_0 = Main.dust[num567]; expr_174DA_cp_0.position.Y = expr_174DA_cp_0.position.Y - num566; } return; } if (this.aiStyle == 60) { this.scale -= 0.015f; if (this.scale <= 0f) { this.velocity *= 5f; this.oldVelocity = this.velocity; this.Kill(); } if (this.ai[0] <= 3f) { this.ai[0] += 1f; return; } int num568 = 103; if (this.type == 406) { num568 = 137; } if (this.owner == Main.myPlayer) { Rectangle rectangle4 = new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height); for (int num569 = 0; num569 < 200; num569++) { if (Main.npc[num569].active && !Main.npc[num569].dontTakeDamage && Main.npc[num569].lifeMax > 1) { Rectangle value11 = new Rectangle((int)Main.npc[num569].position.X, (int)Main.npc[num569].position.Y, Main.npc[num569].width, Main.npc[num569].height); if (rectangle4.Intersects(value11)) { Main.npc[num569].AddBuff(num568, 1500, false); this.Kill(); } } } for (int num570 = 0; num570 < 255; num570++) { if (num570 != this.owner && Main.player[num570].active && !Main.player[num570].dead) { Rectangle value12 = new Rectangle((int)Main.player[num570].position.X, (int)Main.player[num570].position.Y, Main.player[num570].width, Main.player[num570].height); if (rectangle4.Intersects(value12)) { Main.player[num570].AddBuff(num568, 1500, false); this.Kill(); } } } } this.ai[0] += this.ai[1]; if (this.ai[0] > 30f) { this.velocity.Y = this.velocity.Y + 0.1f; } if (this.type == 358) { for (int num571 = 0; num571 < 1; num571++) { for (int num572 = 0; num572 < 6; num572++) { float num573 = this.velocity.X / 6f * (float)num572; float num574 = this.velocity.Y / 6f * (float)num572; int num575 = 6; int num576 = Dust.NewDust(new Vector2(this.position.X + (float)num575, this.position.Y + (float)num575), this.width - num575 * 2, this.height - num575 * 2, 211, 0f, 0f, 75, default(Color), 1.2f); if (Main.rand.Next(2) == 0) { Main.dust[num576].alpha += 25; } if (Main.rand.Next(2) == 0) { Main.dust[num576].alpha += 25; } if (Main.rand.Next(2) == 0) { Main.dust[num576].alpha += 25; } Main.dust[num576].noGravity = true; Main.dust[num576].velocity *= 0.3f; Main.dust[num576].velocity += this.velocity * 0.5f; Main.dust[num576].position = base.Center; Dust expr_1796D_cp_0 = Main.dust[num576]; expr_1796D_cp_0.position.X = expr_1796D_cp_0.position.X - num573; Dust expr_1798C_cp_0 = Main.dust[num576]; expr_1798C_cp_0.position.Y = expr_1798C_cp_0.position.Y - num574; Main.dust[num576].velocity *= 0.2f; } if (Main.rand.Next(4) == 0) { int num577 = 6; int num578 = Dust.NewDust(new Vector2(this.position.X + (float)num577, this.position.Y + (float)num577), this.width - num577 * 2, this.height - num577 * 2, 211, 0f, 0f, 75, default(Color), 0.65f); Main.dust[num578].velocity *= 0.5f; Main.dust[num578].velocity += this.velocity * 0.5f; } } } if (this.type == 406) { int num579 = 175; Color newColor = new Color(0, 80, 255, 100); for (int num580 = 0; num580 < 6; num580++) { Vector2 vector42 = this.velocity * (float)num580 / 6f; int num581 = 6; int num582 = Dust.NewDust(this.position + Vector2.One * 6f, this.width - num581 * 2, this.height - num581 * 2, 4, 0f, 0f, num579, newColor, 1.2f); if (Main.rand.Next(2) == 0) { Main.dust[num582].alpha += 25; } if (Main.rand.Next(2) == 0) { Main.dust[num582].alpha += 25; } if (Main.rand.Next(2) == 0) { Main.dust[num582].alpha += 25; } Main.dust[num582].noGravity = true; Main.dust[num582].velocity *= 0.3f; Main.dust[num582].velocity += this.velocity * 0.5f; Main.dust[num582].position = base.Center; Dust expr_17C49_cp_0 = Main.dust[num582]; expr_17C49_cp_0.position.X = expr_17C49_cp_0.position.X - vector42.X; Dust expr_17C6D_cp_0 = Main.dust[num582]; expr_17C6D_cp_0.position.Y = expr_17C6D_cp_0.position.Y - vector42.Y; Main.dust[num582].velocity *= 0.2f; } if (Main.rand.Next(4) == 0) { int num583 = 6; int num584 = Dust.NewDust(this.position + Vector2.One * 6f, this.width - num583 * 2, this.height - num583 * 2, 4, 0f, 0f, num579, newColor, 1.2f); Main.dust[num584].velocity *= 0.5f; Main.dust[num584].velocity += this.velocity * 0.5f; return; } } } else if (this.aiStyle == 61) { this.timeLeft = 60; if (Main.player[this.owner].inventory[Main.player[this.owner].selectedItem].fishingPole == 0 || Main.player[this.owner].CCed || Main.player[this.owner].noItems) { this.Kill(); } else if (Main.player[this.owner].inventory[Main.player[this.owner].selectedItem].shoot != this.type) { this.Kill(); } else if (Main.player[this.owner].pulley) { this.Kill(); } else if (Main.player[this.owner].dead) { this.Kill(); } if (this.ai[1] > 0f && this.localAI[1] >= 0f) { this.localAI[1] = -1f; if (!this.lavaWet && !this.honeyWet) { for (int num585 = 0; num585 < 100; num585++) { int num586 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y - 10f), this.width + 12, 24, Dust.dustWater(), 0f, 0f, 0, default(Color), 1f); Dust expr_17F1E_cp_0 = Main.dust[num586]; expr_17F1E_cp_0.velocity.Y = expr_17F1E_cp_0.velocity.Y - 4f; Dust expr_17F3E_cp_0 = Main.dust[num586]; expr_17F3E_cp_0.velocity.X = expr_17F3E_cp_0.velocity.X * 2.5f; Main.dust[num586].scale = 0.8f; Main.dust[num586].alpha = 100; Main.dust[num586].noGravity = true; } Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 0); } } if (this.ai[0] >= 1f) { if (this.ai[0] == 2f) { this.ai[0] += 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 17); if (!this.lavaWet && !this.honeyWet) { for (int num587 = 0; num587 < 100; num587++) { int num588 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y - 10f), this.width + 12, 24, Dust.dustWater(), 0f, 0f, 0, default(Color), 1f); Dust expr_180A7_cp_0 = Main.dust[num588]; expr_180A7_cp_0.velocity.Y = expr_180A7_cp_0.velocity.Y - 4f; Dust expr_180C7_cp_0 = Main.dust[num588]; expr_180C7_cp_0.velocity.X = expr_180C7_cp_0.velocity.X * 2.5f; Main.dust[num588].scale = 0.8f; Main.dust[num588].alpha = 100; Main.dust[num588].noGravity = true; } Main.PlaySound(19, (int)this.position.X, (int)this.position.Y, 0); } } if (this.localAI[0] < 100f) { this.localAI[0] += 1f; } this.tileCollide = false; float num589 = 15.9f; int num590 = 10; Vector2 vector43 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num591 = Main.player[this.owner].position.X + (float)(Main.player[this.owner].width / 2) - vector43.X; float num592 = Main.player[this.owner].position.Y + (float)(Main.player[this.owner].height / 2) - vector43.Y; float num593 = (float)Math.Sqrt((double)(num591 * num591 + num592 * num592)); if (num593 > 3000f) { this.Kill(); } num593 = num589 / num593; num591 *= num593; num592 *= num593; this.velocity.X = (this.velocity.X * (float)(num590 - 1) + num591) / (float)num590; this.velocity.Y = (this.velocity.Y * (float)(num590 - 1) + num592) / (float)num590; if (Main.myPlayer == this.owner) { Rectangle rectangle5 = new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height); Rectangle value13 = new Rectangle((int)Main.player[this.owner].position.X, (int)Main.player[this.owner].position.Y, Main.player[this.owner].width, Main.player[this.owner].height); if (rectangle5.Intersects(value13)) { if (this.ai[1] > 0f && this.ai[1] < 3602f) { int num594 = (int)this.ai[1]; Item item = new Item(); item.SetDefaults(num594, false); if (num594 == 3196) { int num595 = Main.player[this.owner].FishingLevel(); int minValue = (num595 / 20 + 3) / 2; int num596 = (num595 / 10 + 6) / 2; if (Main.rand.Next(50) < num595) { num596++; } if (Main.rand.Next(100) < num595) { num596++; } if (Main.rand.Next(150) < num595) { num596++; } if (Main.rand.Next(200) < num595) { num596++; } int stack = Main.rand.Next(minValue, num596 + 1); item.stack = stack; } if (num594 == 3197) { int num597 = Main.player[this.owner].FishingLevel(); int minValue2 = (num597 / 4 + 15) / 2; int num598 = (num597 / 2 + 30) / 2; if (Main.rand.Next(50) < num597) { num598 += 4; } if (Main.rand.Next(100) < num597) { num598 += 4; } if (Main.rand.Next(150) < num597) { num598 += 4; } if (Main.rand.Next(200) < num597) { num598 += 4; } int stack2 = Main.rand.Next(minValue2, num598 + 1); item.stack = stack2; } item.newAndShiny = true; Item item2 = Main.player[this.owner].GetItem(this.owner, item, false, false); if (item2.stack > 0) { int number2 = Item.NewItem((int)this.position.X, (int)this.position.Y, this.width, this.height, num594, 1, false, 0, true, false); if (Main.netMode == 1) { NetMessage.SendData(21, -1, -1, "", number2, 1f, 0f, 0f, 0, 0, 0); } } else { item.position.X = base.Center.X - (float)(item.width / 2); item.position.Y = base.Center.Y - (float)(item.height / 2); item.active = true; ItemText.NewText(item, 0, false, false); } } this.Kill(); } } this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f; return; } bool flag20 = false; Vector2 vector44 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num599 = Main.player[this.owner].position.X + (float)(Main.player[this.owner].width / 2) - vector44.X; float num600 = Main.player[this.owner].position.Y + (float)(Main.player[this.owner].height / 2) - vector44.Y; this.rotation = (float)Math.Atan2((double)num600, (double)num599) + 1.57f; float num601 = (float)Math.Sqrt((double)(num599 * num599 + num600 * num600)); if (num601 > 900f) { this.ai[0] = 1f; } if (this.wet) { this.rotation = 0f; this.velocity.X = this.velocity.X * 0.9f; int num602 = (int)(base.Center.X + (float)((this.width / 2 + 8) * this.direction)) / 16; int num603 = (int)(base.Center.Y / 16f); float arg_18830_0 = this.position.Y / 16f; int num604 = (int)((this.position.Y + (float)this.height) / 16f); if (Main.tile[num602, num603] == null) { Main.tile[num602, num603] = new Tile(); } if (Main.tile[num602, num604] == null) { Main.tile[num602, num604] = new Tile(); } if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.5f; } num602 = (int)(base.Center.X / 16f); num603 = (int)(base.Center.Y / 16f); float num605 = this.position.Y + (float)this.height; if (Main.tile[num602, num603 - 1] == null) { Main.tile[num602, num603 - 1] = new Tile(); } if (Main.tile[num602, num603] == null) { Main.tile[num602, num603] = new Tile(); } if (Main.tile[num602, num603 + 1] == null) { Main.tile[num602, num603 + 1] = new Tile(); } if (Main.tile[num602, num603 - 1].liquid > 0) { num605 = (float)(num603 * 16); num605 -= (float)(Main.tile[num602, num603 - 1].liquid / 16); } else if (Main.tile[num602, num603].liquid > 0) { num605 = (float)((num603 + 1) * 16); num605 -= (float)(Main.tile[num602, num603].liquid / 16); } else if (Main.tile[num602, num603 + 1].liquid > 0) { num605 = (float)((num603 + 2) * 16); num605 -= (float)(Main.tile[num602, num603 + 1].liquid / 16); } if (base.Center.Y > num605) { this.velocity.Y = this.velocity.Y - 0.1f; if (this.velocity.Y < -8f) { this.velocity.Y = -8f; } if (base.Center.Y + this.velocity.Y < num605) { this.velocity.Y = num605 - base.Center.Y; } } else { this.velocity.Y = num605 - base.Center.Y; } if ((double)this.velocity.Y >= -0.01 && (double)this.velocity.Y <= 0.01) { flag20 = true; } } else { if (this.velocity.Y == 0f) { this.velocity.X = this.velocity.X * 0.95f; } this.velocity.X = this.velocity.X * 0.98f; this.velocity.Y = this.velocity.Y + 0.2f; if (this.velocity.Y > 15.9f) { this.velocity.Y = 15.9f; } } if (this.ai[1] != 0f) { flag20 = true; } if (flag20) { if (this.ai[1] == 0f && Main.myPlayer == this.owner) { int num606 = Main.player[this.owner].FishingLevel(); if (num606 == -9000) { this.localAI[1] += 5f; this.localAI[1] += (float)Main.rand.Next(1, 3); if (this.localAI[1] > 660f) { this.localAI[1] = 0f; this.FishingCheck(); return; } } else { if (Main.rand.Next(300) < num606) { this.localAI[1] += (float)Main.rand.Next(1, 3); } this.localAI[1] += (float)(num606 / 30); this.localAI[1] += (float)Main.rand.Next(1, 3); if (Main.rand.Next(60) == 0) { this.localAI[1] += 60f; } if (this.localAI[1] > 660f) { this.localAI[1] = 0f; this.FishingCheck(); return; } } } else if (this.ai[1] < 0f) { if (this.velocity.Y == 0f || (this.honeyWet && (double)this.velocity.Y >= -0.01 && (double)this.velocity.Y <= 0.01)) { this.velocity.Y = (float)Main.rand.Next(100, 500) * 0.015f; this.velocity.X = (float)Main.rand.Next(-100, 101) * 0.015f; this.wet = false; this.lavaWet = false; this.honeyWet = false; } this.ai[1] += (float)Main.rand.Next(1, 5); if (this.ai[1] >= 0f) { this.ai[1] = 0f; this.localAI[1] = 0f; this.netUpdate = true; return; } } } } else { if (this.aiStyle == 62) { this.AI_062(); return; } if (this.aiStyle == 63) { if (!Main.player[this.owner].active) { this.active = false; return; } Vector2 value14 = this.position; bool flag21 = false; float num607 = 500f; for (int num608 = 0; num608 < 200; num608++) { NPC nPC = Main.npc[num608]; if (nPC.CanBeChasedBy(this, false)) { float num609 = Vector2.Distance(nPC.Center, base.Center); if (((Vector2.Distance(base.Center, value14) > num609 && num609 < num607) || !flag21) && Collision.CanHit(this.position, this.width, this.height, nPC.position, nPC.width, nPC.height)) { num607 = num609; value14 = nPC.Center; flag21 = true; } } } if (!flag21) { this.velocity.X = this.velocity.X * 0.95f; } else { float num610 = 5f; float num611 = 0.08f; if (this.velocity.Y == 0f) { bool flag22 = false; if (base.Center.Y - 50f > value14.Y) { flag22 = true; } if (flag22) { this.velocity.Y = -6f; } } else { num610 = 8f; num611 = 0.12f; } this.velocity.X = this.velocity.X + (float)Math.Sign(value14.X - base.Center.X) * num611; if (this.velocity.X < -num610) { this.velocity.X = -num610; } if (this.velocity.X > num610) { this.velocity.X = num610; } } float num612 = 0f; Collision.StepUp(ref this.position, ref this.velocity, this.width, this.height, ref num612, ref this.gfxOffY, 1, false, 0); if (this.velocity.Y != 0f) { this.frame = 3; } else { if (Math.Abs(this.velocity.X) > 0.2f) { this.frameCounter++; } if (this.frameCounter >= 9) { this.frameCounter = 0; } if (this.frameCounter >= 6) { this.frame = 2; } else if (this.frameCounter >= 3) { this.frame = 1; } else { this.frame = 0; } } if (this.velocity.X != 0f) { this.direction = Math.Sign(this.velocity.X); } this.spriteDirection = -this.direction; this.velocity.Y = this.velocity.Y + 0.2f; if (this.velocity.Y > 16f) { this.velocity.Y = 16f; return; } } else if (this.aiStyle == 64) { int num613 = 10; int num614 = 15; float num615 = 1f; int num616 = 150; int num617 = 42; if (this.type == 386) { num613 = 16; num614 = 16; num615 = 1.5f; } if (this.velocity.X != 0f) { this.direction = (this.spriteDirection = -Math.Sign(this.velocity.X)); } this.frameCounter++; if (this.frameCounter > 2) { this.frame++; this.frameCounter = 0; } if (this.frame >= 6) { this.frame = 0; } if (this.localAI[0] == 0f && Main.myPlayer == this.owner) { this.localAI[0] = 1f; this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.scale = ((float)(num613 + num614) - this.ai[1]) * num615 / (float)(num614 + num613); this.width = (int)((float)num616 * this.scale); this.height = (int)((float)num617 * this.scale); this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.netUpdate = true; } if (this.ai[1] != -1f) { this.scale = ((float)(num613 + num614) - this.ai[1]) * num615 / (float)(num614 + num613); this.width = (int)((float)num616 * this.scale); this.height = (int)((float)num617 * this.scale); } if (!Collision.SolidCollision(this.position, this.width, this.height)) { this.alpha -= 30; if (this.alpha < 60) { this.alpha = 60; } if (this.type == 386 && this.alpha < 100) { this.alpha = 100; } } else { this.alpha += 30; if (this.alpha > 150) { this.alpha = 150; } } if (this.ai[0] > 0f) { this.ai[0] -= 1f; } if (this.ai[0] == 1f && this.ai[1] > 0f && this.owner == Main.myPlayer) { this.netUpdate = true; Vector2 center = base.Center; center.Y -= (float)num617 * this.scale / 2f; float num618 = ((float)(num613 + num614) - this.ai[1] + 1f) * num615 / (float)(num614 + num613); center.Y -= (float)num617 * num618 / 2f; center.Y += 2f; Projectile.NewProjectile(center.X, center.Y, this.velocity.X, this.velocity.Y, this.type, this.damage, this.knockBack, this.owner, 10f, this.ai[1] - 1f); int num619 = 4; if (this.type == 386) { num619 = 2; } if ((int)this.ai[1] % num619 == 0 && this.ai[1] != 0f) { int num620 = 372; if (this.type == 386) { num620 = 373; } int num621 = NPC.NewNPC((int)center.X, (int)center.Y, num620, 0, 0f, 0f, 0f, 0f, 255); Main.npc[num621].velocity = this.velocity; Main.npc[num621].netUpdate = true; if (this.type == 386) { Main.npc[num621].ai[2] = (float)this.width; Main.npc[num621].ai[3] = -1.5f; } } } if (this.ai[0] <= 0f) { float num622 = 0.104719758f; float num623 = (float)this.width / 5f; if (this.type == 386) { num623 *= 2f; } float num624 = (float)(Math.Cos((double)(num622 * -(double)this.ai[0])) - 0.5) * num623; this.position.X = this.position.X - num624 * (float)(-(float)this.direction); this.ai[0] -= 1f; num624 = (float)(Math.Cos((double)(num622 * -(double)this.ai[0])) - 0.5) * num623; this.position.X = this.position.X + num624 * (float)(-(float)this.direction); return; } } else if (this.aiStyle == 65) { if (this.ai[1] > 0f) { int num625 = (int)this.ai[1] - 1; if (num625 < 255) { this.localAI[0] += 1f; if (this.localAI[0] > 10f) { int num626 = 6; for (int num627 = 0; num627 < num626; num627++) { Vector2 vector45 = Vector2.Normalize(this.velocity) * new Vector2((float)this.width / 2f, (float)this.height) * 0.75f; vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)((float)num626), default(Vector2)) + base.Center; Vector2 value15 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); int num628 = Dust.NewDust(vector45 + value15, 0, 0, 172, value15.X * 2f, value15.Y * 2f, 100, default(Color), 1.4f); Main.dust[num628].noGravity = true; Main.dust[num628].noLight = true; Main.dust[num628].velocity /= 4f; Main.dust[num628].velocity -= this.velocity; } this.alpha -= 5; if (this.alpha < 100) { this.alpha = 100; } this.rotation += this.velocity.X * 0.1f; this.frame = (int)(this.localAI[0] / 3f) % 3; } Vector2 value16 = Main.player[num625].Center - base.Center; float num629 = 4f; num629 += this.localAI[0] / 20f; this.velocity = Vector2.Normalize(value16) * num629; if (value16.Length() < 50f) { this.Kill(); } } } else { float num630 = 0.209439516f; float num631 = 4f; float num632 = (float)(Math.Cos((double)(num630 * this.ai[0])) - 0.5) * num631; this.velocity.Y = this.velocity.Y - num632; this.ai[0] += 1f; num632 = (float)(Math.Cos((double)(num630 * this.ai[0])) - 0.5) * num631; this.velocity.Y = this.velocity.Y + num632; this.localAI[0] += 1f; if (this.localAI[0] > 10f) { this.alpha -= 5; if (this.alpha < 100) { this.alpha = 100; } this.rotation += this.velocity.X * 0.1f; this.frame = (int)(this.localAI[0] / 3f) % 3; } } if (this.wet) { this.position.Y = this.position.Y - 16f; this.Kill(); return; } } else if (this.aiStyle == 66) { float num633 = 0f; float num634 = 0f; float num635 = 0f; float num636 = 0f; if (this.type == 387 || this.type == 388) { num633 = 700f; num634 = 800f; num635 = 1200f; num636 = 150f; if (Main.player[this.owner].dead) { Main.player[this.owner].twinsMinion = false; } if (Main.player[this.owner].twinsMinion) { this.timeLeft = 2; } } if (this.type == 806)// { num633 = 700f; num634 = 800f; num635 = 1200f; num636 = 150f; if (Main.player[this.owner].dead) { Main.player[this.owner].gastropodMinion = false; } if (Main.player[this.owner].gastropodMinion) { this.timeLeft = 2; } } if (this.type == 533) { num633 = 1500f; num634 = 900f; num635 = 1500f; num636 = 450f; if (Main.player[this.owner].dead) { Main.player[this.owner].DeadlySphereMinion = false; } if (Main.player[this.owner].DeadlySphereMinion) { this.timeLeft = 2; } } float num637 = 0.05f; for (int num638 = 0; num638 < 1000; num638++) { bool flag23 = (Main.projectile[num638].type == 387 || Main.projectile[num638].type == 388) && (this.type == 387 || this.type == 388); if (!flag23) { flag23 = (this.type == 533 && Main.projectile[num638].type == 533); if (!flag23) { flag23 = (this.type == 806 && Main.projectile[num638].type == 806); }// } if (num638 != this.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == this.owner && flag23 && Math.Abs(this.position.X - Main.projectile[num638].position.X) + Math.Abs(this.position.Y - Main.projectile[num638].position.Y) < (float)this.width) { if (this.position.X < Main.projectile[num638].position.X) { this.velocity.X = this.velocity.X - num637; } else { this.velocity.X = this.velocity.X + num637; } if (this.position.Y < Main.projectile[num638].position.Y) { this.velocity.Y = this.velocity.Y - num637; } else { this.velocity.Y = this.velocity.Y + num637; } } } if (this.type == 533) { if ((int)this.ai[0] % 3 != 2) { Lighting.AddLight(base.Center, 0.8f, 0.3f, 0.1f); } else { Lighting.AddLight(base.Center, 0.3f, 0.5f, 0.7f); } } bool flag24 = false; if (this.ai[0] == 2f && this.type == 388) { this.ai[1] += 1f; this.extraUpdates = 1; this.rotation = this.velocity.ToRotation() + 3.14159274f; this.frameCounter++; if (this.frameCounter > 1) { this.frame++; this.frameCounter = 0; } if (this.frame > 2) { this.frame = 0; } if (this.ai[1] > 40f) { this.ai[1] = 1f; this.ai[0] = 0f; this.extraUpdates = 0; this.numUpdates = 0; this.netUpdate = true; } else { flag24 = true; } } if (this.type == 533 && this.ai[0] >= 3f && this.ai[0] <= 5f) { int num639 = 2; flag24 = true; this.velocity *= 0.9f; this.ai[1] += 1f; int num640 = (int)this.ai[1] / num639 + (int)(this.ai[0] - 3f) * 8; if (num640 < 4) { this.frame = 17 + num640; } else if (num640 < 5) { this.frame = 0; } else if (num640 < 8) { this.frame = 1 + num640 - 5; } else if (num640 < 11) { this.frame = 11 - num640; } else if (num640 < 12) { this.frame = 0; } else if (num640 < 16) { this.frame = num640 - 2; } else if (num640 < 20) { this.frame = 29 - num640; } else if (num640 < 21) { this.frame = 0; } else { this.frame = num640 - 4; } if (this.ai[1] > (float)(num639 * 8)) { this.ai[0] -= 3f; this.ai[1] = 0f; } } if (this.type == 533 && this.ai[0] >= 6f && this.ai[0] <= 8f) { this.ai[1] += 1f; this.MaxUpdates = 2; if (this.ai[0] == 7f) { this.rotation = this.velocity.ToRotation() + 3.14159274f; } else { this.rotation += 0.5235988f; } int num641 = 0; switch ((int)this.ai[0]) { case 6: this.frame = 5; num641 = 40; break; case 7: this.frame = 13; num641 = 30; break; case 8: this.frame = 17; num641 = 30; break; } if (this.ai[1] > (float)num641) { this.ai[1] = 1f; this.ai[0] -= 6f; this.localAI[0] += 1f; this.extraUpdates = 0; this.numUpdates = 0; this.netUpdate = true; } else { flag24 = true; } if (this.ai[0] == 8f) { for (int num642 = 0; num642 < 4; num642++) { int num643 = Utils.SelectRandom<int>(Main.rand, new int[] { 226, 228, 75 }); int num644 = Dust.NewDust(base.Center, 0, 0, num643, 0f, 0f, 0, default(Color), 1f); Dust dust = Main.dust[num644]; Vector2 value17 = Vector2.One.RotatedBy((double)((float)num642 * 1.57079637f), default(Vector2)).RotatedBy((double)this.rotation, default(Vector2)); dust.position = base.Center + value17 * 10f; dust.velocity = value17 * 1f; dust.scale = 0.6f + Main.rand.NextFloat() * 0.5f; dust.noGravity = true; } } } if (flag24) { return; } Vector2 vector46 = this.position; bool flag25 = false; if (this.ai[0] != 1f && (this.type == 387 || this.type == 388 || this.type == 806))// { this.tileCollide = true; } if (this.type == 533 && this.ai[0] < 9f) { this.tileCollide = true; } if (this.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)base.Center.X / 16, (int)base.Center.Y / 16))) { this.tileCollide = false; } for (int num645 = 0; num645 < 200; num645++) { NPC nPC2 = Main.npc[num645]; if (nPC2.CanBeChasedBy(this, false)) { float num646 = Vector2.Distance(nPC2.Center, base.Center); if (((Vector2.Distance(base.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(this.position, this.width, this.height, nPC2.position, nPC2.width, nPC2.height)) { num633 = num646; vector46 = nPC2.Center; flag25 = true; } } } float num647 = num634; if (flag25) { num647 = num635; } Player player = Main.player[this.owner]; if (Vector2.Distance(player.Center, base.Center) > num647) { if (this.type == 387 || this.type == 388 || this.type == 806)// { this.ai[0] = 1f; } if (this.type == 533 && this.ai[0] < 9f) { this.ai[0] += (float)(3 * (3 - (int)(this.ai[0] / 3f))); } this.tileCollide = false; this.netUpdate = true; } if ((this.type == 388 || this.type == 387 || this.type == 806) && flag25 && this.ai[0] == 0f)// { Vector2 vector47 = vector46 - base.Center; float num648 = vector47.Length(); vector47.Normalize(); if (num648 > 200f) { float scaleFactor2 = 6f; if (this.type == 388) { scaleFactor2 = 8f; } vector47 *= scaleFactor2; this.velocity = (this.velocity * 40f + vector47) / 41f; } else { float num649 = 4f; vector47 *= -num649; this.velocity = (this.velocity * 40f + vector47) / 41f; } } else { bool flag26 = false; if (!flag26) { flag26 = (this.ai[0] == 1f && (this.type == 387 || this.type == 388 || this.type == 806));// } if (!flag26) { flag26 = (this.ai[0] >= 9f && this.type == 533); } float num650 = 6f; if (this.type == 533) { num650 = 12f; } if (flag26) { num650 = 15f; } Vector2 center2 = base.Center; Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); float num651 = vector48.Length(); if (num651 > 200f && num650 < 8f) { num650 = 8f; } if (num651 < num636 && flag26 && !Collision.SolidCollision(this.position, this.width, this.height)) { if (this.type == 387 || this.type == 388 || this.type == 806)// { this.ai[0] = 0f; } if (this.type == 533) { this.ai[0] -= 9f; } this.netUpdate = true; } if (num651 > 2000f) { this.position.X = Main.player[this.owner].Center.X - (float)(this.width / 2); this.position.Y = Main.player[this.owner].Center.Y - (float)(this.height / 2); this.netUpdate = true; } if (num651 > 70f) { vector48.Normalize(); vector48 *= num650; this.velocity = (this.velocity * 40f + vector48) / 41f; } else if (this.velocity.X == 0f && this.velocity.Y == 0f) { this.velocity.X = -0.15f; this.velocity.Y = -0.05f; } } if (this.type == 388) { this.rotation = this.velocity.ToRotation() + 3.14159274f; } if (this.type == 387) { if (flag25) { this.rotation = (vector46 - base.Center).ToRotation() + 3.14159274f; } else { this.rotation = this.velocity.ToRotation() + 3.14159274f; } } if (this.type == 806) { this.rotation = this.velocity.X * 0.09f; if (this.velocity.X > 0) { this.direction = this.spriteDirection = -1; } else { this.direction = this.spriteDirection = -1; } } if (this.type == 533 && (this.ai[0] < 3f || this.ai[0] >= 9f)) { this.rotation += this.velocity.X * 0.04f; } if (this.type == 388 || this.type == 387) { this.frameCounter++; if (this.frameCounter > 3) { this.frame++; this.frameCounter = 0; } if (this.frame > 2) { this.frame = 0; } } if (this.type == 806) { this.frameCounter++; if (this.frameCounter > 5) { this.frame++; this.frameCounter = 0; } if (this.frame > 1) { this.frame = 0; } } else if (this.type == 533) { if (this.ai[0] < 3f || this.ai[0] >= 9f) { this.frameCounter++; if (this.frameCounter >= 24) { this.frameCounter = 0; } int num652 = this.frameCounter / 4; this.frame = 4 + num652; int num653 = (int)this.ai[0]; switch (num653) { case 0: break; case 1: goto IL_1AB87; case 2: goto IL_1ABA2; default: switch (num653) { case 9: break; case 10: goto IL_1AB87; case 11: goto IL_1ABA2; default: goto IL_1ABCC; } break; } this.frame = 4 + num652; goto IL_1ABCC; IL_1AB87: num652 = this.frameCounter / 8; this.frame = 14 + num652; goto IL_1ABCC; IL_1ABA2: num652 = this.frameCounter / 3; if (num652 >= 4) { num652 -= 4; } this.frame = 17 + num652; } IL_1ABCC: if (this.ai[0] == 2f && Main.rand.Next(2) == 0) { for (int num654 = 0; num654 < 4; num654++) { if (Main.rand.Next(2) != 0) { int num655 = Utils.SelectRandom<int>(Main.rand, new int[] { 226, 228, 75 }); int num656 = Dust.NewDust(base.Center, 0, 0, num655, 0f, 0f, 0, default(Color), 1f); Dust dust2 = Main.dust[num656]; Vector2 value18 = Vector2.One.RotatedBy((double)((float)num654 * 1.57079637f), default(Vector2)).RotatedBy((double)this.rotation, default(Vector2)); dust2.position = base.Center + value18 * 10f; dust2.velocity = value18 * 1f; dust2.scale = 0.3f + Main.rand.NextFloat() * 0.5f; dust2.noGravity = true; dust2.customData = this; dust2.noLight = true; } } } } if (this.ai[1] > 0f && (this.type == 387 || this.type == 388 || this.type == 806)) { this.ai[1] += (float)Main.rand.Next(1, 4); } if (this.ai[1] > 90f && (this.type == 387 || this.type == 806)) { this.ai[1] = 0f; this.netUpdate = true; } if (this.ai[1] > 40f && this.type == 388) { this.ai[1] = 0f; this.netUpdate = true; } if (this.ai[1] > 0f && this.type == 533) { this.ai[1] += 1f; int num657 = 10; if (this.ai[1] > (float)num657) { this.ai[1] = 0f; this.netUpdate = true; } } if (this.ai[0] == 0f && (this.type == 387 || this.type == 388 || this.type == 806))// { if (this.type == 387 || this.type == 806)// { float scaleFactor3 = 8f; int num658 = 389; if (flag25 && this.ai[1] == 0f) { this.ai[1] += 1f; if (Main.myPlayer == this.owner && Collision.CanHitLine(this.position, this.width, this.height, vector46, 0, 0)) { Vector2 value19 = vector46 - base.Center; value19.Normalize(); value19 *= scaleFactor3; int num659 = Projectile.NewProjectile(base.Center.X, base.Center.Y, value19.X, value19.Y, num658, (int)((float)this.damage * 0.8f), 0f, Main.myPlayer, 0f, 0f); Main.projectile[num659].timeLeft = 300; this.netUpdate = true; } } } if (this.type == 388 && this.ai[1] == 0f && flag25 && num633 < 500f) { this.ai[1] += 1f; if (Main.myPlayer == this.owner) { this.ai[0] = 2f; Vector2 value20 = vector46 - base.Center; value20.Normalize(); this.velocity = value20 * 8f; this.netUpdate = true; return; } } } else if (this.type == 533 && this.ai[0] < 3f) { int num660 = 0; switch ((int)this.ai[0]) { case 0: case 3: case 6: num660 = 400; break; case 1: case 4: case 7: num660 = 400; break; case 2: case 5: case 8: num660 = 600; break; } if (this.ai[1] == 0f && flag25 && num633 < (float)num660) { this.ai[1] += 1f; if (Main.myPlayer == this.owner) { if (this.localAI[0] >= 3f) { this.ai[0] += 4f; if (this.ai[0] == 6f) { this.ai[0] = 3f; } this.localAI[0] = 0f; return; } this.ai[0] += 6f; Vector2 value21 = vector46 - base.Center; value21.Normalize(); float scaleFactor4 = (this.ai[0] == 8f) ? 12f : 10f; this.velocity = value21 * scaleFactor4; this.netUpdate = true; return; } } } } else if (this.aiStyle == 67) { Player player2 = Main.player[this.owner]; if (!player2.active) { this.active = false; return; } bool flag27 = this.type == 393 || this.type == 394 || this.type == 395; if (flag27) { if (player2.dead) { player2.pirateMinion = false; } if (player2.pirateMinion) { this.timeLeft = 2; } } if (this.type == 500) { if (player2.dead) { player2.crimsonHeart = false; } if (player2.crimsonHeart) { this.timeLeft = 2; } } Vector2 vector49 = player2.Center; if (flag27) { vector49.X -= (float)((15 + player2.width / 2) * player2.direction); vector49.X -= (float)(this.minionPos * 40 * player2.direction); } if (this.type == 500) { vector49.X -= (float)((15 + player2.width / 2) * player2.direction); vector49.X -= (float)(40 * player2.direction); } if (this.type == 500) { Lighting.AddLight(base.Center, 0.9f, 0.1f, 0.3f); int num661 = 6; if (this.frame == 0 || this.frame == 2) { num661 = 12; } if (++this.frameCounter >= num661) { this.frameCounter = 0; if (++this.frame >= Main.projFrames[this.type]) { this.frame = 0; } } this.rotation += this.velocity.X / 20f; Vector2 vector50 = (-Vector2.UnitY).RotatedBy((double)this.rotation, default(Vector2)).RotatedBy((double)((float)this.direction * 0.2f), default(Vector2)); int num662 = Dust.NewDust(base.Center + vector50 * 10f - new Vector2(4f), 0, 0, 5, vector50.X, vector50.Y, 0, Color.Transparent, 1f); Main.dust[num662].scale = 1f; Main.dust[num662].velocity = vector50.RotatedByRandom(0.78539818525314331) * 3.5f; Main.dust[num662].noGravity = true; Main.dust[num662].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cLight, Main.player[this.owner]); } bool flag28 = true; if (this.type == 500) { flag28 = false; } int num663 = -1; float num664 = 450f; if (flag27) { num664 = 800f; } int num665 = 15; if (this.ai[0] == 0f && flag28) { for (int num666 = 0; num666 < 200; num666++) { NPC nPC3 = Main.npc[num666]; if (nPC3.CanBeChasedBy(this, false)) { float num667 = (nPC3.Center - base.Center).Length(); if (num667 < num664) { num663 = num666; num664 = num667; } } } } if (this.ai[0] == 1f) { this.tileCollide = false; float num668 = 0.2f; float num669 = 10f; int num670 = 200; if (num669 < Math.Abs(player2.velocity.X) + Math.Abs(player2.velocity.Y)) { num669 = Math.Abs(player2.velocity.X) + Math.Abs(player2.velocity.Y); } Vector2 value22 = player2.Center - base.Center; float num671 = value22.Length(); if (num671 > 2000f) { this.position = player2.Center - new Vector2((float)this.width, (float)this.height) / 2f; } if (num671 < (float)num670 && player2.velocity.Y == 0f && this.position.Y + (float)this.height <= player2.position.Y + (float)player2.height && !Collision.SolidCollision(this.position, this.width, this.height)) { this.ai[0] = 0f; this.netUpdate = true; if (this.velocity.Y < -6f) { this.velocity.Y = -6f; } } if (num671 >= 60f) { value22.Normalize(); value22 *= num669; if (this.velocity.X < value22.X) { this.velocity.X = this.velocity.X + num668; if (this.velocity.X < 0f) { this.velocity.X = this.velocity.X + num668 * 1.5f; } } if (this.velocity.X > value22.X) { this.velocity.X = this.velocity.X - num668; if (this.velocity.X > 0f) { this.velocity.X = this.velocity.X - num668 * 1.5f; } } if (this.velocity.Y < value22.Y) { this.velocity.Y = this.velocity.Y + num668; if (this.velocity.Y < 0f) { this.velocity.Y = this.velocity.Y + num668 * 1.5f; } } if (this.velocity.Y > value22.Y) { this.velocity.Y = this.velocity.Y - num668; if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y - num668 * 1.5f; } } } if (this.velocity.X != 0f) { this.spriteDirection = Math.Sign(this.velocity.X); } if (flag27) { this.frameCounter++; if (this.frameCounter > 3) { this.frame++; this.frameCounter = 0; } if (this.frame < 10 | this.frame > 13) { this.frame = 10; } this.rotation = this.velocity.X * 0.1f; } } if (this.ai[0] == 2f) { this.friendly = true; this.spriteDirection = this.direction; this.rotation = 0f; this.frame = 4 + (int)((float)num665 - this.ai[1]) / (num665 / 3); if (this.velocity.Y != 0f) { this.frame += 3; } this.velocity.Y = this.velocity.Y + 0.4f; if (this.velocity.Y > 10f) { this.velocity.Y = 10f; } this.ai[1] -= 1f; if (this.ai[1] <= 0f) { this.ai[1] = 0f; this.ai[0] = 0f; this.friendly = false; this.netUpdate = true; return; } } if (num663 >= 0) { float num672 = 400f; float num673 = 20f; if (flag27) { num672 = 700f; } if ((double)this.position.Y > Main.worldSurface * 16.0) { num672 *= 0.7f; } NPC nPC4 = Main.npc[num663]; Vector2 center3 = nPC4.Center; float num674 = (center3 - base.Center).Length(); Collision.CanHit(this.position, this.width, this.height, nPC4.position, nPC4.width, nPC4.height); if (num674 < num672) { vector49 = center3; if (center3.Y < base.Center.Y - 30f && this.velocity.Y == 0f) { float num675 = Math.Abs(center3.Y - base.Center.Y); if (num675 < 120f) { this.velocity.Y = -10f; } else if (num675 < 210f) { this.velocity.Y = -13f; } else if (num675 < 270f) { this.velocity.Y = -15f; } else if (num675 < 310f) { this.velocity.Y = -17f; } else if (num675 < 380f) { this.velocity.Y = -18f; } } } if (num674 < num673) { this.ai[0] = 2f; this.ai[1] = (float)num665; this.netUpdate = true; } } if (this.ai[0] == 0f && num663 < 0) { float num676 = 500f; if (this.type == 500) { num676 = 200f; } if (Main.player[this.owner].rocketDelay2 > 0) { this.ai[0] = 1f; this.netUpdate = true; } Vector2 vector51 = player2.Center - base.Center; if (vector51.Length() > 2000f) { this.position = player2.Center - new Vector2((float)this.width, (float)this.height) / 2f; } else if (vector51.Length() > num676 || Math.Abs(vector51.Y) > 300f) { this.ai[0] = 1f; this.netUpdate = true; if (this.velocity.Y > 0f && vector51.Y < 0f) { this.velocity.Y = 0f; } if (this.velocity.Y < 0f && vector51.Y > 0f) { this.velocity.Y = 0f; } } } if (this.ai[0] == 0f) { this.tileCollide = true; float num677 = 0.5f; float num678 = 4f; float num679 = 4f; float num680 = 0.1f; if (num679 < Math.Abs(player2.velocity.X) + Math.Abs(player2.velocity.Y)) { num679 = Math.Abs(player2.velocity.X) + Math.Abs(player2.velocity.Y); num677 = 0.7f; } int num681 = 0; bool flag29 = false; float num682 = vector49.X - base.Center.X; if (Math.Abs(num682) > 5f) { if (num682 < 0f) { num681 = -1; if (this.velocity.X > -num678) { this.velocity.X = this.velocity.X - num677; } else { this.velocity.X = this.velocity.X - num680; } } else { num681 = 1; if (this.velocity.X < num678) { this.velocity.X = this.velocity.X + num677; } else { this.velocity.X = this.velocity.X + num680; } } flag29 = true; } else { this.velocity.X = this.velocity.X * 0.9f; if (Math.Abs(this.velocity.X) < num677 * 2f) { this.velocity.X = 0f; } } if (num681 != 0) { int num683 = (int)(this.position.X + (float)(this.width / 2)) / 16; int num684 = (int)this.position.Y / 16; num683 += num681; num683 += (int)this.velocity.X; for (int num685 = num684; num685 < num684 + this.height / 16 + 1; num685++) { if (WorldGen.SolidTile(num683, num685)) { flag29 = true; } } } if (this.type == 500 && this.velocity.X != 0f) { flag29 = true; } Collision.StepUp(ref this.position, ref this.velocity, this.width, this.height, ref this.stepSpeed, ref this.gfxOffY, 1, false, 0); if (this.velocity.Y == 0f && flag29) { int num686 = 0; while (num686 < 3) { int num687 = (int)(this.position.X + (float)(this.width / 2)) / 16; if (num686 == 0) { num687 = (int)this.position.X / 16; } if (num686 == 2) { num687 = (int)(this.position.X + (float)this.width) / 16; } int num688 = (int)(this.position.Y + (float)this.height) / 16 + 1; if (WorldGen.SolidTile(num687, num688) || Main.tile[num687, num688].halfBrick()) { goto Block_1933; } if (Main.tile[num687, num688].slope() > 0) { goto Block_1933; } IL_1C297: num686++; continue; Block_1933: try { num687 = (int)(this.position.X + (float)(this.width / 2)) / 16; num688 = (int)(this.position.Y + (float)(this.height / 2)) / 16; num687 += num681; num687 += (int)this.velocity.X; if (!WorldGen.SolidTile(num687, num688 - 1) && !WorldGen.SolidTile(num687, num688 - 2)) { this.velocity.Y = -5.1f; } else if (!WorldGen.SolidTile(num687, num688 - 2)) { this.velocity.Y = -7.1f; } else if (WorldGen.SolidTile(num687, num688 - 5)) { this.velocity.Y = -11.1f; } else if (WorldGen.SolidTile(num687, num688 - 4)) { this.velocity.Y = -10.1f; } else { this.velocity.Y = -9.1f; } } catch { this.velocity.Y = -9.1f; } goto IL_1C297; } } if (this.velocity.X > num679) { this.velocity.X = num679; } if (this.velocity.X < -num679) { this.velocity.X = -num679; } if (this.velocity.X < 0f) { this.direction = -1; } if (this.velocity.X > 0f) { this.direction = 1; } if (this.velocity.X > num677 && num681 == 1) { this.direction = 1; } if (this.velocity.X < -num677 && num681 == -1) { this.direction = -1; } this.spriteDirection = this.direction; if (flag27) { this.rotation = 0f; if (this.velocity.Y == 0f) { if (this.velocity.X == 0f) { this.frame = 0; this.frameCounter = 0; } else if (Math.Abs(this.velocity.X) >= 0.5f) { this.frameCounter += (int)Math.Abs(this.velocity.X); this.frameCounter++; if (this.frameCounter > 10) { this.frame++; this.frameCounter = 0; } if (this.frame >= 4) { this.frame = 0; } } else { this.frame = 0; this.frameCounter = 0; } } else if (this.velocity.Y != 0f) { this.frameCounter = 0; this.frame = 14; } } this.velocity.Y = this.velocity.Y + 0.4f; if (this.velocity.Y > 10f) { this.velocity.Y = 10f; } } if (flag27) { this.localAI[0] += 1f; if (this.velocity.X == 0f) { this.localAI[0] += 1f; } if (this.localAI[0] >= (float)Main.rand.Next(900, 1200)) { this.localAI[0] = 0f; for (int num689 = 0; num689 < 6; num689++) { int num690 = Dust.NewDust(base.Center + Vector2.UnitX * (float)(-(float)this.direction) * 8f - Vector2.One * 5f + Vector2.UnitY * 8f, 3, 6, 216, (float)(-(float)this.direction), 1f, 0, default(Color), 1f); Main.dust[num690].velocity /= 2f; Main.dust[num690].scale = 0.8f; } int num691 = Gore.NewGore(base.Center + Vector2.UnitX * (float)(-(float)this.direction) * 8f, Vector2.Zero, Main.rand.Next(580, 583), 1f); Main.gore[num691].velocity /= 2f; Main.gore[num691].velocity.Y = Math.Abs(Main.gore[num691].velocity.Y); Main.gore[num691].velocity.X = -Math.Abs(Main.gore[num691].velocity.X) * (float)this.direction; return; } } } else if (this.aiStyle == 68) { this.rotation += 0.25f * (float)this.direction; this.ai[0] += 1f; if (this.ai[0] >= 3f) { this.alpha -= 40; if (this.alpha < 0) { this.alpha = 0; } } if (this.ai[0] >= 15f) { this.velocity.Y = this.velocity.Y + 0.2f; if (this.velocity.Y > 16f) { this.velocity.Y = 16f; } this.velocity.X = this.velocity.X * 0.99f; } if (this.alpha == 0) { Vector2 vector52 = new Vector2(4f, -8f); float num692 = this.rotation; if (this.direction == -1) { vector52.X = -4f; } vector52 = vector52.RotatedBy((double)num692, default(Vector2)); for (int num693 = 0; num693 < 1; num693++) { int num694 = Dust.NewDust(base.Center + vector52 - Vector2.One * 5f, 4, 4, 6, 0f, 0f, 0, default(Color), 1f); Main.dust[num694].scale = 1.5f; Main.dust[num694].noGravity = true; Main.dust[num694].velocity = Main.dust[num694].velocity * 0.25f + Vector2.Normalize(vector52) * 1f; Main.dust[num694].velocity = Main.dust[num694].velocity.RotatedBy((double)(-1.57079637f * (float)this.direction), default(Vector2)); } } this.spriteDirection = this.direction; if (this.owner == Main.myPlayer && this.timeLeft <= 3) { this.tileCollide = false; this.alpha = 255; this.position.X = this.position.X + (float)(this.width / 2); this.position.Y = this.position.Y + (float)(this.height / 2); this.width = 80; this.height = 80; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); this.knockBack = 8f; } if (this.wet && this.timeLeft > 3) { this.timeLeft = 3; return; } } else if (this.aiStyle == 69) { Vector2 vector53 = Main.player[this.owner].Center - base.Center; this.rotation = vector53.ToRotation() - 1.57f; if (Main.player[this.owner].dead) { this.Kill(); return; } Main.player[this.owner].itemAnimation = 10; Main.player[this.owner].itemTime = 10; if (vector53.X < 0f) { Main.player[this.owner].ChangeDir(1); this.direction = 1; } else { Main.player[this.owner].ChangeDir(-1); this.direction = -1; } Main.player[this.owner].itemRotation = (vector53 * -1f * (float)this.direction).ToRotation(); this.spriteDirection = ((vector53.X > 0f) ? -1 : 1); if (this.ai[0] == 0f && vector53.Length() > 400f) { this.ai[0] = 1f; } if (this.ai[0] == 1f || this.ai[0] == 2f) { float num695 = vector53.Length(); if (num695 > 1500f) { this.Kill(); return; } if (num695 > 600f) { this.ai[0] = 2f; } this.tileCollide = false; float num696 = 20f; if (this.ai[0] == 2f) { num696 = 40f; } this.velocity = Vector2.Normalize(vector53) * num696; if (vector53.Length() < num696) { this.Kill(); return; } } this.ai[1] += 1f; if (this.ai[1] > 5f) { this.alpha = 0; } if ((int)this.ai[1] % 4 == 0 && this.owner == Main.myPlayer) { Vector2 vector54 = vector53 * -1f; vector54.Normalize(); vector54 *= (float)Main.rand.Next(45, 65) * 0.1f; vector54 = vector54.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866, default(Vector2)); Projectile.NewProjectile(base.Center.X, base.Center.Y, vector54.X, vector54.Y, 405, this.damage, this.knockBack, this.owner, -10f, 0f); return; } } else { if (this.aiStyle == 70) { if (this.ai[0] == 0f) { float num697 = 500f; int num698 = -1; for (int num699 = 0; num699 < 200; num699++) { NPC nPC5 = Main.npc[num699]; if (nPC5.CanBeChasedBy(this, false) && Collision.CanHit(this.position, this.width, this.height, nPC5.position, nPC5.width, nPC5.height)) { float num700 = (nPC5.Center - base.Center).Length(); if (num700 < num697) { num698 = num699; num697 = num700; } } } this.ai[0] = (float)(num698 + 1); if (this.ai[0] == 0f) { this.ai[0] = -15f; } if (this.ai[0] > 0f) { float scaleFactor5 = (float)Main.rand.Next(35, 75) / 30f; this.velocity = (this.velocity * 20f + Vector2.Normalize(Main.npc[(int)this.ai[0] - 1].Center - base.Center + new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101))) * scaleFactor5) / 21f; this.netUpdate = true; } } else if (this.ai[0] > 0f) { Vector2 value23 = Vector2.Normalize(Main.npc[(int)this.ai[0] - 1].Center - base.Center); this.velocity = (this.velocity * 40f + value23 * 12f) / 41f; } else { this.ai[0] += 1f; this.alpha -= 25; if (this.alpha < 50) { this.alpha = 50; } this.velocity *= 0.95f; } if (this.ai[1] == 0f) { this.ai[1] = (float)Main.rand.Next(80, 121) / 100f; this.netUpdate = true; } this.scale = this.ai[1]; return; } if (this.aiStyle == 71) { this.localAI[1] += 1f; if (this.localAI[1] > 10f && Main.rand.Next(3) == 0) { int num701 = 6; for (int num702 = 0; num702 < num701; num702++) { Vector2 vector55 = Vector2.Normalize(this.velocity) * new Vector2((float)this.width, (float)this.height) / 2f; vector55 = vector55.RotatedBy((double)(num702 - (num701 / 2 - 1)) * 3.1415926535897931 / (double)((float)num701), default(Vector2)) + base.Center; Vector2 value24 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); int num703 = Dust.NewDust(vector55 + value24, 0, 0, 217, value24.X * 2f, value24.Y * 2f, 100, default(Color), 1.4f); Main.dust[num703].noGravity = true; Main.dust[num703].noLight = true; Main.dust[num703].velocity /= 4f; Main.dust[num703].velocity -= this.velocity; } this.alpha -= 5; if (this.alpha < 50) { this.alpha = 50; } this.rotation += this.velocity.X * 0.1f; this.frame = (int)(this.localAI[1] / 3f) % 3; Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.1f, 0.4f, 0.6f); } int num704 = -1; Vector2 vector56 = base.Center; float num705 = 500f; if (this.localAI[0] > 0f) { this.localAI[0] -= 1f; } if (this.ai[0] == 0f && this.localAI[0] == 0f) { for (int num706 = 0; num706 < 200; num706++) { NPC nPC6 = Main.npc[num706]; if (nPC6.CanBeChasedBy(this, false) && (this.ai[0] == 0f || this.ai[0] == (float)(num706 + 1))) { Vector2 center4 = nPC6.Center; float num707 = Vector2.Distance(center4, vector56); if (num707 < num705 && Collision.CanHit(this.position, this.width, this.height, nPC6.position, nPC6.width, nPC6.height)) { num705 = num707; vector56 = center4; num704 = num706; } } } if (num704 >= 0) { this.ai[0] = (float)(num704 + 1); this.netUpdate = true; } } if (this.localAI[0] == 0f && this.ai[0] == 0f) { this.localAI[0] = 30f; } bool flag30 = false; if (this.ai[0] != 0f) { int num708 = (int)(this.ai[0] - 1f); if (Main.npc[num708].active && !Main.npc[num708].dontTakeDamage && Main.npc[num708].immune[this.owner] == 0) { float num709 = Main.npc[num708].position.X + (float)(Main.npc[num708].width / 2); float num710 = Main.npc[num708].position.Y + (float)(Main.npc[num708].height / 2); float num711 = Math.Abs(this.position.X + (float)(this.width / 2) - num709) + Math.Abs(this.position.Y + (float)(this.height / 2) - num710); if (num711 < 1000f) { flag30 = true; vector56 = Main.npc[num708].Center; } } else { this.ai[0] = 0f; flag30 = false; this.netUpdate = true; } } if (flag30) { Vector2 v = vector56 - base.Center; float num712 = this.velocity.ToRotation(); float num713 = v.ToRotation(); double num714 = (double)(num713 - num712); if (num714 > 3.1415926535897931) { num714 -= 6.2831853071795862; } if (num714 < -3.1415926535897931) { num714 += 6.2831853071795862; } this.velocity = this.velocity.RotatedBy(num714 * 0.10000000149011612, default(Vector2)); } float num715 = this.velocity.Length(); this.velocity.Normalize(); this.velocity *= num715 + 0.0025f; return; } if (this.aiStyle == 72) { this.localAI[0] += 1f; if (this.localAI[0] > 5f) { this.alpha -= 25; if (this.alpha < 50) { this.alpha = 50; } } this.velocity *= 0.96f; if (this.ai[1] == 0f) { this.ai[1] = (float)Main.rand.Next(60, 121) / 100f; this.netUpdate = true; } this.scale = this.ai[1]; this.position = base.Center; int num716 = 14; int num717 = 14; this.width = (int)((float)num716 * this.ai[1]); this.height = (int)((float)num717 * this.ai[1]); this.position -= new Vector2((float)(this.width / 2), (float)(this.height / 2)); return; } if (this.aiStyle == 73) { int num718 = (int)this.ai[0]; int num719 = (int)this.ai[1]; Tile tile = Main.tile[num718, num719]; if (tile == null || !tile.active() || tile.type != 338) { this.Kill(); return; } float num720 = 2f; float num721 = (float)this.timeLeft / 60f; if (num721 < 1f) { num720 *= num721; } if (this.type == 419) { for (int num722 = 0; num722 < 2; num722++) { Vector2 vector57 = new Vector2(0f, -num720); vector57 *= 0.85f + (float)Main.rand.NextDouble() * 0.2f; vector57 = vector57.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866, default(Vector2)); int num723 = Dust.NewDust(this.position, this.width, this.height, 222, 0f, 0f, 100, default(Color), 1f); Dust dust3 = Main.dust[num723]; dust3.scale = 1f + (float)Main.rand.NextDouble() * 0.3f; dust3.velocity *= 0.5f; if (dust3.velocity.Y > 0f) { Dust expr_1D88A_cp_0 = dust3; expr_1D88A_cp_0.velocity.Y = expr_1D88A_cp_0.velocity.Y * -1f; } dust3.position -= new Vector2((float)(2 + Main.rand.Next(-2, 3)), 0f); dust3.velocity += vector57; dust3.scale = 0.6f; dust3.fadeIn = dust3.scale + 0.2f; Dust expr_1D910_cp_0 = dust3; expr_1D910_cp_0.velocity.Y = expr_1D910_cp_0.velocity.Y * 2f; } } if (this.type == 420) { for (int num724 = 0; num724 < 2; num724++) { Vector2 vector58 = new Vector2(0f, -num720); vector58 *= 0.85f + (float)Main.rand.NextDouble() * 0.2f; vector58 = vector58.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866, default(Vector2)); int num725 = 219; if (Main.rand.Next(5) == 0) { num725 = 222; } int num726 = Dust.NewDust(this.position, this.width, this.height, num725, 0f, 0f, 100, default(Color), 1f); Dust dust4 = Main.dust[num726]; dust4.scale = 1f + (float)Main.rand.NextDouble() * 0.3f; dust4.velocity *= 0.5f; if (dust4.velocity.Y > 0f) { Dust expr_1DA81_cp_0 = dust4; expr_1DA81_cp_0.velocity.Y = expr_1DA81_cp_0.velocity.Y * -1f; } dust4.position -= new Vector2((float)(2 + Main.rand.Next(-2, 3)), 0f); dust4.velocity += vector58; Dust expr_1DAE1_cp_0 = dust4; expr_1DAE1_cp_0.velocity.X = expr_1DAE1_cp_0.velocity.X * 0.5f; dust4.scale = 0.6f; dust4.fadeIn = dust4.scale + 0.2f; Dust expr_1DB21_cp_0 = dust4; expr_1DB21_cp_0.velocity.Y = expr_1DB21_cp_0.velocity.Y * 2f; } } if (this.type == 421) { for (int num727 = 0; num727 < 2; num727++) { Vector2 vector59 = new Vector2(0f, -num720); vector59 *= 0.85f + (float)Main.rand.NextDouble() * 0.2f; vector59 = vector59.RotatedBy((Main.rand.NextDouble() - 0.5) * 0.78539818525314331, default(Vector2)); int num728 = Dust.NewDust(this.position, this.width, this.height, 221, 0f, 0f, 100, default(Color), 1f); Dust dust5 = Main.dust[num728]; dust5.scale = 1f + (float)Main.rand.NextDouble() * 0.3f; dust5.velocity *= 0.1f; if (dust5.velocity.Y > 0f) { Dust expr_1DC74_cp_0 = dust5; expr_1DC74_cp_0.velocity.Y = expr_1DC74_cp_0.velocity.Y * -1f; } dust5.position -= new Vector2((float)(2 + Main.rand.Next(-2, 3)), 0f); dust5.velocity += vector59; dust5.scale = 0.6f; dust5.fadeIn = dust5.scale + 0.2f; Dust expr_1DCFA_cp_0 = dust5; expr_1DCFA_cp_0.velocity.Y = expr_1DCFA_cp_0.velocity.Y * 2.5f; } if (this.timeLeft % 10 == 0) { float num729 = 0.85f + (float)Main.rand.NextDouble() * 0.2f; for (int num730 = 0; num730 < 9; num730++) { Vector2 value25 = new Vector2((float)(num730 - 4) / 5f, -num720 * num729); int num731 = Dust.NewDust(this.position, this.width, this.height, 222, 0f, 0f, 100, default(Color), 1f); Dust dust6 = Main.dust[num731]; dust6.scale = 0.7f + (float)Main.rand.NextDouble() * 0.3f; dust6.velocity *= 0f; if (dust6.velocity.Y > 0f) { Dust expr_1DE16_cp_0 = dust6; expr_1DE16_cp_0.velocity.Y = expr_1DE16_cp_0.velocity.Y * -1f; } dust6.position -= new Vector2((float)(2 + Main.rand.Next(-2, 3)), 0f); dust6.velocity += value25; dust6.scale = 0.6f; dust6.fadeIn = dust6.scale + 0.2f; Dust expr_1DE9C_cp_0 = dust6; expr_1DE9C_cp_0.velocity.Y = expr_1DE9C_cp_0.velocity.Y * 2f; } } } if (this.type == 422) { for (int num732 = 0; num732 < 2; num732++) { Vector2 vector60 = new Vector2(0f, -num720); vector60 *= 0.85f + (float)Main.rand.NextDouble() * 0.2f; vector60 = vector60.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866, default(Vector2)); int num733 = Dust.NewDust(this.position, this.width, this.height, 219 + Main.rand.Next(5), 0f, 0f, 100, default(Color), 1f); Dust dust7 = Main.dust[num733]; dust7.scale = 1f + (float)Main.rand.NextDouble() * 0.3f; dust7.velocity *= 0.5f; if (dust7.velocity.Y > 0f) { Dust expr_1DFFC_cp_0 = dust7; expr_1DFFC_cp_0.velocity.Y = expr_1DFFC_cp_0.velocity.Y * -1f; } dust7.position -= new Vector2((float)(2 + Main.rand.Next(-2, 3)), 0f); dust7.velocity += vector60; dust7.scale = 0.6f; dust7.fadeIn = dust7.scale + 0.2f; Dust expr_1E082_cp_0 = dust7; expr_1E082_cp_0.velocity.Y = expr_1E082_cp_0.velocity.Y * 2f; } return; } } else if (this.aiStyle == 74) { if (this.extraUpdates == 1) { this.localAI[0] *= this.localAI[1]; this.localAI[1] -= 0.001f; if ((double)this.localAI[0] < 0.01) { this.Kill(); return; } } } else { if (this.aiStyle == 75) { this.AI_075(); return; } if (this.aiStyle == 76) { Player player3 = Main.player[this.owner]; player3.heldProj = this.whoAmI; if (this.type == 441) { if (player3.mount.Type != 9) { this.Kill(); return; } } else if (this.type == 453 && player3.mount.Type != 8) { this.Kill(); return; } if (Main.myPlayer != this.owner) { this.position.X = player3.position.X + this.ai[0]; this.position.Y = player3.position.Y + this.ai[1]; if (this.type == 441) { if (!player3.mount.AbilityCharging) { player3.mount.StartAbilityCharge(player3); } } else if (this.type == 453 && !player3.mount.AbilityActive) { player3.mount.UseAbility(player3, this.position, false); } player3.mount.AimAbility(player3, this.position); return; } this.position.X = Main.screenPosition.X + (float)Main.mouseX; this.position.Y = Main.screenPosition.Y + (float)Main.mouseY; if (this.ai[0] != this.position.X - player3.position.X || this.ai[1] != this.position.Y - player3.position.Y) { this.netUpdate = true; } this.ai[0] = this.position.X - player3.position.X; this.ai[1] = this.position.Y - player3.position.Y; player3.mount.AimAbility(player3, this.position); if (!player3.channel) { player3.mount.UseAbility(player3, this.position, false); this.Kill(); return; } } else { if (this.aiStyle == 77) { if (this.ai[1] == 1f) { this.friendly = false; if (this.alpha < 255) { this.alpha += 51; } if (this.alpha >= 255) { this.alpha = 255; this.Kill(); return; } } else { if (this.alpha > 0) { this.alpha -= 50; } if (this.alpha < 0) { this.alpha = 0; } } float num734 = 30f; float num735 = num734 * 4f; this.ai[0] += 1f; if (this.ai[0] > num735) { this.ai[0] = 0f; } Vector2 vector61 = -Vector2.UnitY.RotatedBy((double)(6.28318548f * this.ai[0] / num734), default(Vector2)); float val = 0.75f + vector61.Y * 0.25f; float val2 = 0.8f - vector61.Y * 0.2f; float num736 = Math.Max(val, val2); this.position += new Vector2((float)this.width, (float)this.height) / 2f; this.width = (this.height = (int)(80f * num736)); this.position -= new Vector2((float)this.width, (float)this.height) / 2f; this.frameCounter++; if (this.frameCounter >= 3) { this.frameCounter = 0; this.frame++; if (this.frame >= 4) { this.frame = 0; } } for (int num737 = 0; num737 < 1; num737++) { float num738 = 55f * num736; float num739 = 11f * num736; float num740 = 0.5f; int num741 = Dust.NewDust(this.position, this.width, this.height, 226, 0f, 0f, 100, default(Color), 0.5f); Main.dust[num741].noGravity = true; Main.dust[num741].velocity *= 2f; Main.dust[num741].position = ((float)Main.rand.NextDouble() * 6.28318548f).ToRotationVector2() * (num739 + num740 * (float)Main.rand.NextDouble() * num738) + base.Center; Main.dust[num741].velocity = Main.dust[num741].velocity / 2f + Vector2.Normalize(Main.dust[num741].position - base.Center); if (Main.rand.Next(2) == 0) { num741 = Dust.NewDust(this.position, this.width, this.height, 226, 0f, 0f, 100, default(Color), 0.9f); Main.dust[num741].noGravity = true; Main.dust[num741].velocity *= 1.2f; Main.dust[num741].position = ((float)Main.rand.NextDouble() * 6.28318548f).ToRotationVector2() * (num739 + num740 * (float)Main.rand.NextDouble() * num738) + base.Center; Main.dust[num741].velocity = Main.dust[num741].velocity / 2f + Vector2.Normalize(Main.dust[num741].position - base.Center); } if (Main.rand.Next(4) == 0) { num741 = Dust.NewDust(this.position, this.width, this.height, 226, 0f, 0f, 100, default(Color), 0.7f); Main.dust[num741].noGravity = true; Main.dust[num741].velocity *= 1.2f; Main.dust[num741].position = ((float)Main.rand.NextDouble() * 6.28318548f).ToRotationVector2() * (num739 + num740 * (float)Main.rand.NextDouble() * num738) + base.Center; Main.dust[num741].velocity = Main.dust[num741].velocity / 2f + Vector2.Normalize(Main.dust[num741].position - base.Center); } } return; } if (this.aiStyle == 78) { if (this.alpha > 0) { this.alpha -= 30; } if (this.alpha < 0) { this.alpha = 0; } Vector2 v2 = this.ai[0].ToRotationVector2(); float num742 = this.velocity.ToRotation(); float num743 = v2.ToRotation(); double num744 = (double)(num743 - num742); if (num744 > 3.1415926535897931) { num744 -= 6.2831853071795862; } if (num744 < -3.1415926535897931) { num744 += 6.2831853071795862; } this.velocity = this.velocity.RotatedBy(num744 * 0.05000000074505806, default(Vector2)); this.velocity *= 0.96f; this.rotation = this.velocity.ToRotation() - 1.57079637f; if (Main.myPlayer == this.owner && this.timeLeft > 60) { this.timeLeft = 60; return; } } else if (this.aiStyle == 79) { bool flag31 = true; int num745 = (int)this.ai[0] - 1; if (this.type == 447 && (this.ai[0] == 0f || ((!Main.npc[num745].active || Main.npc[num745].type != 392) && (!Main.npc[num745].active || Main.npc[num745].type != 395 || Main.npc[num745].ai[3] % 120f < 60f || Main.npc[num745].ai[0] != 2f)))) { flag31 = false; } if (!flag31) { this.Kill(); return; } NPC nPC7 = Main.npc[num745]; float num746 = nPC7.Center.Y + 46f; int num747 = (int)nPC7.Center.X / 16; int num748 = (int)num746 / 16; int num749 = 0; bool flag32 = Main.tile[num747, num748].nactive() && Main.tileSolid[(int)Main.tile[num747, num748].type] && !Main.tileSolidTop[(int)Main.tile[num747, num748].type]; if (flag32) { num749 = 1; } else { while (num749 < 150 && num748 + num749 < Main.maxTilesY) { int num750 = num748 + num749; bool flag33 = Main.tile[num747, num750].nactive() && Main.tileSolid[(int)Main.tile[num747, num750].type] && !Main.tileSolidTop[(int)Main.tile[num747, num750].type]; if (flag33) { num749--; break; } num749++; } } this.position.X = nPC7.Center.X - (float)(this.width / 2); this.position.Y = num746; this.height = (num749 + 1) * 16; int num751 = (int)this.position.Y + this.height; if (Main.tile[num747, num751 / 16].nactive() && Main.tileSolid[(int)Main.tile[num747, num751 / 16].type] && !Main.tileSolidTop[(int)Main.tile[num747, num751 / 16].type]) { int num752 = num751 % 16; this.height -= num752 - 2; } if (this.type == 447) { for (int num753 = 0; num753 < 2; num753++) { int num754 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (float)this.height - 16f), this.width, 16, 228, 0f, 0f, 0, default(Color), 1f); Main.dust[num754].noGravity = true; Main.dust[num754].velocity *= 0.5f; Dust expr_1EE07_cp_0 = Main.dust[num754]; expr_1EE07_cp_0.velocity.X = expr_1EE07_cp_0.velocity.X - ((float)num753 - nPC7.velocity.X * 2f / 3f); Main.dust[num754].scale = 2.8f; } if (Main.rand.Next(5) == 0) { int num755 = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) - (float)(this.width / 2 * Math.Sign(nPC7.velocity.X)) - 4f, this.position.Y + (float)this.height - 16f), 4, 16, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num755].velocity *= 0.5f; Dust expr_1EF1D_cp_0 = Main.dust[num755]; expr_1EF1D_cp_0.velocity.X = expr_1EF1D_cp_0.velocity.X - nPC7.velocity.X / 2f; Main.dust[num755].velocity.Y = -Math.Abs(Main.dust[num755].velocity.Y); } } if (this.type == 447 && ++this.frameCounter >= 5) { this.frameCounter = 0; if (++this.frame >= 4) { this.frame = 0; return; } } } else { if (this.aiStyle == 80) { if (this.ai[0] == 0f && this.ai[1] > 0f) { this.ai[1] -= 1f; } else if (this.ai[0] == 0f && this.ai[1] == 0f) { this.ai[0] = 1f; this.ai[1] = (float)Player.FindClosest(this.position, this.width, this.height); this.netUpdate = true; float num756 = this.velocity.Length(); this.velocity = Vector2.Normalize(this.velocity) * (num756 + 4f); for (int num757 = 0; num757 < 8; num757++) { Vector2 vector62 = Vector2.UnitX * -8f; vector62 += -Vector2.UnitY.RotatedBy((double)((float)num757 * 3.14159274f / 4f), default(Vector2)) * new Vector2(2f, 8f); vector62 = vector62.RotatedBy((double)(this.rotation - 1.57079637f), default(Vector2)); int num758 = Dust.NewDust(base.Center, 0, 0, 228, 0f, 0f, 0, default(Color), 1f); Main.dust[num758].scale = 1.5f; Main.dust[num758].noGravity = true; Main.dust[num758].position = base.Center + vector62; Main.dust[num758].velocity = this.velocity * 0f; } } else if (this.ai[0] == 1f) { this.tileCollide = true; this.localAI[1] += 1f; float num759 = 180f; float num760 = 0f; float num761 = 30f; if (this.localAI[1] == num759) { this.Kill(); return; } if (this.localAI[1] >= num760 && this.localAI[1] < num760 + num761) { Vector2 v3 = Main.player[(int)this.ai[1]].Center - base.Center; float num762 = this.velocity.ToRotation(); float num763 = v3.ToRotation(); double num764 = (double)(num763 - num762); if (num764 > 3.1415926535897931) { num764 -= 6.2831853071795862; } if (num764 < -3.1415926535897931) { num764 += 6.2831853071795862; } this.velocity = this.velocity.RotatedBy(num764 * 0.20000000298023224, default(Vector2)); } if (this.localAI[1] % 5f == 0f) { for (int num765 = 0; num765 < 4; num765++) { Vector2 vector63 = Vector2.UnitX * -8f; vector63 += -Vector2.UnitY.RotatedBy((double)((float)num765 * 3.14159274f / 4f), default(Vector2)) * new Vector2(2f, 4f); vector63 = vector63.RotatedBy((double)(this.rotation - 1.57079637f), default(Vector2)); int num766 = Dust.NewDust(base.Center, 0, 0, 228, 0f, 0f, 0, default(Color), 1f); Main.dust[num766].scale = 1.5f; Main.dust[num766].noGravity = true; Main.dust[num766].position = base.Center + vector63; Main.dust[num766].velocity = this.velocity * 0f; } } } this.rotation = this.velocity.ToRotation() + 1.57079637f; if (++this.frameCounter >= 3) { this.frameCounter = 0; if (++this.frame >= 3) { this.frame = 0; } } int num767 = 0; while ((float)num767 < 1f + this.ai[0]) { Vector2 value26 = Vector2.UnitY.RotatedBy((double)this.rotation, default(Vector2)) * 8f * (float)(num767 + 1); int num768 = Dust.NewDust(base.Center, 0, 0, 228, 0f, 0f, 0, default(Color), 1f); Main.dust[num768].position = base.Center + value26; Main.dust[num768].scale = 1f; Main.dust[num768].noGravity = true; num767++; } for (int num769 = 0; num769 < 255; num769++) { Player player4 = Main.player[num769]; if (player4.active && !player4.dead && Vector2.Distance(player4.Center, base.Center) <= 42f) { this.Kill(); return; } } return; } if (this.aiStyle == 81) { int num770 = this.penetrate; if (this.ai[0] == 0f) { this.tileCollide = true; this.localAI[0] += 1f; if (this.localAI[0] > 7f) { int num771 = Utils.SelectRandom<int>(Main.rand, new int[] { 226, 229 }); Vector2 center5 = base.Center; Vector2 vector64 = new Vector2(-16f, 16f); float num772 = 1f; vector64 += new Vector2(-16f, 16f); vector64 = vector64.RotatedBy((double)this.rotation, default(Vector2)); int num773 = 4; int num774 = Dust.NewDust(center5 + vector64 + Vector2.One * (float)(-(float)num773), num773 * 2, num773 * 2, num771, 0f, 0f, 100, default(Color), num772); Main.dust[num774].velocity *= 0.1f; if (Main.rand.Next(6) != 0) { Main.dust[num774].noGravity = true; } } float num775 = 0.01f; int num776 = 5; int num777 = num776 * 15; int num778 = 0; if (this.localAI[0] > 7f) { if (this.localAI[1] == 0f) { this.scale -= num775; this.alpha += num776; if (this.alpha > num777) { this.alpha = num777; this.localAI[1] = 1f; } } else if (this.localAI[1] == 1f) { this.scale += num775; this.alpha -= num776; if (this.alpha <= num778) { this.alpha = num778; this.localAI[1] = 0f; } } } this.rotation = this.velocity.ToRotation() + 0.7853982f; } else if (this.ai[0] >= (float)1 && this.ai[0] < (float)(1 + num770)) { this.tileCollide = false; this.alpha += 15; this.velocity *= 0.98f; this.localAI[0] = 0f; if (this.alpha >= 255) { if (this.ai[0] == 1f) { this.Kill(); return; } int num779 = -1; Vector2 value27 = base.Center; float num780 = 250f; for (int num781 = 0; num781 < 200; num781++) { NPC nPC8 = Main.npc[num781]; if (nPC8.CanBeChasedBy(this, false)) { Vector2 center6 = nPC8.Center; float num782 = Vector2.Distance(center6, base.Center); if (num782 < num780) { num780 = num782; value27 = center6; num779 = num781; } } } if (num779 >= 0) { this.netUpdate = true; this.ai[0] += (float)num770; this.position = value27 + ((float)Main.rand.NextDouble() * 6.28318548f).ToRotationVector2() * 100f - new Vector2((float)this.width, (float)this.height) / 2f; this.velocity = Vector2.Normalize(value27 - base.Center) * 15f; this.rotation = this.velocity.ToRotation() + 0.7853982f; } else { this.Kill(); } } if (Main.rand.Next(3) == 0) { int num783 = Utils.SelectRandom<int>(Main.rand, new int[] { 226, 229 }); Vector2 center7 = base.Center; Vector2 vector65 = new Vector2(-16f, 16f); //vector65 = (vector65 = vector65); float num784 = 0.6f; vector65 += new Vector2(-16f, 16f); vector65 = vector65.RotatedBy((double)this.rotation, default(Vector2)); int num785 = 4; int num786 = Dust.NewDust(center7 + vector65 + Vector2.One * (float)(-(float)num785), num785 * 2, num785 * 2, num783, 0f, 0f, 100, default(Color), num784); Main.dust[num786].velocity *= 0.1f; Main.dust[num786].noGravity = true; } } else if (this.ai[0] >= (float)(1 + num770) && this.ai[0] < (float)(1 + num770 * 2)) { this.scale = 0.9f; this.tileCollide = false; this.rotation = this.velocity.ToRotation() + 0.7853982f; this.ai[1] += 1f; if (this.ai[1] >= 15f) { this.alpha += 51; this.velocity *= 0.8f; if (this.alpha >= 255) { this.Kill(); } } else { this.alpha -= 125; if (this.alpha < 0) { this.alpha = 0; } this.velocity *= 0.98f; } this.localAI[0] += 1f; int num787 = Utils.SelectRandom<int>(Main.rand, new int[] { 226, 229 }); Vector2 center8 = base.Center; Vector2 vector66 = new Vector2(-16f, 16f); float num788 = 0.6f; vector66 += new Vector2(-16f, 16f); vector66 = vector66.RotatedBy((double)this.rotation, default(Vector2)); int num789 = 4; int num790 = Dust.NewDust(center8 + vector66 + Vector2.One * (float)(-(float)num789), num789 * 2, num789 * 2, num787, 0f, 0f, 100, default(Color), num788); Main.dust[num790].velocity *= 0.1f; Main.dust[num790].noGravity = true; } float num791 = (float)this.alpha / 255f; Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.3f * num791, 0.4f * num791, 1f * num791); return; } if (this.aiStyle == 82) { this.alpha -= 40; if (this.alpha < 0) { this.alpha = 0; } if (this.ai[0] == 0f) { this.localAI[0] += 1f; if (this.localAI[0] >= 45f) { this.localAI[0] = 0f; this.ai[0] = 1f; this.ai[1] = -this.ai[1]; this.netUpdate = true; } this.velocity.X = this.velocity.RotatedBy((double)this.ai[1], default(Vector2)).X; this.velocity.X = MathHelper.Clamp(this.velocity.X, -6f, 6f); this.velocity.Y = this.velocity.Y - 0.08f; if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y - 0.2f; } if (this.velocity.Y < -7f) { this.velocity.Y = -7f; } } else if (this.ai[0] == 1f) { this.localAI[0] += 1f; if (this.localAI[0] >= 90f) { this.localAI[0] = 0f; this.ai[0] = 2f; this.ai[1] = (float)Player.FindClosest(this.position, this.width, this.height); this.netUpdate = true; } this.velocity.X = this.velocity.RotatedBy((double)this.ai[1], default(Vector2)).X; this.velocity.X = MathHelper.Clamp(this.velocity.X, -6f, 6f); this.velocity.Y = this.velocity.Y - 0.08f; if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y - 0.2f; } if (this.velocity.Y < -7f) { this.velocity.Y = -7f; } } else if (this.ai[0] == 2f) { Vector2 vector67 = Main.player[(int)this.ai[1]].Center - base.Center; if (vector67.Length() < 30f) { this.Kill(); return; } vector67.Normalize(); vector67 *= 14f; vector67 = Vector2.Lerp(this.velocity, vector67, 0.6f); if (vector67.Y < 6f) { vector67.Y = 6f; } float num792 = 0.4f; if (this.velocity.X < vector67.X) { this.velocity.X = this.velocity.X + num792; if (this.velocity.X < 0f && vector67.X > 0f) { this.velocity.X = this.velocity.X + num792; } } else if (this.velocity.X > vector67.X) { this.velocity.X = this.velocity.X - num792; if (this.velocity.X > 0f && vector67.X < 0f) { this.velocity.X = this.velocity.X - num792; } } if (this.velocity.Y < vector67.Y) { this.velocity.Y = this.velocity.Y + num792; if (this.velocity.Y < 0f && vector67.Y > 0f) { this.velocity.Y = this.velocity.Y + num792; } } else if (this.velocity.Y > vector67.Y) { this.velocity.Y = this.velocity.Y - num792; if (this.velocity.Y > 0f && vector67.Y < 0f) { this.velocity.Y = this.velocity.Y - num792; } } } if (this.alpha < 40) { int num793 = Dust.NewDust(base.Center - Vector2.One * 5f, 10, 10, 229, -this.velocity.X / 3f, -this.velocity.Y / 3f, 150, Color.Transparent, 1.2f); Main.dust[num793].noGravity = true; } this.rotation = this.velocity.ToRotation() + 1.57079637f; return; } if (this.aiStyle == 83) { if (this.alpha > 200) { this.alpha = 200; } this.alpha -= 5; if (this.alpha < 0) { this.alpha = 0; } float num794 = (float)this.alpha / 255f; this.scale = 1f - num794; if (this.ai[0] >= 0f) { this.ai[0] += 1f; } if (this.ai[0] == -1f) { this.frame = 1; this.extraUpdates = 1; } else if (this.ai[0] < 30f) { this.position = Main.npc[(int)this.ai[1]].Center - new Vector2((float)this.width, (float)this.height) / 2f - this.velocity; } else { this.velocity *= 0.96f; if (++this.frameCounter >= 6) { this.frameCounter = 0; if (++this.frame >= 2) { this.frame = 0; } } } if (this.alpha < 40) { for (int num795 = 0; num795 < 2; num795++) { float num796 = (float)Main.rand.NextDouble() * 1f - 0.5f; if (num796 < -0.5f) { num796 = -0.5f; } if (num796 > 0.5f) { num796 = 0.5f; } Vector2 value28 = new Vector2((float)(-(float)this.width) * 0.65f * this.scale, 0f).RotatedBy((double)(num796 * 6.28318548f), default(Vector2)).RotatedBy((double)this.velocity.ToRotation(), default(Vector2)); int num797 = Dust.NewDust(base.Center - Vector2.One * 5f, 10, 10, 229, -this.velocity.X / 3f, -this.velocity.Y / 3f, 150, Color.Transparent, 0.7f); Main.dust[num797].velocity = Vector2.Zero; Main.dust[num797].position = base.Center + value28; Main.dust[num797].noGravity = true; } return; } } else if (this.aiStyle == 84) { Vector2? vector68 = null; if (this.velocity.HasNaNs() || this.velocity == Vector2.Zero) { this.velocity = -Vector2.UnitY; } if (this.type == 455 && Main.npc[(int)this.ai[1]].active && Main.npc[(int)this.ai[1]].type == 396) { Vector2 value29 = new Vector2(27f, 59f); Vector2 value30 = Utils.Vector2FromElipse(Main.npc[(int)this.ai[1]].localAI[0].ToRotationVector2(), value29 * Main.npc[(int)this.ai[1]].localAI[1]); this.position = Main.npc[(int)this.ai[1]].Center + value30 - new Vector2((float)this.width, (float)this.height) / 2f; } else if (this.type == 455 && Main.npc[(int)this.ai[1]].active && Main.npc[(int)this.ai[1]].type == 400) { Vector2 value31 = new Vector2(30f, 30f); Vector2 value32 = Utils.Vector2FromElipse(Main.npc[(int)this.ai[1]].localAI[0].ToRotationVector2(), value31 * Main.npc[(int)this.ai[1]].localAI[1]); this.position = Main.npc[(int)this.ai[1]].Center + value32 - new Vector2((float)this.width, (float)this.height) / 2f; } else if (this.type == 537 && Main.npc[(int)this.ai[1]].active && Main.npc[(int)this.ai[1]].type == 411) { Vector2 value33 = new Vector2((float)(Main.npc[(int)this.ai[1]].direction * 6), -4f); this.position = Main.npc[(int)this.ai[1]].Center + value33 - base.Size / 2f + new Vector2(0f, -Main.npc[(int)this.ai[1]].gfxOffY); } else if (this.type == 461 && Main.projectile[(int)this.ai[1]].active && Main.projectile[(int)this.ai[1]].type == 460) { Vector2 value34 = Vector2.Normalize(Main.projectile[(int)this.ai[1]].velocity); this.position = Main.projectile[(int)this.ai[1]].Center + value34 * 16f - new Vector2((float)this.width, (float)this.height) / 2f + new Vector2(0f, -Main.projectile[(int)this.ai[1]].gfxOffY); this.velocity = Vector2.Normalize(Main.projectile[(int)this.ai[1]].velocity); } else if (this.type == 642 && Main.projectile[(int)this.ai[1]].active && Main.projectile[(int)this.ai[1]].type == 641) { base.Center = Main.projectile[(int)this.ai[1]].Center; this.velocity = Vector2.Normalize(Main.projectile[(int)this.ai[1]].ai[1].ToRotationVector2()); } else { if (this.type != 632 || !Main.projectile[(int)this.ai[1]].active || Main.projectile[(int)this.ai[1]].type != 633) { this.Kill(); return; } float num798 = (float)((int)this.ai[0]) - 2.5f; Vector2 value35 = Vector2.Normalize(Main.projectile[(int)this.ai[1]].velocity); Projectile projectile = Main.projectile[(int)this.ai[1]]; float num799 = num798 * 0.5235988f; Vector2 value36 = Vector2.Zero; float num800; float y; float num801; float scaleFactor6; if (projectile.ai[0] < 180f) { num800 = 1f - projectile.ai[0] / 180f; y = 20f - projectile.ai[0] / 180f * 14f; if (projectile.ai[0] < 120f) { num801 = 20f - 4f * (projectile.ai[0] / 120f); this.Opacity = projectile.ai[0] / 120f * 0.4f; } else { num801 = 16f - 10f * ((projectile.ai[0] - 120f) / 60f); this.Opacity = 0.4f + (projectile.ai[0] - 120f) / 60f * 0.6f; } scaleFactor6 = -22f + projectile.ai[0] / 180f * 20f; } else { num800 = 0f; num801 = 1.75f; y = 6f; this.Opacity = 1f; scaleFactor6 = -2f; } float num802 = (projectile.ai[0] + num798 * num801) / (num801 * 6f) * 6.28318548f; num799 = Vector2.UnitY.RotatedBy((double)num802, default(Vector2)).Y * 0.5235988f * num800; value36 = (Vector2.UnitY.RotatedBy((double)num802, default(Vector2)) * new Vector2(4f, y)).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)); this.position = projectile.Center + value35 * 16f - base.Size / 2f + new Vector2(0f, -Main.projectile[(int)this.ai[1]].gfxOffY); this.position += projectile.velocity.ToRotation().ToRotationVector2() * scaleFactor6; this.position += value36; this.velocity = Vector2.Normalize(projectile.velocity).RotatedBy((double)num799, default(Vector2)); this.scale = 1.4f * (1f - num800); this.damage = projectile.damage; if (projectile.ai[0] >= 180f) { this.damage *= 3; vector68 = new Vector2?(projectile.Center); } if (!Collision.CanHitLine(Main.player[this.owner].Center, 0, 0, projectile.Center, 0, 0)) { vector68 = new Vector2?(Main.player[this.owner].Center); } this.friendly = (projectile.ai[0] > 30f); } if (this.velocity.HasNaNs() || this.velocity == Vector2.Zero) { this.velocity = -Vector2.UnitY; } if (this.type == 461) { this.ai[0] += 1f; if (this.ai[0] >= 300f) { this.Kill(); return; } this.scale = (float)Math.Sin((double)(this.ai[0] * 3.14159274f / 300f)) * 10f; if (this.scale > 1f) { this.scale = 1f; } } if (this.type == 455) { if (this.localAI[0] == 0f) { Main.PlaySound(29, (int)this.position.X, (int)this.position.Y, 104); } float num803 = 1f; if (Main.npc[(int)this.ai[1]].type == 400) { num803 = 0.4f; } this.localAI[0] += 1f; if (this.localAI[0] >= 180f) { this.Kill(); return; } this.scale = (float)Math.Sin((double)(this.localAI[0] * 3.14159274f / 180f)) * 10f * num803; if (this.scale > num803) { this.scale = num803; } } if (this.type == 642) { float num804 = 1f; this.localAI[0] += 1f; if (this.localAI[0] >= 50f) { this.Kill(); return; } this.scale = (float)Math.Sin((double)(this.localAI[0] * 3.14159274f / 50f)) * 10f * num804; if (this.scale > num804) { this.scale = num804; } } if (this.type == 537) { float num805 = 0.8f; this.localAI[0] += 1f; if (this.localAI[0] >= 60f) { this.Kill(); return; } this.scale = (float)Math.Sin((double)(this.localAI[0] * 3.14159274f / 60f)) * 10f * num805; if (this.scale > num805) { this.scale = num805; } } float num806 = this.velocity.ToRotation(); if (this.type == 455) { num806 += this.ai[0]; } this.rotation = num806 - 1.57079637f; this.velocity = num806.ToRotationVector2(); float num807 = 0f; float scaleFactor7 = 0f; Vector2 value37 = base.Center; if (vector68.HasValue) { value37 = vector68.Value; } if (this.type == 455) { num807 = 3f; scaleFactor7 = (float)this.width; } else if (this.type == 461) { num807 = 2f; scaleFactor7 = 0f; } else if (this.type == 642) { num807 = 2f; scaleFactor7 = 0f; } else if (this.type == 632) { num807 = 2f; scaleFactor7 = 0f; } else if (this.type == 537) { num807 = 2f; scaleFactor7 = 0f; } float[] array3 = new float[(int)num807]; int num808 = 0; while ((float)num808 < num807) { float num809 = (float)num808 / (num807 - 1f); Vector2 value38 = value37 + this.velocity.RotatedBy(1.5707963705062866, default(Vector2)) * (num809 - 0.5f) * scaleFactor7 * this.scale; int num810 = (int)value38.X / 16; int num811 = (int)value38.Y / 16; Vector2 vector69 = value38 + this.velocity * 16f * 150f; int num812 = (int)vector69.X / 16; int num813 = (int)vector69.Y / 16; Tuple<int, int> tuple; float num814; if (!Collision.TupleHitLine(num810, num811, num812, num813, 0, 0, new List<Tuple<int, int>>(), out tuple)) { num814 = new Vector2((float)Math.Abs(num810 - tuple.Item1), (float)Math.Abs(num811 - tuple.Item2)).Length() * 16f; } else if (tuple.Item1 == num812 && tuple.Item2 == num813) { num814 = 2400f; } else { num814 = new Vector2((float)Math.Abs(num810 - tuple.Item1), (float)Math.Abs(num811 - tuple.Item2)).Length() * 16f; } array3[num808] = num814; num808++; } float num815 = 0f; for (int num816 = 0; num816 < array3.Length; num816++) { num815 += array3[num816]; } num815 /= num807; float amount = 0.5f; if (this.type == 632) { amount = 0.75f; } this.localAI[1] = MathHelper.Lerp(this.localAI[1], num815, amount); if (this.type == 455) { Vector2 vector70 = base.Center + this.velocity * (this.localAI[1] - 14f); for (int num817 = 0; num817 < 2; num817++) { float num818 = this.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; float num819 = (float)Main.rand.NextDouble() * 2f + 2f; Vector2 vector71 = new Vector2((float)Math.Cos((double)num818) * num819, (float)Math.Sin((double)num818) * num819); int num820 = Dust.NewDust(vector70, 0, 0, 229, vector71.X, vector71.Y, 0, default(Color), 1f); Main.dust[num820].noGravity = true; Main.dust[num820].scale = 1.7f; } if (Main.rand.Next(5) == 0) { Vector2 value39 = this.velocity.RotatedBy(1.5707963705062866, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)this.width; int num821 = Dust.NewDust(vector70 + value39 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num821].velocity *= 0.5f; Main.dust[num821].velocity.Y = -Math.Abs(Main.dust[num821].velocity.Y); } DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f); Utils.PlotTileLine(base.Center, base.Center + this.velocity * this.localAI[1], (float)this.width * this.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); } else if (this.type == 642) { Vector2 vector72 = base.Center + this.velocity * (this.localAI[1] - 14f); for (int num822 = 0; num822 < 2; num822++) { float num823 = this.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; float num824 = (float)Main.rand.NextDouble() * 2f + 2f; Vector2 vector73 = new Vector2((float)Math.Cos((double)num823) * num824, (float)Math.Sin((double)num823) * num824); int num825 = Dust.NewDust(vector72, 0, 0, 229, vector73.X, vector73.Y, 0, default(Color), 1f); Main.dust[num825].noGravity = true; Main.dust[num825].scale = 1.7f; } if (Main.rand.Next(5) == 0) { Vector2 value40 = this.velocity.RotatedBy(1.5707963705062866, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)this.width; int num826 = Dust.NewDust(vector72 + value40 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num826].velocity *= 0.5f; Main.dust[num826].velocity.Y = -Math.Abs(Main.dust[num826].velocity.Y); } DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f); Utils.PlotTileLine(base.Center, base.Center + this.velocity * this.localAI[1], (float)this.width * this.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); } if (this.type == 461) { Vector2 vector74 = base.Center + this.velocity * (this.localAI[1] - 8f); for (int num827 = 0; num827 < 2; num827++) { float num828 = this.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; float num829 = (float)Main.rand.NextDouble() * 0.8f + 1f; Vector2 vector75 = new Vector2((float)Math.Cos((double)num828) * num829, (float)Math.Sin((double)num828) * num829); int num830 = Dust.NewDust(vector74, 0, 0, 226, vector75.X, vector75.Y, 0, default(Color), 1f); Main.dust[num830].noGravity = true; Main.dust[num830].scale = 1.2f; } if (Main.rand.Next(5) == 0) { Vector2 value41 = this.velocity.RotatedBy(1.5707963705062866, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)this.width; int num831 = Dust.NewDust(vector74 + value41 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num831].velocity *= 0.5f; Main.dust[num831].velocity.Y = -Math.Abs(Main.dust[num831].velocity.Y); } DelegateMethods.v3_1 = new Vector3(0.4f, 0.85f, 0.9f); Utils.PlotTileLine(base.Center, base.Center + this.velocity * this.localAI[1], (float)this.width * this.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); } if (this.type == 537) { Vector2 vector76 = base.Center + this.velocity * (this.localAI[1] - 8f); for (int num832 = 0; num832 < 2; num832++) { float num833 = this.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; float num834 = (float)Main.rand.NextDouble() * 0.8f + 1f; Vector2 vector77 = new Vector2((float)Math.Cos((double)num833) * num834, (float)Math.Sin((double)num833) * num834); int num835 = Dust.NewDust(vector76, 0, 0, 226, vector77.X, vector77.Y, 0, default(Color), 1f); Main.dust[num835].noGravity = true; Main.dust[num835].scale = 1.2f; } if (Main.rand.Next(5) == 0) { Vector2 value42 = this.velocity.RotatedBy(1.5707963705062866, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)this.width; int num836 = Dust.NewDust(vector76 + value42 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num836].velocity *= 0.5f; Main.dust[num836].velocity.Y = -Math.Abs(Main.dust[num836].velocity.Y); } DelegateMethods.v3_1 = new Vector3(0.4f, 0.85f, 0.9f); Utils.PlotTileLine(base.Center, base.Center + this.velocity * this.localAI[1], (float)this.width * this.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); } if (this.type == 632 && Math.Abs(this.localAI[1] - num815) < 100f && this.scale > 0.15f) { float prismHue = this.GetPrismHue(this.ai[0]); float prismSat = this.GetPrismSat(); float prismLum = this.GetPrismLum(); Color color = Main.hslToRgb(prismHue, prismSat, prismLum); color.A = 0; Vector2 vector78 = base.Center + this.velocity * (this.localAI[1] - 14.5f * this.scale); float x = Main.rgbToHsl(new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB)).X; for (int num837 = 0; num837 < 2; num837++) { float num838 = this.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; float num839 = (float)Main.rand.NextDouble() * 0.8f + 1f; Vector2 vector79 = new Vector2((float)Math.Cos((double)num838) * num839, (float)Math.Sin((double)num838) * num839); int num840 = Dust.NewDust(vector78, 0, 0, 267, vector79.X, vector79.Y, 0, default(Color), 1f); Main.dust[num840].color = color; Main.dust[num840].scale = 1.2f; if (this.scale > 1f) { Main.dust[num840].velocity *= this.scale; Main.dust[num840].scale *= this.scale; } Main.dust[num840].noGravity = true; if (this.scale != 1.4f) { Dust dust8 = Dust.CloneDust(Main.dust[num840]); dust8.color = Color.White; dust8.scale /= 2f; } float hue = (x + Main.rand.NextFloat() * 0.4f) % 1f; Main.dust[num840].color = Color.Lerp(color, Main.hslToRgb(hue, 1f, 0.75f), this.scale / 1.4f); } if (Main.rand.Next(5) == 0) { Vector2 value43 = this.velocity.RotatedBy(1.5707963705062866, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)this.width; int num841 = Dust.NewDust(vector78 + value43 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num841].velocity *= 0.5f; Main.dust[num841].velocity.Y = -Math.Abs(Main.dust[num841].velocity.Y); } DelegateMethods.v3_1 = color.ToVector3() * 0.3f; Utils.PlotTileLine(base.Center, base.Center + this.velocity * this.localAI[1], (float)this.width * this.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); return; } } else if (this.aiStyle == 85) { Vector2 value44 = new Vector2(0f, 216f); this.alpha -= 15; if (this.alpha < 0) { this.alpha = 0; } int num842 = (int)Math.Abs(this.ai[0]) - 1; int num843 = (int)this.ai[1]; if (!Main.npc[num842].active || Main.npc[num842].type != 396) { this.Kill(); return; } this.localAI[0] += 1f; if (this.localAI[0] >= 330f && this.ai[0] > 0f && Main.netMode != 1) { this.ai[0] *= -1f; this.netUpdate = true; } if (Main.netMode != 1 && this.ai[0] > 0f && (!Main.player[(int)this.ai[1]].active || Main.player[(int)this.ai[1]].dead)) { this.ai[0] *= -1f; this.netUpdate = true; } this.rotation = (Main.npc[(int)Math.Abs(this.ai[0]) - 1].Center - Main.player[(int)this.ai[1]].Center + value44).ToRotation() + 1.57079637f; if (this.ai[0] > 0f) { Vector2 value45 = Main.player[(int)this.ai[1]].Center - base.Center; if (value45.X != 0f || value45.Y != 0f) { this.velocity = Vector2.Normalize(value45) * Math.Min(16f, value45.Length()); } else { this.velocity = Vector2.Zero; } if (value45.Length() < 20f && this.localAI[1] == 0f) { this.localAI[1] = 1f; int time = 840; if (Main.expertMode) { time = 960; } Main.player[num843].AddBuff(145, time, true); return; } } else { Vector2 value46 = Main.npc[(int)Math.Abs(this.ai[0]) - 1].Center - base.Center + value44; if (value46.X != 0f || value46.Y != 0f) { this.velocity = Vector2.Normalize(value46) * Math.Min(16f, value46.Length()); } else { this.velocity = Vector2.Zero; } if (value46.Length() < 20f) { this.Kill(); return; } } } else if (this.aiStyle == 86) { if (this.localAI[1] == 0f) { this.localAI[1] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 120); } this.ai[0] += 1f; if (this.ai[1] == 1f) { if (this.ai[0] >= 130f) { this.alpha += 10; } else { this.alpha -= 10; } if (this.alpha < 0) { this.alpha = 0; } if (this.alpha > 255) { this.alpha = 255; } if (this.ai[0] >= 150f) { this.Kill(); return; } if (this.ai[0] % 30f == 0f && Main.netMode != 1) { Vector2 vector80 = this.rotation.ToRotationVector2(); Projectile.NewProjectile(base.Center.X, base.Center.Y, vector80.X, vector80.Y, 464, this.damage, this.knockBack, this.owner, 0f, 0f); } this.rotation += 0.104719758f; Lighting.AddLight(base.Center, 0.3f, 0.75f, 0.9f); return; } else { this.position -= this.velocity; if (this.ai[0] >= 40f) { this.alpha += 3; } else { this.alpha -= 40; } if (this.alpha < 0) { this.alpha = 0; } if (this.alpha > 255) { this.alpha = 255; } if (this.ai[0] >= 45f) { this.Kill(); return; } Vector2 value47 = new Vector2(0f, -720f).RotatedBy((double)this.velocity.ToRotation(), default(Vector2)); float scaleFactor8 = this.ai[0] % 45f / 45f; Vector2 spinningpoint = value47 * scaleFactor8; for (int num844 = 0; num844 < 6; num844++) { Vector2 vector81 = base.Center + spinningpoint.RotatedBy((double)((float)num844 * 6.28318548f / 6f), default(Vector2)); Lighting.AddLight(vector81, 0.3f, 0.75f, 0.9f); for (int num845 = 0; num845 < 2; num845++) { int num846 = Dust.NewDust(vector81 + Utils.RandomVector2(Main.rand, -8f, 8f) / 2f, 8, 8, 197, 0f, 0f, 100, Color.Transparent, 1f); Main.dust[num846].noGravity = true; } } return; } } else { if (this.aiStyle == 87) { this.position.Y = this.ai[0]; this.height = (int)this.ai[1]; if (base.Center.X > Main.player[this.owner].Center.X) { this.direction = 1; } else { this.direction = -1; } this.velocity.X = (float)this.direction * 1E-06f; if (this.owner == Main.myPlayer) { for (int num847 = 0; num847 < 1000; num847++) { if (Main.projectile[num847].active && num847 != this.whoAmI && Main.projectile[num847].type == this.type && Main.projectile[num847].owner == this.owner && Main.projectile[num847].timeLeft > this.timeLeft) { this.Kill(); return; } } } float num848 = (float)(this.width * this.height) * 0.0045f; int num849 = 0; while ((float)num849 < num848) { int num850 = Dust.NewDust(this.position, this.width, this.height, 75, 0f, 0f, 100, default(Color), 1f); Main.dust[num850].noGravity = true; Main.dust[num850].velocity *= 0.5f; Dust expr_22B54_cp_0 = Main.dust[num850]; expr_22B54_cp_0.velocity.Y = expr_22B54_cp_0.velocity.Y - 0.5f; Main.dust[num850].scale = 1.4f; Dust expr_22B88_cp_0 = Main.dust[num850]; expr_22B88_cp_0.position.X = expr_22B88_cp_0.position.X + 6f; Dust expr_22BA8_cp_0 = Main.dust[num850]; expr_22BA8_cp_0.position.Y = expr_22BA8_cp_0.position.Y - 2f; num849++; } return; } if (this.aiStyle == 88) { if (this.type == 465) { if (this.localAI[1] == 0f) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 121); this.localAI[1] = 1f; } if (this.ai[0] < 180f) { this.alpha -= 5; if (this.alpha < 0) { this.alpha = 0; } } else { this.alpha += 5; if (this.alpha > 255) { this.alpha = 255; this.Kill(); return; } } this.ai[0] += 1f; if (this.ai[0] % 30f == 0f && this.ai[0] < 180f && Main.netMode != 1) { int[] array4 = new int[5]; Vector2[] array5 = new Vector2[5]; int num851 = 0; float num852 = 2000f; for (int num853 = 0; num853 < 255; num853++) { if (Main.player[num853].active && !Main.player[num853].dead) { Vector2 center9 = Main.player[num853].Center; float num854 = Vector2.Distance(center9, base.Center); if (num854 < num852 && Collision.CanHit(base.Center, 1, 1, center9, 1, 1)) { array4[num851] = num853; array5[num851] = center9; if (++num851 >= array5.Length) { break; } } } } for (int num855 = 0; num855 < num851; num855++) { Vector2 vector82 = array5[num855] - base.Center; float ai = (float)Main.rand.Next(100); Vector2 vector83 = Vector2.Normalize(vector82.RotatedByRandom(0.78539818525314331)) * 7f; Projectile.NewProjectile(base.Center.X, base.Center.Y, vector83.X, vector83.Y, 466, this.damage, 0f, Main.myPlayer, vector82.ToRotation(), ai); } } Lighting.AddLight(base.Center, 0.4f, 0.85f, 0.9f); if (++this.frameCounter >= 4) { this.frameCounter = 0; if (++this.frame >= Main.projFrames[this.type]) { this.frame = 0; } } if (this.alpha < 150 && this.ai[0] < 180f) { for (int num856 = 0; num856 < 1; num856++) { float num857 = (float)Main.rand.NextDouble() * 1f - 0.5f; if (num857 < -0.5f) { num857 = -0.5f; } if (num857 > 0.5f) { num857 = 0.5f; } Vector2 value48 = new Vector2((float)(-(float)this.width) * 0.2f * this.scale, 0f).RotatedBy((double)(num857 * 6.28318548f), default(Vector2)).RotatedBy((double)this.velocity.ToRotation(), default(Vector2)); int num858 = Dust.NewDust(base.Center - Vector2.One * 5f, 10, 10, 226, -this.velocity.X / 3f, -this.velocity.Y / 3f, 150, Color.Transparent, 0.7f); Main.dust[num858].position = base.Center + value48; Main.dust[num858].velocity = Vector2.Normalize(Main.dust[num858].position - base.Center) * 2f; Main.dust[num858].noGravity = true; } for (int num859 = 0; num859 < 1; num859++) { float num860 = (float)Main.rand.NextDouble() * 1f - 0.5f; if (num860 < -0.5f) { num860 = -0.5f; } if (num860 > 0.5f) { num860 = 0.5f; } Vector2 value49 = new Vector2((float)(-(float)this.width) * 0.6f * this.scale, 0f).RotatedBy((double)(num860 * 6.28318548f), default(Vector2)).RotatedBy((double)this.velocity.ToRotation(), default(Vector2)); int num861 = Dust.NewDust(base.Center - Vector2.One * 5f, 10, 10, 226, -this.velocity.X / 3f, -this.velocity.Y / 3f, 150, Color.Transparent, 0.7f); Main.dust[num861].velocity = Vector2.Zero; Main.dust[num861].position = base.Center + value49; Main.dust[num861].noGravity = true; } return; } } else if (this.type == 466) { this.frameCounter++; Lighting.AddLight(base.Center, 0.3f, 0.45f, 0.5f); if (this.velocity == Vector2.Zero) { if (this.frameCounter >= this.extraUpdates * 2) { this.frameCounter = 0; bool flag34 = true; for (int num862 = 1; num862 < this.oldPos.Length; num862++) { if (this.oldPos[num862] != this.oldPos[0]) { flag34 = false; } } if (flag34) { this.Kill(); return; } } if (Main.rand.Next(this.extraUpdates) == 0) { for (int num863 = 0; num863 < 2; num863++) { float num864 = this.rotation + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; float num865 = (float)Main.rand.NextDouble() * 0.8f + 1f; Vector2 vector84 = new Vector2((float)Math.Cos((double)num864) * num865, (float)Math.Sin((double)num864) * num865); int num866 = Dust.NewDust(base.Center, 0, 0, 226, vector84.X, vector84.Y, 0, default(Color), 1f); Main.dust[num866].noGravity = true; Main.dust[num866].scale = 1.2f; } if (Main.rand.Next(5) == 0) { Vector2 value50 = this.velocity.RotatedBy(1.5707963705062866, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)this.width; int num867 = Dust.NewDust(base.Center + value50 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num867].velocity *= 0.5f; Main.dust[num867].velocity.Y = -Math.Abs(Main.dust[num867].velocity.Y); return; } } } else if (this.frameCounter >= this.extraUpdates * 2) { this.frameCounter = 0; float num868 = this.velocity.Length(); Random random = new Random((int)this.ai[1]); int num869 = 0; Vector2 spinningpoint2 = -Vector2.UnitY; Vector2 vector85; do { int num870 = random.Next(); this.ai[1] = (float)num870; num870 %= 100; float f = (float)num870 / 100f * 6.28318548f; vector85 = f.ToRotationVector2(); if (vector85.Y > 0f) { vector85.Y *= -1f; } bool flag35 = false; if (vector85.Y > -0.02f) { flag35 = true; } if (vector85.X * (float)(this.extraUpdates + 1) * 2f * num868 + this.localAI[0] > 40f) { flag35 = true; } if (vector85.X * (float)(this.extraUpdates + 1) * 2f * num868 + this.localAI[0] < -40f) { flag35 = true; } if (!flag35) { goto IL_23620; } } while (num869++ < 100); this.velocity = Vector2.Zero; this.localAI[1] = 1f; goto IL_23628; IL_23620: spinningpoint2 = vector85; IL_23628: if (this.velocity != Vector2.Zero) { this.localAI[0] += spinningpoint2.X * (float)(this.extraUpdates + 1) * 2f * num868; this.velocity = spinningpoint2.RotatedBy((double)(this.ai[0] + 1.57079637f), default(Vector2)) * num868; this.rotation = this.velocity.ToRotation() + 1.57079637f; return; } } } else if (this.type == 580) { if (this.localAI[1] == 0f && this.ai[0] >= 900f) { this.ai[0] -= 1000f; this.localAI[1] = -1f; } this.frameCounter++; Lighting.AddLight(base.Center, 0.3f, 0.45f, 0.5f); if (this.velocity == Vector2.Zero) { if (this.frameCounter >= this.extraUpdates * 2) { this.frameCounter = 0; bool flag36 = true; for (int num871 = 1; num871 < this.oldPos.Length; num871++) { if (this.oldPos[num871] != this.oldPos[0]) { flag36 = false; } } if (flag36) { this.Kill(); return; } } if (Main.rand.Next(this.extraUpdates) == 0 && (this.velocity != Vector2.Zero || Main.rand.Next((this.localAI[1] == 2f) ? 2 : 6) == 0)) { for (int num872 = 0; num872 < 2; num872++) { float num873 = this.rotation + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; float num874 = (float)Main.rand.NextDouble() * 0.8f + 1f; Vector2 vector86 = new Vector2((float)Math.Cos((double)num873) * num874, (float)Math.Sin((double)num873) * num874); int num875 = Dust.NewDust(base.Center, 0, 0, 226, vector86.X, vector86.Y, 0, default(Color), 1f); Main.dust[num875].noGravity = true; Main.dust[num875].scale = 1.2f; } if (Main.rand.Next(5) == 0) { Vector2 value51 = this.velocity.RotatedBy(1.5707963705062866, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)this.width; int num876 = Dust.NewDust(base.Center + value51 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num876].velocity *= 0.5f; Main.dust[num876].velocity.Y = -Math.Abs(Main.dust[num876].velocity.Y); return; } } } else if (this.frameCounter >= this.extraUpdates * 2) { this.frameCounter = 0; float num877 = this.velocity.Length(); Random random2 = new Random((int)this.ai[1]); int num878 = 0; Vector2 spinningpoint3 = -Vector2.UnitY; Vector2 vector87; do { int num879 = random2.Next(); this.ai[1] = (float)num879; num879 %= 100; float f2 = (float)num879 / 100f * 6.28318548f; vector87 = f2.ToRotationVector2(); if (vector87.Y > 0f) { vector87.Y *= -1f; } bool flag37 = false; if (vector87.Y > -0.02f) { flag37 = true; } if (vector87.X * (float)(this.extraUpdates + 1) * 2f * num877 + this.localAI[0] > 40f) { flag37 = true; } if (vector87.X * (float)(this.extraUpdates + 1) * 2f * num877 + this.localAI[0] < -40f) { flag37 = true; } if (!flag37) { goto IL_23B84; } } while (num878++ < 100); this.velocity = Vector2.Zero; if (this.localAI[1] < 1f) { this.localAI[1] += 2f; goto IL_23B8C; } goto IL_23B8C; IL_23B84: spinningpoint3 = vector87; IL_23B8C: if (this.velocity != Vector2.Zero) { this.localAI[0] += spinningpoint3.X * (float)(this.extraUpdates + 1) * 2f * num877; this.velocity = spinningpoint3.RotatedBy((double)(this.ai[0] + 1.57079637f), default(Vector2)) * num877; this.rotation = this.velocity.ToRotation() + 1.57079637f; if (Main.rand.Next(4) == 0 && Main.netMode != 1 && this.localAI[1] == 0f) { float num880 = (float)Main.rand.Next(-3, 4) * 1.04719758f / 3f; Vector2 vector88 = this.ai[0].ToRotationVector2().RotatedBy((double)num880, default(Vector2)) * this.velocity.Length(); if (!Collision.CanHitLine(base.Center, 0, 0, base.Center + vector88 * 50f, 0, 0)) { Projectile.NewProjectile(base.Center.X - vector88.X, base.Center.Y - vector88.Y, vector88.X, vector88.Y, this.type, this.damage, this.knockBack, this.owner, vector88.ToRotation() + 1000f, this.ai[1]); return; } } } } } } else if (this.aiStyle == 89) { if (this.ai[1] == -1f) { this.alpha += 12; } else if (this.ai[0] < 300f) { this.alpha -= 5; } else { this.alpha += 12; } if (this.alpha < 0) { this.alpha = 0; } if (this.alpha > 255) { this.alpha = 255; } this.scale = 1f - (float)this.alpha / 255f; this.scale *= 0.6f; this.rotation += 0.0149599658f; if (this.localAI[1] == 0f) { this.localAI[1] = 1f; Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 123); } if (this.alpha == 0) { for (int num881 = 0; num881 < 2; num881++) { float num882 = (float)Main.rand.Next(2, 4); float num883 = this.scale; if (num881 == 1) { num883 *= 0.42f; num882 *= -0.75f; } Vector2 value52 = new Vector2((float)Main.rand.Next(-10, 11), (float)Main.rand.Next(-10, 11)); value52.Normalize(); int num884 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 228, 0f, 0f, 100, default(Color), 2f); Main.dust[num884].noGravity = true; Main.dust[num884].noLight = true; Main.dust[num884].position = base.Center + value52 * 204f * num883; if (Main.rand.Next(8) == 0) { Main.dust[num884].velocity = value52 * -num882 * 2f; Main.dust[num884].scale += 0.5f; } else { Main.dust[num884].velocity = value52 * -num882; } } } this.ai[0] += 1f; if (this.ai[0] >= 60f) { int arg_2402D_0 = (int)(this.ai[0] - 0f) / 60; for (int num885 = 0; num885 < 1; num885++) { float scaleFactor9 = (float)Main.rand.Next(1, 3); Vector2 value53 = new Vector2((float)Main.rand.Next(-10, 11), (float)Main.rand.Next(-10, 11)); value53.Normalize(); int num886 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 228, 0f, 0f, 100, default(Color), 2f); Main.dust[num886].noGravity = true; Main.dust[num886].noLight = true; Main.dust[num886].position = base.Center; if (Main.rand.Next(2) == 0) { Main.dust[num886].velocity = value53 * scaleFactor9 * 2f; Main.dust[num886].scale += 0.5f; } else { Main.dust[num886].velocity = value53 * scaleFactor9; } Main.dust[num886].fadeIn = 2f; } } if (this.ai[0] == 300f && this.ai[1] != -1f && Main.netMode != 1) { if (!NPC.AnyNPCs(454)) { this.ai[1] = (float)NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 454, 0, 0f, 0f, 0f, 0f, 255); } else { this.ai[1] = (float)NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 521, 0, 0f, 0f, 0f, 0f, 255); } } else if (this.ai[0] == 320f) { this.Kill(); return; } bool flag38 = false; if (this.ai[1] == -1f) { if (this.alpha == 255) { flag38 = true; } } else { flag38 = (this.ai[1] < 0f || !Main.npc[(int)this.ai[1]].active); if ((flag38 || Main.npc[(int)this.ai[1]].type != 439) && (flag38 || Main.npc[(int)this.ai[1]].type != 454) && (flag38 || Main.npc[(int)this.ai[1]].type != 521)) { flag38 = true; } } if (flag38) { this.Kill(); return; } Lighting.AddLight(base.Center, 1.1f, 0.9f, 0.4f); return; } else if (this.aiStyle == 90) { if (Main.player[this.owner].dead) { this.Kill(); } if (Main.myPlayer == this.owner && Main.player[this.owner].magicLantern) { this.timeLeft = 2; } if (this.tileCollide) { if (!Collision.CanHit(this.position, this.width, this.height, Main.player[this.owner].Center, 1, 1)) { this.tileCollide = false; } else if (!Collision.SolidCollision(this.position, this.width, this.height) && Collision.CanHitLine(this.position, this.width, this.height, Main.player[this.owner].Center, 1, 1)) { this.tileCollide = true; } } this.direction = Main.player[this.owner].direction; this.spriteDirection = this.direction; Lighting.AddLight(this.position, 0.35f, 0.35f, 0.1f); this.localAI[0] += 1f; if (this.localAI[0] >= 10f) { this.localAI[0] = 0f; int num887 = 17; if ((base.Center - Main.player[Main.myPlayer].Center).Length() < (float)(Main.screenWidth + num887 * 16)) { int num888 = (int)base.Center.X / 16; int num889 = (int)base.Center.Y / 16; for (int num890 = num888 - num887; num890 <= num888 + num887; num890++) { for (int num891 = num889 - num887; num891 <= num889 + num887; num891++) { if (Main.rand.Next(4) == 0) { Vector2 vector89 = new Vector2((float)(num888 - num890), (float)(num889 - num891)); if (vector89.Length() < (float)num887 && num890 > 0 && num890 < Main.maxTilesX - 1 && num891 > 0 && num891 < Main.maxTilesY - 1 && Main.tile[num890, num891] != null && Main.tile[num890, num891].active()) { bool flag39 = false; if (Main.tile[num890, num891].type == 185 && Main.tile[num890, num891].frameY == 18) { if (Main.tile[num890, num891].frameX >= 576 && Main.tile[num890, num891].frameX <= 882) { flag39 = true; } } else if (Main.tile[num890, num891].type == 186 && Main.tile[num890, num891].frameX >= 864 && Main.tile[num890, num891].frameX <= 1170) { flag39 = true; } if (flag39 || Main.tileSpelunker[(int)Main.tile[num890, num891].type] || (Main.tileAlch[(int)Main.tile[num890, num891].type] && Main.tile[num890, num891].type != 82)) { int num892 = Dust.NewDust(new Vector2((float)(num890 * 16), (float)(num891 * 16)), 16, 16, 204, 0f, 0f, 150, default(Color), 0.3f); Main.dust[num892].fadeIn = 0.75f; Main.dust[num892].velocity *= 0.1f; Main.dust[num892].noLight = true; } } } } } } } Vector2 vector90 = Main.player[this.owner].Center - base.Center; vector90.X += (float)(40 * this.direction); vector90.Y -= 40f; float num893 = vector90.Length(); if (num893 > 1000f) { base.Center = Main.player[this.owner].Center; } float num894 = 3f; float num895 = 4f; if (num893 > 200f) { num895 += (num893 - 200f) * 0.1f; this.tileCollide = false; } if (num893 < num895) { this.velocity *= 0.25f; num895 = num893; } if (vector90.X != 0f || vector90.Y != 0f) { vector90.Normalize(); vector90 *= num895; } this.velocity = (this.velocity * (num894 - 1f) + vector90) / num894; if (this.velocity.Length() > 6f) { float num896 = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f; if ((double)Math.Abs(this.rotation - num896) >= 3.14) { if (num896 < this.rotation) { this.rotation -= 6.28f; } else { this.rotation += 6.28f; } } this.rotation = (this.rotation * 4f + num896) / 5f; this.frameCounter++; if (this.frameCounter > 4) { this.frameCounter = 0; this.frame++; if (this.frame > 7) { this.frame = 4; } } if (this.frame < 4) { this.frame = 7; return; } } else { if ((double)this.rotation > 3.14) { this.rotation -= 6.28f; } if ((double)this.rotation > -0.01 && (double)this.rotation < 0.01) { this.rotation = 0f; } else { this.rotation *= 0.9f; } this.frameCounter++; if (this.frameCounter > 6) { this.frameCounter = 0; this.frame++; if (this.frame > 3) { this.frame = 0; return; } } } } else if (this.aiStyle == 91) { Vector2 center10 = base.Center; this.scale = 1f - this.localAI[0]; this.width = (int)(20f * this.scale); this.height = this.width; this.position.X = center10.X - (float)(this.width / 2); this.position.Y = center10.Y - (float)(this.height / 2); if ((double)this.localAI[0] < 0.1) { this.localAI[0] += 0.01f; } else { this.localAI[0] += 0.025f; } if (this.localAI[0] >= 0.95f) { this.Kill(); } this.velocity.X = this.velocity.X + this.ai[0] * 1.5f; this.velocity.Y = this.velocity.Y + this.ai[1] * 1.5f; if (this.velocity.Length() > 16f) { this.velocity.Normalize(); this.velocity *= 16f; } this.ai[0] *= 1.05f; this.ai[1] *= 1.05f; if (this.scale < 1f) { int num897 = 0; while ((float)num897 < this.scale * 10f) { int num898 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 27, this.velocity.X, this.velocity.Y, 100, default(Color), 1.1f); Main.dust[num898].position = (Main.dust[num898].position + base.Center) / 2f; Main.dust[num898].noGravity = true; Main.dust[num898].velocity *= 0.1f; Main.dust[num898].velocity -= this.velocity * (1.3f - this.scale); Main.dust[num898].fadeIn = (float)(100 + this.owner); Main.dust[num898].scale += this.scale * 0.75f; num897++; } return; } } else { if (this.aiStyle == 92) { this.tileCollide = false; this.ai[1] += 1f; if (this.ai[1] > 60f) { this.ai[0] += 10f; } if (this.ai[0] > 255f) { this.Kill(); this.ai[0] = 255f; } this.alpha = (int)(100.0 + (double)this.ai[0] * 0.7); this.rotation += this.velocity.X * 0.1f; this.rotation += (float)this.direction * 0.003f; this.velocity *= 0.96f; Rectangle rectangle6 = new Rectangle((int)this.position.X, (int)this.position.Y, this.width, this.height); for (int num899 = 0; num899 < 1000; num899++) { if (num899 != this.whoAmI && Main.projectile[num899].active && Main.projectile[num899].type >= 511 && Main.projectile[num899].type <= 513) { Rectangle value54 = new Rectangle((int)Main.projectile[num899].position.X, (int)Main.projectile[num899].position.Y, Main.projectile[num899].width, Main.projectile[num899].height); if (rectangle6.Intersects(value54)) { Vector2 vector91 = Main.projectile[num899].Center - base.Center; if (vector91.X == 0f && vector91.Y == 0f) { if (num899 < this.whoAmI) { vector91.X = -1f; vector91.Y = 1f; } else { vector91.X = 1f; vector91.Y = -1f; } } vector91.Normalize(); vector91 *= 0.005f; this.velocity -= vector91; Main.projectile[num899].velocity += vector91; } } } return; } if (this.aiStyle == 93) { if (this.alpha > 0) { this.alpha -= 25; if (this.alpha <= 0) { this.alpha = 0; } } if (this.velocity.Y > 18f) { this.velocity.Y = 18f; } if (this.ai[0] == 0f) { this.ai[1] += 1f; if (this.ai[1] > 20f) { this.velocity.Y = this.velocity.Y + 0.1f; this.velocity.X = this.velocity.X * 0.992f; } this.rotation = (float)Math.Atan2((double)this.velocity.Y, (double)this.velocity.X) + 1.57f; return; } this.tileCollide = false; if (this.ai[0] == 1f) { this.tileCollide = false; this.velocity *= 0.6f; } else { this.tileCollide = false; int num900 = (int)(-(int)this.ai[0]); num900--; this.position = Main.npc[num900].Center - this.velocity; this.position.X = this.position.X - (float)(this.width / 2); this.position.Y = this.position.Y - (float)(this.height / 2); if (!Main.npc[num900].active || Main.npc[num900].life < 0) { this.tileCollide = true; this.ai[0] = 0f; this.ai[1] = 20f; this.velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); this.velocity.Normalize(); this.velocity *= 6f; this.netUpdate = true; } else if (this.velocity.Length() > (float)((Main.npc[num900].width + Main.npc[num900].height) / 3)) { this.velocity *= 0.99f; } } if (this.ai[0] != 0f) { this.ai[1] += 1f; if (this.ai[1] > 90f) { this.Kill(); return; } } } else { if (this.aiStyle == 94) { if (++this.frameCounter >= 4) { this.frameCounter = 0; if (++this.frame >= Main.projFrames[this.type]) { this.frame = 0; } } this.ai[0] += 1f; if (this.ai[0] <= 40f) { this.alpha -= 5; if (this.alpha < 0) { this.alpha = 0; } this.velocity *= 0.85f; if (this.ai[0] == 40f) { this.netUpdate = true; switch (Main.rand.Next(3)) { case 0: this.ai[1] = 10f; break; case 1: this.ai[1] = 15f; break; case 2: this.ai[1] = 30f; break; } } } else if (this.ai[0] <= 60f) { this.velocity = Vector2.Zero; if (this.ai[0] == 60f) { this.netUpdate = true; } } else if (this.ai[0] <= 210f) { if (Main.netMode != 1 && (this.localAI[0] += 1f) >= this.ai[1]) { this.localAI[0] = 0f; int num901 = Item.NewItem((int)base.Center.X, (int)base.Center.Y, 0, 0, 73, 1, false, 0, false, false); Main.item[num901].velocity = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * new Vector2(3f, 2f) * (Main.rand.NextFloat() * 0.5f + 0.5f) - Vector2.UnitY * 1f; } if (this.ai[0] == 210f) { this.netUpdate = true; } } else { this.scale -= 0.0333333351f; this.alpha += 15; if (this.ai[0] == 239f) { this.netUpdate = true; } if (this.ai[0] == 240f) { this.Kill(); } } if (this.alpha < 90 && Main.rand.Next(3) == 0) { Vector2 vector92 = new Vector2((float)this.width, (float)this.height) * this.scale * 0.85f; vector92 /= 2f; Vector2 value55 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * vector92; int num902 = Dust.NewDust(base.Center + value55, 0, 0, 246, 0f, 0f, 0, default(Color), 1f); Main.dust[num902].position = base.Center + value55; Main.dust[num902].velocity = Vector2.Zero; } float num903 = 0.8f; float num904 = 0.709803939f; float num905 = 0.282352954f; Lighting.AddLight(base.Center, num903 * 0.3f, num904 * 0.3f, num905 * 0.3f); return; } if (this.aiStyle == 95) { if (this.localAI[0] > 2f) { this.alpha -= 20; if (this.alpha < 100) { this.alpha = 100; } } else { this.localAI[0] += 1f; } if (this.ai[0] > 30f) { if (this.velocity.Y > -8f) { this.velocity.Y = this.velocity.Y - 0.05f; } this.velocity.X = this.velocity.X * 0.98f; } else { this.ai[0] += 1f; } this.rotation = this.velocity.X * 0.1f; if (this.wet) { if (this.velocity.Y > 0f) { this.velocity.Y = this.velocity.Y * 0.98f; } if (this.velocity.Y > -8f) { this.velocity.Y = this.velocity.Y - 0.2f; } this.velocity.X = this.velocity.X * 0.94f; return; } } else { if (this.aiStyle == 96) { this.ai[0] += 0.6f; if (this.ai[0] > 500f) { this.Kill(); } for (int num906 = 0; num906 < 2; num906++) { if (Main.rand.Next(3) != 0) { int num907 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 170, 0f, 0f, 100, default(Color), 1f); Main.dust[num907].position = (Main.dust[num907].position + base.Center) / 2f; Main.dust[num907].noGravity = true; Main.dust[num907].velocity *= 0.1f; if (num906 == 1) { Main.dust[num907].position += this.velocity / 2f; } float num908 = (800f - this.ai[0]) / 800f; Main.dust[num907].scale *= num908 + 0.1f; } } this.velocity.Y = this.velocity.Y + 0.008f; return; } if (this.aiStyle == 97) { this.frameCounter++; float num909 = 4f; if ((float)this.frameCounter < num909 * 1f) { this.frame = 0; } else if ((float)this.frameCounter < num909 * 2f) { this.frame = 1; } else if ((float)this.frameCounter < num909 * 3f) { this.frame = 2; } else if ((float)this.frameCounter < num909 * 4f) { this.frame = 3; } else if ((float)this.frameCounter < num909 * 5f) { this.frame = 4; } else if ((float)this.frameCounter < num909 * 6f) { this.frame = 3; } else if ((float)this.frameCounter < num909 * 7f) { this.frame = 2; } else if ((float)this.frameCounter < num909 * 8f) { this.frame = 1; } else { this.frameCounter = 0; this.frame = 0; } if (this.owner == Main.myPlayer) { for (int num910 = 0; num910 < 1000; num910++) { if (num910 != this.whoAmI && Main.projectile[num910].active && Main.projectile[num910].owner == this.owner && Main.projectile[num910].type == this.type) { if (this.timeLeft >= Main.projectile[num910].timeLeft) { Main.projectile[num910].Kill(); } else { this.Kill(); } } } } if (this.ai[0] == 0f) { if ((double)this.velocity.Length() < 0.1) { this.velocity.X = 0f; this.velocity.Y = 0f; this.ai[0] = 1f; this.ai[1] = 45f; return; } this.velocity *= 0.94f; if (this.velocity.X < 0f) { this.direction = -1; } else { this.direction = 1; } this.spriteDirection = this.direction; return; } else { if (Main.player[this.owner].Center.X < base.Center.X) { this.direction = -1; } else { this.direction = 1; } this.spriteDirection = this.direction; this.ai[1] += 1f; float num911 = 0.005f; if (this.ai[1] > 0f) { this.velocity.Y = this.velocity.Y - num911; } else { this.velocity.Y = this.velocity.Y + num911; } if (this.ai[1] >= 90f) { this.ai[1] *= -1f; return; } } } else if (this.aiStyle == 98) { Vector2 value56 = new Vector2(this.ai[0], this.ai[1]); Vector2 vector93 = value56 - base.Center; if (vector93.Length() < this.velocity.Length()) { this.Kill(); return; } vector93.Normalize(); vector93 *= 15f; this.velocity = Vector2.Lerp(this.velocity, vector93, 0.1f); for (int num912 = 0; num912 < 2; num912++) { int num913 = Dust.NewDust(base.Center, 0, 0, 228, 0f, 0f, 100, default(Color), 1f); Main.dust[num913].noGravity = true; Main.dust[num913].position += new Vector2(4f); Main.dust[num913].scale += Main.rand.NextFloat() * 1f; } return; } else { if (this.aiStyle == 99 && this.type >= 556 && this.type <= 561) { this.AI_099_1(); return; } if (this.aiStyle == 99) { this.AI_099_2(); return; } if (this.aiStyle == 100) { Player player5 = Main.player[this.owner]; Vector2 zero2 = Vector2.Zero; if (this.type == 535) { zero2.X = (float)player5.direction * 6f; zero2.Y = player5.gravDir * -14f; this.ai[0] += 1f; int num914 = 0; if (this.ai[0] >= 60f) { num914++; } if (this.ai[0] >= 180f) { num914++; } if (this.ai[0] >= 240f) { this.Kill(); return; } bool flag40 = false; if (this.ai[0] == 60f || this.ai[0] == 180f) { flag40 = true; } bool flag41 = this.ai[0] >= 180f; if (flag41) { if (this.frame < 8) { this.frame = 8; } if (this.frame >= 12) { this.frame = 8; } this.frameCounter++; if (++this.frameCounter >= 5) { this.frameCounter = 0; if (++this.frame >= 12) { this.frame = 8; } } } else if (++this.frameCounter >= 5) { this.frameCounter = 0; if (++this.frame >= 8) { this.frame = 0; } } Vector2 center11 = player5.Center; Vector2 vector94 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - center11; if (player5.gravDir == -1f) { vector94.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - center11.Y; } Vector2 velocity2 = new Vector2((float)Math.Sign((vector94.X == 0f) ? ((float)player5.direction) : vector94.X), 0f); if (velocity2.X != this.velocity.X || velocity2.Y != this.velocity.Y) { this.netUpdate = true; } this.velocity = velocity2; if (this.soundDelay <= 0 && !flag41) { this.soundDelay = 10; this.soundDelay *= 2; if (this.ai[0] != 1f) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 15); } } if (this.ai[0] == 181f) { Main.PlaySound(4, (int)this.position.X, (int)this.position.Y, 17); } if (this.ai[0] > 10f && !flag41) { Vector2 vector95 = base.Center + new Vector2((float)(player5.direction * 2), player5.gravDir * 5f); float scaleFactor10 = MathHelper.Lerp(30f, 10f, (this.ai[0] - 10f) / 180f); float num915 = Main.rand.NextFloat() * 6.28318548f; for (float num916 = 0f; num916 < 1f; num916 += 1f) { Vector2 value57 = Vector2.UnitY.RotatedBy((double)(num916 / 1f * 6.28318548f + num915), default(Vector2)); Dust dust9 = Main.dust[Dust.NewDust(vector95, 0, 0, 228, 0f, 0f, 0, default(Color), 1f)]; dust9.position = vector95 + value57 * scaleFactor10; dust9.noGravity = true; dust9.customData = player5; dust9.velocity = value57 * -2f; } } if (this.ai[0] > 180f && this.ai[0] <= 182f) { Vector2 vector96 = base.Center + new Vector2((float)(player5.direction * 2), player5.gravDir * 5f); float scaleFactor11 = MathHelper.Lerp(20f, 30f, (this.ai[0] - 180f) / 182f); Main.rand.NextFloat(); for (float num917 = 0f; num917 < 10f; num917 += 1f) { Vector2 value58 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * (Main.rand.NextFloat() * 0.5f + 0.5f); Dust dust10 = Main.dust[Dust.NewDust(vector96, 0, 0, 228, 0f, 0f, 0, default(Color), 1f)]; dust10.position = vector96 + value58 * scaleFactor11; dust10.noGravity = true; dust10.customData = player5; dust10.velocity = value58 * 4f; dust10.scale = 0.5f + Main.rand.NextFloat(); } } if (Main.myPlayer == this.owner) { bool flag42 = !flag40 || player5.CheckMana(player5.inventory[player5.selectedItem].mana, true, false); bool flag43 = player5.channel && flag42; if ((!flag41 && !flag43) || this.ai[0] == 180f) { Vector2 vector97 = player5.Center + new Vector2((float)(player5.direction * 4), player5.gravDir * 2f); int num918 = this.damage * (1 + num914); vector97 = base.Center; int num919 = 0; float num920 = 0f; for (int num921 = 0; num921 < 200; num921++) { NPC nPC9 = Main.npc[num921]; if (nPC9.active && base.Distance(nPC9.Center) < 500f && nPC9.CanBeChasedBy(this, false) && Collision.CanHitLine(nPC9.position, nPC9.width, nPC9.height, vector97, 0, 0)) { Vector2 v4 = nPC9.Center - vector97; num920 += v4.ToRotation(); num919++; int num922 = Projectile.NewProjectile(vector97.X, vector97.Y, v4.X, v4.Y, 536, 0, 0f, this.owner, (float)this.whoAmI, 0f); Main.projectile[num922].Center = nPC9.Center; Main.projectile[num922].damage = num918; Main.projectile[num922].Damage(); Main.projectile[num922].damage = 0; Main.projectile[num922].Center = vector97; this.ai[0] = 180f; } } if (num919 != 0) { num920 /= (float)num919; } else { num920 = ((player5.direction == 1) ? 0f : 3.14159274f); } for (int num923 = 0; num923 < 6; num923++) { Vector2 vector98 = Vector2.Zero; if (Main.rand.Next(4) != 0) { vector98 = Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)num920, default(Vector2)) * new Vector2(200f, 50f) * (Main.rand.NextFloat() * 0.7f + 0.3f); } else { vector98 = Vector2.UnitX.RotatedByRandom(6.2831854820251465) * new Vector2(200f, 50f) * (Main.rand.NextFloat() * 0.7f + 0.3f); } Projectile.NewProjectile(vector97.X, vector97.Y, vector98.X, vector98.Y, 536, 0, 0f, this.owner, (float)this.whoAmI, 0f); } this.ai[0] = 180f; this.netUpdate = true; } } Lighting.AddLight(base.Center, 0.9f, 0.75f, 0.1f); } this.rotation = ((player5.gravDir == 1f) ? 0f : 3.14159274f); this.spriteDirection = this.direction; this.timeLeft = 2; Vector2 vector99 = Main.OffsetsPlayerOnhand[player5.bodyFrame.Y / 56] * 2f; if (player5.direction != 1) { vector99.X = (float)player5.bodyFrame.Width - vector99.X; } vector99 -= (player5.bodyFrame.Size() - new Vector2((float)player5.width, 42f)) / 2f; base.Center = (player5.position + vector99 + zero2 - this.velocity).Floor(); player5.ChangeDir(this.direction); player5.heldProj = this.whoAmI; player5.itemTime = 2; player5.itemAnimation = 2; return; } if (this.aiStyle == 101) { float num924 = 20f; this.localAI[0] += 1f; this.alpha = (int)MathHelper.Lerp(0f, 255f, this.localAI[0] / num924); int num925 = (int)this.ai[0]; int num926 = -1; int num927 = -1; int num653 = this.type; if (num653 != 536) { if (num653 == 591) { num927 = 1; } } else { num926 = 535; num927 = 0; } if (num927 == 1) { if (this.localAI[0] >= num924 || num925 < 0 || num925 > 255 || !Main.player[num925].active || Main.player[num925].dead) { this.Kill(); return; } if (this.type == 591) { base.Center = Mount.GetMinecartMechPoint(Main.player[num925], 20, -19) - this.velocity; this.rotation = this.velocity.ToRotation() + 1.57079637f; if (Math.Sign(this.velocity.X) != Math.Sign(Main.player[num925].velocity.X) && Main.player[num925].velocity.X != 0f) { this.Kill(); return; } } else { base.Center = Main.player[num925].Center - this.velocity; } } else if (num927 == 0) { if (this.localAI[0] >= num924 || num925 < 0 || num925 > 1000 || !Main.projectile[num925].active || Main.projectile[num925].type != num926) { this.Kill(); return; } base.Center = Main.projectile[num925].Center - this.velocity; } this.rotation = this.velocity.ToRotation() + 1.57079637f; return; } if (this.aiStyle == 102) { int num928 = 0; float num929 = 0f; float x2 = 0f; float y2 = 0f; int num930 = -1; int num931 = 0; float num932 = 0f; bool flag44 = true; bool flag45 = false; bool flag46 = false; int num653 = this.type; if (num653 != 539) { switch (num653) { case 573: num928 = 424; num929 = 90f; num932 = 20f; flag44 = false; flag45 = true; break; case 574: num928 = 420; num929 = 180f; x2 = 0.15f; y2 = 0.075f; num932 = 8f; flag44 = false; num930 = 576; num931 = 65; if (Main.expertMode) { num931 = 50; } flag46 = true; break; } } else { num928 = 407; num929 = 210f; x2 = 0.15f; y2 = 0.075f; num932 = 16f; } if (flag46) { int num933 = (int)this.ai[1]; if (!Main.npc[num933].active || Main.npc[num933].type != num928) { this.Kill(); return; } this.timeLeft = 2; } this.ai[0] += 1f; if (this.ai[0] < num929) { bool flag47 = true; int num934 = (int)this.ai[1]; if (Main.npc[num934].active && Main.npc[num934].type == num928) { if (!flag45 && Main.npc[num934].oldPos[1] != Vector2.Zero) { this.position += Main.npc[num934].position - Main.npc[num934].oldPos[1]; } } else { this.ai[0] = num929; flag47 = false; } if (flag47 && !flag45) { this.velocity += new Vector2((float)Math.Sign(Main.npc[num934].Center.X - base.Center.X), (float)Math.Sign(Main.npc[num934].Center.Y - base.Center.Y)) * new Vector2(x2, y2); if (this.velocity.Length() > 6f) { this.velocity *= 6f / this.velocity.Length(); } } if (this.type == 539) { if (Main.rand.Next(12) == 0) { int num935 = Dust.NewDust(base.Center, 8, 8, 180, 0f, 0f, 0, default(Color), 1f); Main.dust[num935].position = base.Center; Main.dust[num935].velocity *= 0.2f; Main.dust[num935].noGravity = true; } if (++this.frameCounter >= 4) { this.frameCounter = 0; if (++this.frame >= Main.projFrames[this.type]) { this.frame = 0; } } this.rotation = this.velocity.X * 0.1f; } if (this.type == 573) { if (Main.rand.Next(2) == 0) { int num936 = Dust.NewDust(base.Center, 8, 8, 242, 0f, 0f, 0, default(Color), 1f); Main.dust[num936].position = base.Center; Main.dust[num936].velocity = this.velocity; Main.dust[num936].noGravity = true; Main.dust[num936].scale = 1.5f; } this.alpha = 255; } if (this.type == 574) { if (Main.rand.Next(10) == 0) { int num937 = Dust.NewDust(base.Center, 8, 8, 242, 0f, 0f, 0, default(Color), 1f); Main.dust[num937].position = base.Center; Main.dust[num937].velocity = this.velocity; Main.dust[num937].noGravity = true; Main.dust[num937].scale = 1.5f; } if (flag47) { int target = Main.npc[num934].target; float num938 = this.velocity.ToRotation(); if (Collision.CanHitLine(base.Center, 0, 0, Main.player[target].Center, 0, 0)) { num938 = base.DirectionTo(Main.player[target].Center).ToRotation(); } this.rotation = this.rotation.AngleLerp(num938 + 1.57079637f, 0.2f); } this.frame = 1; } } if (this.ai[0] == num929) { bool flag48 = true; int num939 = -1; if (!flag44) { int num940 = (int)this.ai[1]; if (Main.npc[num940].active && Main.npc[num940].type == num928) { num939 = Main.npc[num940].target; } else { flag48 = false; } } else { flag48 = false; } if (!flag48) { num939 = (int)Player.FindClosest(this.position, this.width, this.height); } Vector2 value59 = Main.player[num939].Center - base.Center; value59.X += (float)Main.rand.Next(-50, 51); value59.Y += (float)Main.rand.Next(-50, 51); value59.X *= (float)Main.rand.Next(80, 121) * 0.01f; value59.Y *= (float)Main.rand.Next(80, 121) * 0.01f; Vector2 vector100 = Vector2.Normalize(value59); if (vector100.HasNaNs()) { vector100 = Vector2.UnitY; } if (num930 == -1) { this.velocity = vector100 * num932; this.netUpdate = true; } else { if (Main.netMode != 1 && Collision.CanHitLine(base.Center, 0, 0, Main.player[num939].Center, 0, 0)) { Projectile.NewProjectile(base.Center.X, base.Center.Y, vector100.X * num932, vector100.Y * num932, num930, num931, 1f, Main.myPlayer, 0f, 0f); } this.ai[0] = 0f; } } if (this.ai[0] >= num929) { this.rotation = this.rotation.AngleLerp(this.velocity.ToRotation() + 1.57079637f, 0.4f); if (this.type == 539) { if (++this.frameCounter >= 2) { this.frameCounter = 0; if (++this.frame >= Main.projFrames[this.type]) { this.frame = 0; } } if (Main.rand.Next(2) == 0) { int num941 = Dust.NewDust(this.position, this.width, this.height, 180, 0f, 0f, 100, default(Color), 1f); Main.dust[num941].scale += (float)Main.rand.Next(50) * 0.01f; Main.dust[num941].noGravity = true; Main.dust[num941].velocity *= 0.1f; Main.dust[num941].fadeIn = Main.rand.NextFloat() * 1.5f; } if (Main.rand.Next(3) == 0) { int num942 = Dust.NewDust(this.position, this.width, this.height, 176, 0f, 0f, 100, default(Color), 1f); Main.dust[num942].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; Main.dust[num942].noGravity = true; Main.dust[num942].velocity *= 0.1f; Main.dust[num942].fadeIn = Main.rand.NextFloat() * 1.5f; } } if (this.type == 573) { if (Main.rand.Next(4) == 0) { int num943 = Dust.NewDust(base.Center, 8, 8, 242, 0f, 0f, 0, default(Color), 1f); Main.dust[num943].position = base.Center; Main.dust[num943].velocity *= 0.2f; Main.dust[num943].noGravity = true; Main.dust[num943].scale = 1.5f; } this.alpha = 0; return; } } } else if (this.aiStyle == 103) { this.scale = this.ai[1]; this.ai[0] += 1f; if (this.ai[0] >= 30f) { this.alpha += 25; if (this.alpha >= 250) { this.Kill(); return; } } else if (this.ai[0] >= 0f) { this.alpha -= 25; if (this.alpha < 0) { this.alpha = 0; if (this.localAI[1] == 0f && Main.netMode != 1 && this.localAI[0] != 0f) { this.localAI[1] = 1f; NPC.NewNPC((int)base.Center.X, (int)base.Bottom.Y, (int)this.localAI[0], 0, 0f, 0f, 0f, 0f, 255); return; } } } } else { if (this.aiStyle == 104) { if (this.ai[0] == 1f) { this.scale *= 0.995f; this.alpha += 3; if (this.alpha >= 250) { this.Kill(); } } else { this.scale *= 1.01f; this.alpha -= 7; if (this.alpha < 0) { this.alpha = 0; this.ai[0] = 1f; } } this.frameCounter++; if (this.frameCounter > 6) { this.frameCounter = 0; this.frame++; if (this.frame > 3) { this.frame = 0; } } this.velocity.Y = this.velocity.Y - 0.03f; this.velocity.X = this.velocity.X * 0.97f; return; } if (this.aiStyle == 105) { float num944 = 1f - (float)this.alpha / 255f; num944 *= this.scale; Lighting.AddLight(base.Center, 0.2f * num944, 0.275f * num944, 0.075f * num944); this.localAI[0] += 1f; if (this.localAI[0] >= 90f) { this.localAI[0] *= -1f; } if (this.localAI[0] >= 0f) { this.scale += 0.003f; } else { this.scale -= 0.003f; } this.rotation += 0.0025f * this.scale; float num945 = 1f; float num946 = 1f; if (this.identity % 6 == 0) { num946 *= -1f; } if (this.identity % 6 == 1) { num945 *= -1f; } if (this.identity % 6 == 2) { num946 *= -1f; num945 *= -1f; } if (this.identity % 6 == 3) { num946 = 0f; } if (this.identity % 6 == 4) { num945 = 0f; } this.localAI[1] += 1f; if (this.localAI[1] > 60f) { this.localAI[1] = -180f; } if (this.localAI[1] >= -60f) { this.velocity.X = this.velocity.X + 0.002f * num946; this.velocity.Y = this.velocity.Y + 0.002f * num945; } else { this.velocity.X = this.velocity.X - 0.002f * num946; this.velocity.Y = this.velocity.Y - 0.002f * num945; } this.ai[0] += 1f; if (this.ai[0] > 5400f) { this.damage = 0; this.ai[1] = 1f; if (this.alpha < 255) { this.alpha += 5; if (this.alpha > 255) { this.alpha = 255; } } else if (this.owner == Main.myPlayer) { this.Kill(); } } else { float num947 = (base.Center - Main.player[this.owner].Center).Length() / 100f; if (num947 > 4f) { num947 *= 1.1f; } if (num947 > 5f) { num947 *= 1.2f; } if (num947 > 6f) { num947 *= 1.3f; } if (num947 > 7f) { num947 *= 1.4f; } if (num947 > 8f) { num947 *= 1.5f; } if (num947 > 9f) { num947 *= 1.6f; } if (num947 > 10f) { num947 *= 1.7f; } if (!Main.player[this.owner].sporeSac) { num947 += 100f; } this.ai[0] += num947; if (this.alpha > 50) { this.alpha -= 10; if (this.alpha < 50) { this.alpha = 50; } } } bool flag49 = false; Vector2 center12 = new Vector2(0f, 0f); float num948 = 280f; for (int num949 = 0; num949 < 200; num949++) { if (Main.npc[num949].CanBeChasedBy(this, false)) { float num950 = Main.npc[num949].position.X + (float)(Main.npc[num949].width / 2); float num951 = Main.npc[num949].position.Y + (float)(Main.npc[num949].height / 2); float num952 = Math.Abs(this.position.X + (float)(this.width / 2) - num950) + Math.Abs(this.position.Y + (float)(this.height / 2) - num951); if (num952 < num948) { num948 = num952; center12 = Main.npc[num949].Center; flag49 = true; } } } if (flag49) { Vector2 vector101 = center12 - base.Center; vector101.Normalize(); vector101 *= 0.75f; this.velocity = (this.velocity * 10f + vector101) / 11f; return; } if ((double)this.velocity.Length() > 0.2) { this.velocity *= 0.98f; return; } } else if (this.aiStyle == 106) { this.rotation += this.velocity.X * 0.02f; if (this.velocity.X < 0f) { this.rotation -= Math.Abs(this.velocity.Y) * 0.02f; } else { this.rotation += Math.Abs(this.velocity.Y) * 0.02f; } this.velocity *= 0.98f; this.ai[0] += 1f; if (this.ai[0] >= 60f) { if (this.alpha < 255) { this.alpha += 5; if (this.alpha > 255) { this.alpha = 255; return; } } else if (this.owner == Main.myPlayer) { this.Kill(); return; } } else if (this.alpha > 80) { this.alpha -= 30; if (this.alpha < 80) { this.alpha = 80; return; } } } else if (this.aiStyle == 107) { float num953 = 10f; float scaleFactor12 = 5f; float num954 = 40f; if (this.type == 575) { if (this.timeLeft > 30 && this.alpha > 0) { this.alpha -= 25; } if (this.timeLeft > 30 && this.alpha < 128 && Collision.SolidCollision(this.position, this.width, this.height)) { this.alpha = 128; } if (this.alpha < 0) { this.alpha = 0; } if (++this.frameCounter > 4) { this.frameCounter = 0; if (++this.frame >= 4) { this.frame = 0; } } Lighting.AddLight(base.Center, 0.5f, 0.1f, 0.3f); } else if (this.type == 596) { num953 = 10f; scaleFactor12 = 7.5f; if (this.timeLeft > 30 && this.alpha > 0) { this.alpha -= 25; } if (this.timeLeft > 30 && this.alpha < 128 && Collision.SolidCollision(this.position, this.width, this.height)) { this.alpha = 128; } if (this.alpha < 0) { this.alpha = 0; } if (++this.frameCounter > 4) { this.frameCounter = 0; if (++this.frame >= 4) { this.frame = 0; } } float num955 = 0.5f; if (this.timeLeft < 120) { num955 = 1.1f; } if (this.timeLeft < 60) { num955 = 1.6f; } this.ai[1] += 1f; float arg_2828A_0 = this.ai[1] / 180f; for (float num956 = 0f; num956 < 3f; num956 += 1f) { if (Main.rand.Next(3) != 0) { return; } Dust dust11 = Main.dust[Dust.NewDust(base.Center, 0, 0, 27, 0f, -2f, 0, default(Color), 1f)]; dust11.position = base.Center + Vector2.UnitY.RotatedBy((double)(num956 * 6.28318548f / 3f + this.ai[1]), default(Vector2)) * 10f; dust11.noGravity = true; dust11.velocity = base.DirectionFrom(dust11.position); dust11.scale = num955; dust11.fadeIn = 0.5f; dust11.alpha = 200; } if (this.timeLeft < 4) { int num957 = 40; if (Main.expertMode) { num957 = 30; } this.position = base.Center; this.width = (this.height = 60); base.Center = this.position; this.damage = num957; for (int num958 = 0; num958 < 10; num958++) { Dust dust11 = Main.dust[Dust.NewDust(this.position, this.width, this.height, Utils.SelectRandom<int>(Main.rand, new int[] { 27, 6 }), 0f, -2f, 0, default(Color), 1f)]; dust11.noGravity = true; if (dust11.position != base.Center) { dust11.velocity = base.DirectionTo(dust11.position) * 3f; } } } } int num959 = (int)this.ai[0]; if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) { if (base.Distance(Main.player[num959].Center) > num954) { Vector2 vector102 = base.DirectionTo(Main.player[num959].Center); if (vector102.HasNaNs()) { vector102 = Vector2.UnitY; } this.velocity = (this.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; return; } } else { if (this.timeLeft > 30) { this.timeLeft = 30; } if (this.ai[0] != -1f) { this.ai[0] = -1f; this.netUpdate = true; return; } } } else if (this.aiStyle == 108) { if (this.type == 578 && this.localAI[0] == 0f) { this.localAI[0] = 1f; int num960 = (int)Player.FindClosest(base.Center, 0, 0); Vector2 vector103 = Main.player[num960].Center - base.Center; if (vector103 == Vector2.Zero) { vector103 = Vector2.UnitY; } this.ai[1] = vector103.ToRotation(); this.netUpdate = true; } this.ai[0] += 1f; if (this.ai[0] <= 50f) { if (this.type == 579) { if (Main.rand.Next(4) == 0) { Vector2 vector104 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); Dust dust12 = Main.dust[Dust.NewDust(base.Center - vector104 * 30f, 0, 0, 229, 0f, 0f, 0, default(Color), 1f)]; dust12.noGravity = true; dust12.position = base.Center - vector104 * (float)Main.rand.Next(10, 21); dust12.velocity = vector104.RotatedBy(1.5707963705062866, default(Vector2)) * 4f; dust12.scale = 0.5f + Main.rand.NextFloat(); dust12.fadeIn = 0.5f; } if (Main.rand.Next(4) == 0) { Vector2 vector105 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); Dust dust13 = Main.dust[Dust.NewDust(base.Center - vector105 * 30f, 0, 0, 240, 0f, 0f, 0, default(Color), 1f)]; dust13.noGravity = true; dust13.position = base.Center - vector105 * 30f; dust13.velocity = vector105.RotatedBy(-1.5707963705062866, default(Vector2)) * 2f; dust13.scale = 0.5f + Main.rand.NextFloat(); dust13.fadeIn = 0.5f; } } if (this.type == 578 && Main.rand.Next(2) == 0) { Vector2 vector106 = this.ai[1].ToRotationVector2(); Vector2 vector107 = vector106.RotatedBy(1.5707963705062866, default(Vector2)) * (float)(Main.rand.Next(2) == 0).ToDirectionInt() * (float)Main.rand.Next(10, 21); Vector2 value60 = vector106 * (float)Main.rand.Next(-80, 81); Vector2 vector108 = value60 - vector107; vector108 /= 10f; int num961 = 229; Dust dust14 = Main.dust[Dust.NewDust(base.Center, 0, 0, num961, 0f, 0f, 0, default(Color), 1f)]; dust14.noGravity = true; dust14.position = base.Center + vector107; dust14.velocity = vector108; dust14.scale = 0.5f + Main.rand.NextFloat(); dust14.fadeIn = 0.5f; value60 = vector106 * (float)Main.rand.Next(40, 121); vector108 = value60 - vector107 / 2f; vector108 /= 10f; dust14 = Main.dust[Dust.NewDust(base.Center, 0, 0, num961, 0f, 0f, 0, default(Color), 1f)]; dust14.noGravity = true; dust14.position = base.Center + vector107 / 2f; dust14.velocity = vector108; dust14.scale = 1f + Main.rand.NextFloat(); return; } } else if (this.ai[0] <= 90f) { this.scale = (this.ai[0] - 50f) / 40f; this.alpha = 255 - (int)(255f * this.scale); this.rotation -= 0.157079637f; if (this.type == 579) { if (Main.rand.Next(2) == 0) { Vector2 vector109 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); Dust dust15 = Main.dust[Dust.NewDust(base.Center - vector109 * 30f, 0, 0, 229, 0f, 0f, 0, default(Color), 1f)]; dust15.noGravity = true; dust15.position = base.Center - vector109 * (float)Main.rand.Next(10, 21); dust15.velocity = vector109.RotatedBy(1.5707963705062866, default(Vector2)) * 6f; dust15.scale = 0.5f + Main.rand.NextFloat(); dust15.fadeIn = 0.5f; dust15.customData = base.Center; } if (Main.rand.Next(2) == 0) { Vector2 vector110 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); Dust dust16 = Main.dust[Dust.NewDust(base.Center - vector110 * 30f, 0, 0, 240, 0f, 0f, 0, default(Color), 1f)]; dust16.noGravity = true; dust16.position = base.Center - vector110 * 30f; dust16.velocity = vector110.RotatedBy(-1.5707963705062866, default(Vector2)) * 3f; dust16.scale = 0.5f + Main.rand.NextFloat(); dust16.fadeIn = 0.5f; dust16.customData = base.Center; } } if (this.type == 578) { Vector2 vector111 = this.ai[1].ToRotationVector2(); Vector2 value61 = vector111.RotatedBy(1.5707963705062866, default(Vector2)) * (float)(Main.rand.Next(2) == 0).ToDirectionInt() * (float)Main.rand.Next(10, 21); vector111 *= (float)Main.rand.Next(-80, 81); Vector2 vector112 = vector111 - value61; vector112 /= 10f; int num962 = Utils.SelectRandom<int>(Main.rand, new int[] { 229, 229 }); Dust dust17 = Main.dust[Dust.NewDust(base.Center, 0, 0, num962, 0f, 0f, 0, default(Color), 1f)]; dust17.noGravity = true; dust17.position = base.Center + value61; dust17.velocity = vector112; dust17.scale = 0.5f + Main.rand.NextFloat(); dust17.fadeIn = 0.5f; if (this.ai[0] == 90f && Main.netMode != 1) { Vector2 vector113 = this.ai[1].ToRotationVector2() * 8f; float ai2 = (float)Main.rand.Next(80); Projectile.NewProjectile(base.Center.X - vector113.X, base.Center.Y - vector113.Y, vector113.X, vector113.Y, 580, 15, 1f, Main.myPlayer, this.ai[1], ai2); return; } } else if (this.type == 579 && this.ai[0] == 90f && Main.netMode != 1) { for (int num963 = 0; num963 < 2; num963++) { int num964 = NPC.NewNPC((int)base.Center.X, (int)base.Center.Y, 427, this.whoAmI, 0f, 0f, 0f, 0f, 255); Main.npc[num964].velocity = -Vector2.UnitY.RotatedByRandom(6.2831854820251465) * (float)Main.rand.Next(4, 9) - Vector2.UnitY * 2f; Main.npc[num964].netUpdate = true; } return; } } else { if (this.ai[0] > 120f) { this.scale = 1f - (this.ai[0] - 120f) / 60f; this.alpha = 255 - (int)(255f * this.scale); this.rotation -= 0.104719758f; if (this.alpha >= 255) { this.Kill(); } for (int num965 = 0; num965 < 2; num965++) { int num966 = Main.rand.Next(3); if (num966 == 0) { Vector2 vector114 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * this.scale; Dust dust18 = Main.dust[Dust.NewDust(base.Center - vector114 * 30f, 0, 0, 229, 0f, 0f, 0, default(Color), 1f)]; dust18.noGravity = true; dust18.position = base.Center - vector114 * (float)Main.rand.Next(10, 21); dust18.velocity = vector114.RotatedBy(1.5707963705062866, default(Vector2)) * 6f; dust18.scale = 0.5f + Main.rand.NextFloat(); dust18.fadeIn = 0.5f; dust18.customData = base.Center; } else if (num966 == 1) { Vector2 vector115 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * this.scale; Dust dust19 = Main.dust[Dust.NewDust(base.Center - vector115 * 30f, 0, 0, 240, 0f, 0f, 0, default(Color), 1f)]; dust19.noGravity = true; dust19.position = base.Center - vector115 * 30f; dust19.velocity = vector115.RotatedBy(-1.5707963705062866, default(Vector2)) * 3f; dust19.scale = 0.5f + Main.rand.NextFloat(); dust19.fadeIn = 0.5f; dust19.customData = base.Center; } } return; } this.scale = 1f; this.alpha = 0; this.rotation -= 0.05235988f; if (Main.rand.Next(2) == 0) { Vector2 vector116 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); Dust dust20 = Main.dust[Dust.NewDust(base.Center - vector116 * 30f, 0, 0, 229, 0f, 0f, 0, default(Color), 1f)]; dust20.noGravity = true; dust20.position = base.Center - vector116 * (float)Main.rand.Next(10, 21); dust20.velocity = vector116.RotatedBy(1.5707963705062866, default(Vector2)) * 6f; dust20.scale = 0.5f + Main.rand.NextFloat(); dust20.fadeIn = 0.5f; dust20.customData = base.Center; return; } Vector2 vector117 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); Dust dust21 = Main.dust[Dust.NewDust(base.Center - vector117 * 30f, 0, 0, 240, 0f, 0f, 0, default(Color), 1f)]; dust21.noGravity = true; dust21.position = base.Center - vector117 * 30f; dust21.velocity = vector117.RotatedBy(-1.5707963705062866, default(Vector2)) * 3f; dust21.scale = 0.5f + Main.rand.NextFloat(); dust21.fadeIn = 0.5f; dust21.customData = base.Center; return; } } else { if (this.aiStyle == 109) { if (this.localAI[1] == 0f) { this.localAI[1] = this.velocity.Length(); } if (this.ai[0] == 0f) { this.localAI[0] += 1f; if (this.localAI[0] > 30f) { this.ai[0] = 1f; this.localAI[0] = 0f; return; } } else if (this.ai[0] == 1f) { Vector2 value62 = Vector2.Zero; if (this.type != 582 || !Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].type != 124) { this.Kill(); return; } value62 = Main.npc[(int)this.ai[1]].Center; this.tileCollide = false; float num967 = this.localAI[1]; Vector2 vector118 = value62 - base.Center; if (vector118.Length() < num967) { this.Kill(); return; } vector118.Normalize(); vector118 *= num967; this.velocity = Vector2.Lerp(this.velocity, vector118, 0.04f); } this.rotation += 0.314159274f; return; } if (this.aiStyle == 110) { if (this.localAI[1] == 0f) { this.localAI[1] = this.velocity.Length(); } Vector2 value63 = Vector2.Zero; if (!Main.npc[(int)this.ai[0]].active || !Main.npc[(int)this.ai[0]].townNPC) { this.Kill(); return; } value63 = Main.npc[(int)this.ai[0]].Center; float num968 = this.localAI[1]; Vector2 vector119 = value63 - base.Center; if (vector119.Length() < num968 || base.Hitbox.Intersects(Main.npc[(int)this.ai[0]].Hitbox)) { this.Kill(); int num969 = Main.npc[(int)this.ai[0]].lifeMax - Main.npc[(int)this.ai[0]].life; if (num969 > 20) { num969 = 20; } if (num969 > 0) { Main.npc[(int)this.ai[0]].life += num969; Main.npc[(int)this.ai[0]].HealEffect(num969, true); } return; } vector119.Normalize(); vector119 *= num968; if (vector119.Y < this.velocity.Y) { vector119.Y = this.velocity.Y; } vector119.Y += 1f; this.velocity = Vector2.Lerp(this.velocity, vector119, 0.04f); this.rotation += this.velocity.X * 0.05f; return; } else if (this.aiStyle == 111) { if (!Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].type != 20 || Main.npc[(int)this.ai[1]].ai[0] != 14f) { this.Kill(); return; } this.ai[0] += 1f; this.rotation += 0.0104719754f; this.scale = this.ai[0] / 100f; if (this.scale > 1f) { this.scale = 1f; } this.alpha = (int)(255f * (1f - this.scale)); float num970 = 300f; if (this.ai[0] >= 100f) { num970 = MathHelper.Lerp(300f, 600f, (this.ai[0] - 100f) / 200f); } if (num970 > 600f) { num970 = 600f; } if (this.ai[0] >= 500f) { this.alpha = (int)MathHelper.Lerp(0f, 255f, (this.ai[0] - 500f) / 100f); num970 = MathHelper.Lerp(600f, 1200f, (this.ai[0] - 500f) / 100f); this.rotation += 0.0104719754f; } if (Main.rand.Next(4) == 0) { float scaleFactor13 = num970; Vector2 value64 = new Vector2((float)Main.rand.Next(-10, 11), (float)Main.rand.Next(-10, 11)); float num971 = (float)Main.rand.Next(3, 9); value64.Normalize(); int num972 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 163, 0f, 0f, 100, default(Color), 1f); Main.dust[num972].noGravity = true; Main.dust[num972].position = base.Center + value64 * scaleFactor13; if (Main.rand.Next(8) == 0) { Main.dust[num972].velocity = value64 * -num971 * 3f; Main.dust[num972].scale += 0.5f; } else { Main.dust[num972].velocity = value64 * -num971; } } if (Main.rand.Next(2) == 0) { Vector2 value65 = new Vector2((float)Main.rand.Next(-10, 11), (float)Main.rand.Next(-10, 11)); float num973 = (float)Main.rand.Next(3, 9); value65.Normalize(); int num974 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 163, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num974].noGravity = true; Main.dust[num974].position = base.Center + value65 * 30f; if (Main.rand.Next(8) == 0) { Main.dust[num974].velocity = value65 * -num973 * 3f; Main.dust[num974].scale += 0.5f; } else { Main.dust[num974].velocity = value65 * -num973; } } if (this.ai[0] >= 30f && Main.netMode != 2) { Player player6 = Main.player[Main.myPlayer]; if (player6.active && !player6.dead && base.Distance(player6.Center) <= num970 && player6.HasBuff(165) == -1) { player6.AddBuff(165, 120, true); } } if (this.ai[0] >= 30f && this.ai[0] % 10f == 0f && Main.netMode != 1) { for (int num975 = 0; num975 < 200; num975++) { NPC nPC10 = Main.npc[num975]; if (nPC10.type != 488 && nPC10.active && base.Distance(nPC10.Center) <= num970) { if (nPC10.townNPC && (nPC10.HasBuff(165) == -1 || nPC10.buffTime[nPC10.HasBuff(165)] <= 20)) { nPC10.AddBuff(165, 120, false); } else if (!nPC10.friendly && nPC10.lifeMax > 5 && !nPC10.dontTakeDamage && (nPC10.HasBuff(186) == -1 || nPC10.buffTime[nPC10.HasBuff(186)] <= 20) && (nPC10.dryadBane || Collision.CanHit(base.Center, 1, 1, nPC10.position, nPC10.width, nPC10.height))) { nPC10.AddBuff(186, 120, false); } } } } if (this.ai[0] >= 570f) { this.Kill(); return; } } else if (this.aiStyle == 112) { if (this.type == 590) { if (++this.frameCounter >= 4) { this.frameCounter = 0; if (++this.frame >= 3) { this.frame = 0; } } if (this.alpha > 0) { this.alpha -= 15; } if (this.alpha < 0) { this.alpha = 0; } if (this.alpha == 0) { float num976 = (float)Main.rand.Next(28, 42) * 0.005f; num976 += (float)(270 - (int)Main.mouseTextColor) / 500f; float num977 = 0.1f; float num978 = 0.3f + num976 / 2f; float num979 = 0.6f + num976; float num980 = 0.35f; num977 *= num980; num978 *= num980; num979 *= num980; Lighting.AddLight(base.Center, num977, num978, num979); } this.velocity = new Vector2(0f, (float)Math.Sin((double)(6.28318548f * this.ai[0] / 180f)) * 0.15f); this.ai[0] += 1f; if (this.ai[0] >= 180f) { this.ai[0] = 0f; } } if (this.type == 644) { Color newColor2 = Main.hslToRgb(this.ai[0], 1f, 0.5f); int num981 = (int)this.ai[1]; if (num981 < 0 || num981 >= 1000 || (!Main.projectile[num981].active && Main.projectile[num981].type != 643)) { this.ai[1] = -1f; } else { DelegateMethods.v3_1 = newColor2.ToVector3() * 0.5f; Utils.PlotTileLine(base.Center, Main.projectile[num981].Center, 8f, new Utils.PerLinePoint(DelegateMethods.CastLight)); } if (this.localAI[0] == 0f) { this.localAI[0] = Main.rand.NextFloat() * 0.8f + 0.8f; this.direction = ((Main.rand.Next(2) > 0) ? 1 : -1); } this.rotation = this.localAI[1] / 40f * 6.28318548f * (float)this.direction; if (this.alpha > 0) { this.alpha -= 8; } if (this.alpha < 0) { this.alpha = 0; } if (this.alpha == 0) { Lighting.AddLight(base.Center, newColor2.ToVector3() * 0.5f); } for (int num982 = 0; num982 < 2; num982++) { if (Main.rand.Next(10) == 0) { Vector2 value66 = Vector2.UnitY.RotatedBy((double)((float)num982 * 3.14159274f), default(Vector2)).RotatedBy((double)this.rotation, default(Vector2)); Dust dust22 = Main.dust[Dust.NewDust(base.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; dust22.noGravity = true; dust22.noLight = true; dust22.scale = this.Opacity * this.localAI[0]; dust22.position = base.Center; dust22.velocity = value66 * 2.5f; } } for (int num983 = 0; num983 < 2; num983++) { if (Main.rand.Next(10) == 0) { Vector2 value67 = Vector2.UnitY.RotatedBy((double)((float)num983 * 3.14159274f), default(Vector2)); Dust dust23 = Main.dust[Dust.NewDust(base.Center, 0, 0, 267, 0f, 0f, 225, newColor2, 1.5f)]; dust23.noGravity = true; dust23.noLight = true; dust23.scale = this.Opacity * this.localAI[0]; dust23.position = base.Center; dust23.velocity = value67 * 2.5f; } } if (Main.rand.Next(10) == 0) { float scaleFactor14 = 1f + Main.rand.NextFloat() * 2f; float fadeIn = 1f + Main.rand.NextFloat(); float num984 = 1f + Main.rand.NextFloat(); Vector2 vector120 = Utils.RandomVector2(Main.rand, -1f, 1f); if (vector120 != Vector2.Zero) { vector120.Normalize(); } vector120 *= 20f + Main.rand.NextFloat() * 100f; Vector2 vector121 = base.Center + vector120; Point point3 = vector121.ToTileCoordinates(); bool flag50 = true; if (!WorldGen.InWorld(point3.X, point3.Y, 0)) { flag50 = false; } if (flag50 && WorldGen.SolidTile(point3.X, point3.Y)) { flag50 = false; } if (flag50) { Dust dust24 = Main.dust[Dust.NewDust(vector121, 0, 0, 267, 0f, 0f, 127, newColor2, 1f)]; dust24.noGravity = true; dust24.position = vector121; dust24.velocity = -Vector2.UnitY * scaleFactor14 * (Main.rand.NextFloat() * 0.9f + 1.6f); dust24.fadeIn = fadeIn; dust24.scale = num984; dust24.noLight = true; Dust dust25 = Dust.CloneDust(dust24); dust25.scale *= 0.65f; dust25.fadeIn *= 0.65f; dust25.color = new Color(255, 255, 255, 255); } } this.scale = this.Opacity / 2f * this.localAI[0]; this.velocity = Vector2.Zero; this.localAI[1] += 1f; if (this.localAI[1] >= 60f) { this.Kill(); return; } } } else if (this.aiStyle == 113) { int num985 = 25; if (this.type == 614) { num985 = 63; } if (this.alpha > 0) { this.alpha -= num985; } if (this.alpha < 0) { this.alpha = 0; } if (this.ai[0] == 0f) { bool flag51 = this.type == 614; if (flag51) { int num986 = (int)this.ai[1]; if (!Main.npc[num986].active) { this.Kill(); return; } this.velocity.ToRotation(); Vector2 vector122 = Main.npc[num986].Center - base.Center; if (vector122 != Vector2.Zero) { vector122.Normalize(); vector122 *= 14f; } float num987 = 5f; this.velocity = (this.velocity * (num987 - 1f) + vector122) / num987; } else { this.ai[1] += 1f; if (this.ai[1] >= 45f) { float num988 = 0.98f; float num989 = 0.35f; if (this.type == 636) { num988 = 0.995f; num989 = 0.15f; } this.ai[1] = 45f; this.velocity.X = this.velocity.X * num988; this.velocity.Y = this.velocity.Y + num989; } this.rotation = this.velocity.ToRotation() + 1.57079637f; } } if (this.ai[0] == 1f) { this.ignoreWater = true; this.tileCollide = false; int num990 = 15; if (this.type == 636) { num990 = 5 * this.MaxUpdates; } bool flag52 = false; bool flag53 = false; this.localAI[0] += 1f; if (this.localAI[0] % 30f == 0f) { flag53 = true; } int num991 = (int)this.ai[1]; if (this.localAI[0] >= (float)(60 * num990)) { flag52 = true; } else if (num991 < 0 || num991 >= 200) { flag52 = true; } else if (Main.npc[num991].active && !Main.npc[num991].dontTakeDamage) { base.Center = Main.npc[num991].Center - this.velocity * 2f; this.gfxOffY = Main.npc[num991].gfxOffY; if (flag53) { Main.npc[num991].HitEffect(0, 1.0); } } else { flag52 = true; } if (flag52) { this.Kill(); } } if (this.type == 614) { Lighting.AddLight(base.Center, 0.2f, 0.6f, 0.7f); } if (this.type == 636) { Lighting.AddLight(base.Center, 0.8f, 0.7f, 0.4f); return; } } else if (this.aiStyle == 114) { if (Main.netMode == 2 && this.localAI[0] == 0f) { PortalHelper.SyncPortalSections(base.Center, 1); this.localAI[0] = 1f; } this.timeLeft = 3; bool flag54 = false; if (!Main.player[this.owner].active || Main.player[this.owner].dead || base.Distance(Main.player[this.owner].Center) > 12800f) { flag54 = true; } if (!flag54 && !WorldGen.InWorld((int)base.Center.X / 16, (int)base.Center.Y / 16, Lighting.offScreenTiles)) { flag54 = true; } if (!flag54 && !PortalHelper.SupportedTilesAreFine(base.Center, this.ai[0])) { flag54 = true; } if (flag54) { this.Kill(); return; } Color portalColor = PortalHelper.GetPortalColor(this.owner, (int)this.ai[1]); this.alpha -= 25; if (this.alpha < 0) { this.alpha = 0; } if (this.alpha == 0) { Lighting.AddLight(base.Center + this.velocity * 3f, portalColor.ToVector3() * 0.5f); } if (++this.frameCounter >= 6) { this.frameCounter = 0; if (++this.frame >= Main.projFrames[this.type]) { this.frame = 0; } } this.rotation = this.ai[0] - 1.57079637f; return; } else if (this.aiStyle == 115) { Lighting.AddLight(base.Center, new Vector3(0.075f, 0.3f, 0.15f)); this.velocity *= 0.985f; this.rotation += this.velocity.X * 0.2f; if (this.velocity.X > 0f) { this.rotation += 0.08f; } else { this.rotation -= 0.08f; } this.ai[1] += 1f; if (this.ai[1] > 30f) { this.alpha += 10; if (this.alpha >= 255) { this.alpha = 255; this.Kill(); return; } } } else { if (this.aiStyle == 116) { if (this.localAI[0] == 0f) { this.rotation = this.ai[1]; this.localAI[0] = 1f; } Player player7 = Main.player[this.owner]; if (player7.setSolar) { this.timeLeft = 2; } float num992 = (float)player7.miscCounter / 300f * 12.566371f + this.ai[1]; num992 = MathHelper.WrapAngle(num992); this.rotation = this.rotation.AngleLerp(num992, 0.05f); this.alpha -= 15; if (this.alpha < 0) { this.alpha = 0; } this.velocity = this.rotation.ToRotationVector2() * 100f - player7.velocity; base.Center = player7.Center - this.velocity; return; } if (this.aiStyle == 117) { this.ai[1] += 0.01f; this.scale = this.ai[1]; this.ai[0] += 1f; if (this.ai[0] >= (float)(3 * Main.projFrames[this.type])) { this.Kill(); return; } if (++this.frameCounter >= 3) { this.frameCounter = 0; if (++this.frame >= Main.projFrames[this.type]) { this.hide = true; } } this.alpha -= 63; if (this.alpha < 0) { this.alpha = 0; } bool flag55 = this.type == 612; bool flag56 = this.type == 624; if (flag55) { Lighting.AddLight(base.Center, 0.9f, 0.8f, 0.6f); } if (this.ai[0] == 1f) { this.position = base.Center; this.width = (this.height = (int)(52f * this.scale)); base.Center = this.position; this.Damage(); if (flag55) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); for (int num993 = 0; num993 < 4; num993++) { int num994 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num994].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)this.width / 2f; } for (int num995 = 0; num995 < 10; num995++) { int num996 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 200, default(Color), 2.7f); Main.dust[num996].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)this.width / 2f; Main.dust[num996].noGravity = true; Main.dust[num996].velocity *= 3f; num996 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num996].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)this.width / 2f; Main.dust[num996].velocity *= 2f; Main.dust[num996].noGravity = true; Main.dust[num996].fadeIn = 2.5f; } for (int num997 = 0; num997 < 5; num997++) { int num998 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 0, default(Color), 2.7f); Main.dust[num998].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)this.velocity.ToRotation(), default(Vector2)) * (float)this.width / 2f; Main.dust[num998].noGravity = true; Main.dust[num998].velocity *= 3f; } for (int num999 = 0; num999 < 10; num999++) { int num1000 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 31, 0f, 0f, 0, default(Color), 1.5f); Main.dust[num1000].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)this.velocity.ToRotation(), default(Vector2)) * (float)this.width / 2f; Main.dust[num1000].noGravity = true; Main.dust[num1000].velocity *= 3f; } } if (flag56) { Main.PlaySound(2, (int)this.position.X, (int)this.position.Y, 14); for (int num1001 = 0; num1001 < 20; num1001++) { int num1002 = Dust.NewDust(this.position, this.width, this.height, 135, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num1002].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)this.width / 2f; Main.dust[num1002].velocity *= 2f; Main.dust[num1002].noGravity = true; Main.dust[num1002].fadeIn = 2.5f; Main.dust[num1002].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]); } for (int num1003 = 0; num1003 < 15; num1003++) { int num1004 = Dust.NewDust(this.position, this.width, this.height, 135, 0f, 0f, 0, default(Color), 2.7f); Main.dust[num1004].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)this.velocity.ToRotation(), default(Vector2)) * (float)this.width / 2f; Main.dust[num1004].noGravity = true; Main.dust[num1004].velocity *= 3f; Main.dust[num1004].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]); } float num1005 = (float)Main.rand.NextDouble() * 6.28318548f; float num1006 = (float)Main.rand.NextDouble() * 6.28318548f; float num1007 = (float)Main.rand.NextDouble() * 6.28318548f; float num1008 = 7f + (float)Main.rand.NextDouble() * 7f; float num1009 = 7f + (float)Main.rand.NextDouble() * 7f; float num1010 = 7f + (float)Main.rand.NextDouble() * 7f; float num1011 = num1008; if (num1009 > num1011) { num1011 = num1009; } if (num1010 > num1011) { num1011 = num1010; } for (int num1012 = 0; num1012 < 200; num1012++) { int num1013 = 135; float scaleFactor15 = num1011; if (num1012 > 50) { scaleFactor15 = num1009; } if (num1012 > 100) { scaleFactor15 = num1008; } if (num1012 > 150) { scaleFactor15 = num1010; } int num1014 = Dust.NewDust(this.position, 6, 6, num1013, 0f, 0f, 100, default(Color), 1f); Vector2 vector123 = Main.dust[num1014].velocity; Main.dust[num1014].position = base.Center; vector123.Normalize(); vector123 *= scaleFactor15; if (num1012 > 150) { vector123.Y *= 0.5f; vector123 = vector123.RotatedBy((double)num1007, default(Vector2)); } else if (num1012 > 100) { vector123.X *= 0.5f; vector123 = vector123.RotatedBy((double)num1005, default(Vector2)); } else if (num1012 > 50) { vector123.Y *= 0.5f; vector123 = vector123.RotatedBy((double)num1006, default(Vector2)); } Main.dust[num1014].velocity *= 0.2f; Main.dust[num1014].velocity += vector123; Main.dust[num1014].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]); if (num1012 <= 200) { Main.dust[num1014].scale = 2f; Main.dust[num1014].noGravity = true; Main.dust[num1014].fadeIn = Main.rand.NextFloat() * 2f; if (Main.rand.Next(4) == 0) { Main.dust[num1014].fadeIn = 2.5f; } Main.dust[num1014].noLight = true; if (num1012 < 100) { Main.dust[num1014].position += Main.dust[num1014].velocity * 20f; Main.dust[num1014].velocity *= -1f; } } } return; } } } else if (this.aiStyle == 118) { this.ai[0] += 1f; int num1015 = 0; if (this.velocity.Length() <= 4f) { num1015 = 1; } this.alpha -= 15; if (this.alpha < 0) { this.alpha = 0; } if (num1015 == 0) { this.rotation -= 0.104719758f; if (Main.rand.Next(3) == 0) { if (Main.rand.Next(2) == 0) { Vector2 vector124 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); Dust dust26 = Main.dust[Dust.NewDust(base.Center - vector124 * 30f, 0, 0, Utils.SelectRandom<int>(Main.rand, new int[] { 86, 90 }), 0f, 0f, 0, default(Color), 1f)]; dust26.noGravity = true; dust26.position = base.Center - vector124 * (float)Main.rand.Next(10, 21); dust26.velocity = vector124.RotatedBy(1.5707963705062866, default(Vector2)) * 6f; dust26.scale = 0.5f + Main.rand.NextFloat(); dust26.fadeIn = 0.5f; dust26.customData = this; } else { Vector2 vector125 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); Dust dust27 = Main.dust[Dust.NewDust(base.Center - vector125 * 30f, 0, 0, 240, 0f, 0f, 0, default(Color), 1f)]; dust27.noGravity = true; dust27.position = base.Center - vector125 * 30f; dust27.velocity = vector125.RotatedBy(-1.5707963705062866, default(Vector2)) * 3f; dust27.scale = 0.5f + Main.rand.NextFloat(); dust27.fadeIn = 0.5f; dust27.customData = this; } } if (this.ai[0] >= 30f) { this.velocity *= 0.98f; this.scale += 0.00744680827f; if (this.scale > 1.3f) { this.scale = 1.3f; } this.rotation -= 0.0174532924f; } if (this.velocity.Length() < 4.1f) { this.velocity.Normalize(); this.velocity *= 4f; this.ai[0] = 0f; } } else if (num1015 == 1) { this.rotation -= 0.104719758f; for (int num1016 = 0; num1016 < 1; num1016++) { if (Main.rand.Next(2) == 0) { Vector2 vector126 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); Dust dust28 = Main.dust[Dust.NewDust(base.Center - vector126 * 30f, 0, 0, 86, 0f, 0f, 0, default(Color), 1f)]; dust28.noGravity = true; dust28.position = base.Center - vector126 * (float)Main.rand.Next(10, 21); dust28.velocity = vector126.RotatedBy(1.5707963705062866, default(Vector2)) * 6f; dust28.scale = 0.9f + Main.rand.NextFloat(); dust28.fadeIn = 0.5f; dust28.customData = this; vector126 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); dust28 = Main.dust[Dust.NewDust(base.Center - vector126 * 30f, 0, 0, 90, 0f, 0f, 0, default(Color), 1f)]; dust28.noGravity = true; dust28.position = base.Center - vector126 * (float)Main.rand.Next(10, 21); dust28.velocity = vector126.RotatedBy(1.5707963705062866, default(Vector2)) * 6f; dust28.scale = 0.9f + Main.rand.NextFloat(); dust28.fadeIn = 0.5f; dust28.customData = this; dust28.color = Color.Crimson; } else { Vector2 vector127 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); Dust dust29 = Main.dust[Dust.NewDust(base.Center - vector127 * 30f, 0, 0, 240, 0f, 0f, 0, default(Color), 1f)]; dust29.noGravity = true; dust29.position = base.Center - vector127 * (float)Main.rand.Next(20, 31); dust29.velocity = vector127.RotatedBy(-1.5707963705062866, default(Vector2)) * 5f; dust29.scale = 0.9f + Main.rand.NextFloat(); dust29.fadeIn = 0.5f; dust29.customData = this; } } if (this.ai[0] % 30f == 0f && this.ai[0] < 241f && Main.myPlayer == this.owner) { Vector2 vector128 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * 12f; Projectile.NewProjectile(base.Center.X, base.Center.Y, vector128.X, vector128.Y, 618, this.damage / 2, 0f, this.owner, 0f, (float)this.whoAmI); } Vector2 vector129 = base.Center; float num1017 = 800f; bool flag57 = false; int num1018 = 0; if (this.ai[1] == 0f) { for (int num1019 = 0; num1019 < 200; num1019++) { if (Main.npc[num1019].CanBeChasedBy(this, false)) { Vector2 center13 = Main.npc[num1019].Center; if (base.Distance(center13) < num1017 && Collision.CanHit(new Vector2(this.position.X + (float)(this.width / 2), this.position.Y + (float)(this.height / 2)), 1, 1, Main.npc[num1019].position, Main.npc[num1019].width, Main.npc[num1019].height)) { num1017 = base.Distance(center13); vector129 = center13; flag57 = true; num1018 = num1019; } } } if (flag57) { if (this.ai[1] != (float)(num1018 + 1)) { this.netUpdate = true; } this.ai[1] = (float)(num1018 + 1); } flag57 = false; } if (this.ai[1] != 0f) { int num1020 = (int)(this.ai[1] - 1f); if (Main.npc[num1020].active && Main.npc[num1020].CanBeChasedBy(this, true) && base.Distance(Main.npc[num1020].Center) < 1000f) { flag57 = true; vector129 = Main.npc[num1020].Center; } } if (!this.friendly) { flag57 = false; } if (flag57) { float num1021 = 4f; int num1022 = 8; Vector2 vector130 = new Vector2(this.position.X + (float)this.width * 0.5f, this.position.Y + (float)this.height * 0.5f); float num1023 = vector129.X - vector130.X; float num1024 = vector129.Y - vector130.Y; float num1025 = (float)Math.Sqrt((double)(num1023 * num1023 + num1024 * num1024)); num1025 = num1021 / num1025; num1023 *= num1025; num1024 *= num1025; this.velocity.X = (this.velocity.X * (float)(num1022 - 1) + num1023) / (float)num1022; this.velocity.Y = (this.velocity.Y * (float)(num1022 - 1) + num1024) / (float)num1022; } } if (this.alpha < 150) { Lighting.AddLight(base.Center, 0.7f, 0.2f, 0.6f); } if (this.ai[0] >= 600f) { this.Kill(); return; } } else if (this.aiStyle == 119) { int num1026 = 0; float num1027 = 0f; float x3 = 0f; float y3 = 0f; bool flag58 = false; bool flag59 = false; int num653 = this.type; if (num653 == 618) { num1026 = 617; num1027 = 420f; x3 = 0.15f; y3 = 0.15f; } if (flag59) { int num1028 = (int)this.ai[1]; if (!Main.projectile[num1028].active || Main.projectile[num1028].type != num1026) { this.Kill(); return; } this.timeLeft = 2; } this.ai[0] += 1f; if (this.ai[0] < num1027) { bool flag60 = true; int num1029 = (int)this.ai[1]; if (Main.projectile[num1029].active && Main.projectile[num1029].type == num1026) { if (!flag58 && Main.projectile[num1029].oldPos[1] != Vector2.Zero) { this.position += Main.projectile[num1029].position - Main.projectile[num1029].oldPos[1]; } if (base.Center.HasNaNs()) { this.Kill(); return; } } else { this.ai[0] = num1027; flag60 = false; this.Kill(); } if (flag60 && !flag58) { this.velocity += new Vector2((float)Math.Sign(Main.projectile[num1029].Center.X - base.Center.X), (float)Math.Sign(Main.projectile[num1029].Center.Y - base.Center.Y)) * new Vector2(x3, y3); if (this.velocity.Length() > 6f) { this.velocity *= 6f / this.velocity.Length(); } } if (this.type == 618) { if (Main.rand.Next(2) == 0) { int num1030 = Dust.NewDust(base.Center, 8, 8, 86, 0f, 0f, 0, default(Color), 1f); Main.dust[num1030].position = base.Center; Main.dust[num1030].velocity = this.velocity; Main.dust[num1030].noGravity = true; Main.dust[num1030].scale = 1.5f; if (flag60) { Main.dust[num1030].customData = Main.projectile[(int)this.ai[1]]; } } this.alpha = 255; return; } this.Kill(); return; } } else if (this.aiStyle == 120) { Player player8 = Main.player[this.owner]; if (!player8.active) { this.active = false; return; } bool flag61 = this.type == 623; Vector2 vector131 = player8.Center; float num1031 = 100f; float num1032 = 300f; float num1033 = 100f; float num1034 = 100f; if (flag61) { if (player8.dead) { player8.stardustGuardian = false; } if (player8.stardustGuardian) { this.timeLeft = 2; } num1031 = 150f; num1032 = 250f; num1033 = 200f; vector131.X -= (float)((5 + player8.width / 2) * player8.direction); vector131.Y -= 25f; Lighting.AddLight(base.Center, 0.9f, 0.9f, 0.7f); if (this.ai[0] != 3f && this.alpha == 255) { this.alpha = 0; for (int num1035 = 0; num1035 < 30; num1035++) { int num1036 = Dust.NewDust(this.position, this.width, this.height, 135, 0f, 0f, 200, default(Color), 1.7f); Main.dust[num1036].noGravity = true; Main.dust[num1036].velocity *= 3f; Main.dust[num1036].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]); num1036 = Dust.NewDust(this.position, this.width, this.height, 135, 0f, 0f, 100, default(Color), 1f); Main.dust[num1036].velocity *= 2f; Main.dust[num1036].noGravity = true; Main.dust[num1036].fadeIn = 2.5f; Main.dust[num1036].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]); } } if (this.localAI[0] > 0f) { this.localAI[0] -= 1f; } } if (this.ai[0] != 0f) { Main.player[this.owner].tankPet = this.whoAmI; Main.player[this.owner].tankPetReset = false; } if (this.ai[0] == 0f) { if (player8.HasMinionTarget) { this.ai[0] = 3f; this.netUpdate = true; } base.Center = Vector2.Lerp(base.Center, vector131, 0.2f); this.velocity *= 0.8f; this.direction = (this.spriteDirection = player8.direction); if (flag61 && ++this.frameCounter >= 9) { this.frameCounter = 0; if (++this.frame >= Main.projFrames[this.type] - 4) { this.frame = 0; } } } else if (this.ai[0] == 1f) { if (player8.HasMinionTarget) { vector131 = player8.MinionTargetPoint; } else { this.ai[0] = 0f; this.netUpdate = true; } int num1037 = -1; bool flag62 = true; if (flag61 && Math.Abs(base.Center.X - vector131.X) > num1031 + 20f) { flag62 = false; } if (flag62) { for (int num1038 = 0; num1038 < 200; num1038++) { NPC nPC11 = Main.npc[num1038]; if (nPC11.CanBeChasedBy(this, false)) { float num1039 = base.Distance(nPC11.Center); if (num1039 < num1032) { num1037 = num1038; } } } } if (num1037 != -1) { NPC nPC12 = Main.npc[num1037]; this.direction = (this.spriteDirection = (nPC12.Center.X > base.Center.X).ToDirectionInt()); float num1040 = Math.Abs(vector131.X - base.Center.X); float num1041 = Math.Abs(nPC12.Center.X - base.Center.X); float num1042 = Math.Abs(vector131.Y - base.Center.Y); float num1043 = Math.Abs(nPC12.Center.Y - base.Bottom.Y); float num1044 = (float)(nPC12.Center.Y > base.Bottom.Y).ToDirectionInt(); if ((num1040 < num1031 || (vector131.X - base.Center.X) * (float)this.direction < 0f) && num1041 > 20f && num1041 < num1031 - num1040 + 100f) { this.velocity.X = this.velocity.X + 0.1f * (float)this.direction; } else { this.velocity.X = this.velocity.X * 0.7f; } if ((num1042 < num1034 || (vector131.Y - base.Bottom.Y) * num1044 < 0f) && num1043 > 10f && num1043 < num1034 - num1042 + 10f) { this.velocity.Y = this.velocity.Y + 0.1f * num1044; } else { this.velocity.Y = this.velocity.Y * 0.7f; } if (this.localAI[0] == 0f && this.owner == Main.myPlayer && num1041 < num1033) { this.ai[1] = 0f; this.ai[0] = 2f; this.netUpdate = true; this.localAI[0] = 90f; } } else { if (Math.Abs(vector131.X - base.Center.X) > num1031 + 40f) { this.ai[0] = 3f; this.netUpdate = true; } else if (Math.Abs(vector131.X - base.Center.X) > 20f) { this.direction = (this.spriteDirection = (vector131.X > base.Center.X).ToDirectionInt()); this.velocity.X = this.velocity.X + 0.06f * (float)this.direction; } else { this.velocity.X = this.velocity.X * 0.8f; this.direction = (this.spriteDirection = (player8.Center.X < base.Center.X).ToDirectionInt()); } if (Math.Abs(vector131.Y - base.Center.Y) > num1034) { this.ai[0] = 3f; this.netUpdate = true; } else if (Math.Abs(vector131.Y - base.Center.Y) > 10f) { this.velocity.Y = this.velocity.Y + 0.06f * (float)Math.Sign(vector131.Y - base.Center.Y); } else { this.velocity.Y = this.velocity.Y * 0.8f; } } if (flag61 && ++this.frameCounter >= 9) { this.frameCounter = 0; if (++this.frame >= Main.projFrames[this.type] - 4) { this.frame = 0; } } } else if (this.ai[0] == 2f) { this.velocity.X = this.velocity.X * 0.9f; this.ai[1] += 1f; float num1045 = 0f; if (flag61) { num1045 = 20f; if (this.ai[1] == 10f && this.owner == Main.myPlayer) { int num1046 = (int)(20f * Main.player[this.owner].minionDamage); Projectile.NewProjectile(base.Center.X, base.Center.Y, 0f, 0f, 624, num1046, 6f, this.owner, 0f, 5f); } } if (this.ai[1] >= num1045) { this.ai[1] = 0f; this.ai[0] = 1f; this.netUpdate = true; } if (flag61) { if (this.frame < Main.projFrames[this.type] - 4) { this.frame = Main.projFrames[this.type] - 1; this.frameCounter = 0; } if (++this.frameCounter >= 5) { this.frameCounter = 0; if (--this.frame < Main.projFrames[this.type] - 5) { this.frame = Main.projFrames[this.type] - 1; } } } } if (this.ai[0] == 3f) { if (player8.HasMinionTarget) { vector131 = player8.MinionTargetPoint; } else { this.ai[0] = 0f; this.netUpdate = true; } if (this.alpha == 0) { this.alpha = 255; for (int num1047 = 0; num1047 < 30; num1047++) { int num1048 = Dust.NewDust(this.position, this.width, this.height, 135, 0f, 0f, 200, default(Color), 1.7f); Main.dust[num1048].noGravity = true; Main.dust[num1048].velocity *= 3f; Main.dust[num1048].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]); num1048 = Dust.NewDust(this.position, this.width, this.height, 135, 0f, 0f, 100, default(Color), 1f); Main.dust[num1048].velocity *= 2f; Main.dust[num1048].noGravity = true; Main.dust[num1048].fadeIn = 2.5f; Main.dust[num1048].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]); } } else { for (int num1049 = 0; num1049 < 2; num1049++) { int num1050 = Dust.NewDust(this.position, this.width, this.height, 135, 0f, 0f, 200, default(Color), 1.7f); Main.dust[num1050].noGravity = true; Main.dust[num1050].velocity *= 3f; Main.dust[num1050].noLight = true; Main.dust[num1050].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]); num1050 = Dust.NewDust(this.position, this.width, this.height, 135, 0f, 0f, 100, default(Color), 1f); Main.dust[num1050].velocity *= 2f; Main.dust[num1050].noGravity = true; Main.dust[num1050].fadeIn = 2.5f; Main.dust[num1050].noLight = true; Main.dust[num1050].shader = GameShaders.Armor.GetSecondaryShader(Main.player[this.owner].cPet, Main.player[this.owner]); } } this.velocity *= 0.7f; base.Center = Vector2.Lerp(base.Center, vector131, 0.2f); if (base.Distance(vector131) < 10f) { this.ai[0] = 1f; this.netUpdate = true; return; } } } else if (this.aiStyle == 121) { Player player9 = Main.player[this.owner]; if ((int)Main.time % 120 == 0) { this.netUpdate = true; } if (!player9.active) { this.active = false; return; } bool flag63 = this.type == 625; bool flag64 = this.type == 625 || this.type == 626 || this.type == 627 || this.type == 628; int num1051 = 10; if (flag64) { if (player9.dead) { player9.stardustDragon = false; } if (player9.stardustDragon) { this.timeLeft = 2; } num1051 = 30; if (Main.rand.Next(30) == 0) { int num1052 = Dust.NewDust(this.position, this.width, this.height, 135, 0f, 0f, 0, default(Color), 2f); Main.dust[num1052].noGravity = true; Main.dust[num1052].fadeIn = 2f; Point point4 = Main.dust[num1052].position.ToTileCoordinates(); if (WorldGen.InWorld(point4.X, point4.Y, 5) && WorldGen.SolidTile(point4.X, point4.Y)) { Main.dust[num1052].noLight = true; } } } if (flag63) { Vector2 center14 = player9.Center; float num1053 = 700f; float num1054 = 1000f; int num1055 = -1; if (base.Distance(center14) > 2000f) { base.Center = center14; this.netUpdate = true; } bool flag65 = true; if (flag65) { for (int num1056 = 0; num1056 < 200; num1056++) { NPC nPC13 = Main.npc[num1056]; if (nPC13.CanBeChasedBy(this, false) && player9.Distance(nPC13.Center) < num1054) { float num1057 = base.Distance(nPC13.Center); if (num1057 < num1053) { num1055 = num1056; bool arg_2D8E1_0 = nPC13.boss; } } } } if (num1055 != -1) { NPC nPC14 = Main.npc[num1055]; Vector2 vector132 = nPC14.Center - base.Center; (vector132.X > 0f).ToDirectionInt(); (vector132.Y > 0f).ToDirectionInt(); float scaleFactor16 = 0.4f; if (vector132.Length() < 600f) { scaleFactor16 = 0.6f; } if (vector132.Length() < 300f) { scaleFactor16 = 0.8f; } if (vector132.Length() > nPC14.Size.Length() * 0.75f) { this.velocity += Vector2.Normalize(vector132) * scaleFactor16 * 1.5f; if (Vector2.Dot(this.velocity, vector132) < 0.25f) { this.velocity *= 0.8f; } } float num1058 = 30f; if (this.velocity.Length() > num1058) { this.velocity = Vector2.Normalize(this.velocity) * num1058; } } else { float num1059 = 0.2f; Vector2 vector133 = center14 - base.Center; if (vector133.Length() < 200f) { num1059 = 0.12f; } if (vector133.Length() < 140f) { num1059 = 0.06f; } if (vector133.Length() > 100f) { if (Math.Abs(center14.X - base.Center.X) > 20f) { this.velocity.X = this.velocity.X + num1059 * (float)Math.Sign(center14.X - base.Center.X); } if (Math.Abs(center14.Y - base.Center.Y) > 10f) { this.velocity.Y = this.velocity.Y + num1059 * (float)Math.Sign(center14.Y - base.Center.Y); } } else if (this.velocity.Length() > 2f) { this.velocity *= 0.96f; } if (Math.Abs(this.velocity.Y) < 1f) { this.velocity.Y = this.velocity.Y - 0.1f; } float num1060 = 15f; if (this.velocity.Length() > num1060) { this.velocity = Vector2.Normalize(this.velocity) * num1060; } } this.rotation = this.velocity.ToRotation() + 1.57079637f; int direction = this.direction; this.direction = (this.spriteDirection = ((this.velocity.X > 0f) ? 1 : -1)); if (direction != this.direction) { this.netUpdate = true; } float num1061 = MathHelper.Clamp(this.localAI[0], 0f, 50f); this.position = base.Center; this.scale = 1f + num1061 * 0.01f; this.width = (this.height = (int)((float)num1051 * this.scale)); base.Center = this.position; if (this.alpha > 0) { for (int num1062 = 0; num1062 < 2; num1062++) { int num1063 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 135, 0f, 0f, 100, default(Color), 2f); Main.dust[num1063].noGravity = true; Main.dust[num1063].noLight = true; } this.alpha -= 42; if (this.alpha < 0) { this.alpha = 0; return; } } } else { bool flag66 = false; Vector2 value68 = Vector2.Zero; Vector2 arg_2DD78_0 = Vector2.Zero; float num1064 = 0f; float scaleFactor17 = 0f; float scaleFactor18 = 1f; if (this.ai[1] == 1f) { this.ai[1] = 0f; this.netUpdate = true; } int byUUID = Projectile.GetByUUID(this.owner, (int)this.ai[0]); if (flag64 && byUUID >= 0 && Main.projectile[byUUID].active && (Main.projectile[byUUID].type == 625 || Main.projectile[byUUID].type == 626 || Main.projectile[byUUID].type == 627)) { flag66 = true; value68 = Main.projectile[byUUID].Center; Vector2 arg_2DE6A_0 = Main.projectile[byUUID].velocity; num1064 = Main.projectile[byUUID].rotation; float num1065 = MathHelper.Clamp(Main.projectile[byUUID].scale, 0f, 50f); scaleFactor18 = num1065; scaleFactor17 = 16f; int arg_2DEC0_0 = Main.projectile[byUUID].alpha; Main.projectile[byUUID].localAI[0] = this.localAI[0] + 1f; if (Main.projectile[byUUID].type != 625) { Main.projectile[byUUID].localAI[1] = (float)this.whoAmI; } if (this.owner == Main.myPlayer && Main.projectile[byUUID].type == 625 && this.type == 628) { Main.projectile[byUUID].Kill(); this.Kill(); return; } } if (!flag66) { return; } if (this.alpha > 0) { for (int num1066 = 0; num1066 < 2; num1066++) { int num1067 = Dust.NewDust(this.position, this.width, this.height, 135, 0f, 0f, 100, default(Color), 2f); Main.dust[num1067].noGravity = true; Main.dust[num1067].noLight = true; } } this.alpha -= 42; if (this.alpha < 0) { this.alpha = 0; } this.velocity = Vector2.Zero; Vector2 vector134 = value68 - base.Center; if (num1064 != this.rotation) { float num1068 = MathHelper.WrapAngle(num1064 - this.rotation); vector134 = vector134.RotatedBy((double)(num1068 * 0.1f), default(Vector2)); } this.rotation = vector134.ToRotation() + 1.57079637f; this.position = base.Center; this.scale = scaleFactor18; this.width = (this.height = (int)((float)num1051 * this.scale)); base.Center = this.position; if (vector134 != Vector2.Zero) { base.Center = value68 - Vector2.Normalize(vector134) * scaleFactor17 * scaleFactor18; } this.spriteDirection = ((vector134.X > 0f) ? 1 : -1); return; } } else if (this.aiStyle == 122) { int num1069 = (int)this.ai[0]; bool flag67 = false; if (num1069 == -1 || !Main.npc[num1069].active) { flag67 = true; } if (flag67) { if (this.type == 629) { this.Kill(); return; } if (this.type == 631 && this.ai[0] != -1f) { this.ai[0] = -1f; this.netUpdate = true; } } if (!flag67 && base.Hitbox.Intersects(Main.npc[num1069].Hitbox)) { this.Kill(); if (this.type == 631) { this.localAI[1] = 1f; this.Damage(); } return; } if (this.type == 629) { Vector2 value69 = Main.npc[num1069].Center - base.Center; this.velocity = Vector2.Normalize(value69) * 5f; Dust.QuickDust(base.Center, Color.Red); } if (this.type == 631) { if (this.ai[1] > 0f) { this.ai[1] -= 1f; this.velocity = Vector2.Zero; return; } if (flag67) { if (this.velocity == Vector2.Zero) { this.Kill(); } this.tileCollide = true; this.alpha += 10; if (this.alpha > 255) { this.Kill(); } } else { Vector2 value70 = Main.npc[num1069].Center - base.Center; this.velocity = Vector2.Normalize(value70) * 12f; this.alpha -= 15; if (this.alpha < 0) { this.alpha = 0; } } this.rotation = this.velocity.ToRotation() - 1.57079637f; return; } } else if (this.aiStyle == 123) { bool flag68 = this.type == 641; bool flag69 = this.type == 643; float num1070 = 1000f; this.velocity = Vector2.Zero; if (flag68) { this.alpha -= 5; if (this.alpha < 0) { this.alpha = 0; } if (this.direction == 0) { this.direction = Main.player[this.owner].direction; } this.rotation -= (float)this.direction * 6.28318548f / 120f; this.scale = this.Opacity; Lighting.AddLight(base.Center, new Vector3(0.3f, 0.9f, 0.7f) * this.Opacity); if (Main.rand.Next(2) == 0) { Vector2 vector135 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); Dust dust30 = Main.dust[Dust.NewDust(base.Center - vector135 * 30f, 0, 0, 229, 0f, 0f, 0, default(Color), 1f)]; dust30.noGravity = true; dust30.position = base.Center - vector135 * (float)Main.rand.Next(10, 21); dust30.velocity = vector135.RotatedBy(1.5707963705062866, default(Vector2)) * 6f; dust30.scale = 0.5f + Main.rand.NextFloat(); dust30.fadeIn = 0.5f; dust30.customData = base.Center; } if (Main.rand.Next(2) == 0) { Vector2 vector136 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); Dust dust31 = Main.dust[Dust.NewDust(base.Center - vector136 * 30f, 0, 0, 240, 0f, 0f, 0, default(Color), 1f)]; dust31.noGravity = true; dust31.position = base.Center - vector136 * 30f; dust31.velocity = vector136.RotatedBy(-1.5707963705062866, default(Vector2)) * 3f; dust31.scale = 0.5f + Main.rand.NextFloat(); dust31.fadeIn = 0.5f; dust31.customData = base.Center; } if (this.ai[0] < 0f) { Vector2 center15 = base.Center; int num1071 = Dust.NewDust(center15 - Vector2.One * 8f, 16, 16, 229, this.velocity.X / 2f, this.velocity.Y / 2f, 0, default(Color), 1f); Main.dust[num1071].velocity *= 2f; Main.dust[num1071].noGravity = true; Main.dust[num1071].scale = Utils.SelectRandom<float>(Main.rand, new float[] { 0.8f, 1.65f }); Main.dust[num1071].customData = this; } } if (flag69) { this.alpha -= 5; if (this.alpha < 0) { this.alpha = 0; } if (this.direction == 0) { this.direction = Main.player[this.owner].direction; } if (++this.frameCounter >= 3) { this.frameCounter = 0; if (++this.frame >= Main.projFrames[this.type]) { this.frame = 0; } } if (this.alpha == 0 && Main.rand.Next(15) == 0) { Dust dust32 = Main.dust[Dust.NewDust(base.Top, 0, 0, 261, 0f, 0f, 100, default(Color), 1f)]; dust32.velocity.X = 0f; dust32.noGravity = true; dust32.fadeIn = 1f; dust32.position = base.Center + Vector2.UnitY.RotatedByRandom(6.2831854820251465) * (4f * Main.rand.NextFloat() + 26f); dust32.scale = 0.5f; } this.localAI[0] += 1f; if (this.localAI[0] >= 60f) { this.localAI[0] = 0f; } } if (this.ai[0] < 0f) { this.ai[0] += 1f; if (flag68) { this.ai[1] -= (float)this.direction * 0.3926991f / 50f; } } if (this.ai[0] == 0f) { int num1072 = -1; float num1073 = num1070; for (int num1074 = 0; num1074 < 200; num1074++) { NPC nPC15 = Main.npc[num1074]; if (nPC15.CanBeChasedBy(this, false)) { float num1075 = base.Distance(nPC15.Center); if (num1075 < num1073 && Collision.CanHitLine(base.Center, 0, 0, nPC15.Center, 0, 0)) { num1073 = num1075; num1072 = num1074; } } } if (num1072 != -1) { this.ai[0] = 1f; this.ai[1] = (float)num1072; this.netUpdate = true; return; } } if (this.ai[0] > 0f) { int num1076 = (int)this.ai[1]; if (!Main.npc[num1076].CanBeChasedBy(this, false)) { this.ai[0] = 0f; this.ai[1] = 0f; this.netUpdate = true; return; } this.ai[0] += 1f; float num1077 = 30f; if (flag69) { num1077 = 5f; } if (this.ai[0] >= num1077) { Vector2 vector137 = base.DirectionTo(Main.npc[num1076].Center); if (vector137.HasNaNs()) { vector137 = Vector2.UnitY; } float num1078 = vector137.ToRotation(); int num1079 = (vector137.X > 0f) ? 1 : -1; if (flag68) { this.direction = num1079; this.ai[0] = -60f; this.ai[1] = num1078 + (float)num1079 * 3.14159274f / 16f; this.netUpdate = true; if (this.owner == Main.myPlayer) { Projectile.NewProjectile(base.Center.X, base.Center.Y, vector137.X, vector137.Y, 642, this.damage, this.knockBack, this.owner, 0f, (float)this.whoAmI); } } if (flag69) { this.direction = num1079; this.ai[0] = -20f; this.netUpdate = true; if (this.owner == Main.myPlayer) { Vector2 vector138 = Main.npc[num1076].position + Main.npc[num1076].Size * Utils.RandomVector2(Main.rand, 0f, 1f) - base.Center; for (int num1080 = 0; num1080 < 3; num1080++) { Vector2 vector139 = base.Center + vector138; if (num1080 > 0) { vector139 = base.Center + vector138.RotatedByRandom(0.78539818525314331) * (Main.rand.NextFloat() * 0.5f + 0.75f); } float x4 = Main.rgbToHsl(new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB)).X; Projectile.NewProjectile(vector139.X, vector139.Y, 0f, 0f, 644, this.damage, this.knockBack, this.owner, x4, (float)this.whoAmI); } return; } } } } } else if (this.aiStyle == 124) { Player player10 = Main.player[this.owner]; if (player10.dead) { this.Kill(); return; } if (Main.myPlayer == this.owner && player10.suspiciouslookingTentacle) { this.timeLeft = 2; } this.direction = (this.spriteDirection = player10.direction); Vector3 v3_ = new Vector3(0.5f, 0.9f, 1f) * 1.5f; DelegateMethods.v3_1 = v3_; Utils.PlotTileLine(base.Center, base.Center + this.velocity * 6f, 20f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); Utils.PlotTileLine(base.Left, base.Right, 20f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); Utils.PlotTileLine(player10.Center, player10.Center + player10.velocity * 6f, 40f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); Utils.PlotTileLine(player10.Left, player10.Right, 40f, new Utils.PerLinePoint(DelegateMethods.CastLightOpen)); Vector2 value71 = new Vector2((float)(player10.direction * 30), -20f); Vector2 vector140 = player10.MountedCenter + value71; float num1081 = Vector2.Distance(base.Center, vector140); if (num1081 > 1000f) { base.Center = player10.Center + value71; } Vector2 vector141 = vector140 - base.Center; float num1082 = 4f; if (num1081 < num1082) { this.velocity *= 0.25f; } if (vector141 != Vector2.Zero) { if (vector141.Length() < num1082) { this.velocity = vector141; } else { this.velocity = vector141 * 0.1f; } } if (this.velocity.Length() > 6f) { float num1083 = this.velocity.ToRotation() + 1.57079637f; if (Math.Abs(this.rotation - num1083) >= 3.14159274f) { if (num1083 < this.rotation) { this.rotation -= 6.28318548f; } else { this.rotation += 6.28318548f; } } float num1084 = 12f; this.rotation = (this.rotation * (num1084 - 1f) + num1083) / num1084; if (++this.frameCounter >= 4) { this.frameCounter = 0; if (++this.frame >= Main.projFrames[this.type]) { this.frame = 0; } } } else { if (this.rotation > 3.14159274f) { this.rotation -= 6.28318548f; } if (this.rotation > -0.005f && this.rotation < 0.005f) { this.rotation = 0f; } else { this.rotation *= 0.96f; } if (++this.frameCounter >= 6) { this.frameCounter = 0; if (++this.frame >= Main.projFrames[this.type]) { this.frame = 0; } } } if (this.ai[0] > 0f && (this.ai[0] += 1f) >= 60f) { this.ai[0] = 0f; this.ai[1] = 0f; } if (Main.rand.Next(15) == 0) { float num1085 = -1f; int num1086 = 17; if ((base.Center - player10.Center).Length() < (float)Main.screenWidth) { int num1087 = (int)base.Center.X / 16; int num1088 = (int)base.Center.Y / 16; num1087 = (int)MathHelper.Clamp((float)num1087, (float)(num1086 + 1), (float)(Main.maxTilesX - num1086 - 1)); num1088 = (int)MathHelper.Clamp((float)num1088, (float)(num1086 + 1), (float)(Main.maxTilesY - num1086 - 1)); for (int num1089 = num1087 - num1086; num1089 <= num1087 + num1086; num1089++) { for (int num1090 = num1088 - num1086; num1090 <= num1088 + num1086; num1090++) { int num1091 = Main.rand.Next(8); if (num1091 < 4) { Vector2 vector142 = new Vector2((float)(num1087 - num1089), (float)(num1088 - num1090)); if (vector142.Length() < (float)num1086 && Main.tile[num1089, num1090] != null && Main.tile[num1089, num1090].active()) { bool flag70 = false; if (Main.tile[num1089, num1090].type == 185 && Main.tile[num1089, num1090].frameY == 18) { if (Main.tile[num1089, num1090].frameX >= 576 && Main.tile[num1089, num1090].frameX <= 882) { flag70 = true; } } else if (Main.tile[num1089, num1090].type == 186 && Main.tile[num1089, num1090].frameX >= 864 && Main.tile[num1089, num1090].frameX <= 1170) { flag70 = true; } if (flag70 || Main.tileSpelunker[(int)Main.tile[num1089, num1090].type] || (Main.tileAlch[(int)Main.tile[num1089, num1090].type] && Main.tile[num1089, num1090].type != 82)) { float num1092 = base.Distance(new Vector2((float)(num1089 * 16 + 8), (float)(num1090 * 16 + 8))); if (num1092 < num1085 || num1085 == -1f) { num1085 = num1092; this.ai[0] = 1f; this.ai[1] = base.AngleTo(new Vector2((float)(num1089 * 16 + 8), (float)(num1090 * 16 + 8))); } if (num1091 < 2) { int num1093 = Dust.NewDust(new Vector2((float)(num1089 * 16), (float)(num1090 * 16)), 16, 16, 204, 0f, 0f, 150, default(Color), 0.3f); Main.dust[num1093].fadeIn = 0.75f; Main.dust[num1093].velocity *= 0.1f; } } } } } } } } float f3 = this.localAI[0] % 6.28318548f - 3.14159274f; float num1094 = (float)Math.IEEERemainder((double)this.localAI[1], 1.0); if (num1094 < 0f) { num1094 += 1f; } float num1095 = (float)Math.Floor((double)this.localAI[1]); float max = 0.999f; int num1096 = 0; float amount2 = 0.1f; bool flag71 = player10.velocity.Length() > 3f; int num1097 = -1; int num1098 = -1; float num1099 = 300f; float num1100 = 500f; for (int num1101 = 0; num1101 < 200; num1101++) { NPC nPC16 = Main.npc[num1101]; if (nPC16.active && nPC16.chaseable && !nPC16.dontTakeDamage && !nPC16.immortal) { float num1102 = base.Distance(nPC16.Center); if (nPC16.friendly || nPC16.lifeMax <= 5) { if (num1102 < num1099 && !flag71) { num1099 = num1102; num1098 = num1101; } } else if (num1102 < num1100) { num1100 = num1102; num1097 = num1101; } } } float num1103; if (flag71) { num1103 = base.AngleTo(base.Center + player10.velocity); num1096 = 1; num1094 = MathHelper.Clamp(num1094 + 0.05f, 0f, max); num1095 += (float)Math.Sign(-10f - num1095); } else if (num1097 != -1) { num1103 = base.AngleTo(Main.npc[num1097].Center); num1096 = 2; num1094 = MathHelper.Clamp(num1094 + 0.05f, 0f, max); num1095 += (float)Math.Sign(-12f - num1095); } else if (num1098 != -1) { num1103 = base.AngleTo(Main.npc[num1098].Center); num1096 = 3; num1094 = MathHelper.Clamp(num1094 + 0.05f, 0f, max); num1095 += (float)Math.Sign(6f - num1095); } else if (this.ai[0] > 0f) { num1103 = this.ai[1]; num1094 = MathHelper.Clamp(num1094 + (float)Math.Sign(0.75f - num1094) * 0.05f, 0f, max); num1096 = 4; num1095 += (float)Math.Sign(10f - num1095); if (Main.rand.Next(10) == 0) { int num1104 = Dust.NewDust(base.Center + f3.ToRotationVector2() * 6f * num1094 - Vector2.One * 4f, 8, 8, 204, 0f, 0f, 150, default(Color), 0.3f); Main.dust[num1104].fadeIn = 0.75f; Main.dust[num1104].velocity *= 0.1f; } } else { num1103 = ((player10.direction == 1) ? 0f : 3.14160275f); num1094 = MathHelper.Clamp(num1094 + (float)Math.Sign(0.75f - num1094) * 0.05f, 0f, max); num1095 += (float)Math.Sign(0f - num1095); amount2 = 0.12f; } Vector2 value72 = num1103.ToRotationVector2(); num1103 = Vector2.Lerp(f3.ToRotationVector2(), value72, amount2).ToRotation(); this.localAI[0] = num1103 + (float)num1096 * 6.28318548f + 3.14159274f; this.localAI[1] = num1095 + num1094; } else { UlterrariaProjectiles.ProjectileAiStyles(this, this.aiStyle); } } } } } } } } } } } } } } } } } } } } } } }