diff --git a/CalamityMod.cs b/CalamityMod.cs index cdb59203ce..cd02b742a6 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -1773,7 +1773,6 @@ namespace CalamityMod ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), - ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 12830e52c8..918d2203ec 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -123,7 +123,6 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.gfxOffY = charging ? -40 : -50; npc.width = npc.frame.Width / 2; npc.height = (int)(npc.frame.Height * (charging ? 1.5f : 1.8f)); - //npc.ai[0] = 3f; // Mode variables bool death = CalamityWorld.death || CalamityWorld.bossRushActive; @@ -131,10 +130,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; // Light - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.3f, 0.7f, 0f); + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.3f, 0.7f, 0f); // Show message - if (!halfLife && ((double)npc.life <= (double)npc.lifeMax * 0.5 || death)) + if (!halfLife && (npc.life <= npc.lifeMax * 0.5 || death)) { string key = "Mods.CalamityMod.PlagueBossText"; Color messageColor = Color.Lime; @@ -165,7 +164,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Defense gain if (expertMode) { - int num1040 = death ? 20 : (int)(20f * (1f - (float)npc.life / (float)npc.lifeMax)); + int num1040 = death ? 20 : (int)(20f * (1f - npc.life / (float)npc.lifeMax)); npc.defense = npc.defDefense + num1040; } @@ -179,13 +178,13 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Vector2 distFromPlayer = player.Center - vectorCenter; // Enrage - bool aboveGroundEnrage = ((double)player.position.Y < Main.worldSurface * 16.0 || player.position.Y > (float)((Main.maxTilesY - 200) * 16)) && !CalamityWorld.bossRushActive; + bool aboveGroundEnrage = (player.position.Y < Main.worldSurface * 16.0 || player.position.Y > ((Main.maxTilesY - 200) * 16)) && !CalamityWorld.bossRushActive; bool jungleEnrage = false; if (!player.ZoneJungle && !CalamityWorld.bossRushActive) jungleEnrage = true; - bool diagonalDash = revenge && ((double)npc.life <= (double)npc.lifeMax * 0.8 || death); + bool diagonalDash = revenge && (npc.life <= npc.lifeMax * 0.8 || death); if (npc.ai[0] != 0f && npc.ai[0] != 4f) { @@ -248,7 +247,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath num596 = 3; } - while ((float)num596 == num595); + while (num596 == num595); if (num596 == 0 && diagonalDash && distFromPlayer.Length() < 1800f) { switch (Main.rand.Next(3)) @@ -264,7 +263,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath break; } } - npc.ai[0] = (float)num596; + npc.ai[0] = num596; npc.ai[1] = 0f; npc.ai[2] = 0f; } @@ -276,15 +275,15 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float num1044 = revenge ? 28f : 26f; if (aboveGroundEnrage) num1044 += 6f; - if ((double)npc.life < (double)npc.lifeMax * 0.66 || death) + if (npc.life < npc.lifeMax * 0.66 || death) num1044 += 2f; - if ((double)npc.life < (double)npc.lifeMax * 0.33 || death) + if (npc.life < npc.lifeMax * 0.33 || death) num1044 += 2f; if (npc.Calamity().enraged > 0 || (CalamityMod.CalamityConfig.BossRushXerocCurse && CalamityWorld.bossRushActive)) num1044 += 2f; int num1043 = 2; - if ((npc.ai[1] > (float)(2 * num1043) && npc.ai[1] % 2f == 0f) || distFromPlayer.Length() > 1800f) + if ((npc.ai[1] > (2 * num1043) && npc.ai[1] % 2f == 0f) || distFromPlayer.Length() > 1800f) { npc.ai[0] = -1f; npc.ai[1] = 0f; @@ -300,7 +299,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float playerLocation = vectorCenter.X - player.Center.X; - if (Math.Abs(npc.Center.Y - (player.Center.Y - (float)chargeDistance)) < 20f) + if (Math.Abs(npc.Center.Y - (player.Center.Y - chargeDistance)) < 20f) { if (diagonalDash) { @@ -324,14 +323,14 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.ai[1] += 1f; npc.ai[2] = 0f; - float num1045 = player.position.X + (float)(player.width / 2) - vectorCenter.X; - float num1046 = player.position.Y + (float)(player.height / 2) - vectorCenter.Y; - float num1047 = (float)Math.Sqrt((double)(num1045 * num1045 + num1046 * num1046)); + float num1045 = player.position.X + (player.width / 2) - vectorCenter.X; + float num1046 = player.position.Y + (player.height / 2) - vectorCenter.Y; + float num1047 = (float)Math.Sqrt(num1045 * num1045 + num1046 * num1046); num1047 = num1044 / num1047; npc.velocity.X = num1045 * num1047; npc.velocity.Y = num1046 * num1047; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); npc.Calamity().newAI[1] = npc.velocity.X; npc.Calamity().newAI[2] = npc.velocity.Y; @@ -350,12 +349,12 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float num1048 = revenge ? 14f : 12f; float num1049 = revenge ? 0.25f : 0.22f; - if ((double)npc.life < (double)npc.lifeMax * 0.66 || death) + if (npc.life < npc.lifeMax * 0.66 || death) { num1048 += 1f; num1049 += 0.05f; } - if ((double)npc.life < (double)npc.lifeMax * 0.33 || death) + if (npc.life < npc.lifeMax * 0.33 || death) { num1048 += 1f; num1049 += 0.05f; @@ -366,7 +365,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath num1049 += 0.1f; } - if (vectorCenter.Y < (player.Center.Y - (float)chargeDistance)) + if (vectorCenter.Y < (player.Center.Y - chargeDistance)) npc.velocity.Y += num1049; else npc.velocity.Y -= num1049; @@ -377,9 +376,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.velocity.Y = num1048; if (Math.Abs(vectorCenter.X - player.Center.X) > 650f) - npc.velocity.X += num1049 * (float)npc.direction; + npc.velocity.X += num1049 * npc.direction; else if (Math.Abs(vectorCenter.X - player.Center.X) < 500f) - npc.velocity.X -= num1049 * (float)npc.direction; + npc.velocity.X -= num1049 * npc.direction; else npc.velocity.X *= 0.8f; @@ -412,16 +411,16 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath num1050 = 300; else if (aboveGroundEnrage || CalamityWorld.bossRushActive) num1050 = 400; - else if ((double)npc.life < (double)npc.lifeMax * 0.33 || death) + else if (npc.life < npc.lifeMax * 0.33 || death) num1050 = revenge ? 450 : 475; - else if ((double)npc.life < (double)npc.lifeMax * 0.66) + else if (npc.life < npc.lifeMax * 0.66) num1050 = revenge ? 475 : 500; int num1051 = 1; if (vectorCenter.X < player.Center.X) num1051 = -1; - if (npc.direction == num1051 && (Math.Abs(vectorCenter.X - player.Center.X) > (float)num1050 || Math.Abs(vectorCenter.Y - player.Center.Y) > (float)num1050)) + if (npc.direction == num1051 && (Math.Abs(vectorCenter.X - player.Center.X) > num1050 || Math.Abs(vectorCenter.Y - player.Center.Y) > num1050)) { npc.ai[2] = 1f; } @@ -451,17 +450,17 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.velocity *= 0.9f; float num1052 = revenge ? 0.12f : 0.1f; - if ((double)npc.life < (double)npc.lifeMax * 0.8 || death) + if (npc.life < npc.lifeMax * 0.8 || death) { npc.velocity *= 0.98f; num1052 += 0.05f; } - if ((double)npc.life < (double)npc.lifeMax * 0.6 || death) + if (npc.life < npc.lifeMax * 0.6 || death) { npc.velocity *= 0.98f; num1052 += 0.05f; } - if ((double)npc.life < (double)npc.lifeMax * 0.4 || death) + if (npc.life < npc.lifeMax * 0.4 || death) { npc.velocity *= 0.98f; num1052 += 0.05f; @@ -490,12 +489,12 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.direction = playerLocation < 0 ? 1 : -1; npc.spriteDirection = npc.direction; - float num1055 = player.position.X + (float)(player.width / 2) - vectorCenter.X; - float num1056 = player.position.Y + (float)(player.height / 2) - 200f - vectorCenter.Y; - float num1057 = (float)Math.Sqrt((double)(num1055 * num1055 + num1056 * num1056)); + float num1055 = player.position.X + (player.width / 2) - vectorCenter.X; + float num1056 = player.position.Y + (player.height / 2) - 200f - vectorCenter.Y; + float num1057 = (float)Math.Sqrt(num1055 * num1055 + num1056 * num1056); if (num1057 < 600f) { - npc.ai[0] = ((double)npc.life <= (double)npc.lifeMax * 0.66 || death) ? 5f : 1f; + npc.ai[0] = (npc.life <= npc.lifeMax * 0.66 || death) ? 5f : 1f; npc.ai[1] = 0f; npc.netUpdate = true; return; @@ -513,16 +512,16 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.TargetClosest(true); Vector2 vector119 = new Vector2(npc.direction == 1 ? npc.getRect().BottomLeft().X : npc.getRect().BottomRight().X, npc.getRect().Bottom().Y - 40f); - vector119.X += (npc.direction * 120); - float num1058 = player.position.X + (float)(player.width / 2) - vectorCenter.X; - float num1059 = player.position.Y + (float)(player.height / 2) - vectorCenter.Y; - float num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); + vector119.X += npc.direction * 120; + float num1058 = player.position.X + (player.width / 2) - vectorCenter.X; + float num1059 = player.position.Y + (player.height / 2) - vectorCenter.Y; + float num1060 = (float)Math.Sqrt(num1058 * num1058 + num1059 * num1059); npc.ai[1] += 1f; - npc.ai[1] += (float)(num1038 / 2); - if ((double)npc.life < (double)npc.lifeMax * 0.75) + npc.ai[1] += num1038 / 2; + if (npc.life < npc.lifeMax * 0.75) npc.ai[1] += 0.25f; - if ((double)npc.life < (double)npc.lifeMax * 0.5) + if (npc.life < npc.lifeMax * 0.5) npc.ai[1] += 0.25f; bool flag103 = false; @@ -554,8 +553,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (NPC.CountNPCS(ModContent.NPCType()) < 2) { int num1062 = NPC.NewNPC((int)vector119.X, (int)vector119.Y, randomAmt, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num1062].velocity.X = (float)Main.rand.Next(-200, 201) * (CalamityWorld.bossRushActive ? 0.04f : 0.02f); - Main.npc[num1062].velocity.Y = (float)Main.rand.Next(-200, 201) * (CalamityWorld.bossRushActive ? 0.04f : 0.02f); + Main.npc[num1062].velocity.X = Main.rand.Next(-200, 201) * (CalamityWorld.bossRushActive ? 0.04f : 0.02f); + Main.npc[num1062].velocity.Y = Main.rand.Next(-200, 201) * (CalamityWorld.bossRushActive ? 0.04f : 0.02f); Main.npc[num1062].localAI[0] = 60f; Main.npc[num1062].netUpdate = true; } @@ -588,17 +587,17 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.TargetClosest(true); Vector2 vector119 = new Vector2(npc.direction == 1 ? npc.getRect().BottomLeft().X : npc.getRect().BottomRight().X, npc.getRect().Bottom().Y - 40f); - vector119.X += (npc.direction * 120); - float num1058 = player.position.X + (float)(player.width / 2) - vectorCenter.X; - float num1059 = player.position.Y + (float)(player.height / 2) - vectorCenter.Y; - float num1060 = (float)Math.Sqrt((double)(num1058 * num1058 + num1059 * num1059)); + vector119.X += npc.direction * 120; + float num1058 = player.position.X + (player.width / 2) - vectorCenter.X; + float num1059 = player.position.Y + (player.height / 2) - vectorCenter.Y; + float num1060 = (float)Math.Sqrt(num1058 * num1058 + num1059 * num1059); npc.ai[1] += 1f; - npc.ai[1] += (float)(num1038 / 2); + npc.ai[1] += num1038 / 2; bool flag103 = false; - if ((double)npc.life < (double)npc.lifeMax * 0.25 || death) + if (npc.life < npc.lifeMax * 0.25 || death) npc.ai[1] += 0.25f; - if ((double)npc.life < (double)npc.lifeMax * 0.1 || death) + if (npc.life < npc.lifeMax * 0.1 || death) npc.ai[1] += 0.25f; if (npc.ai[1] > 40f) @@ -621,9 +620,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.NewNPC((int)vector119.X, (int)vector119.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); float projectileSpeed = revenge ? 6f : 5f; - float num1071 = player.position.X + (float)player.width * 0.5f - vector119.X; - float num1072 = player.position.Y + (float)player.height * 0.5f - vector119.Y; - float num1073 = (float)Math.Sqrt((double)(num1071 * num1071 + num1072 * num1072)); + float num1071 = player.position.X + player.width * 0.5f - vector119.X; + float num1072 = player.position.Y + player.height * 0.5f - vector119.Y; + float num1073 = (float)Math.Sqrt(num1071 * num1071 + num1072 * num1072); num1073 = projectileSpeed / num1073; num1071 *= num1073; @@ -670,12 +669,12 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (npc.ai[1] % 10f == 9f) flag104 = true; } - else if ((double)npc.life < (double)npc.lifeMax * 0.1 || death || aboveGroundEnrage) + else if (npc.life < npc.lifeMax * 0.1 || death || aboveGroundEnrage) { if (npc.ai[1] % 20f == 19f) flag104 = true; } - else if ((double)npc.life < (double)npc.lifeMax * 0.5) + else if (npc.life < npc.lifeMax * 0.5) { if (npc.ai[1] % 25f == 24f) flag104 = true; @@ -695,9 +694,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (CalamityWorld.bossRushActive) projectileSpeed *= 1.5f; - float num1071 = player.position.X + (float)player.width * 0.5f - vector121.X; - float num1072 = player.position.Y + (float)player.height * 0.5f - vector121.Y; - float num1073 = (float)Math.Sqrt((double)(num1071 * num1071 + num1072 * num1072)); + float num1071 = player.position.X + player.width * 0.5f - vector121.X; + float num1072 = player.position.Y + player.height * 0.5f - vector121.Y; + float num1073 = (float)Math.Sqrt(num1071 * num1071 + num1072 * num1072); num1073 = projectileSpeed / num1073; num1071 *= num1073; num1072 *= num1073; @@ -707,7 +706,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (expertMode) { num1074 = 32; - int damageBoost = death ? 5 : (int)(6f * (1f - (float)npc.life / (float)npc.lifeMax)); + int damageBoost = death ? 5 : (int)(6f * (1f - npc.life / (float)npc.lifeMax)); num1074 += damageBoost; if (Main.rand.NextBool(6)) @@ -750,7 +749,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath num1044 = 32f; int num1043 = 2; - if (npc.ai[1] > (float)(2 * num1043) && npc.ai[1] % 2f == 0f) + if (npc.ai[1] > (2 * num1043) && npc.ai[1] % 2f == 0f) { MissileCountdown = 0; npc.ai[0] = -1f; @@ -790,7 +789,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { Vector2 spawn = vectorCenter; spawn.X += i * 27 - (MissileProjectiles * 12); // -96 to 93 - Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-MissileAngleSpread / 2 + (MissileAngleSpread * i / (float)MissileProjectiles))); + Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-MissileAngleSpread / 2 + (MissileAngleSpread * i / MissileProjectiles))); Projectile.NewProjectile(spawn.X, spawn.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, player.position.Y); } } @@ -801,14 +800,14 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.ai[1] += 1f; npc.ai[2] = 0f; - float num1045 = player.position.X + (float)(player.width / 2) - vectorCenter.X; - float num1046 = player.position.Y - 500f + (float)(player.height / 2) - vectorCenter.Y; - float num1047 = (float)Math.Sqrt((double)(num1045 * num1045 + num1046 * num1046)); + float num1045 = player.position.X + (player.width / 2) - vectorCenter.X; + float num1046 = player.position.Y - 500f + (player.height / 2) - vectorCenter.Y; + float num1047 = (float)Math.Sqrt(num1045 * num1045 + num1046 * num1046); num1047 = num1044 / num1047; npc.velocity.X = num1045 * num1047; npc.velocity.Y = num1046 * num1047; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); npc.direction = playerLocation < 0 ? 1 : -1; npc.spriteDirection = npc.direction; @@ -840,9 +839,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.velocity.Y = num1048; if (Math.Abs(vectorCenter.X - player.Center.X) > 600f) - npc.velocity.X += 0.15f * (float)npc.direction; + npc.velocity.X += 0.15f * npc.direction; else if (Math.Abs(vectorCenter.X - player.Center.X) < 300f) - npc.velocity.X -= 0.15f * (float)npc.direction; + npc.velocity.X -= 0.15f * npc.direction; else npc.velocity.X *= 0.8f; @@ -875,7 +874,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (vectorCenter.X < player.Center.X) num1051 = -1; - if (npc.direction == num1051 && Math.Abs(vectorCenter.X - player.Center.X) > (float)num1050) + if (npc.direction == num1051 && Math.Abs(vectorCenter.X - player.Center.X) > num1050) npc.ai[2] = 1f; if (npc.ai[2] != 1f) @@ -956,7 +955,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (npc.velocity.Y < -5f) npc.velocity.Y = -5f; } - if (npc.position.X + (float)(npc.width / 2) > player.position.X + (float)(player.width / 2) + xPos) + if (npc.position.X + (npc.width / 2) > player.position.X + (player.width / 2) + xPos) { if (npc.velocity.X > 0f) npc.velocity.X *= 0.98f; @@ -964,7 +963,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (npc.velocity.X > 8f) npc.velocity.X = 8f; } - if (npc.position.X + (float)(npc.width / 2) < player.position.X + (float)(player.width / 2) - xPos) + if (npc.position.X + (npc.width / 2) < player.position.X + (player.width / 2) - xPos) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.98f; @@ -986,12 +985,12 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { for (int i = 1; i < 7; i++) Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("PlaguebringerGoliathGore" + i), 2f); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.position.X = npc.position.X + (npc.width / 2); + npc.position.Y = npc.position.Y + (npc.height / 2); npc.width = 100; npc.height = 100; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + npc.position.X = npc.position.X - (npc.width / 2); + npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 40; num621++) { int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 46, 0f, 0f, 100, default, 2f); @@ -999,7 +998,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 70; num623++) @@ -1054,16 +1053,16 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); color38 = npc.GetAlpha(color38); - color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2((float)texture.Width, (float)(texture.Height / frameCount)) * npc.scale / 2f; + color38 *= (num153 - num155) / 15f; + Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture.Width, texture.Height / frameCount) * npc.scale / 2f; vector41 += vector11 * npc.scale + posOffset; spriteBatch.Draw(texture, vector41, new Rectangle?(rectangle), color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture.Width, (float)(texture.Height / frameCount)) * npc.scale / 2f; + vector43 -= new Vector2(texture.Width, texture.Height / frameCount) * npc.scale / 2f; vector43 += vector11 * npc.scale + posOffset; spriteBatch.Draw(texture, vector43, new Rectangle?(rectangle), npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); @@ -1075,9 +1074,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); - color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = npc.oldPos[num163] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2((float)glowTexture.Width, (float)(glowTexture.Height / frameCount)) * npc.scale / 2f; + color41 *= (num153 - num163) / 15f; + Vector2 vector44 = npc.oldPos[num163] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + vector44 -= new Vector2(glowTexture.Width, glowTexture.Height / frameCount) * npc.scale / 2f; vector44 += vector11 * npc.scale + posOffset; spriteBatch.Draw(glowTexture, vector44, new Rectangle?(rectangle), color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 60e3ddb756..99de93d7cc 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -470,7 +470,7 @@ namespace CalamityMod.NPCs.Providence phase = 3; break; // 1575 or 1500 case 1: - phase = 2; + phase = 5; break; // 1875 or 1800 case 2: phase = 0; @@ -641,6 +641,7 @@ namespace CalamityMod.NPCs.Providence npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; + calamityGlobalNPC.newAI[1] = 0f; } // Holy blasts @@ -742,32 +743,17 @@ namespace CalamityMod.NPCs.Providence npc.TargetClosest(true); - Vector2 vector114 = new Vector2(vector.X, vector.Y + 20f); - float num866 = Main.rand.Next(-1000, 1001); - float num867 = Main.rand.Next(-1000, 1001); - float num868 = (float)Math.Sqrt(num866 * num866 + num867 * num867); - float num869 = 3f; - if (!targetDead) - npc.velocity *= 0.9f; - - num868 = num869 / num868; - num866 *= num868; - num867 *= num868; - vector114.X += num866 * 32f; - vector114.Y += num867 * 32f; - - if (Vector2.Distance(player.Center, vector) < 32f) { - num866 *= -1f; - num867 *= -1f; + if (npc.velocity.Length() <= 2f) + npc.velocity = Vector2.Zero; + if (npc.velocity.Length() > 2f) + { + npc.velocity *= 0.9f; + return; + } } - if (npc.velocity.Length() <= 2f) - npc.velocity = Vector2.Zero; - if (npc.velocity.Length() > 2f) - return; - float divisor = (expertMode ? 2f : 3f) + (float)Math.Floor(3f * lifeRatio) + (attackRateMult > 1D ? (float)Math.Ceiling(attackRateMult * 1.6) : 0f); int totalProjectiles = 36; int chains = 4; @@ -822,26 +808,6 @@ namespace CalamityMod.NPCs.Providence } } - /*int shootBoost = (int)(4f * (1f - lifeRatio)); - - int num870 = (expertMode ? 3 : 4) - shootBoost; - - if (attackRateMult > 1D) - num870 += (int)Math.Ceiling(attackRateMult * 1.6); - - npc.ai[1] += 1f; - if (npc.ai[1] >= num870) - { - npc.ai[1] = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (Main.rand.NextBool(4) && !death) - Projectile.NewProjectile(vector114.X, vector114.Y, num866, num867, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); - else - Projectile.NewProjectile(vector114.X, vector114.Y, num866, num867, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); - } - }*/ - if (npc.ai[3] == 0f) { for (int x = 0; x < Main.maxProjectiles; x++) @@ -1014,7 +980,15 @@ namespace CalamityMod.NPCs.Providence npc.TargetClosest(true); if (!targetDead) - npc.velocity *= 0.9f; + { + if (npc.velocity.Length() <= 2f) + npc.velocity = Vector2.Zero; + if (npc.velocity.Length() > 2f) + { + npc.velocity *= 0.9f; + return; + } + } if (npc.ai[1] == 0f) { @@ -1044,22 +1018,30 @@ namespace CalamityMod.NPCs.Providence { npc.ai[2] = 0f; - Vector2 vector93 = vector; - float num742 = expertMode ? 12f : 10f; - float num743 = player.position.X + player.width * 0.5f - vector93.X; - float num744 = player.position.Y + player.height * 0.5f - vector93.Y; - float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); + float velocity = 3f; + int damage = expertMode ? 52 : 65; + int projectileType = ModContent.ProjectileType(); - num745 = num742 / num745; - num743 *= num745; - num744 *= num745; - vector93.X += num743 * 3f; - vector93.Y += num744 * 3f; + if (calamityGlobalNPC.newAI[2] % 2f == 0f) + { + int totalProjectiles = 12; + double radians = MathHelper.TwoPi / totalProjectiles; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-calamityGlobalNPC.newAI[1], -velocity)) * velocity; - int seeProjFilesforDmg = 0; - int num747 = ModContent.ProjectileType(); - Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, num747, seeProjFilesforDmg, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1000), player.position.Y + Main.rand.Next(-100, 100), 0f, 0f, ModContent.ProjectileType(), seeProjFilesforDmg, 0f, Main.myPlayer, (float)Main.rand.Next(2), 0f); + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 vector2 = spinningPoint.RotatedBy(radians * i); + Projectile.NewProjectile(vector, vector2, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); + } + + calamityGlobalNPC.newAI[1] += 0.2f; + } + + calamityGlobalNPC.newAI[2] += 1f; + + velocity = expertMode ? 12f : 10f; + Vector2 velocity2 = Vector2.Normalize(player.Center - vector) * velocity; + Projectile.NewProjectile(vector, velocity2, projectileType, damage, 0f, Main.myPlayer, 1f, 0f); } } diff --git a/NPCs/TownNPCs/FAP.cs b/NPCs/TownNPCs/FAP.cs index d6bcda693d..66686008bd 100644 --- a/NPCs/TownNPCs/FAP.cs +++ b/NPCs/TownNPCs/FAP.cs @@ -79,7 +79,7 @@ namespace CalamityMod.NPCs.TownNPCs public override string GetChat() { if (CalamityWorld.bossRushActive) - return "We expect you to turn in a perfect performance!"; + return "Why are you talking to me right now? Either way, I expect you to turn in a perfect performance!"; if (npc.homeless) { @@ -102,12 +102,12 @@ namespace CalamityMod.NPCs.TownNPCs } else if (random == 2) { - return "Everyone else is so rude tonight. If they don't get over it soon I'll break down their doors and make them!"; + return "Everyone else is so rude tonight. If they don't get over it soon, I'll break down their doors and make them!"; } else { Main.player[Main.myPlayer].Hurt(PlayerDeathReason.ByCustomReason(Main.player[Main.myPlayer].name + " was slapped too hard."), Main.player[Main.myPlayer].statLife / 2, -Main.player[Main.myPlayer].direction, false, false, false, -1); - return "Being drunk I have no moral compass atm."; + return "Being drunk, I have no moral compass atm."; } } @@ -118,7 +118,7 @@ namespace CalamityMod.NPCs.TownNPCs if (Main.dayTime) { - dialogue.Add("Like I always say, when you're drunk you can put up with a lot more."); + dialogue.Add("Like I always say, when you're drunk you can tolerate annoying people a lot more easily..."); dialogue.Add("I'm literally balls drunk off my sass right now."); dialogue.Add("I'm either laughing because I'm drunk or because I've lost my mind. Probably both."); dialogue.Add("When I'm drunk I'm way happier...at least until the talking worms start to appear."); @@ -127,10 +127,10 @@ namespace CalamityMod.NPCs.TownNPCs } else { - dialogue.Add("Now I want to get alcohol, first drinks are on me!"); - dialogue.Add("Here's a challenge...take a drink whenever you take a hit. Oh wait, you'd die."); - dialogue.Add("Well I was planning to light some candles in order to relax...ah well, time to program while drunk."); - dialogue.Add("Yes, everyone knows the mechworm is buggy."); + dialogue.Add("A perfect night...for alcohol! First drinks are on me!"); + dialogue.Add("Here's a challenge...take a drink whenever you get hit. Oh wait, you'd die."); + dialogue.Add("Well I was planning to light some candles in order to relax...ah well, time to code while drunk."); + dialogue.Add("Yes, everyone knows the mechworm is buggy. Well, not so much anymore, but still."); dialogue.Add("That's west, " + Main.player[Main.myPlayer].name + ". You're fired again."); dialogue.Add("Are you sure you're 21? ...alright, fine, but don't tell anyone I sold you this."); } @@ -148,33 +148,36 @@ namespace CalamityMod.NPCs.TownNPCs dialogue.Add("God I can't wait to beat on some ice again!"); if (CalamityWorld.downedLeviathan) - dialogue.Add("Only things I am attracted to are fish women, women, men who look like women, and that's it."); + dialogue.Add("The only things I'm attracted to are fish women, women, men who look like women and that's it."); if (NPC.downedMoonlord) { dialogue.Add("I'll always be watching."); - dialogue.Add("Why did one creature need that many tentacles? ...actually, don't answer that."); + dialogue.Add("Why did that weird monster need that many tentacles? ...actually, don't answer that."); } if (CalamityWorld.rainingAcid) - dialogue.Add("There's chemicals in the water...and it's turning the frogs gay!"); + dialogue.Add("There's chemicals in the water...and they're turning the frogs gay!"); if (CalamityWorld.downedPolterghast) - dialogue.Add("I saw a ghost down by the old train tracks once flailing wildly at the lily pads, those were the days."); + dialogue.Add("I saw a ghost down by the old train tracks once, flailing wildly at the lily pads, those were the days."); if (CalamityWorld.downedDoG) - dialogue.Add("I hear it's amazing when the famous purple-stuffed worm out in flap-jaw space with the tuning fork does a raw blink on Hara-kiri rock. I need scissors! 61!"); + dialogue.Add("I hear it's amazing when the famous purple-stuffed worm out in flap-jaw space, with the tuning fork, does a raw blink on Hara-kiri rock. I need scissors! 61!"); int tavernKeep = NPC.FindFirstNPC(NPCID.DD2Bartender); if (tavernKeep != -1) { dialogue.Add("Tell " + Main.npc[tavernKeep].GivenName + " to stop calling me. He's not wanted."); - dialogue.Add("My booze will always be better than " + Main.npc[tavernKeep].GivenName + "'s and nobody can convince me otherwise."); + dialogue.Add("My booze will always be better than " + Main.npc[tavernKeep].GivenName + "'s, and nobody can convince me otherwise."); } + // Doesn't seem like a necessary line + /* int dryad = NPC.FindFirstNPC(NPCID.Dryad); if (dryad != -1) - dialogue.Add(Main.npc[dryad].GivenName + " is cool too but she'd outlive me."); + dialogue.Add(Main.npc[dryad].GivenName + " is cool too, but she'd outlive me."); + */ int permadong = NPC.FindFirstNPC(ModContent.NPCType()); if (permadong != -1) @@ -183,7 +186,7 @@ namespace CalamityMod.NPCs.TownNPCs int waifu = NPC.FindFirstNPC(NPCID.Stylist); if (waifu != -1) { - dialogue.Add("You still can't stop me from selling alcohol and trying to move in with " + Main.npc[waifu].GivenName + "."); + dialogue.Add("You still can't stop me from trying to move in with " + Main.npc[waifu].GivenName + "."); dialogue.Add("I love it when " + Main.npc[waifu].GivenName + "'s hands get sticky from all that...wax."); dialogue.Add(Main.npc[waifu].GivenName + " works wonders for my hair...among other things."); } @@ -193,16 +196,16 @@ namespace CalamityMod.NPCs.TownNPCs if ((Main.player[Main.myPlayer].Calamity().sirenBoobs && !Main.player[Main.myPlayer].Calamity().sirenBoobsHide) || (Main.player[Main.myPlayer].Calamity().sirenBoobsAlt && !Main.player[Main.myPlayer].Calamity().sirenBoobsAltHide)) - dialogue.Add("Nice...scales...did it get hot in here?"); + dialogue.Add("Nice scales...did it get hot in here?"); if (Main.player[Main.myPlayer].Calamity().fabsolVodka) - dialogue.Add("Oh yeah now you're drinking the good stuff! Do you like it? I created the recipe by mixing fairy dust, crystals, and other magical crap."); + dialogue.Add("Oh yeah, now you're drinking the good stuff! Do you like it? I created the recipe by mixing fairy dust, crystals and other magical crap."); if (Main.player[Main.myPlayer].Calamity().fab) { - dialogue.Add("...so, you're riding me huh? That's not weird at all."); + dialogue.Add("So...you're riding me, huh? That's not weird at all."); dialogue.Add("Are you coming on to me?"); - dialogue.Add("If I was a magical horse in this reality I'd be out in space swirling cocktails as I watch space worms battle for my enjoyment."); + dialogue.Add("If I was a magical horse, I'd be out in space swirling cocktails, as I watch space worms battle for my enjoyment."); } IList donorList = new List(CalamityMod.donatorList); diff --git a/Projectiles/Boss/HolyShot.cs b/Projectiles/Boss/HolyShot.cs deleted file mode 100644 index 43ed091407..0000000000 --- a/Projectiles/Boss/HolyShot.cs +++ /dev/null @@ -1,103 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Boss -{ - public class HolyShot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holy Spear"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.alpha = 100; - projectile.timeLeft = 900; - cooldownSlot = 1; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - } - - public override void AI() - { - projectile.velocity *= 1.03f; - projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, projectile.Center); - } - int num746 = Main.expertMode ? 52 : 65; - if (projectile.timeLeft == 883) - projectile.damage = num746; - if (projectile.timeLeft < 85) - projectile.damage = 0; - } - - public override bool CanHitPlayer(Player target) - { - if (projectile.timeLeft > 883 || projectile.timeLeft < 85) - { - return false; - } - return true; - } - - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft > 883) - { - projectile.localAI[1] += 5f; - byte b2 = (byte)(((int)projectile.localAI[1]) * 3); - byte a2 = (byte)((float)projectile.alpha * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)((float)projectile.alpha * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, projectile.alpha); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = projectile; - } - } -} diff --git a/Projectiles/Boss/HolyShot.png b/Projectiles/Boss/HolyShot.png deleted file mode 100644 index e64b5053e6..0000000000 Binary files a/Projectiles/Boss/HolyShot.png and /dev/null differ diff --git a/Projectiles/Boss/HolySpear.cs b/Projectiles/Boss/HolySpear.cs index ce5fcdb880..6fbae0083b 100644 --- a/Projectiles/Boss/HolySpear.cs +++ b/Projectiles/Boss/HolySpear.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using System.IO; using Terraria; using Terraria.ID; @@ -9,6 +10,8 @@ namespace CalamityMod.Projectiles.Boss { public class HolySpear : ModProjectile { + Vector2 velocity = Vector2.Zero; + public override void SetStaticDefaults() { DisplayName.SetDefault("Holy Spear"); @@ -33,50 +36,64 @@ namespace CalamityMod.Projectiles.Boss { writer.Write(projectile.localAI[0]); writer.Write(projectile.localAI[1]); - } + writer.WriteVector2(velocity); + } public override void ReceiveExtraAI(BinaryReader reader) { projectile.localAI[0] = reader.ReadSingle(); projectile.localAI[1] = reader.ReadSingle(); - } + velocity = reader.ReadVector2(); + } public override void AI() { - if (projectile.timeLeft > 815) - { - if (projectile.ai[0] == 0f) - projectile.velocity.X = 1f; - else - projectile.velocity.X = -1f; - } - else - { - if (projectile.ai[0] == 0f) - projectile.velocity.X = 15f; - else - projectile.velocity.X = -15f; - } - projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; - if (projectile.localAI[0] == 0f && projectile.timeLeft < 815) - { - projectile.localAI[0] = 1f; - Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, projectile.Center); - } - int num746 = Main.expertMode ? 52 : 65; - if (projectile.timeLeft == 815) - projectile.damage = num746; - if (projectile.timeLeft < 85) - projectile.damage = 0; - } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, projectile.Center); - public override bool CanHitPlayer(Player target) - { - if (projectile.timeLeft > 815 || projectile.timeLeft < 85) - { - return false; - } - return true; + if (projectile.ai[0] == 1f) + velocity = projectile.velocity; + } + + if (projectile.ai[0] == 0f) + { + projectile.ai[1] += 1f; + + float slowGateValue = 90f; + float fastGateValue = 30f; + float minVelocity = 3f; + float maxVelocity = 12f; + float deceleration = 0.95f; + float acceleration = 1.2f; + + if (projectile.ai[1] <= slowGateValue) + { + if (projectile.velocity.Length() > minVelocity) + projectile.velocity *= deceleration; + } + else if (projectile.ai[1] < slowGateValue + fastGateValue) + { + if (projectile.velocity.Length() < maxVelocity) + projectile.velocity *= acceleration; + } + else + projectile.ai[1] = 0f; + } + else + { + float frequency = 0.1f; + float amplitude = 2f; + + projectile.ai[1] += frequency; + + float wavyVelocity = (float)Math.Sin(projectile.ai[1]); + + projectile.velocity = velocity + new Vector2(wavyVelocity, wavyVelocity).RotatedBy(MathHelper.ToRadians(velocity.ToRotation())) * amplitude; + } + + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override Color? GetAlpha(Color lightColor) @@ -85,14 +102,14 @@ namespace CalamityMod.Projectiles.Boss { projectile.localAI[1] += 5f; byte b2 = (byte)(((int)projectile.localAI[1]) * 3); - byte a2 = (byte)((float)projectile.alpha * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); + byte a2 = (byte)(projectile.alpha * (b2 / 255f)); + return new Color(b2, b2, b2, a2); } if (projectile.timeLeft < 85) { byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)((float)projectile.alpha * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); + byte a2 = (byte)(projectile.alpha * (b2 / 255f)); + return new Color(b2, b2, b2, a2); } return new Color(255, 255, 255, projectile.alpha); }