public static void ExplosionEffect(Projectile p) { Main.PlaySound(2, (int)p.position.X, (int)p.position.Y, 14); for (int num500 = 0; num500 < 10; num500++) { Dust.NewDust(new Vector2(p.position.X, p.position.Y), p.width, p.height, 31, 0f, 0f, 100, default(Color), 1.5f); } for (int num501 = 0; num501 < 5; num501++) { int num502 = Dust.NewDust(new Vector2(p.position.X, p.position.Y), p.width, p.height, 6, 0f, 0f, 100, default(Color), 2.5f); Main.dust[num502].noGravity = true; Main.dust[num502].velocity *= 3f; num502 = Dust.NewDust(new Vector2(p.position.X, p.position.Y), p.width, p.height, 6, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num502].velocity *= 2f; } int num503 = Gore.NewGore(new Vector2(p.position.X, p.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(p.position.X, p.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 (p.owner == Main.myPlayer) { p.penetrate = -1; p.position.X = p.position.X + (float)(p.width / 2); p.position.Y = p.position.Y + (float)(p.height / 2); p.width = 48; p.height = 48; p.position.X = p.position.X - (float)(p.width / 2); p.position.Y = p.position.Y - (float)(p.height / 2); p.Damage(); } }
public static void Explode(int index, int sizeX, int sizeY, ExtraAction visualAction = null) { Terraria.Projectile projectile = Main.projectile[index]; if (!projectile.active) { return; } projectile.tileCollide = false; projectile.alpha = 255; projectile.position.X = projectile.position.X + (float)(projectile.width / 2); projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); projectile.width = sizeX; projectile.height = sizeY; projectile.position.X = projectile.position.X - (float)(projectile.width / 2); projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); projectile.Damage(); Main.projectileIdentity[projectile.owner, projectile.identity] = -1; projectile.position.X = projectile.position.X + (float)(projectile.width / 2); projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); projectile.width = (int)((float)sizeX / 5.8f); projectile.height = (int)((float)sizeY / 5.8f); projectile.position.X = projectile.position.X - (float)(projectile.width / 2); projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); if (visualAction == null) { for (int i = 0; i < 30; i++) { int num = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num].velocity *= 1.4f; } for (int j = 0; j < 20; j++) { int num2 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 3.5f); Main.dust[num2].noGravity = true; Main.dust[num2].velocity *= 7f; num2 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num2].velocity *= 3f; } for (int k = 0; k < 2; k++) { float scaleFactor = 0.4f; if (k == 1) { scaleFactor = 0.8f; } int num3 = Gore.NewGore(new Vector2(projectile.position.X, projectile.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num3].velocity *= scaleFactor; Gore gore = Main.gore[num3]; gore.velocity.X = gore.velocity.X + 1f; Gore gore2 = Main.gore[num3]; gore2.velocity.Y = gore2.velocity.Y + 1f; num3 = Gore.NewGore(new Vector2(projectile.position.X, projectile.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num3].velocity *= scaleFactor; Gore gore3 = Main.gore[num3]; gore3.velocity.X = gore3.velocity.X - 1f; Gore gore4 = Main.gore[num3]; gore4.velocity.Y = gore4.velocity.Y + 1f; num3 = Gore.NewGore(new Vector2(projectile.position.X, projectile.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num3].velocity *= scaleFactor; Gore gore5 = Main.gore[num3]; gore5.velocity.X = gore5.velocity.X + 1f; Gore gore6 = Main.gore[num3]; gore6.velocity.Y = gore6.velocity.Y - 1f; num3 = Gore.NewGore(new Vector2(projectile.position.X, projectile.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num3].velocity *= scaleFactor; Gore gore7 = Main.gore[num3]; gore7.velocity.X = gore7.velocity.X - 1f; Gore gore8 = Main.gore[num3]; gore8.velocity.Y = gore8.velocity.Y - 1f; } return; } visualAction(); }
public static void ProjectileKilled(Projectile p) { if (p.type == 882) { UlterrariaProjectiles.ExplosionEffect(p); } if (p.type == 843) { Main.PlaySound(2, (int)p.position.X, (int)p.position.Y, 14); for (int num500 = 0; num500 < 10; num500++) { Dust.NewDust(new Vector2(p.position.X, p.position.Y), p.width, p.height, 31, 0f, 0f, 100, default(Color), 1.5f); } for (int num501 = 0; num501 < 5; num501++) { int num502 = Dust.NewDust(new Vector2(p.position.X, p.position.Y), p.width, p.height, 6, 0f, 0f, 100, default(Color), 2.5f); Main.dust[num502].noGravity = true; Main.dust[num502].velocity *= 3f; num502 = Dust.NewDust(new Vector2(p.position.X, p.position.Y), p.width, p.height, 6, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num502].velocity *= 2f; } int num503 = Gore.NewGore(new Vector2(p.position.X, p.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(p.position.X, p.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 (p.owner == Main.myPlayer) { p.penetrate = -1; p.position.X = p.position.X + (float)(p.width / 2); p.position.Y = p.position.Y + (float)(p.height / 2); p.width = 48; p.height = 48; p.position.X = p.position.X - (float)(p.width / 2); p.position.Y = p.position.Y - (float)(p.height / 2); p.damage = 100; p.Damage(); } } if (p.type == 852) { float angle = -45; for (int i = 0; i < 8; i++) { angle += 45; float rads = MathHelper.ToRadians(angle); Vector2 vel = angle.ToRotationVector2(); vel *= 7f; Projectile.NewProjectile(p.Center.X, p.Center.Y, vel.X, vel.Y, 24, (int)(p.damage * 0.8f), 0.2f); } for (int i = 0; i < 16; i++) { int d = Dust.NewDust(p.position, p.width, p.height, 41); Main.dust[d].noGravity = true; } } if (p.type == 849) { Main.PlaySound(2, (int)p.position.X, (int)p.position.Y, 14); for (int num500 = 0; num500 < 10; num500++) { Dust.NewDust(new Vector2(p.position.X, p.position.Y), p.width, p.height, 31, 0f, 0f, 100, default(Color), 1.5f); } for (int num501 = 0; num501 < 5; num501++) { int num502 = Dust.NewDust(new Vector2(p.position.X, p.position.Y), p.width, p.height, 6, 0f, 0f, 100, default(Color), 2.5f); Main.dust[num502].noGravity = true; Main.dust[num502].velocity *= 3f; num502 = Dust.NewDust(new Vector2(p.position.X, p.position.Y), p.width, p.height, 6, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num502].velocity *= 2f; } int num503 = Gore.NewGore(new Vector2(p.position.X, p.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(p.position.X, p.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 (p.owner == Main.myPlayer) { p.penetrate = -1; p.position.X = p.position.X + (float)(p.width / 2); p.position.Y = p.position.Y + (float)(p.height / 2); p.width = 48; p.height = 48; p.position.X = p.position.X - (float)(p.width / 2); p.position.Y = p.position.Y - (float)(p.height / 2); p.damage = 100; p.Damage(); } float angle = -45; for (int i = 0; i < 8; i++) { angle += 45; float rads = MathHelper.ToRadians(angle); Vector2 vel = angle.ToRotationVector2(); vel *= 7f; Projectile.NewProjectile(p.Center.X, p.Center.Y, vel.X, vel.Y, 850, (int)(p.damage * 0.8f), 0.2f); } for (int i = 0; i < 16; i++) { int d = Dust.NewDust(p.position, p.width, p.height, 41); Main.dust[d].noGravity = true; } } if (p.type == 836) { float angle = -45; for (int i = 0; i < 8; i++) { angle += 45; float rads = MathHelper.ToRadians(angle); Vector2 vel = angle.ToRotationVector2(); vel *= 7f; Projectile.NewProjectile(p.Center.X, p.Center.Y, vel.X, vel.Y, 837, (int)(p.damage * 0.8f), 0.2f); } for (int i = 0; i < 16; i++) { int d = Dust.NewDust(p.position, p.width, p.height, 41); Main.dust[d].noGravity = true; } } if (p.type == 828) { for (int i = 0; i < 4; i++) { int d = Dust.NewDust(p.Center, 0, 0, 41); Main.dust[d].noGravity = true; } for (int i = 0; i < 4; i++) { if (Main.rand.Next(2) == 0) { int side = Main.rand.Next(4) <= 1 ? 3 : -3; Projectile.NewProjectile(p.Center.X, p.Center.Y, side, Main.rand.Next(0, 31) / 10, 829, 5, 2f, Main.myPlayer); } else { int side1 = Main.rand.Next(4) <= 1 ? 3 : -3; Projectile.NewProjectile(p.Center.X, p.Center.Y, Main.rand.Next(-30, 31) / 10, side1, 829, 5, 2f, Main.myPlayer); } } } if (p.type == 811) { for (int i = 0; i < 4; i++) { int d = Dust.NewDust(p.Center, 0, 0, 76); Main.dust[d].noGravity = true; } } if (p.type == 812) { for (int l = 0; l < 128; l++) { int du = Dust.NewDust(p.position, p.width, p.height, 245, Main.rand.Next(-50, 51) / 100, Main.rand.Next(-50, 51) / 100); Main.dust[du].color = Ulterraria.RainbowColor[Main.rand.Next(0, Ulterraria.rainbow.Length)]; Main.dust[du].fadeIn = 0.3f; } } if (p.type == 794) { Projectile.NewProjectile(p.Center.X, p.Center.Y, 0f, 0f, 795, 69, 5f); } if (p.type == 793) { Main.PlaySound(2, (int)p.position.X, (int)p.position.Y, 14); for (int num500 = 0; num500 < 10; num500++) { Dust.NewDust(new Vector2(p.position.X, p.position.Y), p.width, p.height, 31, 0f, 0f, 100, default(Color), 1.5f); } for (int num501 = 0; num501 < 5; num501++) { int num502 = Dust.NewDust(new Vector2(p.position.X, p.position.Y), p.width, p.height, 6, 0f, 0f, 100, default(Color), 2.5f); Main.dust[num502].noGravity = true; Main.dust[num502].velocity *= 3f; num502 = Dust.NewDust(new Vector2(p.position.X, p.position.Y), p.width, p.height, 6, 0f, 0f, 100, default(Color), 1.5f); Main.dust[num502].velocity *= 2f; } int num503 = Gore.NewGore(new Vector2(p.position.X, p.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(p.position.X, p.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 (p.owner == Main.myPlayer) { p.penetrate = -1; p.position.X = p.position.X + (float)(p.width / 2); p.position.Y = p.position.Y + (float)(p.height / 2); p.width = 64; p.height = 64; p.position.X = p.position.X - (float)(p.width / 2); p.position.Y = p.position.Y - (float)(p.height / 2); p.Damage(); } } if (p.type == 792) { for (int j = 0; j < 200; j++) { if (Vector2.Distance(Main.npc[j].Center, p.Center) < 550f && Vector2.Distance(Main.npc[j].Center, p.Center) > 30f) { if (!Main.npc[j].boss && Main.npc[j].knockBackResist != 0f) { float sp = 6f - (Vector2.Distance(Main.npc[j].Center, p.position) / 120); Vector2 pos = p.position - Main.npc[j].Center; float mag = (float)Math.Sqrt(Math.Pow(pos.X, 2) + Math.Pow(pos.Y, 2)); if (mag > sp) { pos *= sp / mag; } Main.npc[j].velocity += pos *= 0.3f; } } } } if (p.type == 791) { if (p.ai[2] == 0f) { for (int i = 0; i < 35; i++) { int randAngle = Main.rand.Next(0, 361); Vector2 position = new Vector2( (float)Math.Cos(MathHelper.ToRadians(randAngle)) * i + p.position.X, (float)Math.Sin(MathHelper.ToRadians(randAngle)) * i + p.position.Y ); Vector2 velocity = p.position - position; velocity.Normalize(); velocity *= 4 + (i / 20); int dust = Main.rand.Next(2) == 0 ? 6 : 35; int newDust = Dust.NewDust(position, 38, 38, dust, -velocity.X, -velocity.Y, 50 + Main.rand.Next(0, 151)); Main.dust[newDust].noGravity = true; Main.dust[newDust].velocity = velocity; } if (p.ai[1] == 0) { for (int k = 0; k < 8; k++) { Vector2 newVelocity = new Vector2((float)Math.Cos(p.rotation + (k * Math.PI / 4)), (float)Math.Sin(p.rotation + (k * Math.PI / 4))); newVelocity *= -8f; Projectile.NewProjectile(p.Center.X, p.Center.Y, newVelocity.X, newVelocity.Y, 791, 48, 3f, Main.myPlayer, 0f, 1f); } } } } if (p.type == 787) { Main.PlaySound(2, (int)p.position.X, (int)p.position.Y, 62); for (int num615 = 0; num615 < 30; num615++) { int num616 = Dust.NewDust(new Vector2(p.position.X, p.position.Y), p.width, p.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(p.position.X, p.position.Y), p.width, p.height, 6, 0f, 0f, 100, default(Color), 3.5f); Main.dust[num618].noGravity = true; Main.dust[num618].velocity *= 7f; num618 = Dust.NewDust(new Vector2(p.position.X, p.position.Y), p.width, p.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(p.position.X, p.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(p.position.X, p.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(p.position.X, p.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(p.position.X, p.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; } for (int i = 0; i < 8; i++) { Vector2 newVelocity = new Vector2((float)Math.Cos(p.rotation + (i * Math.PI / 4)), (float)Math.Sin(p.rotation + (i * Math.PI / 4))); newVelocity *= -8f; Projectile.NewProjectile(p.Center.X, p.Center.Y, newVelocity.X, newVelocity.Y, (int)p.localAI[0], 18, 3f, Main.myPlayer); } } if (p.type == 785 || p.type == 786) { Main.PlaySound(2, (int)p.position.X, (int)p.position.Y, 10); int num429 = 18; int num430 = 3; for (int num431 = 0; num431 < num429; num431++) { Dust.NewDust(p.position, p.width, p.height, 152, p.velocity.X * 0.1f, p.velocity.Y * 0.1f, 250, default(Color), 1.2f); } if (p.type != 786) { for (int num432 = 0; num432 < num430; num432++) { int num433 = Main.rand.Next(16, 18); Gore.NewGore(p.position, new Vector2(p.velocity.X * 0.05f, p.velocity.Y * 0.05f), num433, 1f); } } } if (p.type == 783) { for (int num691 = 0; num691 < 6; num691++) { Dust.NewDust(new Vector2(p.position.X, p.position.Y), p.width, p.height, 109, 0f, 0f, 0, default(Color), 1f); } } if (p.type == 782 || p.type == 784) { int size = 22; if (p.type == 784) { size = 100; } p.position.X = p.position.X + (float)(p.width / 2); p.position.Y = p.position.Y + (float)(p.height / 2); p.width = size; p.height = size; p.position.X = p.position.X - (float)(p.width / 2); p.position.Y = p.position.Y - (float)(p.height / 2); p.Damage(); Main.PlaySound(2, (int)p.position.X, (int)p.position.Y, 62); for (int num615 = 0; num615 < 30; num615++) { int num616 = Dust.NewDust(new Vector2(p.position.X, p.position.Y), p.width, p.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(p.position.X, p.position.Y), p.width, p.height, 6, 0f, 0f, 100, default(Color), 3.5f); Main.dust[num618].noGravity = true; Main.dust[num618].velocity *= 7f; num618 = Dust.NewDust(new Vector2(p.position.X, p.position.Y), p.width, p.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(p.position.X, p.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(p.position.X, p.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(p.position.X, p.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(p.position.X, p.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; } int rand = Main.rand.Next(1, 4); if (p.type == 784) { rand = Main.rand.Next(2, 6); } for (int i = 0; i < rand; i++) { if (Main.rand.Next(2) == 0) { int side = Main.rand.Next(4) <= 1 ? 3 : -3; Projectile.NewProjectile(p.Center.X, p.Center.Y, side, Main.rand.Next(0, 4), 783, 5, 2f, Main.myPlayer); } else { int side1 = Main.rand.Next(4) <= 1 ? 3 : -3; Projectile.NewProjectile(p.Center.X, p.Center.Y, Main.rand.Next(-3, 4), side1, 783, 5, 2f, Main.myPlayer); } } } if (p.type == 781) { Main.PlaySound(2, (int)p.position.X, (int)p.position.Y, 4); for (int num691 = 0; num691 < 14; num691++) { Dust.NewDust(new Vector2(p.position.X, p.position.Y), p.width, p.height, 124, 0f, 0f, 0, default(Color), 1f); } if (p.owner == Main.myPlayer) { float num720 = 80f; for (int num722 = 0; num722 < 255; num722++) { Player player = Main.player[num722]; if (player.active && !player.dead && Vector2.Distance(p.Center, player.Center) < num720) { player.AddBuff(203, 1800, true); } } for (int num723 = 0; num723 < 200; num723++) { NPC nPC = Main.npc[num723]; if (nPC.active && nPC.life > 0 && Vector2.Distance(p.Center, nPC.Center) < num720) { nPC.AddBuff(203, 1800, false); } } } } if (p.type == 771) { int rand = Main.rand.Next(1, 3); for (int i = 0; i < rand; i++) { if (Main.rand.Next(2) == 0) { int side = Main.rand.Next(4) <= 1 ? 3 : -3; Projectile.NewProjectile(p.Center.X, p.Center.Y, side, Main.rand.Next(-3, 4), 753, 5, 2f, Main.myPlayer); } else { int side1 = Main.rand.Next(4) <= 1 ? 3 : -3; Projectile.NewProjectile(p.Center.X, p.Center.Y, Main.rand.Next(-3, 4), side1, 753, 5, 2f, Main.myPlayer); } } } if (p.type == 769 || p.type == 770 || p.type == 816) { bool flag = false; int whoIsIt = -1; for (int i = 0; i < 200; i++) { if (Main.npc[i].getRect().Intersects(p.getRect())) { flag = true; whoIsIt = i; } } if (flag && whoIsIt != -1) { Projectile.NewProjectile(p.Center.X, p.Center.Y, 0f, 0f, 776, 4, 0f, Main.myPlayer, whoIsIt, Main.npc[whoIsIt].rotation); } int amount = 10; if (p.type == 770) { amount = 3; } for (int d = 0; d < amount; d++) { Dust.NewDust(p.Center, 6, 6, 135, 0f, 0f, 100, default(Color), 1f); } } if (p.type == 766) { Main.PlaySound(2, (int)p.position.X, (int)p.position.Y, 14); for (int num526 = 0; num526 < 300; num526++) { float num527 = 12f; int num528 = 60; if (num526 < 200) { num528 = 66; num527 = 8f; } if (num526 < 100) { num528 = 56; num527 = 4f; } int num529 = Dust.NewDust(new Vector2(p.position.X, p.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; } p.position.X = p.position.X + (float)(p.width / 2); p.position.Y = p.position.Y + (float)(p.height / 2); p.width = 144; p.height = 144; p.position.X = p.position.X - (float)(p.width / 2); p.position.Y = p.position.Y - (float)(p.height / 2); p.penetrate = -1; p.Damage(); } if (p.type == 774 || p.type == 775) { int amount = p.type == 774 ? 30 : 3; for (int num665 = 0; num665 < amount; num665++) { Dust.NewDust(new Vector2(p.position.X, p.position.Y), p.width, p.height, 76, 0f, 0f, 0, default(Color), 1f); } if (p.type == 774) { int rand = Main.rand.Next(14, 26); for (int i = 0; i < rand; i++) { if (Main.rand.Next(2) == 0) { int side = Main.rand.Next(4) <= 1 ? 5 : -5; Projectile.NewProjectile(p.Center.X, p.Center.Y, side, Main.rand.Next(-5, 6), 775, 17, 2f, Main.myPlayer); } else { int side1 = Main.rand.Next(4) <= 1 ? 5 : -5; Projectile.NewProjectile(p.Center.X, p.Center.Y, Main.rand.Next(-5, 6), side1, 775, 17, 2f, Main.myPlayer); } } } } if (p.type == 756) { Main.PlaySound(13, (int)p.position.X, (int)p.position.Y, 1); for (int num665 = 0; num665 < 5; num665++) { Dust.NewDust(new Vector2(p.position.X, p.position.Y), p.width, p.height, 13, 0f, 0f, 0, default(Color), 1f); } for (int num666 = 0; num666 < 30; num666++) { int num667 = Dust.NewDust(new Vector2(p.position.X, p.position.Y), p.width, p.height, 135, 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; } } if (p.type == 752) { bool friendly = p.ai[8] == 0f ? true : false; bool hostile = p.ai[8] == 1f ? true : false; int rand = Main.rand.Next(1, 4); for (int i = 0; i < rand; i++) { if (Main.rand.Next(2) == 0) { int side = Main.rand.Next(4) <= 1 ? 3 : -3; int proj = Projectile.NewProjectile(p.Center.X, p.Center.Y, side, Main.rand.Next(-3, 4), 753, 38, 2f, Main.myPlayer); Main.projectile[proj].friendly = friendly; Main.projectile[proj].hostile = hostile; Main.projectile[proj].timeLeft = 120; } else { int side1 = Main.rand.Next(4) <= 1 ? 3 : -3; int proj = Projectile.NewProjectile(p.Center.X, p.Center.Y, Main.rand.Next(-3, 4), side1, 753, 38, 2f, Main.myPlayer); Main.projectile[proj].friendly = friendly; Main.projectile[proj].hostile = hostile; Main.projectile[proj].timeLeft = 120; } } } if (p.type == 750) { for (int i = 0; i < 4; i++) { if (Main.rand.Next(2) == 0) { int side = Main.rand.Next(4) <= 1 ? 6 : -6; Projectile.NewProjectile(p.Center.X, p.Center.Y, side, Main.rand.Next(-6, 7), 751, 29, 2f, Main.myPlayer); } else { int side1 = Main.rand.Next(4) <= 1 ? 6 : -6; Projectile.NewProjectile(p.Center.X, p.Center.Y, Main.rand.Next(-6, 7), side1, 751, 29, 2f, Main.myPlayer); } } for (int o = 0; o < 18; o++) { Dust.NewDust(p.Center, p.width, p.height, 279, Main.rand.Next(-2, 3), Main.rand.Next(-2, 3)); } } if (p.type == 700) { for (int i = 0; i < 8; i++) { Projectile.NewProjectile(p.Center.X, p.Center.Y, Main.rand.Next(-8, 9), Main.rand.Next(-8, 9), 701, 101, 6f, Main.myPlayer); } for (int o = 0; o < 18; o++) { Dust.NewDust(p.Center, p.width, p.height, 212, Main.rand.Next(-2, 3), Main.rand.Next(-2, 3)); } } if (p.type == 702) { for (int i = 0; i < 13; i++) { Dust.NewDust(p.Center, p.width, p.height, 169, Main.rand.Next(-2, 3), Main.rand.Next(-2, 3)); } } if (p.type == 706) { for (int i = 0; i < 6; i++) { Dust.NewDust(p.Center, p.width, p.height, 255, Main.rand.Next(-1, 2), Main.rand.Next(-1, 2)); } } if (p.type == 707) { for (int i = 0; i < 7; i++) { Dust.NewDust(p.Center, p.width, p.height, 207, Main.rand.Next(-1, 2), Main.rand.Next(-1, 2)); } } if (p.type == 717 || p.type == 716) { for (int i = 0; i < 5; i++) { Dust.NewDust(p.Center, p.width, p.height, 174, Main.rand.Next(-1, 2), Main.rand.Next(-1, 2)); } } if (p.type == 718) { if (!p.noDropItem) { for (int i = 0; i < 3; i++) { Dust.NewDust(p.Center, p.width, p.height, 214, Main.rand.Next(-1, 2), Main.rand.Next(-1, 2)); } int ra = Main.rand.Next(10); if (ra <= 8) { Item.NewItem((int)p.Center.X, (int)p.Center.Y, 20, 20, 27); } } } if (p.type == 720) { for (int i = 0; i < 3; i++) { float xSp = 0; float ySp = 0; if (Main.rand.Next(2) == 0) { xSp = 5; ySp = Main.rand.Next(-5, 6); } else { ySp = 5; xSp = Main.rand.Next(-5, 6); } Projectile.NewProjectile(p.Center.X, p.Center.Y, xSp, ySp, 721 + i, 9, 1f, Main.myPlayer); } } if (p.type == 725) { for (int i = 0; i < 10; i++) { int d = Dust.NewDust(p.Center, p.width, p.height, 21); Main.dust[d].noGravity = true; } } if (p.type == 727) { int num503 = Gore.NewGore(new Vector2(p.position.X, p.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num503].velocity *= 0.4f; Gore g = Main.gore[num503]; g.velocity.X = g.velocity.X + (float)Main.rand.Next(-10, 11) * 0.1f; Gore g2 = Main.gore[num503]; g2.velocity.Y = g2.velocity.Y + (float)Main.rand.Next(-10, 11) * 0.1f; num503 = Gore.NewGore(new Vector2(p.position.X, p.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[num503].velocity *= 0.4f; Gore g3 = Main.gore[num503]; g3.velocity.X = g3.velocity.X + (float)Main.rand.Next(-10, 11) * 0.1f; Gore g4 = Main.gore[num503]; g4.velocity.Y = g4.velocity.Y + (float)Main.rand.Next(-10, 11) * 0.1f; if (p.owner == Main.myPlayer) { p.penetrate = -1; p.position.X = p.position.X + (float)(p.width / 2); p.position.Y = p.position.Y + (float)(p.height / 2); p.width = 96; p.height = 96; p.position.X = p.position.X - (float)(p.width / 2); p.position.Y = p.position.Y - (float)(p.height / 2); p.Damage(); } } }
public static void ProjectileAiStyles(Projectile p, int aiStyle) { if (p.aiStyle == 125) { if (p.type != 656) { if (p.type == 653) { for (int num92 = 0; num92 < 5; num92++) { float num93 = p.velocity.X / 3f * (float)num92; float num94 = p.velocity.Y / 3f * (float)num92; int num95 = 4; int num96 = Dust.NewDust(new Vector2(p.position.X + (float)num95, p.position.Y + (float)num95), p.width - num95 * 2, p.height - num95 * 2, 6, 0f, 0f, 100, default(Color), 1.2f); Main.dust[num96].noGravity = true; Main.dust[num96].velocity *= 0.1f; Main.dust[num96].velocity += p.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(p.position.X + (float)num97, p.position.Y + (float)num97), p.width - num97 * 2, p.height - num97 * 2, 6, 0f, 0f, 100, default(Color), 0.6f); Main.dust[num98].velocity *= 0.25f; Main.dust[num98].velocity += p.velocity * 0.5f; } } if (p.ai[0] < 45f && p.ai[1] == 0) { p.ai[0] += 1f; } else if (p.ai[0] == 45f && p.ai[1] == 0) { p.Kill(); } else if (p.ai[1] == 1f) { p.velocity *= 1.4f; p.ai[1]++; } else if (p.ai[1] >= 1f && p.ai[1] < 40f) { p.ai[1]++; } if (p.ai[1] >= 10f) { p.Kill(); } } else { for (int num92 = 0; num92 < 5; num92++) { float num93 = p.velocity.X / 3f * (float)num92; float num94 = p.velocity.Y / 3f * (float)num92; int num95 = 4; int num96 = Dust.NewDust(new Vector2(p.position.X + (float)num95, p.position.Y + (float)num95), p.width - num95 * 2, p.height - num95 * 2, 180, 0f, 0f, 100, default(Color), 1.2f); Main.dust[num96].noGravity = true; Main.dust[num96].velocity *= 0.1f; Main.dust[num96].velocity += p.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(p.position.X + (float)num97, p.position.Y + (float)num97), p.width - num97 * 2, p.height - num97 * 2, 180, 0f, 0f, 100, default(Color), 0.6f); Main.dust[num98].velocity *= 0.25f; Main.dust[num98].velocity += p.velocity * 0.5f; } p.ai[0]++; if (p.ai[0] < 90) { float sp = 8f; Vector2 pos = Main.player[Main.myPlayer].Center - p.Center; float mag = (float)Math.Sqrt(pos.X * pos.X + pos.Y * pos.Y); if (mag > sp) { pos *= mag / sp; } p.velocity = pos; } else { p.velocity *= 1.02f; } } } else if (p.aiStyle == 126) { if (p.type == 659) { p.ai[0]++; if (p.ai[0] < 30f && p.ai[1] == 0f) { for (int i = 0; i < 2; i++) { int dust = Dust.NewDust(p.position, p.width, p.height, 135, p.velocity.X, p.velocity.Y); Main.dust[dust].noGravity = true; } } else { if (p.ai[2] == 10f && p.ai[1] == 0f) { p.Kill(); } if (p.ai[1] == 1f) { p.position.X = p.position.X + (float)(p.width / 2); p.position.Y = p.position.Y + (float)(p.height / 2); p.width = 1024; p.height = 128; p.position.X = p.position.X - (float)(p.width / 2); p.position.Y = p.position.Y - (float)(p.height / 2); p.damage = 45; p.knockBack = 16f; p.ai[2] = 10f; } else { p.Kill(); } } } else if (p.type == 660) { p.rotation += MathHelper.ToRadians(54f); for (int i = 0; i < 5; i++) { int dust = Dust.NewDust(p.position, p.width, p.height, 41, p.velocity.X, p.velocity.Y); Main.dust[dust].noGravity = true; } } } else if (p.aiStyle == 127) { p.ai[0]++; if (p.ai[0] > 15) { if (p.type != 669) { p.velocity *= 0.96f; } else { p.velocity *= 0.975f; } } p.spriteDirection = p.direction; if (p.direction < 0) { p.rotation = (float)Math.Atan2((double)(-(double)p.velocity.Y), (double)(-(double)p.velocity.X)); } else { p.rotation = (float)Math.Atan2((double)p.velocity.Y, (double)p.velocity.X); } p.frameCounter++; if (p.frameCounter > 4) { p.frame++; p.frameCounter = 0; } if (p.frame > 3) { p.frame = 0; return; } } else if (p.aiStyle == 128) { if (p.type == 678) { p.ai[0]++; if (p.ai[0] == 1) { int d = Dust.NewDust(p.position, 14, 14, 197, 0f, 0f, 0); Main.dust[d].velocity = new Vector2(0f, 0f); Main.dust[d].noGravity = true; p.ai[0] = -2f; } } else if (p.type == 680) { p.rotation = (float)Math.Atan2(p.velocity.Y, p.velocity.X); for (int i = 0; i < 2; i++) { int d = Dust.NewDust(p.position, p.width, p.height, 271, 0f, 0f, 0); Main.dust[d].noGravity = true; Main.dust[d].velocity = new Vector2(0f, 0f); } } else if (p.type == 681) { p.ai[0]++; if (p.ai[0] < 320) { float speed = (float)((2 * Math.PI) / 60); float radius = 50; p.circularAngle += speed; p.position.X = (float)Math.Cos(p.circularAngle) * radius + Main.npc[(int)p.ai[1]].Center.X; p.position.Y = (float)Math.Sin(p.circularAngle) * radius + Main.npc[(int)p.ai[1]].Center.Y; for (int i = 0; i < 4; i++) { int d = Dust.NewDust(p.position, 12, 12, 252, 0f, 0f); Main.dust[d].noGravity = true; } if (Main.npc[(int)p.ai[1]].life <= 0) { p.Kill(); } } else { p.Kill(); } } else if (p.type >= 682 && p.type <= 684 || p.type == 745) { p.rotation = (float)Math.Atan2(p.velocity.Y, p.velocity.X); } else if (p.type == 685) { p.ai[5]++; if (p.ai[5] < 900) { p.Center = new Vector2(Main.npc[(int)p.ai[1]].Center.X, Main.npc[(int)p.ai[1]].Center.Y); Vector2 thing = p.Center - new Vector2(Main.player[Main.npc[(int)p.ai[1]].target].Center.X, Main.player[Main.npc[(int)p.ai[1]].target].Center.Y); float toBeRotation = (float)Math.Atan2(thing.Y, thing.X); p.rotation = Ulterraria.CurveAngle(p.rotation, toBeRotation, 0.06f); p.ai[0]++; if (p.ai[0] == 10) { Vector2 newVelocity = new Vector2((float)Math.Cos(p.rotation), (float)Math.Sin(p.rotation)); newVelocity *= 9f; int proj = Projectile.NewProjectile(p.Center.X, p.Center.Y, -newVelocity.X, -newVelocity.Y, 14, 40, 1f, Main.myPlayer); Main.projectile[proj].hostile = true; Main.projectile[proj].friendly = false; p.ai[0] = 0; } if (Main.npc[(int)p.ai[1]].life <= 0 || !Main.npc[(int)p.ai[1]].active) { p.Kill(); } } else { if (p.ai[5] == 900) { p.ai[4] = Main.rand.Next(2); } else { p.velocity.Y *= 1.008f; ; p.tileCollide = true; p.rotation += (p.ai[4] == 0 ? MathHelper.ToDegrees(0.5f) : MathHelper.ToDegrees(-0.5f)); } } } } else if (p.aiStyle == 129) { for (int q = 0; q < Main.projectile.Length; q++) { if (Main.projectile[q].type == 690 && q != p.whoAmI) { Main.projectile[q].Kill(); } } int s = p.type == 686 ? 120 : p.type == 690 ? 45 : 90; if (p.type == 844) { s = 20; } float speed = (float)((2 * Math.PI) / s); float radius = 40; if (p.type == 844) { radius = 140; } p.circularAngle += speed; p.position.X = (float)Math.Cos(p.circularAngle) * radius + Main.player[Main.myPlayer].Center.X - 10; p.position.Y = (float)Math.Sin(p.circularAngle) * radius + Main.player[Main.myPlayer].Center.Y - 10; for (int i = 0; i < 8; i++) { int d = 0; if (p.type == 686) d = Dust.NewDust(p.position, 16, 16, 6, 0f, 0f); else if (p.type == 687) d = Dust.NewDust(p.position, 16, 16, 135, 0f, 0f); else if (p.type == 690) d = Dust.NewDust(p.position, 16, 16, 227, 0f, 0f); else if (p.type == 844) d = Dust.NewDust(p.position, 16, 16, 143, 0f, 0f); Main.dust[d].noGravity = true; } } else if (p.aiStyle == 130) { if (p.ai[0] == 0) { int waterX = 0, waterY = 0; int target = 400; bool electrocute = false; p.dest = new Vector2((float)Main.mouseX + Main.screenPosition.X, (float)Main.mouseY + Main.screenPosition.Y); int mainA = (int)(Vector2.Distance(Main.player[Main.myPlayer].Center, p.dest) / 34); int secA = mainA - 11; if (mainA < 4) mainA = 4; if (secA < 4) secA = 4; p.mainArc = new Vector2[mainA]; p.secondaryArc = new Vector2[secA][]; for (int i = 0; i < p.secondaryArc.Length; i++) { p.secondaryArc[i] = new Vector2[8]; } p.velocity = Vector2.Zero; Vector2 v = p.dest; float radius = 220f; float close = radius; float lastClose = close; int lastTarget = target; #region Corners for (int i = 0; i < Main.npc.Length; i++) { if (Main.npc[i].friendly == false && Vector2.Distance(p.dest, Main.npc[i].Center) < radius) { lastClose = close; lastTarget = target; Vector2 v1 = new Vector2(Main.npc[i].position.X, Main.npc[i].position.Y); float len = (v1 - v).Length(); if (len <= radius && len < close) { close = len; target = i; } v1.Y += (float)Main.npc[i].height; len = (v1 - v).Length(); if (len <= radius && len < close) { close = len; target = i; } v.X += (float)Main.npc[i].width; len = (v1 - v).Length(); if (len <= radius && len < close) { close = len; target = i; } v.Y -= (float)Main.npc[i].height; len = (v1 - v).Length(); if (len <= radius && len < close) { close = len; target = i; } break; } } #endregion if (target < Main.npc.Length && Main.npc[target].active) { v.X = Main.npc[target].position.X + (float)(Main.npc[target].width >> 1) - p.position.X + (float)(p.width >> 1); v.Y = Main.npc[target].position.Y + (float)(Main.npc[target].height >> 1) - p.position.Y + (float)(p.height >> 1); } else { target = Main.npc.Length + 1; v.X = p.dest.X - p.position.X + (float)(p.width >> 1); v.Y = p.dest.Y - p.position.Y + (float)(p.height >> 1); } Vector2 nrm = Vector2.Normalize(v); Vector2 dir = Vector2.Normalize(Vector2.Normalize(new Vector2(Main.rand.Next(-100, 100) / 100f, Main.rand.Next(-100, 100) / 100f)) / 6f + nrm); float increment = v.Length() / 3f; p.mainArc[0] = new Vector2(p.position.X + (float)(p.height >> 1), p.position.Y + (float)(p.width >> 1)); for (int i = 1; i < p.mainArc.Length; i++) { dir = Vector2.Normalize(dir + nrm); p.mainArc[i] = Vector2.Normalize(dir + Vector2.Normalize(new Vector2(Main.rand.Next(-100, 100) / 120f, Main.rand.Next(-100, 100) / 120f)) * 0.35f) * (increment / (float)i + 1f) + p.mainArc[i - 1]; } p.mainArc[p.mainArc.Length - 1] = v + p.position; #region tiles for (int i = 0; i < p.mainArc.Length - 1; i++) { bool exit = false; dir = p.mainArc[i + 1] - p.mainArc[i]; float maxLen = dir.Length(); dir.Normalize(); float tileLen = 0f; int startX = (int)p.mainArc[i].X >> 4; int startY = (int)p.mainArc[i].Y >> 4; while (tileLen < maxLen && !exit) { tileLen += 16f; int tileX = (int)(dir.X * tileLen / 16f) + startX; int tileY = (int)(dir.Y * tileLen / 16f) + startY; if (!electrocute) { if (Main.tile[tileX, tileY].liquid > 0 && !Main.tile[tileX, tileY].lava()) { electrocute = true; waterX = tileX; waterY = tileY; } } if (Main.tile[tileX, tileY].active() && Main.tile[tileX, tileY] != null) { if (Main.tileSolid[Main.tile[tileX, tileY].type] && !Main.tileSolidTop[Main.tile[tileX, tileY].type]) { p.mainArc[i + 1].X = (float)(tileX * 16 + 8); p.mainArc[i + 1].Y = (float)(tileY * 16 + 8); exit = true; } } if (exit) { target = Main.npc.Length + 1; for (int n = 1; n < p.mainArc.Length - 1; n++) { if (n > i + 1) { p.mainArc[n] = default(Vector2); } } } } } #endregion int b = 0; increment *= 0.45f; while (b < p.secondaryArc.Length) { for (int i = 1; i < p.mainArc.Length - 1; i++) { // create branch arc if (b < p.secondaryArc.Length && Main.rand.Next(i) > 0) { if (p.mainArc[i] != default(Vector2)) { // set starting point of branch arc p.secondaryArc[b][0] = p.mainArc[i]; // varset dir = Vector2.Normalize(Vector2.Normalize(Vector2.Normalize(new Vector2(Main.rand.Next(-100, 100) / 100f, Main.rand.Next(-100, 100) / 100f))) + nrm); for (int n = 1; n < p.secondaryArc[b].Length; n++) { dir = Vector2.Normalize(dir + nrm / 2f); p.secondaryArc[b][n] = Vector2.Normalize(dir + Vector2.Normalize(Vector2.Normalize(Vector2.Normalize(new Vector2(Main.rand.Next(-100, 100) / 100f, Main.rand.Next(-100, 100) / 100f))))) * (increment / (float)n + 1.25f) + p.secondaryArc[b][n - 1]; } } b++; } } } for (b = 0; b < p.secondaryArc.Length; b++) { for (int i = 0; i < p.secondaryArc[b].Length - 1; i++) { bool exit = false; dir = p.secondaryArc[b][i + 1] - p.secondaryArc[b][i]; float maxLen = dir.Length(); dir.Normalize(); float tileLen = 0f; int startX = (int)p.secondaryArc[b][i].X >> 4; int startY = (int)p.secondaryArc[b][i].Y >> 4; while (tileLen < maxLen && !exit) { tileLen += 16f; int tileX = (int)(dir.X * tileLen / 16f) + startX; int tileY = (int)(dir.Y * tileLen / 16f) + startY; if (Main.tile[tileX, tileY].active() && Main.tile[tileX, tileY] != null) { if (Main.tileSolid[Main.tile[tileX, tileY].type] && !Main.tileSolidTop[Main.tile[tileX, tileY].type]) { p.secondaryArc[b][i + 1].X = (float)(tileX * 16 + 8); p.secondaryArc[b][i + 1].Y = (float)(tileY * 16 + 8); exit = true; } } if (exit) { // break all successive links in the chain for (int n = 1; n < p.secondaryArc[b].Length - 1; n++) { if (n > i + 1) { p.secondaryArc[b][n] = default(Vector2); } } } } } } for (int i = 0; i < p.mainArc.Length - 1; i++) { if (p.mainArc[i + 1] != default(Vector2)) { Microsoft.Xna.Framework.Point p1 = new Microsoft.Xna.Framework.Point((int)p.mainArc[i].X, (int)p.mainArc[i].Y); Microsoft.Xna.Framework.Point p2 = new Microsoft.Xna.Framework.Point((int)p.mainArc[i + 1].X, (int)p.mainArc[i + 1].Y); for (int n = 0; n < Main.npc.Length; n++) { // enemies + guide&doll + animals if (!Main.npc[i].friendly) { Rectangle rect = new Rectangle((int)Main.npc[n].position.X, (int)Main.npc[n].position.Y, Main.npc[n].width, Main.npc[n].height); if (Ulterraria.LineIntersectsRect(p1, p2, rect)) { if (target < Main.npc.Length && n == target) { // full damage Ulterraria.DoArcHit(n, 1.0f, p); } else { // three-quarters damage Ulterraria.DoArcHit(n, 0.75f, p); } } } } } } for (b = 0; b < p.secondaryArc.Length; b++) { for (int i = 0; i < p.secondaryArc[b].Length - 1; i++) { if (p.secondaryArc[b][i + 1] != default(Vector2)) { Microsoft.Xna.Framework.Point p1 = new Microsoft.Xna.Framework.Point((int)p.secondaryArc[b][i].X, (int)p.secondaryArc[b][i].Y); Microsoft.Xna.Framework.Point p2 = new Microsoft.Xna.Framework.Point((int)p.secondaryArc[b][i + 1].X, (int)p.secondaryArc[b][i + 1].Y); for (int n = 0; n < Main.npc.Length; n++) { if (!Main.npc[i].friendly) { Rectangle rect = new Rectangle((int)Main.npc[n].position.X, (int)Main.npc[n].position.Y, Main.npc[n].width, Main.npc[n].height); if (Ulterraria.LineIntersectsRect(p1, p2, rect)) { // half damage Ulterraria.DoArcHit(n, 0.5f, p); } } } } } } if (electrocute) { int windowSize = 512 + (p.soundDelay << 2); float centerX = (float)(waterX << 4) + 8f; float centerY = (float)(waterY << 4) + 8f; Rectangle window = new Rectangle((int)centerX - (windowSize >> 1), (int)centerY - (windowSize >> 1), windowSize, windowSize); for (int i = 0; i < Main.npc.Length; i++) { if (!Main.npc[i].friendly) { if (Main.npc[i].wet && !Main.npc[i].lavaWet) { if (window.Intersects(new Rectangle((int)Main.npc[i].position.X, (int)Main.npc[i].position.Y, Main.npc[i].width, Main.npc[i].height))) { if (Collision.CanHit(new Vector2(centerX, centerY), 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height)) { bool crit = Main.rand.Next(1, 101) <= Main.player[p.owner].magicCrit; int dmg = Main.DamageVar(((float)(15 + p.soundDelay + Main.rand.Next(p.timeLeft)) * (((float)windowSize - (Main.npc[i].position - new Vector2(centerX, centerY)).Length()) / (float)windowSize))); Main.npc[i].StrikeNPC(dmg, 0f, 0, crit, true); Main.npc[i].immune[p.owner] = Main.rand.Next(5, 10); } } } } } if (Main.myPlayer == Main.player[p.owner].whoAmI) { if (!Main.player[p.owner].immune && Main.player[p.owner].wet && !Main.player[p.owner].lavaWet) { if (window.Intersects(new Rectangle((int)Main.player[p.owner].position.X, (int)Main.player[p.owner].position.Y, Main.player[p.owner].width, Main.player[p.owner].height))) { if (Collision.CanHit(new Vector2(centerX, centerY), 1, 1, Main.player[p.owner].position, Main.player[p.owner].width, Main.player[p.owner].height)) { bool crit = Main.rand.Next(1, 101) <= Main.player[p.owner].magicCrit; int dmg = Main.DamageVar(((float)(15 + p.soundDelay + Main.rand.Next(p.timeLeft)) * (((float)windowSize - (Main.player[p.owner].position - new Vector2(centerX, centerY)).Length()) / (float)windowSize))); bool kb = Main.player[p.owner].noKnockback; Main.player[p.owner].noKnockback = true; Main.player[p.owner].Hurt(dmg, Main.player[p.owner].direction, false, false, " electrocuted themself...", crit); Main.player[p.owner].immuneTime = Main.rand.Next(5, 10); Main.player[p.owner].noKnockback = kb; } } } } } p.penetrate = 20; p.damage = 0; } p.ai[0]++; } else if (p.aiStyle == 131) { p.ai[0]++; if (p.ai[0] > 10) { float num472 = p.Center.X; float num473 = p.Center.Y; float num474 = 400f; bool flag17 = false; for (int num475 = 0; num475 < 200; num475++) { if (Main.npc[num475].CanBeChasedBy(p, false) && Collision.CanHit(p.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(p.position.X + (float)(p.width / 2) - num476) + Math.Abs(p.position.Y + (float)(p.height / 2) - num477); if (num478 < num474) { num474 = num478; num472 = num476; num473 = num477; flag17 = true; } } } if (flag17) { float num483 = 8f; Vector2 vector35 = new Vector2(p.position.X + (float)p.width * 0.5f, p.position.Y + (float)p.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; p.velocity.X = (p.velocity.X * 20f + num484) / 21f; p.velocity.Y = (p.velocity.Y * 20f + num485) / 21f; } } if (p.ai[0] > 120) { p.Kill(); } p.rotation = (float)Math.Atan2(p.velocity.Y, p.velocity.X) + (float)(Math.PI / 2); } else if (p.aiStyle == 132) { p.velocity *= 0.95f; p.ai[0] += 1f; if (p.ai[0] == 180f) { p.Kill(); } if (p.ai[1] == 0f) { p.ai[1] = 1f; for (int num62 = 0; num62 < 30; num62++) { int du = Dust.NewDust(p.position, p.width, p.height, 152 + Main.rand.Next(0, 2), p.velocity.X, p.velocity.Y, 50, default(Color), 1f); } } int num63 = (int)(p.position.X / 16f) - 1; int num64 = (int)((p.position.X + (float)p.width) / 16f) + 2; int num65 = (int)(p.position.Y / 16f) - 1; int num66 = (int)((p.position.Y + (float)p. 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 (p.position.X + (float)p.width > vector5.X && p.position.X < vector5.X + 16f && p.position.Y + (float)p.height > vector5.Y && p.position.Y < vector5.Y + 16f && Main.myPlayer == p.owner && !Main.tile[num67, num68].active()) { if (Main.tile[num67, num68] == null) { Main.tile[num67, num68] = new Tile(); } if (Main.tile[num67, num68 + 1] == null) { Main.tile[num67, num68 + 1] = new Tile(); } if (Main.tile[num67, num68].type != 3 || Main.tile[num67, num68].type != 73 || Main.tile[num67, num68].type != 110 || Main.tile[num67, num68].type != 113 || Main.tile[num67, num68].type != 74) { if (!Main.tile[num67, num68].active() && Main.tile[num67, num68].liquid == 0 && Main.tile[num67, num68 + 1] != null && WorldGen.SolidTile(num67, num68 + 1)) { Main.tile[num67, num68].frameY = 0; Main.tile[num67, num68].slope(0); Main.tile[num67, num68].halfBrick(false); if (Main.tile[num67, num68 + 1].type == 2) { if (Main.rand.Next(2) == 0) { Main.tile[num67, num68].active(true); Main.tile[num67, num68].type = 3; Main.tile[num67, num68].frameX = (short)(18 * Main.rand.Next(6, 11)); while (Main.tile[num67, num68].frameX == 144) { Main.tile[num67, num68].frameX = (short)(18 * Main.rand.Next(6, 11)); } } else { Main.tile[num67, num68].active(true); Main.tile[num67, num68].type = 73; Main.tile[num67, num68].frameX = (short)(18 * Main.rand.Next(6, 21)); while (Main.tile[num67, num68].frameX == 144) { Main.tile[num67, num68].frameX = (short)(18 * Main.rand.Next(6, 21)); } } if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num67, num68, 1); } } else if (Main.tile[num67, num68 + 1].type == 109) { if (Main.rand.Next(2) == 0) { Main.tile[num67, num68].active(true); Main.tile[num67, num68].type = 110; Main.tile[num67, num68].frameX = (short)(18 * Main.rand.Next(4, 7)); while (Main.tile[num67, num68].frameX == 90) { Main.tile[num67, num68].frameX = (short)(18 * Main.rand.Next(4, 7)); } } else { Main.tile[num67, num68].active(true); Main.tile[num67, num68].type = 113; Main.tile[num67, num68].frameX = (short)(18 * Main.rand.Next(2, 8)); while (Main.tile[num67, num68].frameX == 90) { Main.tile[num67, num68].frameX = (short)(18 * Main.rand.Next(2, 8)); } } if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num67, num68, 1); } } else if (Main.tile[num67, num68 + 1].type == 60) { Main.tile[num67, num68].active(true); Main.tile[num67, num68].type = 74; Main.tile[num67, num68].frameX = (short)(18 * Main.rand.Next(9, 17)); if (Main.netMode == 1) { NetMessage.SendTileSquare(-1, num67, num68, 1); } } p.Kill(); } } } } } } else if (p.aiStyle == 133) { if (p.ai[0] == 0 && p.type == 697) { for (int e = 0; e < Main.projectile.Length; e++) { if (Main.projectile[e].type == 698) { Main.projectile[e].Kill(); } } Vector2[] circularPositions = new Vector2[60]; for (int i = 0; i < 60; i++) { p.circularAngle += (float)((2 * Math.PI) / 60); circularPositions[i] = new Vector2((float)Math.Cos(p.circularAngle) * 120 + Main.player[Main.myPlayer].Center.X - 10, (float)Math.Sin(p.circularAngle) * 120 + Main.player[Main.myPlayer].Center.Y - 10); } foreach (Vector2 Cen in circularPositions) { Projectile.NewProjectile(Cen.X, Cen.Y, 0f, 0f, 698, 48, 10f, Main.myPlayer); } } else if (p.type == 697) { p.Kill(); } p.ai[0]++; if (p.type == 698) { if (p.ai[0] < 3600) { for (int l = 0; l < 2; l++) { int n = Dust.NewDust(p.Center, p.width, p.height, 75, 0f, 0f, 100, default(Color), 1f); Main.dust[n].noGravity = true; } } else { p.Kill(); } } } else if (p.aiStyle == 134) { p.velocity.Y += 0.04f; p.rotation = (float)Math.Atan2((double)p.velocity.Y, (double)p.velocity.X); } else if (p.aiStyle == 135) { p.frameCounter++; if (p.frameCounter > 5) { p.frame++; p.frameCounter = 0; } if (p.frame > 3) { p.frame = 0; } p.rotation = (float)Math.Atan2((double)p.velocity.Y, (double)p.velocity.X); p.rotation += (float)(Math.PI / 2); if (p.type == 700) { p.ai[0]++; if (p.ai[0] > 94) { p.alpha += 10; if (p.alpha > 255) { p.Kill(); } } if (p.ai[0] % 10 == 0) { float amount = MathHelper.ToRadians(Main.rand.Next(-360, 361)); Vector2 newVelocity = new Vector2((float)Math.Cos(p.rotation + amount), (float)Math.Sin(p.rotation + amount)); newVelocity *= 9f; Projectile.NewProjectile(p.Center.X, p.Center.Y, -newVelocity.X, -newVelocity.Y, 701, 78, 2f, Main.myPlayer); } } else if (p.type == 701) { p.ai[0]++; if (p.ai[0] > 94) { p.alpha += 10; if (p.alpha > 255) { p.Kill(); } } } } else if (p.aiStyle == 136) { p.frameCounter++; if (p.frameCounter > 5) { p.frame++; p.frameCounter = 0; } if (p.frame > 3) { p.frame = 0; } p.rotation = (float)Math.Atan2(p.velocity.Y, p.velocity.X); p.alpha += 9; if (p.alpha > 255) { p.Kill(); } } else if (p.aiStyle == 137) { p.frameCounter++; if (p.frameCounter > 4) { p.frame++; p.frameCounter = 0; } if (p.frame > 1) { p.frame = 0; } p.rotation = (float)Math.Atan2(p.velocity.Y, p.velocity.X); float num472 = p.Center.X; float num473 = p.Center.Y; float num474 = 400f; bool flag17 = false; for (int num475 = 0; num475 < 200; num475++) { if (Main.npc[num475].CanBeChasedBy(p, false) && Collision.CanHit(p.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(p.position.X + (float)(p.width / 2) - num476) + Math.Abs(p.position.Y + (float)(p.height / 2) - num477); if (num478 < num474) { num474 = num478; num472 = num476; num473 = num477; flag17 = true; } } } if (flag17) { float num483 = 8f; Vector2 vector35 = new Vector2(p.position.X + (float)p.width * 0.5f, p.position.Y + (float)p.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; p.velocity.X = (p.velocity.X * 20f + num484) / 21f; p.velocity.Y = (p.velocity.Y * 20f + num485) / 21f; return; } } else if (p.aiStyle == 138) { p.frameCounter++; if (p.frameCounter > 5) { p.frame++; p.frameCounter = 0; } if (p.frame >= Main.projFrames[p.type]) { p.frame = 0; return; } p.ai[1]++; if (p.ai[1] > 540) { p.alpha += 3; if (p.alpha > 255) { p.Kill(); } } } else if (p.aiStyle == 139) { p.frameCounter++; if (p.frameCounter > 5) { p.frame++; p.frameCounter = 0; } if (p.frame >= Main.projFrames[p.type]) { p.frame = 0; return; } p.rotation = (float)Math.Atan2(p.velocity.Y, p.velocity.X); p.rotation -= (float)(Math.PI / 2); p.ai[1]++; if (p.ai[1] > 140) { p.alpha += 2; if (p.alpha > 255) { p.Kill(); } } int dustType = Utils.SelectRandom<int>(Main.rand, new int[] { 242, 73, 72, 71, 255 }); if (p.type == 706) { dustType = Utils.SelectRandom<int>(Main.rand, new int[] { 242, 59, 88 }); } if (Main.rand.Next(12) == 0) { for (int num42 = 0; num42 < 1; num42++) { Vector2 value9 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)p.velocity.ToRotation(), default(Vector2)); int num43 = Dust.NewDust(p.position, p.width, p.height, 31, 0f, 0f, 100, default(Color), 1f); Main.dust[num43].velocity *= 0.1f; Main.dust[num43].position = p.Center + value9 * (float)p.width / 2f + p.velocity * 2f; Main.dust[num43].fadeIn = 0.9f; } } if (Main.rand.Next(64) == 0) { for (int num44 = 0; num44 < 1; num44++) { Vector2 value10 = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy((double)p.velocity.ToRotation(), default(Vector2)); int num45 = Dust.NewDust(p.position, p.width, p.height, 31, 0f, 0f, 155, default(Color), 0.8f); Main.dust[num45].velocity *= 0.3f; Main.dust[num45].position = p.Center + value10 * (float)p.width / 2f; if (Main.rand.Next(2) == 0) { Main.dust[num45].fadeIn = 1.4f; } } } if (Main.rand.Next(4) == 0) { for (int num46 = 0; num46 < 2; num46++) { Vector2 value11 = -Vector2.UnitX.RotatedByRandom(0.78539818525314331).RotatedBy((double)p.velocity.ToRotation(), default(Vector2)); int num47 = Dust.NewDust(p.position, p.width, p.height, dustType, 0f, 0f, 0, default(Color), 1.2f); Main.dust[num47].velocity *= 0.3f; Main.dust[num47].noGravity = true; Main.dust[num47].position = p.Center + value11 * (float)p.width / 2f; if (Main.rand.Next(2) == 0) { Main.dust[num47].fadeIn = 1.4f; } } } if (Main.rand.Next(12) == 0 && p.type == 634) { Vector2 value12 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)p.velocity.ToRotation(), default(Vector2)); int num48 = Dust.NewDust(p.position, p.width, p.height, dustType, 0f, 0f, 100, default(Color), 1f); Main.dust[num48].velocity *= 0.3f; Main.dust[num48].position = p.Center + value12 * (float)p.width / 2f; Main.dust[num48].fadeIn = 0.9f; Main.dust[num48].noGravity = true; } if (Main.rand.Next(3) == 0 && p.type == 635) { Vector2 value13 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)p.velocity.ToRotation(), default(Vector2)); int num49 = Dust.NewDust(p.position, p.width, p.height, dustType, 0f, 0f, 100, default(Color), 1f); Main.dust[num49].velocity *= 0.3f; Main.dust[num49].position = p.Center + value13 * (float)p.width / 2f; Main.dust[num49].fadeIn = 1.2f; Main.dust[num49].scale = 1.5f; Main.dust[num49].noGravity = true; } } else if (p.aiStyle == 140) { p.velocity.Y += 0.09f; p.rotation += 0.19703424f; for (int i = 0; i < 200; i++) { Rectangle r = new Rectangle((int)Main.npc[i].position.X, (int)Main.npc[i].position.Y, Main.npc[i].width, Main.npc[i].height); if (r.Intersects(new Rectangle((int)p.position.X, (int)p.position.Y, p.width, p.height))) { p.Center = Main.npc[i].Center; if (Main.npc[i].life <= 0) { p.Kill(); } } } } else if (p.aiStyle == 141) { if (p.type == 713) { for (int i = 0; i < 3; i++) { int d = Dust.NewDust(p.Center, 0, 0, 272 + Main.rand.Next(0, 7), 0f, 0f, 50, default(Color), 1.13f); Main.dust[d].noGravity = true; Main.dust[d].velocity = new Vector2(0f, 0f); } } else if (p.type == 714) { p.rotation = (float)Math.Atan2(p.velocity.Y, p.velocity.X); Lighting.AddLight(p.Center, new Vector3(0.384f, 0.081f, 0.687f)); } else if (p.type == 715) { p.rotation = (float)Math.Atan2(p.velocity.Y, p.velocity.X); Lighting.AddLight(p.Center, new Vector3(0.057f, 0.564f, 0.708f)); } else if (p.type == 716 || p.type == 717) { p.rotation = (float)Math.Atan2(p.velocity.Y, p.velocity.X); p.ai[0]++; if (p.ai[0] > 15) { p.Kill(); } } } else if (p.aiStyle == 142) { p.rotation = (float)Math.Atan2(p.velocity.Y, p.velocity.X) - (float)Math.PI / 2 - (float)Math.PI / 4; p.velocity.Y += 0.12f; } else if (p.aiStyle == 143) { if (Main.player[p.owner].dead) { p.Kill(); return; } Vector2 mountedCenter2 = Main.player[p.owner].MountedCenter + new Vector2(Main.player[p.owner].direction * 10, 3); Vector2 vector18 = new Vector2(p.position.X + (float)p.width * 0.5f, p.position.Y + (float)p.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 (p.ai[0] == 0f) { float num207 = 160f; p.tileCollide = true; if (num206 > num207) { p.ai[0] = 1f; p.netUpdate = true; } else if (!Main.player[p.owner].channel) { if (p.velocity.Y < 0f) { p.velocity.Y = p.velocity.Y * 0.9f; } p.velocity.Y = p.velocity.Y + 1f; p.velocity.X = p.velocity.X * 0.9f; } } else if (p.ai[0] == 1f) { float num208 = 14f / Main.player[p.owner].meleeSpeed; float num209 = 0.9f / Main.player[p.owner].meleeSpeed; float num210 = 300f; Math.Abs(num204); Math.Abs(num205); if (p.ai[1] == 1f) { p.tileCollide = false; } if (!Main.player[p.owner].channel || num206 > num210 || !p.tileCollide) { p.ai[1] = 1f; if (p.tileCollide) { p.netUpdate = true; } p.tileCollide = false; } if (!p.tileCollide) { num209 *= 2f; } int num211 = 60; if (num206 > (float)num211 || !p.tileCollide) { num206 = num208 / num206; num204 *= num206; num205 *= num206; new Vector2(p.velocity.X, p.velocity.Y); float num212 = num204 - p.velocity.X; float num213 = num205 - p.velocity.Y; float num214 = (float)Math.Sqrt((double)(num212 * num212 + num213 * num213)); num214 = num209 / num214; num212 *= num214; num213 *= num214; p.velocity.X = p.velocity.X * 0.98f; p.velocity.Y = p.velocity.Y * 0.98f; p.velocity.X = p.velocity.X + num212; p.velocity.Y = p.velocity.Y + num213; } else { if (Math.Abs(p.velocity.X) + Math.Abs(p.velocity.Y) < 6f) { p.velocity.X = p.velocity.X * 0.96f; p.velocity.Y = p.velocity.Y + 0.2f; } if (Main.player[p.owner].velocity.X == 0f) { p.velocity.X = p.velocity.X * 0.96f; } } } p.rotation = (float)Math.Atan2((double)num205, (double)num204) - p.velocity.X * 0.1f; if (p.velocity.X < 0f) { p.rotation -= (Math.Abs(p.velocity.X) + Math.Abs(p.velocity.Y)) * 0.01f; } else { p.rotation += (Math.Abs(p.velocity.X) + Math.Abs(p.velocity.Y)) * 0.01f; } } else if (p.aiStyle == 144) { p.rotation += (float)(Math.PI / 45); if (p.type != 725) { p.velocity.Y += 0.13f; } if (p.type == 725) { for (int i = 0; i < 4; i++) { int d = Dust.NewDust(p.Center, p.width, p.height, 21); Main.dust[d].noGravity = true; } } if (p.type == 739) { float num472 = p.Center.X; float num473 = p.Center.Y; float num474 = 400f; bool flag17 = false; for (int num475 = 0; num475 < 200; num475++) { if (Main.npc[num475].CanBeChasedBy(p, false) && Collision.CanHit(p.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(p.position.X + (float)(p.width / 2) - num476) + Math.Abs(p.position.Y + (float)(p.height / 2) - num477); if (num478 < num474) { num474 = num478; num472 = num476; num473 = num477; flag17 = true; } } } if (flag17) { float num483 = 8f; Vector2 vector35 = new Vector2(p.position.X + (float)p.width * 0.5f, p.position.Y + (float)p.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; p.velocity.X = (p.velocity.X * 20f + num484) / 21f; p.velocity.Y = (p.velocity.Y * 20f + num485) / 21f; return; } } } else if (p.aiStyle == 145) { if (p.type != 761) { p.rotation += (float)Math.PI / 90; p.velocity.Y += 0.125f; if (p.type == 751) { for (int i = 0; i < 2; i++) { int dus = Dust.NewDust(new Vector2(p.Center.X - 2, p.Center.Y - 2), 4, 4, 279); Main.dust[dus].noGravity = true; } } } else { p.frameCounter++; if (p.frameCounter > 6) { p.frame++; if (p.frame > 3) { p.frame = 0; } p.frameCounter = 0; } p.ai[0]++; if (p.ai[0] > 210) { p.alpha += 10; if (p.alpha > 255) { p.Kill(); } } } } else if (p.aiStyle == 146) { if (p.type == 774) { p.rotation += 0 + ((float)Math.Sqrt(Math.Pow(p.velocity.X, 2) * Math.Pow(p.velocity.Y, 2)) * 0.12f); p.velocity *= 0.98f; if ((p.velocity.X < 1f && p.velocity.X > -1f) && (p.velocity.Y < 1f && p.velocity.Y > -1f)) { p.ai[0]++; if (p.ai[0] > 30) { p.scale *= 0.96f; p.alpha += 15; if (p.alpha > 255) { p.ai[1]++; if (p.ai[1] > 20) { p.Kill(); for (int i = 0; i < 40; i++) { int side = Main.rand.Next(-12, 13); if (Main.rand.Next(0, 2) == 0) { Vector2 dustPos = p.Center + new Vector2(side, Main.rand.Next(-12, 13)); Vector2 speed = dustPos - p.Center; Dust.NewDust(dustPos, 1, 1, 76, speed.X, speed.Y); } else { Vector2 dustPos = p.Center + new Vector2(Main.rand.Next(-12, 13), side); Vector2 speed = dustPos - p.Center; Dust.NewDust(dustPos, 1, 1, 76, speed.X, speed.Y); } side = Main.rand.Next(-20, 21); if (Main.rand.Next(0, 2) == 0) { Vector2 dustPos = p.Center + new Vector2(side, Main.rand.Next(-20, 21)); Vector2 speed = dustPos - p.Center; Dust.NewDust(dustPos, 1, 1, 76, speed.X, speed.Y); } else { Vector2 dustPos = p.Center + new Vector2(Main.rand.Next(-20, 21), side); Vector2 speed = dustPos - p.Center; Dust.NewDust(dustPos, 1, 1, 76, speed.X, speed.Y); } } } } } } } if (p.type == 775) { p.velocity.Y += 0.115f; p.rotation = p.velocity.ToRotation(); p.frameCounter++; if (p.frameCounter > 7) { p.frameCounter = 0; p.frame++; if (p.frame > 2) { p.frame = 0; } } } if (p.type == 811) { p.rotation = p.velocity.ToRotation(); if (p.ai[0] >= 0) p.ai[0]++; if (p.ai[0] == 20) { p.ai[1] = p.velocity.X * -1; p.ai[2] = p.velocity.Y * -1; } if (p.ai[0] > 20) { p.velocity *= 0.975f; if (p.velocity.X < 0.3f && p.velocity.X > -0.3f && p.velocity.Y > -0.3f && p.velocity.Y < 0.3f) { p.velocity = new Vector2(p.ai[1], p.ai[2]); p.ai[0] = -200; } } p.frameCounter++; if (p.frameCounter > 7) { p.frameCounter = 0; p.frame++; if (p.frame > 2) { p.frame = 0; } } } } else if (p.aiStyle == 147) { p.rotation = p.velocity.ToRotation(); p.ai[1] += 1f; if (p.ai[1] > 4f) { int dustType = Utils.SelectRandom<int>(Main.rand, new int[] { 56, 60, 66 }); int num356 = Dust.NewDust(new Vector2(p.position.X + 2f, p.position.Y), 8, 8, dustType, p.velocity.X, p.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)p.rotation, p.Center); } float num472 = p.Center.X; float num473 = p.Center.Y; float num474 = 200f; bool flag17 = false; for (int num475 = 0; num475 < 200; num475++) { if (Main.npc[num475].CanBeChasedBy(p, false) && Collision.CanHit(p.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(p.position.X + (float)(p.width / 2) - num476) + Math.Abs(p.position.Y + (float)(p.height / 2) - num477); if (num478 < num474) { num474 = num478; num472 = num476; num473 = num477; flag17 = true; } } } if (flag17) { float num483 = 6f; Vector2 vector35 = new Vector2(p.position.X + (float)p.width * 0.5f, p.position.Y + (float)p.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; p.velocity.X = (p.velocity.X * 20f + num484) / 21f; p.velocity.Y = (p.velocity.Y * 20f + num485) / 21f; return; } } else if (p.aiStyle == 148) { if (p.type == 769) { p.rotation = p.velocity.ToRotation() + (float)(Math.PI / 2); return; } NPC npc = Main.npc[(int)p.ai[0]]; if (p.ai[2] == 0) { p.ai[2]++; Vector2 pos = p.Center - npc.Center; p.ai[3] = pos.X; p.ai[4] = pos.Y; } Vector2 position = npc.Center + new Vector2(p.ai[3], p.ai[4]); p.Center = position.RotatedBy(npc.rotation, npc.Center); if (!npc.active || npc.life <= 0) { p.Kill(); return; } } else if (p.aiStyle == 149) { if (p.type == 856) { p.ai[0]++; if (p.ai[0] % 40 == 0) { p.ai[1]++; p.ai[0] = 0; UlterrariaProjectiles.ExplosionEffect(p); p.width = 75; p.height = 75; p.position.X -= 37.5f; p.position.Y -= 37.5f; p.damage = 70; p.Damage(); p.width = 14; p.height = 20; p.position.X += 37.5f; p.position.Y += 37.5f; } if (p.ai[1] >= 3) { p.Kill(); } } //--------------- if (p.type == 843) { if (p.ai[0] == 0) { if (p.velocity.X > 0) { p.ai[0] = 0.005f; } else { p.ai[0] = -0.005f; } Vector2 position = p.Center - (p.Center + new Vector2(-2, 6)); p.ai[2] = position.X; p.ai[3] = position.Y; } p.ai[1] += p.ai[0]; p.rotation += p.ai[1]; p.ai[4]++; if (p.ai[4] > Main.rand.Next(120, 180)) { p.Kill(); } for (int i = 0; i < p.ai[0] * 100; i++) { Vector2 pos = p.Center + new Vector2(p.ai[2], p.ai[3]); Vector2 center = pos.RotatedBy(p.rotation, p.Center); int du = Dust.NewDust(center, 3, 2, 6, 0.1f, 0.1f); Main.dust[du].noGravity = true; } } //----------------- if (p.type == 842) { if (p.ai[0] == 0) { p.ai[0]++; p.velocity *= 1.2f; } p.rotation += p.velocity.X * 0.02f; } //---------------- if (p.type == 832) { p.frameCounter++; if (p.frameCounter > 6) { p.frameCounter = 0; p.frame++; if (p.frame > 5) { p.Kill(); } } } //----------------- if (p.type == 831) { if (p.ai[0] == 0) { p.ai[1] = p.velocity.X * 1.8f; p.ai[2] = p.velocity.Y * 1.8f; p.rotation = p.velocity.ToRotation() + ((float)(Math.PI / 4)); } p.ai[0]++; if (p.ai[0] < 30) { p.velocity *= 0.94f; } if (p.ai[0] == 30) { p.velocity = Vector2.Zero; } if (p.ai[0] > 60) { p.velocity = new Vector2(p.ai[1], p.ai[2]); p.rotation = p.velocity.ToRotation() + ((float)(Math.PI / 4)); } for (int i = 0; i < (int)(p.velocity.Length() / 2); i++) { int d = Dust.NewDust(p.Center, 0, 0, 107); Main.dust[d].noGravity = true; } } //----------------- if (p.type == 830) { //p.ai[1] is the angle to increase every frame //p.ai[2] is the distance from the player if (p.ai[0] == 0) { p.ai[0]++; p.ai[1] = 5f; p.ai[2] = 30; p.ai[3] = Main.rand.Next(2); p.circularAngle = -5f; } p.ai[0]++; if (p.ai[0] > 360) { p.alpha += 5; if (p.alpha > 255) { p.Kill(); } } float speed = ((float)(Math.PI) / 180) * p.ai[1]; float radius = p.ai[2]; p.circularAngle += speed; p.Center = new Vector2((float)Math.Cos(p.circularAngle) * radius + Main.player[p.owner].Center.X, (float)Math.Sin(p.circularAngle) * radius + Main.player[p.owner].Center.Y); p.ai[1] += 0.012f; p.ai[2] += 0.6f; p.rotation += p.ai[3] == 0 ? ((float)(Math.PI) / 180) * 1 : ((float)(Math.PI) / 180) * -1; } //------------------ if (p.type == 825 || p.type == 826 || p.type == 827 || p.type == 828 || p.type == 829 || p.type == 833 || p.type == 834 || p.type == 835 || (p.type >= 836 && p.type <= 838)) { p.rotation = p.velocity.ToRotation() + (float)(Math.PI / 2); if (p.type == 828 || p.type == 829) { p.velocity.Y += 0.145f; } if (p.type == 834) { p.ai[0]++; if (p.ai[0] > 10) { Projectile.NewProjectile(p.Center.X, p.Center.Y, 0, 0, 835, (int)(p.damage * 0.90), 0); } } if (p.type == 835) { int du = Dust.NewDust(p.position, p.width, p.height, 261, 0f, 0f); Main.dust[du].noGravity = true; } if (p.type == 836) { p.frameCounter++; if (p.frameCounter > 5) { p.frame++; p.frameCounter = 0; if (p.frame > 3) { p.frame = 0; } } if (p.ai[0] == 0) { p.velocity.X = 0; p.velocity.Y = -3; } for (int i = 0; i < 2; i++) { int du = Dust.NewDust(p.Center, 0, 0, 41, 0, 0); Main.dust[du].noGravity = true; } p.ai[0]++; if (p.ai[0] > 120) { p.velocity *= 0.93f; p.alpha += 10; if (p.alpha > 255) { p.Kill(); } } } if (p.type == 837) { int du = Dust.NewDust(p.Center, 0, 0, 41, 0, 0); Main.dust[du].noGravity = true; p.frameCounter++; if (p.frameCounter > 5) { p.frame++; p.frameCounter = 0; if (p.frame > 3) { p.frame = 0; } } } if (p.type == 838) { int du = Dust.NewDust(p.Center, 0, 0, 41, 0, 0); Main.dust[du].noGravity = true; p.frameCounter++; if (p.frameCounter > 6) { p.frame++; p.frameCounter = 0; if (p.frame > 2) { p.frame = 0; } } } } //------------------ if (p.type == 817) { if (p.ai[3] == 0) { p.ai[3] = 1; Color color = Ulterraria.RainbowColor[Main.rand.Next(0, Ulterraria.rainbow.Length)]; p.ai[16] = color.R; p.ai[17] = color.G; p.ai[18] = color.B; } p.rotation = p.velocity.ToRotation(); } //------------------ if (p.type == 813) { if (p.ai[0] == 0) { p.ai[0] = 1; p.scale = Main.rand.Next(80, 121) / 100; } p.frameCounter++; if (p.frameCounter > 7) { p.frame++; if (p.frame > 3) { p.Kill(); } } } //------------------ if (p.type == 812) { p.velocity *= 0.96f; p.rotation += p.velocity.X * 0.01f; if (Main.rand.Next(8) == 0) { Projectile.NewProjectile(p.Center.X + Main.rand.Next(-100, 101), p.Center.Y + Main.rand.Next(-100, 101), 0f, 0f, 813, 37, 0f); } if (p.velocity.X >= -1 && p.velocity.X <= 1 && p.velocity.Y <= 1 && p.velocity.Y >= -1) { p.alpha += 51; if (p.alpha >= 255) { p.Kill(); } } } //--------------------- if (p.type == 808) { p.rotation = p.velocity.ToRotation() - (float)((Math.PI / 4f) * 3f); } //--------------------- if (p.type == 807) { p.rotation += 0.02f; p.velocity *= 0.99f; if (p.velocity.X <= 1 && p.velocity.X >= -1 && p.velocity.Y <= 1 && p.velocity.Y >= -1) { p.alpha += 17; if (p.alpha >= 255) { float originalRot = Main.rand.Next(0, 314) / 100; for (int i = 0; i < 8; i++) { originalRot += (float)(Math.PI / 4f); Vector2 velocity = originalRot.ToRotationVector2(); float velocityMult = Main.expertMode ? 8f : 5f; velocity *= velocityMult; Projectile.NewProjectile(p.Center.X, p.Center.Y, velocity.X, velocity.Y, 808, 10, 1f); } p.Kill(); } } } //------------------- if (p.type == 809) { p.owner = Main.myPlayer; int emptyCounter = 0; int enemy = 0; for (int i = 0; i < 200; i++) { if (!Main.npc[i].active || Main.npc[i].life <= 0) { emptyCounter++; } if (emptyCounter > 8) { break; } if (Vector2.Distance(Main.npc[i].Center, p.Center) < Vector2.Distance(Main.npc[enemy].Center, p.Center)) { enemy = i; } } } //--------------- if (p.type == 805) { p.ai[5]++; if (p.ai[5] > 5) { p.ai[5] = 0; p.frame++; if (p.frame > 3) { p.frame = 0; } } if (p.ai[2] == 1) { if (p.ai[3] == 0) { p.ai[3]++; p.circularAngle = p.ai[1]; } float speed = (float)(Math.PI * 2) / 180; float radius = 50; p.circularAngle += speed; p.Center = new Vector2((float)Math.Cos(p.circularAngle) * radius + Main.npc[(int)p.ai[0]].Center.X, (float)Math.Sin(p.circularAngle) * radius + Main.npc[(int)p.ai[0]].Center.Y); if (Main.npc[(int)p.ai[0]].life <= 0 || Main.npc[(int)p.ai[0]].type != 579 || !Main.npc[(int)p.ai[0]].active) { p.Kill(); } } else { p.ai[6]++; if (p.ai[6] > 120) { p.alpha += 15; if (p.alpha >= 255) { p.Kill(); } } } } //------------- if (p.type == 801) { if (p.ai[0] == 0f) { p.rotation += p.velocity.X * 0.02f; p.velocity.Y += 0.0124f; p.frame = (int)p.ai[1]; } else if (p.ai[0] == 1) { p.frame = (int)p.ai[1]; if (p.ai[12] == 0f) p.ai[10] = Main.npc[(int)p.ai[2]].ai[14]; if (p.ai[10] == 0) { if (p.ai[7] == 0) { p.ai[7] = (float)((2 * Math.PI) / Main.rand.Next(70, 150)); } float speed = p.ai[7]; float radius = 40; p.circularAngle += speed; p.Center = new Vector2((float)Math.Cos(p.circularAngle) * radius + Main.npc[(int)p.ai[2]].Center.X, (float)Math.Sin(p.circularAngle) * radius + Main.npc[(int)p.ai[2]].Center.Y); if (Main.npc[(int)p.ai[2]].life <= 0 || Main.npc[(int)p.ai[2]].type != 559 || !Main.npc[(int)p.ai[2]].active) { p.Kill(); } } else { p.ai[12] = 1; if (p.ai[5] == 0) { p.tileCollide = true; p.ai[5] = 1; float num679 = 8f; float num680 = Main.player[(int)p.ai[4]].Center.X - p.Center.X; float num681 = Main.player[(int)p.ai[4]].Center.Y - p.Center.Y; float num682 = (float)Math.Sqrt((double)(num680 * num680 + num681 * num681)); num682 = num679 / num682; num680 *= num682; num681 *= num682; p.velocity.X = num680; p.velocity.Y = num681; } p.rotation += p.velocity.X * 0.02f; p.velocity.Y += 0.0124f; } } } //-------------------------- if (p.type == 800) { p.rotation = p.velocity.ToRotation() + (float)(Math.PI / 2); for (int k = 0; k < 2; k++) { int du = Dust.NewDust(p.position, p.width, p.height, 6, 0f, 0f); Main.dust[du].noGravity = true; } } //-------------------------- if (p.type >= 796 && p.type <= 799) { if (p.type == 799) { for (int k = 0; k < 4; k++) { int du = Dust.NewDust(p.position, p.width, p.height, 6, 0f, 0f); Main.dust[du].noGravity = true; } #region Homing if (p.Center.X < Main.player[p.owner].Center.X) { p.velocity.X += 0.16f; if (p.velocity.X > 8f) { p.velocity.X = 8f; } } if (p.Center.X > Main.player[p.owner].Center.X) { p.velocity.X -= 0.16f; if (p.velocity.X < -8f) { p.velocity.X = -8f; } } if (p.Center.Y < Main.player[p.owner].Center.Y) { p.velocity.Y += 0.16f; if (p.velocity.Y > 8f) { p.velocity.Y = 8f; } } if (p.Center.Y > Main.player[p.owner].Center.Y) { p.velocity.Y -= 0.16f; if (p.velocity.Y < -8f) { p.velocity.Y = -8f; } } #endregion p.rotation += 0.0821561f; p.ai[3]++; if (p.ai[3] > 120) { p.alpha += 5; if (p.alpha >= 255) { Projectile.NewProjectile(p.Center.X, p.Center.Y, 0, -4, 798, 80, 1f, p.owner); Projectile.NewProjectile(p.Center.X, p.Center.Y, 0, 4, 798, 80, 1f, p.owner); p.Kill(); } } } if (p.type == 798) { for (int k = 0; k < 3; k++) { int du = Dust.NewDust(p.position, p.width, p.height, 6, 0f, 0f); Main.dust[du].noGravity = true; } #region Homing if (p.Center.X < Main.player[p.owner].Center.X) { p.velocity.X += 0.16f; if (p.velocity.X > 8f) { p.velocity.X = 8f; } } if (p.Center.X > Main.player[p.owner].Center.X) { p.velocity.X -= 0.16f; if (p.velocity.X < -8f) { p.velocity.X = -8f; } } if (p.Center.Y < Main.player[p.owner].Center.Y) { p.velocity.Y += 0.16f; if (p.velocity.Y > 8f) { p.velocity.Y = 8f; } } if (p.Center.Y > Main.player[p.owner].Center.Y) { p.velocity.Y -= 0.16f; if (p.velocity.Y < -8f) { p.velocity.Y = -8f; } } #endregion p.rotation += 0.0821561f; p.ai[3]++; if (p.ai[3] > 60) { p.alpha += 5; if (p.alpha >= 255) { int proj = Projectile.NewProjectile(p.Center.X, p.Center.Y, 4, 0, 797, 70, 1f, p.owner); Main.projectile[proj].ai[5] = 1; proj = Projectile.NewProjectile(p.Center.X, p.Center.Y, -4, 0, 797, 70, 1f, p.owner); Main.projectile[proj].ai[5] = 1; p.Kill(); } } } if (p.type == 797 && p.ai[5] == 1) { for (int k = 0; k < 2; k++) { int du = Dust.NewDust(p.position, p.width, p.height, 6, 0f, 0f); Main.dust[du].noGravity = true; } #region Homing if (p.Center.X < Main.player[p.owner].Center.X) { p.velocity.X += 0.16f; if (p.velocity.X > 8f) { p.velocity.X = 8f; } } if (p.Center.X > Main.player[p.owner].Center.X) { p.velocity.X -= 0.16f; if (p.velocity.X < -8f) { p.velocity.X = -8f; } } if (p.Center.Y < Main.player[p.owner].Center.Y) { p.velocity.Y += 0.16f; if (p.velocity.Y > 8f) { p.velocity.Y = 8f; } } if (p.Center.Y > Main.player[p.owner].Center.Y) { p.velocity.Y -= 0.16f; if (p.velocity.Y < -8f) { p.velocity.Y = -8f; } } #endregion p.rotation += 0.0821561f; p.alpha += 5; if (p.alpha >= 255) { Projectile.NewProjectile(p.Center.X, p.Center.Y, 0, -4, 796, 60, 1f, p.owner); Projectile.NewProjectile(p.Center.X, p.Center.Y, 0, 4, 796, 60, 1f, p.owner); p.Kill(); } } if (p.type == 796) { for (int k = 0; k < 1; k++) { int du = Dust.NewDust(p.position, p.width, p.height, 6, 0f, 0f); Main.dust[du].noGravity = true; } #region Homing if (p.Center.X < Main.player[p.owner].Center.X) { p.velocity.X += 0.16f; if (p.velocity.X > 8f) { p.velocity.X = 8f; } } if (p.Center.X > Main.player[p.owner].Center.X) { p.velocity.X -= 0.16f; if (p.velocity.X < -8f) { p.velocity.X = -8f; } } if (p.Center.Y < Main.player[p.owner].Center.Y) { p.velocity.Y += 0.16f; if (p.velocity.Y > 8f) { p.velocity.Y = 8f; } } if (p.Center.Y > Main.player[p.owner].Center.Y) { p.velocity.Y -= 0.16f; if (p.velocity.Y < -8f) { p.velocity.Y = -8f; } } #endregion p.rotation += 0.0821561f; p.ai[3]++; if (p.ai[3] > 180) { p.alpha += 5; if (p.alpha >= 255) { p.Kill(); } } } //spinning flarework that explodes into fire if (p.type == 797 && p.ai[5] == 0) { for (int k = 0; k < 2; k++) { int du = Dust.NewDust(p.position, p.width, p.height, 6, 0f, 0f); Main.dust[du].noGravity = true; } #region homing if (p.Center.X < Main.player[p.owner].Center.X) { p.velocity.X += 0.12f; if (p.velocity.X > 5f) { p.velocity.X = 5f; } } if (p.Center.X > Main.player[p.owner].Center.X) { p.velocity.X -= 0.12f; if (p.velocity.X < -5f) { p.velocity.X = -5f; } } if (p.Center.Y < Main.player[p.owner].Center.Y) { p.velocity.Y += 0.12f; if (p.velocity.Y > 5f) { p.velocity.Y = 5f; } } if (p.Center.Y > Main.player[p.owner].Center.Y) { p.velocity.Y -= 0.12f; if (p.velocity.Y < -5f) { p.velocity.Y = -5f; } } #endregion p.rotation += 0.0821561f; p.ai[3]++; if (p.ai[3] > 120) { if (p.ai[3] % 7 == 0) { Vector2 vel = p.rotation.ToRotationVector2(); vel *= 6.5f; int proj = Projectile.NewProjectile(p.Center.X, p.Center.Y, vel.X, vel.Y, 791, 58, 1f, Main.myPlayer, 0f, 1f); Main.projectile[proj].friendly = false; Main.projectile[proj].hostile = true; Main.projectile[proj].tileCollide = false; } p.alpha += 5; if (p.alpha >= 255) { p.Kill(); } } } } //----------------------- if (p.type == 795) { if (p.ai[0] == 0) { p.ai[0]++; p.Damage(); for (int i = 0; i < 15; i++) { Dust.NewDust(p.position, p.width, p.height, 152, Main.rand.Next(-4, 5), Main.rand.Next(-4, 5)); } } p.frameCounter++; if (p.frameCounter >= 4) { p.frameCounter = 0; p.frame++; if (p.frame > 5) { p.Kill(); } } } //--------------- if (p.type == 794) { p.rotation = p.velocity.ToRotation() - (float)(Math.PI / 2); } //-------------- if (p.type == 793) { p.rotation = p.velocity.ToRotation() + (float)(Math.PI / 2); p.velocity.Y += 0.132f; } //------------ if (p.type == 792) { p.frameCounter++; if (p.frameCounter >= 7) { p.frameCounter = 0; p.frame++; if (p.frame > 2) { p.frame = 0; } } for (int i = 0; i < 2; i++) { int du = Dust.NewDust(p.position, p.width, p.height, 249, p.velocity.X * 0.8f, p.velocity.Y * 0.8f); Main.dust[du].noGravity = true; } p.rotation = p.velocity.ToRotation() + (float)Math.PI; } //----------- if (p.type == 791) { p.frameCounter++; if (p.frameCounter >= 7) { p.frameCounter = 0; p.frame++; if (p.frame > 2) { p.frame = 0; } } for (int i = 0; i < 4 - ((1f - p.scale) * 15); i++) { int du = Dust.NewDust(p.position, p.width, p.height, 6, p.velocity.X * 0.5f, p.velocity.Y * 0.5f); Main.dust[du].noGravity = true; } p.rotation = p.velocity.ToRotation() + (float)Math.PI; if (p.ai[1] == 0f && p.ai[2] == 0f) { p.ai[0]++; if (p.ai[0] > 60) { for (int k = 0; k < 2; k++) { int randAngle = Main.rand.Next(0, 361); Vector2 position = new Vector2( (float)Math.Cos(MathHelper.ToRadians(randAngle)) * 15 + p.position.X, (float)Math.Sin(MathHelper.ToRadians(randAngle)) * 15 + p.position.Y ); Vector2 velocity = p.position - position; velocity.Normalize(); velocity *= 1.5f; int newDust = Dust.NewDust(position, 38, 38, 6, -velocity.X, -velocity.Y, 50 + Main.rand.Next(0, 151)); Main.dust[newDust].noGravity = true; Main.dust[newDust].velocity = velocity; } p.velocity *= 0.95f; } if (p.ai[0] > 120) { p.Kill(); } } else { if (p.ai[2] == 0f) p.scale = 0.75f; } } //----------- if (p.type == 790) { for (int j = 0; j < 200; j++) { if (Vector2.Distance(Main.npc[j].Center, p.Center) < 550f && Vector2.Distance(Main.npc[j].Center, p.Center) > 30f) { if (!Main.npc[j].boss && Main.npc[j].knockBackResist != 0f) { float sp = 6f - (Vector2.Distance(Main.npc[j].Center, p.position) / 100); Vector2 pos = p.position - Main.npc[j].Center; float mag = (float)Math.Sqrt(Math.Pow(pos.X, 2) + Math.Pow(pos.Y, 2)); if (mag > sp) { pos *= sp / mag; } Main.npc[j].velocity += pos *= 0.1f; } } } p.frameCounter++; if (p.frameCounter >= 6) { p.frameCounter = 0; p.frame++; if (p.frame > 2) { p.frame = 0; } } if (p.ai[0] == 0) { p.alpha = 255; p.ai[0] = 1f; p.ai[1] = Main.rand.Next(2) == 0 ? -0.04352f : 0.04352f; } p.rotation += p.ai[1]; p.ai[0]++; if (p.alpha > 0 && p.ai[0] < 150) { p.alpha -= 10; if (p.alpha < 0) { p.alpha = 0; } } if (p.ai[0] > 345) { p.alpha++; if (p.alpha > 255) { p.Kill(); } } for (int i = 0; i < 4 + (int)(p.ai[0] / 60); i++) { int radius = i * 10; for (int d = 0; d < 2; d++) { if (Main.rand.Next(0, 10 - (int)(p.ai[0] / 120)) == 0) { int randAngle = Main.rand.Next(0, 361); Vector2 position = new Vector2( (float)Math.Cos(MathHelper.ToRadians(randAngle)) * radius + p.position.X, (float)Math.Sin(MathHelper.ToRadians(randAngle)) * radius + p.position.Y ); Vector2 velocity = p.position - position; velocity.Normalize(); velocity *= 4 + (radius / 45); int newDust = Dust.NewDust(position, 38, 38, 249, -velocity.X, -velocity.Y, 50 + Main.rand.Next(0, 151)); Main.dust[newDust].noGravity = true; Main.dust[newDust].velocity = velocity; } } } } //--------------- if (p.type == 789) { p.alpha += 4; if (p.alpha > 255) { p.Kill(); } Lighting.AddLight(p.Center, 0.0255f, 0.0153f, 0); } if (p.type == 788) { p.rotation = p.velocity.ToRotation() + (float)(Math.PI / 2); p.velocity.Y += 0.145f; p.ai[0] += Main.rand.Next(50, 150) / 100; if (p.ai[0] >= 3) { p.ai[0] = 0; Projectile.NewProjectile(p.Center.X, p.Center.Y, 0f, 0f, 789, 10, 1f, Main.myPlayer); } Lighting.AddLight(p.Center, 0.0510f, 0.0306f, 0); } if (p.type == 787) { p.rotation += p.velocity.X * 0.05f; } //------------- if (p.type == 785 || p.type == 786) { if (p.ai[1] == 0f && !Collision.SolidCollision(p.position, p.width, p.height)) { p.ai[1] = 1f; p.netUpdate = true; } if (p.ai[1] != 0f) { p.tileCollide = true; } if (p.soundDelay == 0) { p.soundDelay = 20 + Main.rand.Next(40); Main.PlaySound(2, (int)p.position.X, (int)p.position.Y, 9); } if (p.localAI[0] == 0f) { p.localAI[0] = 1f; } p.alpha += (int)(25f * p.localAI[0]); if (p.alpha > 200) { p.alpha = 200; p.localAI[0] = -1f; } if (p.alpha < 0) { p.alpha = 0; p.localAI[0] = 1f; } if (p.type != 786) p.rotation += (Math.Abs(p.velocity.X) + Math.Abs(p.velocity.Y)) * 0.01f * (float)p.direction; else p.rotation = p.velocity.ToRotation() + (float)(Math.PI / 2); p.light = 0.9f; if (Main.rand.Next(10) == 0) { Dust.NewDust(p.position, p.width, p.height, 152, p.velocity.X * 0.5f, p.velocity.Y * 0.5f, 150, default(Color), 1.2f); } if (p.type != 786) { if (Main.rand.Next(20) == 0) { Gore.NewGore(p.position, new Vector2(p.velocity.X * 0.2f, p.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); } } } //------------ if (p.type == 784) { p.rotation += p.velocity.X * 0.05f; p.velocity.Y += 0.135f; try { int num223 = (int)(p.position.X / 16f) - 1; int num224 = (int)((p.position.X + (float)p.width) / 16f) + 2; int num225 = (int)(p.position.Y / 16f) - 1; int num226 = (int)((p.position.Y + (float)p.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 (p.position.X + (float)p.width - 4f > vector19.X && p.position.X + 4f < vector19.X + 16f && p.position.Y + (float)p.height - 4f > vector19.Y && p.position.Y + 4f < vector19.Y + 16f) { p.velocity.X = 0f; p.velocity.Y = 0f; } } } } } catch { } } //------------ if (p.type == 783) { p.rotation += p.velocity.X * 0.05f; p.velocity.Y += 0.135f; } //------------ if (p.type == 782) { p.rotation = p.velocity.ToRotation() + (float)(Math.PI / 2); } //------------ if (p.type == 777) { if (p.ai[0] == 0) { p.ai[0]++; p.ai[1] = Main.rand.Next(-6, 7) / 100; } p.rotation += p.ai[1]; p.velocity.Y += 0.145f; } //------------ else if (p.type == 779) { if (Main.player[Main.myPlayer].birdnana) {// p.timeLeft = 2; } p.friendly = true; float num531 = 6f; if (p.ai[0] == 1f) { num531 = 10f; } Vector2 vector38 = new Vector2(p.position.X + (float)p.width * 0.5f, p.position.Y + (float)p.height * 0.5f); float num532 = Main.player[p.owner].Center.X - vector38.X + (20f * Main.player[p.owner].direction); float num533 = Main.player[p.owner].Center.Y - vector38.Y; float num534 = (float)Math.Sqrt((double)(num532 * num532 + num533 * num533)); if (num534 < 100f && p.ai[0] == 1f && !Collision.SolidCollision(p.position, p.width, p.height)) { p.ai[0] = 0f; } if (num534 > 2000f) { p.position.X = Main.player[p.owner].Center.X - (float)(p.width / 2); p.position.Y = Main.player[p.owner].Center.Y - (float)(p.width / 2); } if (num534 > 70f) { num534 = num531 / num534; num532 *= num534; num533 *= num534; p.velocity.X = (p.velocity.X * 20f + num532) / 21f; p.velocity.Y = (p.velocity.Y * 20f + num533) / 21f; } else { if (p.velocity.X == 0f && p.velocity.Y == 0f) { p.velocity.X = -0.15f; p.velocity.Y = -0.05f; } p.velocity *= 1.01f; } p.friendly = false; p.rotation = p.velocity.X * 0.05f; p.frameCounter++; if (p.frameCounter >= 7) { p.frameCounter = 0; p.frame++; } if (p.frame > 3) { p.frame = 0; } if ((double)Math.Abs(p.velocity.X) > 0.15) { p.spriteDirection = p.direction; } } //------------ if (p.type == 772) { p.rotation = p.velocity.ToRotation() + (float)(Math.PI / 2); p.velocity.Y += 0.145f; p.ai[0] += Main.rand.Next(50, 150) / 100; if (p.ai[0] >= 15) { p.ai[0] = 0; Projectile.NewProjectile(p.Center.X, p.Center.Y, 0f, 0f, 777, 10, 1f, Main.myPlayer); } } } }